From 7aaf3acb5167216827ea8c14f177d5ab88844bee Mon Sep 17 00:00:00 2001 From: Rekard0 <5880388+Rekard0@users.noreply.github.com> Date: Thu, 7 Sep 2023 15:25:32 +0200 Subject: [PATCH] update contract settings, update subgraph WIP --- .../contracts/deploy/02_setup/10_setup.ts | 5 +- .../deploy/02_setup/11_setup_conclude.ts | 9 +- .../goerli/VocdoniVotingSetup.json | 503 ++++++++++++++++++ .../a4b1fde8af8923e78e9eb969c5556451.json | 435 +++++++++++++++ packages/contracts/plugin-info-testing.json | 32 ++ packages/contracts/plugin-info.json | 54 +- packages/contracts/plugin-settings.ts | 7 +- packages/contracts/src/release-metadata.json | 6 +- packages/subgraph/manifest/data/goerli.json | 2 +- packages/subgraph/manifest/data/mumbai.json | 2 +- .../manifest/subgraph.placeholder.yaml | 12 +- packages/subgraph/schema.graphql | 1 - packages/subgraph/scripts/deploy-subgraph.sh | 2 +- .../subgraph/src/osx/pluginSetupProcessor.ts | 13 + packages/subgraph/src/plugin/plugin.ts | 11 +- packages/subgraph/utils/constants.ts | 2 +- 16 files changed, 1028 insertions(+), 68 deletions(-) create mode 100644 packages/contracts/deployments/goerli/VocdoniVotingSetup.json create mode 100644 packages/contracts/deployments/goerli/solcInputs/a4b1fde8af8923e78e9eb969c5556451.json create mode 100644 packages/contracts/plugin-info-testing.json diff --git a/packages/contracts/deploy/02_setup/10_setup.ts b/packages/contracts/deploy/02_setup/10_setup.ts index 09609ffe..42116abf 100644 --- a/packages/contracts/deploy/02_setup/10_setup.ts +++ b/packages/contracts/deploy/02_setup/10_setup.ts @@ -11,7 +11,10 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { await deploy(PLUGIN_SETUP_CONTRACT_NAME, { from: deployer, - args: [], + args: [ + '0xf868169bde323f45005e476287f4c76411a610f8', + '0x073b8528bcfbb2454c8fa792558aa4a1e64c613b', + ], log: true, }); }; diff --git a/packages/contracts/deploy/02_setup/11_setup_conclude.ts b/packages/contracts/deploy/02_setup/11_setup_conclude.ts index b625d610..27687efa 100644 --- a/packages/contracts/deploy/02_setup/11_setup_conclude.ts +++ b/packages/contracts/deploy/02_setup/11_setup_conclude.ts @@ -1,5 +1,8 @@ import {PLUGIN_SETUP_CONTRACT_NAME} from '../../plugin-settings'; -import {MyPluginSetup__factory, MyPlugin__factory} from '../../typechain'; +import { + VocdoniVoting__factory, + VocdoniVotingSetup__factory, +} from '../../typechain'; import {DeployFunction} from 'hardhat-deploy/types'; import {HardhatRuntimeEnvironment} from 'hardhat/types'; import {setTimeout} from 'timers/promises'; @@ -11,11 +14,11 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const {deployments, network} = hre; const setupDeployment = await deployments.get(PLUGIN_SETUP_CONTRACT_NAME); - const setup = MyPluginSetup__factory.connect( + const setup = VocdoniVotingSetup__factory.connect( setupDeployment.address, deployer ); - const implementation = MyPlugin__factory.connect( + const implementation = VocdoniVoting__factory.connect( await setup.implementation(), deployer ); diff --git a/packages/contracts/deployments/goerli/VocdoniVotingSetup.json b/packages/contracts/deployments/goerli/VocdoniVotingSetup.json new file mode 100644 index 00000000..b3a9ac31 --- /dev/null +++ b/packages/contracts/deployments/goerli/VocdoniVotingSetup.json @@ -0,0 +1,503 @@ +{ + "address": "0x8dCb538Bf27CCED7A3498c45e9D51CBfa479bacF", + "abi": [ + { + "inputs": [ + { + "internalType": "contract GovernanceERC20", + "name": "_governanceERC20Base", + "type": "address" + }, + { + "internalType": "contract GovernanceWrappedERC20", + "name": "_governanceWrappedERC20Base", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "TokenNotContract", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "TokenNotERC20", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "length", + "type": "uint256" + } + ], + "name": "WrongHelpersArrayLength", + "type": "error" + }, + { + "inputs": [], + "name": "governanceERC20Base", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "governanceWrappedERC20Base", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_dao", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "prepareInstallation", + "outputs": [ + { + "internalType": "address", + "name": "plugin", + "type": "address" + }, + { + "components": [ + { + "internalType": "address[]", + "name": "helpers", + "type": "address[]" + }, + { + "components": [ + { + "internalType": "enum PermissionLib.Operation", + "name": "operation", + "type": "uint8" + }, + { + "internalType": "address", + "name": "where", + "type": "address" + }, + { + "internalType": "address", + "name": "who", + "type": "address" + }, + { + "internalType": "address", + "name": "condition", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "permissionId", + "type": "bytes32" + } + ], + "internalType": "struct PermissionLib.MultiTargetPermission[]", + "name": "permissions", + "type": "tuple[]" + } + ], + "internalType": "struct IPluginSetup.PreparedSetupData", + "name": "preparedSetupData", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_dao", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "plugin", + "type": "address" + }, + { + "internalType": "address[]", + "name": "currentHelpers", + "type": "address[]" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct IPluginSetup.SetupPayload", + "name": "_payload", + "type": "tuple" + } + ], + "name": "prepareUninstallation", + "outputs": [ + { + "components": [ + { + "internalType": "enum PermissionLib.Operation", + "name": "operation", + "type": "uint8" + }, + { + "internalType": "address", + "name": "where", + "type": "address" + }, + { + "internalType": "address", + "name": "who", + "type": "address" + }, + { + "internalType": "address", + "name": "condition", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "permissionId", + "type": "bytes32" + } + ], + "internalType": "struct PermissionLib.MultiTargetPermission[]", + "name": "permissions", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_dao", + "type": "address" + }, + { + "internalType": "uint16", + "name": "_currentBuild", + "type": "uint16" + }, + { + "components": [ + { + "internalType": "address", + "name": "plugin", + "type": "address" + }, + { + "internalType": "address[]", + "name": "currentHelpers", + "type": "address[]" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct IPluginSetup.SetupPayload", + "name": "_payload", + "type": "tuple" + } + ], + "name": "prepareUpdate", + "outputs": [ + { + "internalType": "bytes", + "name": "initData", + "type": "bytes" + }, + { + "components": [ + { + "internalType": "address[]", + "name": "helpers", + "type": "address[]" + }, + { + "components": [ + { + "internalType": "enum PermissionLib.Operation", + "name": "operation", + "type": "uint8" + }, + { + "internalType": "address", + "name": "where", + "type": "address" + }, + { + "internalType": "address", + "name": "who", + "type": "address" + }, + { + "internalType": "address", + "name": "condition", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "permissionId", + "type": "bytes32" + } + ], + "internalType": "struct PermissionLib.MultiTargetPermission[]", + "name": "permissions", + "type": "tuple[]" + } + ], + "internalType": "struct IPluginSetup.PreparedSetupData", + "name": "preparedSetupData", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xfa76d5b89e8382b89133ebb3b1a33308870c7b5033440661c662f1bb3c882b04", + "receipt": { + "to": null, + "from": "0xc8541aAE19C5069482239735AD64FAC3dCc52Ca2", + "contractAddress": "0x8dCb538Bf27CCED7A3498c45e9D51CBfa479bacF", + "transactionIndex": 26, + "gasUsed": "7309830", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000800000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x38bdfcbc1ce6985745ce37ebd673318ac69c2a66b61c61111ffdb9cd19f40642", + "transactionHash": "0xfa76d5b89e8382b89133ebb3b1a33308870c7b5033440661c662f1bb3c882b04", + "logs": [ + { + "transactionIndex": 26, + "blockNumber": 9652932, + "transactionHash": "0xfa76d5b89e8382b89133ebb3b1a33308870c7b5033440661c662f1bb3c882b04", + "address": "0xd741c7eE3fc1766897d94d62FB1cf483f08680a4", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", + "logIndex": 57, + "blockHash": "0x38bdfcbc1ce6985745ce37ebd673318ac69c2a66b61c61111ffdb9cd19f40642" + } + ], + "blockNumber": 9652932, + "cumulativeGasUsed": "17407929", + "status": 1, + "byzantium": true + }, + "args": [ + "0xf868169bde323f45005e476287f4c76411a610f8", + "0x073b8528bcfbb2454c8fa792558aa4a1e64c613b" + ], + "numDeployments": 1, + "solcInputHash": "a4b1fde8af8923e78e9eb969c5556451", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract GovernanceERC20\",\"name\":\"_governanceERC20Base\",\"type\":\"address\"},{\"internalType\":\"contract GovernanceWrappedERC20\",\"name\":\"_governanceWrappedERC20Base\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"TokenNotContract\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"TokenNotERC20\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"length\",\"type\":\"uint256\"}],\"name\":\"WrongHelpersArrayLength\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"governanceERC20Base\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governanceWrappedERC20Base\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_dao\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"prepareInstallation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"plugin\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address[]\",\"name\":\"helpers\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"enum PermissionLib.Operation\",\"name\":\"operation\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"where\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"who\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"condition\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"permissionId\",\"type\":\"bytes32\"}],\"internalType\":\"struct PermissionLib.MultiTargetPermission[]\",\"name\":\"permissions\",\"type\":\"tuple[]\"}],\"internalType\":\"struct IPluginSetup.PreparedSetupData\",\"name\":\"preparedSetupData\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_dao\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"plugin\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"currentHelpers\",\"type\":\"address[]\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct IPluginSetup.SetupPayload\",\"name\":\"_payload\",\"type\":\"tuple\"}],\"name\":\"prepareUninstallation\",\"outputs\":[{\"components\":[{\"internalType\":\"enum PermissionLib.Operation\",\"name\":\"operation\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"where\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"who\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"condition\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"permissionId\",\"type\":\"bytes32\"}],\"internalType\":\"struct PermissionLib.MultiTargetPermission[]\",\"name\":\"permissions\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_dao\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"_currentBuild\",\"type\":\"uint16\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"plugin\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"currentHelpers\",\"type\":\"address[]\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct IPluginSetup.SetupPayload\",\"name\":\"_payload\",\"type\":\"tuple\"}],\"name\":\"prepareUpdate\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"initData\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"address[]\",\"name\":\"helpers\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"enum PermissionLib.Operation\",\"name\":\"operation\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"where\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"who\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"condition\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"permissionId\",\"type\":\"bytes32\"}],\"internalType\":\"struct PermissionLib.MultiTargetPermission[]\",\"name\":\"permissions\",\"type\":\"tuple[]\"}],\"internalType\":\"struct IPluginSetup.PreparedSetupData\",\"name\":\"preparedSetupData\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"_interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Vocdoni\",\"errors\":{\"TokenNotContract(address)\":[{\"params\":{\"token\":\"The token address\"}}],\"TokenNotERC20(address)\":[{\"params\":{\"token\":\"The token address\"}}],\"WrongHelpersArrayLength(uint256)\":[{\"params\":{\"length\":\"The array length of passed helpers.\"}}]},\"kind\":\"dev\",\"methods\":{\"implementation()\":{\"details\":\"The implementation can be instantiated via the `new` keyword, cloned via the minimal clones pattern (see [ERC-1167](https://eips.ethereum.org/EIPS/eip-1167)), or proxied via the UUPS pattern (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)).\",\"returns\":{\"_0\":\"The address of the plugin implementation contract.\"}},\"prepareInstallation(address,bytes)\":{\"params\":{\"_dao\":\"The address of the installing DAO.\",\"_data\":\"The bytes-encoded data containing the input parameters for the installation as specified in the plugin's build metadata JSON file.\"},\"returns\":{\"plugin\":\"The address of the `Plugin` contract being prepared for installation.\",\"preparedSetupData\":\"The deployed plugin's relevant data which consists of helpers and permissions.\"}},\"prepareUninstallation(address,(address,address[],bytes))\":{\"params\":{\"_dao\":\"The address of the uninstalling DAO.\",\"_payload\":\"The relevant data necessary for the `prepareUninstallation`. See above.\"},\"returns\":{\"permissions\":\"The array of multi-targeted permission operations to be applied by the `PluginSetupProcessor` to the uninstalling DAO.\"}},\"prepareUpdate(address,uint16,(address,address[],bytes))\":{\"params\":{\"_currentBuild\":\"The build number of the plugin to update from.\",\"_dao\":\"The address of the updating DAO.\",\"_payload\":\"The relevant data necessary for the `prepareUpdate`. See above.\"},\"returns\":{\"initData\":\"The initialization data to be passed to upgradeable contracts when the update is applied in the `PluginSetupProcessor`.\",\"preparedSetupData\":\"The deployed plugin's relevant data which consists of helpers and permissions.\"}},\"supportsInterface(bytes4)\":{\"params\":{\"_interfaceId\":\"The ID of the interface.\"},\"returns\":{\"_0\":\"Returns `true` if the interface is supported.\"}}},\"title\":\"VocdoniVotingSetup\",\"version\":1},\"userdoc\":{\"errors\":{\"TokenNotContract(address)\":[{\"notice\":\"Thrown if token address is passed which is not a token.\"}],\"TokenNotERC20(address)\":[{\"notice\":\"Thrown if token address is not ERC20.\"}],\"WrongHelpersArrayLength(uint256)\":[{\"notice\":\"Thrown if passed helpers array is of wrong length.\"}]},\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"The contract constructor, that deploys the `VocdoniVoting` plugin logic contract.\"},\"governanceERC20Base()\":{\"notice\":\"The address of the `GovernanceERC20` base contract.\"},\"governanceWrappedERC20Base()\":{\"notice\":\"The address of the `GovernanceWrappedERC20` base contract.\"},\"implementation()\":{\"notice\":\"Returns the plugin implementation address.\"},\"prepareInstallation(address,bytes)\":{\"notice\":\"Prepares the installation of a plugin.\"},\"prepareUninstallation(address,(address,address[],bytes))\":{\"notice\":\"Prepares the uninstallation of a plugin.\"},\"prepareUpdate(address,uint16,(address,address[],bytes))\":{\"notice\":\"Prepares the update of a plugin.\"},\"supportsInterface(bytes4)\":{\"notice\":\"Checks if this or the parent contract supports an interface by its ID.\"}},\"notice\":\"The setup contract of the `VocdoniVoting` plugin.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/VocdoniVotingSetup.sol\":\"VocdoniVotingSetup\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"none\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@aragon/osx/core/dao/DAO.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-or-later\\n\\npragma solidity 0.8.17;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165StorageUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155ReceiverUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts/interfaces/IERC1271.sol\\\";\\n\\nimport {IProtocolVersion} from \\\"../../utils/protocol/IProtocolVersion.sol\\\";\\nimport {ProtocolVersion} from \\\"../../utils/protocol/ProtocolVersion.sol\\\";\\nimport {PermissionManager} from \\\"../permission/PermissionManager.sol\\\";\\nimport {CallbackHandler} from \\\"../utils/CallbackHandler.sol\\\";\\nimport {hasBit, flipBit} from \\\"../utils/BitMap.sol\\\";\\nimport {IEIP4824} from \\\"./IEIP4824.sol\\\";\\nimport {IDAO} from \\\"./IDAO.sol\\\";\\n\\n/// @title DAO\\n/// @author Aragon Association - 2021-2023\\n/// @notice This contract is the entry point to the Aragon DAO framework and provides our users a simple and easy to use public interface.\\n/// @dev Public API of the Aragon DAO framework.\\ncontract DAO is\\n IEIP4824,\\n Initializable,\\n IERC1271,\\n ERC165StorageUpgradeable,\\n IDAO,\\n UUPSUpgradeable,\\n ProtocolVersion,\\n PermissionManager,\\n CallbackHandler\\n{\\n using SafeERC20Upgradeable for IERC20Upgradeable;\\n using AddressUpgradeable for address;\\n\\n /// @notice The ID of the permission required to call the `execute` function.\\n bytes32 public constant EXECUTE_PERMISSION_ID = keccak256(\\\"EXECUTE_PERMISSION\\\");\\n\\n /// @notice The ID of the permission required to call the `_authorizeUpgrade` function.\\n bytes32 public constant UPGRADE_DAO_PERMISSION_ID = keccak256(\\\"UPGRADE_DAO_PERMISSION\\\");\\n\\n /// @notice The ID of the permission required to call the `setMetadata` function.\\n bytes32 public constant SET_METADATA_PERMISSION_ID = keccak256(\\\"SET_METADATA_PERMISSION\\\");\\n\\n /// @notice The ID of the permission required to call the `setTrustedForwarder` function.\\n bytes32 public constant SET_TRUSTED_FORWARDER_PERMISSION_ID =\\n keccak256(\\\"SET_TRUSTED_FORWARDER_PERMISSION\\\");\\n\\n /// @notice The ID of the permission required to call the `setSignatureValidator` function.\\n bytes32 public constant SET_SIGNATURE_VALIDATOR_PERMISSION_ID =\\n keccak256(\\\"SET_SIGNATURE_VALIDATOR_PERMISSION\\\");\\n\\n /// @notice The ID of the permission required to call the `registerStandardCallback` function.\\n bytes32 public constant REGISTER_STANDARD_CALLBACK_PERMISSION_ID =\\n keccak256(\\\"REGISTER_STANDARD_CALLBACK_PERMISSION\\\");\\n\\n /// @notice The internal constant storing the maximal action array length.\\n uint256 internal constant MAX_ACTIONS = 256;\\n\\n /// @notice The first out of two values to which the `_reentrancyStatus` state variable (used by the `nonReentrant` modifier) can be set inidicating that a function was not entered.\\n uint256 private constant _NOT_ENTERED = 1;\\n\\n /// @notice The second out of two values to which the `_reentrancyStatus` state variable (used by the `nonReentrant` modifier) can be set inidicating that a function was entered.\\n uint256 private constant _ENTERED = 2;\\n\\n /// @notice The [ERC-1271](https://eips.ethereum.org/EIPS/eip-1271) signature validator contract.\\n /// @dev Added in v1.0.0.\\n IERC1271 public signatureValidator;\\n\\n /// @notice The address of the trusted forwarder verifying meta transactions.\\n /// @dev Added in v1.0.0.\\n address private trustedForwarder;\\n\\n /// @notice The [EIP-4824](https://eips.ethereum.org/EIPS/eip-4824) DAO URI.\\n /// @dev Added in v1.0.0.\\n string private _daoURI;\\n\\n /// @notice The state variable for the reentrancy guard of the `execute` function.\\n /// @dev Added in v1.3.0. The variable can be of value `_NOT_ENTERED = 1` or `_ENTERED = 2` in usage and is initialized with `_NOT_ENTERED`.\\n uint256 private _reentrancyStatus;\\n\\n /// @notice Thrown if a call is reentrant.\\n error ReentrantCall();\\n\\n /// @notice Thrown if the action array length is larger than `MAX_ACTIONS`.\\n error TooManyActions();\\n\\n /// @notice Thrown if action execution has failed.\\n /// @param index The index of the action in the action array that failed.\\n error ActionFailed(uint256 index);\\n\\n /// @notice Thrown if an action has insufficent gas left.\\n error InsufficientGas();\\n\\n /// @notice Thrown if the deposit amount is zero.\\n error ZeroAmount();\\n\\n /// @notice Thrown if there is a mismatch between the expected and actually deposited amount of native tokens.\\n /// @param expected The expected native token amount.\\n /// @param actual The actual native token amount deposited.\\n error NativeTokenDepositAmountMismatch(uint256 expected, uint256 actual);\\n\\n /// @notice Thrown if an upgrade is not supported from a specific protocol version .\\n error ProtocolVersionUpgradeNotSupported(uint8[3] protocolVersion);\\n\\n /// @notice Emitted when a new DAO URI is set.\\n /// @param daoURI The new URI.\\n event NewURI(string daoURI);\\n\\n /// @notice A modifier to protect a function from calling itself, directly or indirectly (reentrancy).\\n /// @dev Currently, this modifier is only applied to the `execute()` function. If this is used multiple times, private `_beforeNonReentrant()` and `_afterNonReentrant()` functions should be created to prevent code duplication.\\n modifier nonReentrant() {\\n if (_reentrancyStatus == _ENTERED) {\\n revert ReentrantCall();\\n }\\n _reentrancyStatus = _ENTERED;\\n\\n _;\\n\\n _reentrancyStatus = _NOT_ENTERED;\\n }\\n\\n /// @notice Disables the initializers on the implementation contract to prevent it from being left uninitialized.\\n constructor() {\\n _disableInitializers();\\n }\\n\\n /// @notice Initializes the DAO by\\n /// - setting the reentrancy status variable to `_NOT_ENTERED`\\n /// - registering the [ERC-165](https://eips.ethereum.org/EIPS/eip-165) interface ID\\n /// - setting the trusted forwarder for meta transactions\\n /// - giving the `ROOT_PERMISSION_ID` permission to the initial owner (that should be revoked and transferred to the DAO after setup).\\n /// @dev This method is required to support [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822).\\n /// @param _metadata IPFS hash that points to all the metadata (logo, description, tags, etc.) of a DAO.\\n /// @param _initialOwner The initial owner of the DAO having the `ROOT_PERMISSION_ID` permission.\\n /// @param _trustedForwarder The trusted forwarder responsible for verifying meta transactions.\\n /// @param daoURI_ The DAO URI required to support [ERC-4824](https://eips.ethereum.org/EIPS/eip-4824).\\n function initialize(\\n bytes calldata _metadata,\\n address _initialOwner,\\n address _trustedForwarder,\\n string calldata daoURI_\\n ) external reinitializer(2) {\\n _reentrancyStatus = _NOT_ENTERED; // added in v1.3.0\\n\\n _registerInterface(type(IDAO).interfaceId);\\n _registerInterface(type(IERC1271).interfaceId);\\n _registerInterface(type(IEIP4824).interfaceId);\\n _registerInterface(type(IProtocolVersion).interfaceId); // added in v1.3.0\\n _registerTokenInterfaces();\\n\\n _setMetadata(_metadata);\\n _setTrustedForwarder(_trustedForwarder);\\n _setDaoURI(daoURI_);\\n __PermissionManager_init(_initialOwner);\\n }\\n\\n /// @notice Initializes the DAO after an upgrade from a previous protocol version.\\n /// @param _previousProtocolVersion The semantic protocol version number of the previous DAO implementation contract this upgrade is transitioning from.\\n /// @param _initData The initialization data to be passed to via `upgradeToAndCall` (see [ERC-1967](https://docs.openzeppelin.com/contracts/4.x/api/proxy#ERC1967Upgrade)).\\n function initializeFrom(\\n uint8[3] calldata _previousProtocolVersion,\\n bytes calldata _initData\\n ) external reinitializer(2) {\\n _initData; // Silences the unused function parameter warning.\\n\\n // Check that the contract is not upgrading from a different major release.\\n if (_previousProtocolVersion[0] != 1) {\\n revert ProtocolVersionUpgradeNotSupported(_previousProtocolVersion);\\n }\\n\\n // Initialize `_reentrancyStatus` that was added in v1.3.0.\\n // Register Interface `ProtocolVersion` that was added in v1.3.0.\\n if (_previousProtocolVersion[1] <= 2) {\\n _reentrancyStatus = _NOT_ENTERED;\\n _registerInterface(type(IProtocolVersion).interfaceId);\\n }\\n }\\n\\n /// @inheritdoc PermissionManager\\n function isPermissionRestrictedForAnyAddr(\\n bytes32 _permissionId\\n ) internal pure override returns (bool) {\\n return\\n _permissionId == EXECUTE_PERMISSION_ID ||\\n _permissionId == UPGRADE_DAO_PERMISSION_ID ||\\n _permissionId == SET_METADATA_PERMISSION_ID ||\\n _permissionId == SET_TRUSTED_FORWARDER_PERMISSION_ID ||\\n _permissionId == SET_SIGNATURE_VALIDATOR_PERMISSION_ID ||\\n _permissionId == REGISTER_STANDARD_CALLBACK_PERMISSION_ID;\\n }\\n\\n /// @notice Internal method authorizing the upgrade of the contract via the [upgradeability mechanism for UUPS proxies](https://docs.openzeppelin.com/contracts/4.x/api/proxy#UUPSUpgradeable) (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)).\\n /// @dev The caller must have the `UPGRADE_DAO_PERMISSION_ID` permission.\\n function _authorizeUpgrade(address) internal virtual override auth(UPGRADE_DAO_PERMISSION_ID) {}\\n\\n /// @inheritdoc IDAO\\n function setTrustedForwarder(\\n address _newTrustedForwarder\\n ) external override auth(SET_TRUSTED_FORWARDER_PERMISSION_ID) {\\n _setTrustedForwarder(_newTrustedForwarder);\\n }\\n\\n /// @inheritdoc IDAO\\n function getTrustedForwarder() external view virtual override returns (address) {\\n return trustedForwarder;\\n }\\n\\n /// @inheritdoc IDAO\\n function hasPermission(\\n address _where,\\n address _who,\\n bytes32 _permissionId,\\n bytes memory _data\\n ) external view override returns (bool) {\\n return isGranted(_where, _who, _permissionId, _data);\\n }\\n\\n /// @inheritdoc IDAO\\n function setMetadata(\\n bytes calldata _metadata\\n ) external override auth(SET_METADATA_PERMISSION_ID) {\\n _setMetadata(_metadata);\\n }\\n\\n /// @inheritdoc IDAO\\n function execute(\\n bytes32 _callId,\\n Action[] calldata _actions,\\n uint256 _allowFailureMap\\n )\\n external\\n override\\n nonReentrant\\n auth(EXECUTE_PERMISSION_ID)\\n returns (bytes[] memory execResults, uint256 failureMap)\\n {\\n // Check that the action array length is within bounds.\\n if (_actions.length > MAX_ACTIONS) {\\n revert TooManyActions();\\n }\\n\\n execResults = new bytes[](_actions.length);\\n\\n uint256 gasBefore;\\n uint256 gasAfter;\\n\\n for (uint256 i = 0; i < _actions.length; ) {\\n gasBefore = gasleft();\\n\\n (bool success, bytes memory result) = _actions[i].to.call{value: _actions[i].value}(\\n _actions[i].data\\n );\\n gasAfter = gasleft();\\n\\n // Check if failure is allowed\\n if (!hasBit(_allowFailureMap, uint8(i))) {\\n // Check if the call failed.\\n if (!success) {\\n revert ActionFailed(i);\\n }\\n } else {\\n // Check if the call failed.\\n if (!success) {\\n // Make sure that the action call did not fail because 63/64 of `gasleft()` was insufficient to execute the external call `.to.call` (see [ERC-150](https://eips.ethereum.org/EIPS/eip-150)).\\n // In specific scenarios, i.e. proposal execution where the last action in the action array is allowed to fail, the account calling `execute` could force-fail this action by setting a gas limit\\n // where 63/64 is insufficient causing the `.to.call` to fail, but where the remaining 1/64 gas are sufficient to successfully finish the `execute` call.\\n if (gasAfter < gasBefore / 64) {\\n revert InsufficientGas();\\n }\\n\\n // Store that this action failed.\\n failureMap = flipBit(failureMap, uint8(i));\\n }\\n }\\n\\n execResults[i] = result;\\n\\n unchecked {\\n ++i;\\n }\\n }\\n\\n emit Executed({\\n actor: msg.sender,\\n callId: _callId,\\n actions: _actions,\\n allowFailureMap: _allowFailureMap,\\n failureMap: failureMap,\\n execResults: execResults\\n });\\n }\\n\\n /// @inheritdoc IDAO\\n function deposit(\\n address _token,\\n uint256 _amount,\\n string calldata _reference\\n ) external payable override {\\n if (_amount == 0) revert ZeroAmount();\\n\\n if (_token == address(0)) {\\n if (msg.value != _amount)\\n revert NativeTokenDepositAmountMismatch({expected: _amount, actual: msg.value});\\n } else {\\n if (msg.value != 0)\\n revert NativeTokenDepositAmountMismatch({expected: 0, actual: msg.value});\\n\\n IERC20Upgradeable(_token).safeTransferFrom(msg.sender, address(this), _amount);\\n }\\n\\n emit Deposited(msg.sender, _token, _amount, _reference);\\n }\\n\\n /// @inheritdoc IDAO\\n function setSignatureValidator(\\n address _signatureValidator\\n ) external override auth(SET_SIGNATURE_VALIDATOR_PERMISSION_ID) {\\n signatureValidator = IERC1271(_signatureValidator);\\n\\n emit SignatureValidatorSet({signatureValidator: _signatureValidator});\\n }\\n\\n /// @inheritdoc IDAO\\n function isValidSignature(\\n bytes32 _hash,\\n bytes memory _signature\\n ) external view override(IDAO, IERC1271) returns (bytes4) {\\n if (address(signatureValidator) == address(0)) {\\n // Return the invalid magic number\\n return bytes4(0);\\n }\\n // Forward the call to the set signature validator contract\\n return signatureValidator.isValidSignature(_hash, _signature);\\n }\\n\\n /// @notice Emits the `NativeTokenDeposited` event to track native token deposits that weren't made via the deposit method.\\n /// @dev This call is bound by the gas limitations for `send`/`transfer` calls introduced by [ERC-2929](https://eips.ethereum.org/EIPS/eip-2929).\\n /// Gas cost increases in future hard forks might break this function. As an alternative, [ERC-2930](https://eips.ethereum.org/EIPS/eip-2930)-type transactions using access lists can be employed.\\n receive() external payable {\\n emit NativeTokenDeposited(msg.sender, msg.value);\\n }\\n\\n /// @notice Fallback to handle future versions of the [ERC-165](https://eips.ethereum.org/EIPS/eip-165) standard.\\n /// @param _input An alias being equivalent to `msg.data`. This feature of the fallback function was introduced with the [solidity compiler version 0.7.6](https://github.com/ethereum/solidity/releases/tag/v0.7.6)\\n /// @return The magic number registered for the function selector triggering the fallback.\\n fallback(bytes calldata _input) external returns (bytes memory) {\\n bytes4 magicNumber = _handleCallback(msg.sig, _input);\\n return abi.encode(magicNumber);\\n }\\n\\n /// @notice Emits the MetadataSet event if new metadata is set.\\n /// @param _metadata Hash of the IPFS metadata object.\\n function _setMetadata(bytes calldata _metadata) internal {\\n emit MetadataSet(_metadata);\\n }\\n\\n /// @notice Sets the trusted forwarder on the DAO and emits the associated event.\\n /// @param _trustedForwarder The trusted forwarder address.\\n function _setTrustedForwarder(address _trustedForwarder) internal {\\n trustedForwarder = _trustedForwarder;\\n\\n emit TrustedForwarderSet(_trustedForwarder);\\n }\\n\\n /// @notice Registers the [ERC-721](https://eips.ethereum.org/EIPS/eip-721) and [ERC-1155](https://eips.ethereum.org/EIPS/eip-1155) interfaces and callbacks.\\n function _registerTokenInterfaces() private {\\n _registerInterface(type(IERC721ReceiverUpgradeable).interfaceId);\\n _registerInterface(type(IERC1155ReceiverUpgradeable).interfaceId);\\n\\n _registerCallback(\\n IERC721ReceiverUpgradeable.onERC721Received.selector,\\n IERC721ReceiverUpgradeable.onERC721Received.selector\\n );\\n _registerCallback(\\n IERC1155ReceiverUpgradeable.onERC1155Received.selector,\\n IERC1155ReceiverUpgradeable.onERC1155Received.selector\\n );\\n _registerCallback(\\n IERC1155ReceiverUpgradeable.onERC1155BatchReceived.selector,\\n IERC1155ReceiverUpgradeable.onERC1155BatchReceived.selector\\n );\\n }\\n\\n /// @inheritdoc IDAO\\n function registerStandardCallback(\\n bytes4 _interfaceId,\\n bytes4 _callbackSelector,\\n bytes4 _magicNumber\\n ) external override auth(REGISTER_STANDARD_CALLBACK_PERMISSION_ID) {\\n _registerInterface(_interfaceId);\\n _registerCallback(_callbackSelector, _magicNumber);\\n emit StandardCallbackRegistered(_interfaceId, _callbackSelector, _magicNumber);\\n }\\n\\n /// @inheritdoc IEIP4824\\n function daoURI() external view returns (string memory) {\\n return _daoURI;\\n }\\n\\n /// @notice Updates the set DAO URI to a new value.\\n /// @param newDaoURI The new DAO URI to be set.\\n function setDaoURI(string calldata newDaoURI) external auth(SET_METADATA_PERMISSION_ID) {\\n _setDaoURI(newDaoURI);\\n }\\n\\n /// @notice Sets the new [ERC-4824](https://eips.ethereum.org/EIPS/eip-4824) DAO URI and emits the associated event.\\n /// @param daoURI_ The new DAO URI.\\n function _setDaoURI(string calldata daoURI_) internal {\\n _daoURI = daoURI_;\\n\\n emit NewURI(daoURI_);\\n }\\n\\n /// @notice This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain (see [OpenZeppelin's guide about storage gaps](https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps)).\\n uint256[46] private __gap;\\n}\\n\",\"keccak256\":\"0x86e1551c4c685e5bb38a6a68ffac0b390b3aa883f8dc9e1a45d321bceb1a7cc8\",\"license\":\"AGPL-3.0-or-later\"},\"@aragon/osx/core/dao/IDAO.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-or-later\\n\\npragma solidity ^0.8.8;\\n\\n/// @title IDAO\\n/// @author Aragon Association - 2022-2023\\n/// @notice The interface required for DAOs within the Aragon App DAO framework.\\ninterface IDAO {\\n /// @notice The action struct to be consumed by the DAO's `execute` function resulting in an external call.\\n /// @param to The address to call.\\n /// @param value The native token value to be sent with the call.\\n /// @param data The bytes-encoded function selector and calldata for the call.\\n struct Action {\\n address to;\\n uint256 value;\\n bytes data;\\n }\\n\\n /// @notice Checks if an address has permission on a contract via a permission identifier and considers if `ANY_ADDRESS` was used in the granting process.\\n /// @param _where The address of the contract.\\n /// @param _who The address of a EOA or contract to give the permissions.\\n /// @param _permissionId The permission identifier.\\n /// @param _data The optional data passed to the `PermissionCondition` registered.\\n /// @return Returns true if the address has permission, false if not.\\n function hasPermission(\\n address _where,\\n address _who,\\n bytes32 _permissionId,\\n bytes memory _data\\n ) external view returns (bool);\\n\\n /// @notice Updates the DAO metadata (e.g., an IPFS hash).\\n /// @param _metadata The IPFS hash of the new metadata object.\\n function setMetadata(bytes calldata _metadata) external;\\n\\n /// @notice Emitted when the DAO metadata is updated.\\n /// @param metadata The IPFS hash of the new metadata object.\\n event MetadataSet(bytes metadata);\\n\\n /// @notice Executes a list of actions. If a zero allow-failure map is provided, a failing action reverts the entire execution. If a non-zero allow-failure map is provided, allowed actions can fail without the entire call being reverted.\\n /// @param _callId The ID of the call. The definition of the value of `callId` is up to the calling contract and can be used, e.g., as a nonce.\\n /// @param _actions The array of actions.\\n /// @param _allowFailureMap A bitmap allowing execution to succeed, even if individual actions might revert. If the bit at index `i` is 1, the execution succeeds even if the `i`th action reverts. A failure map value of 0 requires every action to not revert.\\n /// @return The array of results obtained from the executed actions in `bytes`.\\n /// @return The resulting failure map containing the actions have actually failed.\\n function execute(\\n bytes32 _callId,\\n Action[] memory _actions,\\n uint256 _allowFailureMap\\n ) external returns (bytes[] memory, uint256);\\n\\n /// @notice Emitted when a proposal is executed.\\n /// @param actor The address of the caller.\\n /// @param callId The ID of the call.\\n /// @param actions The array of actions executed.\\n /// @param allowFailureMap The allow failure map encoding which actions are allowed to fail.\\n /// @param failureMap The failure map encoding which actions have failed.\\n /// @param execResults The array with the results of the executed actions.\\n /// @dev The value of `callId` is defined by the component/contract calling the execute function. A `Plugin` implementation can use it, for example, as a nonce.\\n event Executed(\\n address indexed actor,\\n bytes32 callId,\\n Action[] actions,\\n uint256 allowFailureMap,\\n uint256 failureMap,\\n bytes[] execResults\\n );\\n\\n /// @notice Emitted when a standard callback is registered.\\n /// @param interfaceId The ID of the interface.\\n /// @param callbackSelector The selector of the callback function.\\n /// @param magicNumber The magic number to be registered for the callback function selector.\\n event StandardCallbackRegistered(\\n bytes4 interfaceId,\\n bytes4 callbackSelector,\\n bytes4 magicNumber\\n );\\n\\n /// @notice Deposits (native) tokens to the DAO contract with a reference string.\\n /// @param _token The address of the token or address(0) in case of the native token.\\n /// @param _amount The amount of tokens to deposit.\\n /// @param _reference The reference describing the deposit reason.\\n function deposit(address _token, uint256 _amount, string calldata _reference) external payable;\\n\\n /// @notice Emitted when a token deposit has been made to the DAO.\\n /// @param sender The address of the sender.\\n /// @param token The address of the deposited token.\\n /// @param amount The amount of tokens deposited.\\n /// @param _reference The reference describing the deposit reason.\\n event Deposited(\\n address indexed sender,\\n address indexed token,\\n uint256 amount,\\n string _reference\\n );\\n\\n /// @notice Emitted when a native token deposit has been made to the DAO.\\n /// @dev This event is intended to be emitted in the `receive` function and is therefore bound by the gas limitations for `send`/`transfer` calls introduced by [ERC-2929](https://eips.ethereum.org/EIPS/eip-2929).\\n /// @param sender The address of the sender.\\n /// @param amount The amount of native tokens deposited.\\n event NativeTokenDeposited(address sender, uint256 amount);\\n\\n /// @notice Setter for the trusted forwarder verifying the meta transaction.\\n /// @param _trustedForwarder The trusted forwarder address.\\n function setTrustedForwarder(address _trustedForwarder) external;\\n\\n /// @notice Getter for the trusted forwarder verifying the meta transaction.\\n /// @return The trusted forwarder address.\\n function getTrustedForwarder() external view returns (address);\\n\\n /// @notice Emitted when a new TrustedForwarder is set on the DAO.\\n /// @param forwarder the new forwarder address.\\n event TrustedForwarderSet(address forwarder);\\n\\n /// @notice Setter for the [ERC-1271](https://eips.ethereum.org/EIPS/eip-1271) signature validator contract.\\n /// @param _signatureValidator The address of the signature validator.\\n function setSignatureValidator(address _signatureValidator) external;\\n\\n /// @notice Emitted when the signature validator address is updated.\\n /// @param signatureValidator The address of the signature validator.\\n event SignatureValidatorSet(address signatureValidator);\\n\\n /// @notice Checks whether a signature is valid for the provided hash by forwarding the call to the set [ERC-1271](https://eips.ethereum.org/EIPS/eip-1271) signature validator contract.\\n /// @param _hash The hash of the data to be signed.\\n /// @param _signature The signature byte array associated with `_hash`.\\n /// @return Returns the `bytes4` magic value `0x1626ba7e` if the signature is valid.\\n function isValidSignature(bytes32 _hash, bytes memory _signature) external returns (bytes4);\\n\\n /// @notice Registers an ERC standard having a callback by registering its [ERC-165](https://eips.ethereum.org/EIPS/eip-165) interface ID and callback function signature.\\n /// @param _interfaceId The ID of the interface.\\n /// @param _callbackSelector The selector of the callback function.\\n /// @param _magicNumber The magic number to be registered for the function signature.\\n function registerStandardCallback(\\n bytes4 _interfaceId,\\n bytes4 _callbackSelector,\\n bytes4 _magicNumber\\n ) external;\\n}\\n\",\"keccak256\":\"0x3876d62c73312234c1e2ab4e75cdac2783a6688c3445a67a15b767cd98e01f80\",\"license\":\"AGPL-3.0-or-later\"},\"@aragon/osx/core/dao/IEIP4824.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-or-later\\n\\npragma solidity 0.8.17;\\n\\n/// @title EIP-4824 Common Interfaces for DAOs\\n/// @dev See https://eips.ethereum.org/EIPS/eip-4824\\n/// @author Aragon Association - 2021-2023\\ninterface IEIP4824 {\\n /// @notice A distinct Uniform Resource Identifier (URI) pointing to a JSON object following the \\\"EIP-4824 DAO JSON-LD Schema\\\". This JSON file splits into four URIs: membersURI, proposalsURI, activityLogURI, and governanceURI. The membersURI should point to a JSON file that conforms to the \\\"EIP-4824 Members JSON-LD Schema\\\". The proposalsURI should point to a JSON file that conforms to the \\\"EIP-4824 Proposals JSON-LD Schema\\\". The activityLogURI should point to a JSON file that conforms to the \\\"EIP-4824 Activity Log JSON-LD Schema\\\". The governanceURI should point to a flatfile, normatively a .md file. Each of the JSON files named above can be statically hosted or dynamically-generated.\\n /// @return _daoURI The DAO URI.\\n function daoURI() external view returns (string memory _daoURI);\\n}\\n\",\"keccak256\":\"0x8daa4bf72f8686ccea0441c3a0d8c10a5f4dc95e98351dc984346c099cc4db31\",\"license\":\"AGPL-3.0-or-later\"},\"@aragon/osx/core/permission/IPermissionCondition.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-or-later\\n\\npragma solidity ^0.8.8;\\n\\n/// @title IPermissionCondition\\n/// @author Aragon Association - 2021-2023\\n/// @notice This interface can be implemented to support more customary permissions depending on on- or off-chain state, e.g., by querying token ownershop or a secondary condition, respectively.\\ninterface IPermissionCondition {\\n /// @notice This method is used to check if a call is permitted.\\n /// @param _where The address of the target contract.\\n /// @param _who The address (EOA or contract) for which the permissions are checked.\\n /// @param _permissionId The permission identifier.\\n /// @param _data Optional data passed to the `PermissionCondition` implementation.\\n /// @return allowed Returns true if the call is permitted.\\n function isGranted(\\n address _where,\\n address _who,\\n bytes32 _permissionId,\\n bytes calldata _data\\n ) external view returns (bool allowed);\\n}\\n\",\"keccak256\":\"0x0579dbc987eb9a325467282561ae84649f2b6e8e9561d8c2831dba78045ccef1\",\"license\":\"AGPL-3.0-or-later\"},\"@aragon/osx/core/permission/PermissionCondition.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-or-later\\n\\npragma solidity ^0.8.8;\\n\\nimport {ERC165} from \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\n\\nimport {IPermissionCondition} from \\\"./IPermissionCondition.sol\\\";\\n\\n/// @title PermissionCondition\\n/// @author Aragon Association - 2023\\n/// @notice An abstract contract for non-upgradeable contracts instantiated via the `new` keyword to inherit from to support customary permissions depending on arbitrary on-chain state.\\nabstract contract PermissionCondition is ERC165, IPermissionCondition {\\n /// @notice Checks if an interface is supported by this or its parent contract.\\n /// @param _interfaceId The ID of the interface.\\n /// @return Returns `true` if the interface is supported.\\n function supportsInterface(bytes4 _interfaceId) public view override returns (bool) {\\n return\\n _interfaceId == type(IPermissionCondition).interfaceId ||\\n super.supportsInterface(_interfaceId);\\n }\\n}\\n\",\"keccak256\":\"0x49347dc10b664d9a8c286cc6ddc6ca86d5e5382bedfd75da690f1ef026ea007a\",\"license\":\"AGPL-3.0-or-later\"},\"@aragon/osx/core/permission/PermissionLib.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-or-later\\n\\npragma solidity ^0.8.8;\\n\\n/// @title PermissionLib\\n/// @author Aragon Association - 2021-2023\\n/// @notice A library containing objects for permission processing.\\nlibrary PermissionLib {\\n /// @notice A constant expressing that no condition is applied to a permission.\\n address public constant NO_CONDITION = address(0);\\n\\n /// @notice The types of permission operations available in the `PermissionManager`.\\n /// @param Grant The grant operation setting a permission without a condition.\\n /// @param Revoke The revoke operation removing a permission (that was granted with or without a condition).\\n /// @param GrantWithCondition The grant operation setting a permission with a condition.\\n enum Operation {\\n Grant,\\n Revoke,\\n GrantWithCondition\\n }\\n\\n /// @notice A struct containing the information for a permission to be applied on a single target contract without a condition.\\n /// @param operation The permission operation type.\\n /// @param who The address (EOA or contract) receiving the permission.\\n /// @param permissionId The permission identifier.\\n struct SingleTargetPermission {\\n Operation operation;\\n address who;\\n bytes32 permissionId;\\n }\\n\\n /// @notice A struct containing the information for a permission to be applied on multiple target contracts, optionally, with a condition.\\n /// @param operation The permission operation type.\\n /// @param where The address of the target contract for which `who` receives permission.\\n /// @param who The address (EOA or contract) receiving the permission.\\n /// @param condition The `PermissionCondition` that will be asked for authorization on calls connected to the specified permission identifier.\\n /// @param permissionId The permission identifier.\\n struct MultiTargetPermission {\\n Operation operation;\\n address where;\\n address who;\\n address condition;\\n bytes32 permissionId;\\n }\\n}\\n\",\"keccak256\":\"0x9b27fa8990e0f1623055187b8ade9363a6c8a1f15aab900e3a6e5cb312545c02\",\"license\":\"AGPL-3.0-or-later\"},\"@aragon/osx/core/permission/PermissionManager.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-or-later\\n\\npragma solidity ^0.8.8;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\\\";\\n\\nimport {IPermissionCondition} from \\\"./IPermissionCondition.sol\\\";\\nimport {PermissionCondition} from \\\"./PermissionCondition.sol\\\";\\nimport \\\"./PermissionLib.sol\\\";\\n\\n/// @title PermissionManager\\n/// @author Aragon Association - 2021-2023\\n/// @notice The abstract permission manager used in a DAO, its associated plugins, and other framework-related components.\\nabstract contract PermissionManager is Initializable {\\n using AddressUpgradeable for address;\\n\\n /// @notice The ID of the permission required to call the `grant`, `grantWithCondition`, `revoke`, and `bulk` function.\\n bytes32 public constant ROOT_PERMISSION_ID = keccak256(\\\"ROOT_PERMISSION\\\");\\n\\n /// @notice A special address encoding permissions that are valid for any address `who` or `where`.\\n address internal constant ANY_ADDR = address(type(uint160).max);\\n\\n /// @notice A special address encoding if a permissions is not set and therefore not allowed.\\n address internal constant UNSET_FLAG = address(0);\\n\\n /// @notice A special address encoding if a permission is allowed.\\n address internal constant ALLOW_FLAG = address(2);\\n\\n /// @notice A mapping storing permissions as hashes (i.e., `permissionHash(where, who, permissionId)`) and their status encoded by an address (unset, allowed, or redirecting to a `PermissionCondition`).\\n mapping(bytes32 => address) internal permissionsHashed;\\n\\n /// @notice Thrown if a call is unauthorized.\\n /// @param where The context in which the authorization reverted.\\n /// @param who The address (EOA or contract) missing the permission.\\n /// @param permissionId The permission identifier.\\n error Unauthorized(address where, address who, bytes32 permissionId);\\n\\n /// @notice Thrown if a permission has been already granted with a different condition.\\n /// @dev This makes sure that condition on the same permission can not be overwriten by a different condition.\\n /// @param where The address of the target contract to grant `_who` permission to.\\n /// @param who The address (EOA or contract) to which the permission has already been granted.\\n /// @param permissionId The permission identifier.\\n /// @param currentCondition The current condition set for permissionId.\\n /// @param newCondition The new condition it tries to set for permissionId.\\n error PermissionAlreadyGrantedForDifferentCondition(\\n address where,\\n address who,\\n bytes32 permissionId,\\n address currentCondition,\\n address newCondition\\n );\\n\\n /// @notice Thrown if a condition address is not a contract.\\n /// @param condition The address that is not a contract.\\n error ConditionNotAContract(IPermissionCondition condition);\\n\\n /// @notice Thrown if a condition contract does not support the `IPermissionCondition` interface.\\n /// @param condition The address that is not a contract.\\n error ConditionInterfacNotSupported(IPermissionCondition condition);\\n\\n /// @notice Thrown for `ROOT_PERMISSION_ID` or `EXECUTE_PERMISSION_ID` permission grants where `who` or `where` is `ANY_ADDR`.\\n\\n error PermissionsForAnyAddressDisallowed();\\n\\n /// @notice Thrown for permission grants where `who` and `where` are both `ANY_ADDR`.\\n error AnyAddressDisallowedForWhoAndWhere();\\n\\n /// @notice Thrown if `Operation.GrantWithCondition` is requested as an operation but the method does not support it.\\n error GrantWithConditionNotSupported();\\n\\n /// @notice Emitted when a permission `permission` is granted in the context `here` to the address `_who` for the contract `_where`.\\n /// @param permissionId The permission identifier.\\n /// @param here The address of the context in which the permission is granted.\\n /// @param where The address of the target contract for which `_who` receives permission.\\n /// @param who The address (EOA or contract) receiving the permission.\\n /// @param condition The address `ALLOW_FLAG` for regular permissions or, alternatively, the `IPermissionCondition` contract implementation to be used.\\n event Granted(\\n bytes32 indexed permissionId,\\n address indexed here,\\n address where,\\n address indexed who,\\n address condition\\n );\\n\\n /// @notice Emitted when a permission `permission` is revoked in the context `here` from the address `_who` for the contract `_where`.\\n /// @param permissionId The permission identifier.\\n /// @param here The address of the context in which the permission is revoked.\\n /// @param where The address of the target contract for which `_who` loses permission.\\n /// @param who The address (EOA or contract) losing the permission.\\n event Revoked(\\n bytes32 indexed permissionId,\\n address indexed here,\\n address where,\\n address indexed who\\n );\\n\\n /// @notice A modifier to make functions on inheriting contracts authorized. Permissions to call the function are checked through this permission manager.\\n /// @param _permissionId The permission identifier required to call the method this modifier is applied to.\\n modifier auth(bytes32 _permissionId) {\\n _auth(_permissionId);\\n _;\\n }\\n\\n /// @notice Initialization method to set the initial owner of the permission manager.\\n /// @dev The initial owner is granted the `ROOT_PERMISSION_ID` permission.\\n /// @param _initialOwner The initial owner of the permission manager.\\n function __PermissionManager_init(address _initialOwner) internal onlyInitializing {\\n _initializePermissionManager(_initialOwner);\\n }\\n\\n /// @notice Grants permission to an address to call methods in a contract guarded by an auth modifier with the specified permission identifier.\\n /// @dev Requires the `ROOT_PERMISSION_ID` permission.\\n /// @param _where The address of the target contract for which `_who` receives permission.\\n /// @param _who The address (EOA or contract) receiving the permission.\\n /// @param _permissionId The permission identifier.\\n /// @dev Note, that granting permissions with `_who` or `_where` equal to `ANY_ADDR` does not replace other permissions with specific `_who` and `_where` addresses that exist in parallel.\\n function grant(\\n address _where,\\n address _who,\\n bytes32 _permissionId\\n ) external virtual auth(ROOT_PERMISSION_ID) {\\n _grant(_where, _who, _permissionId);\\n }\\n\\n /// @notice Grants permission to an address to call methods in a target contract guarded by an auth modifier with the specified permission identifier if the referenced condition permits it.\\n /// @dev Requires the `ROOT_PERMISSION_ID` permission\\n /// @param _where The address of the target contract for which `_who` receives permission.\\n /// @param _who The address (EOA or contract) receiving the permission.\\n /// @param _permissionId The permission identifier.\\n /// @param _condition The `PermissionCondition` that will be asked for authorization on calls connected to the specified permission identifier.\\n /// @dev Note, that granting permissions with `_who` or `_where` equal to `ANY_ADDR` does not replace other permissions with specific `_who` and `_where` addresses that exist in parallel.\\n function grantWithCondition(\\n address _where,\\n address _who,\\n bytes32 _permissionId,\\n IPermissionCondition _condition\\n ) external virtual auth(ROOT_PERMISSION_ID) {\\n _grantWithCondition(_where, _who, _permissionId, _condition);\\n }\\n\\n /// @notice Revokes permission from an address to call methods in a target contract guarded by an auth modifier with the specified permission identifier.\\n /// @dev Requires the `ROOT_PERMISSION_ID` permission.\\n /// @param _where The address of the target contract for which `_who` loses permission.\\n /// @param _who The address (EOA or contract) losing the permission.\\n /// @param _permissionId The permission identifier.\\n /// @dev Note, that revoking permissions with `_who` or `_where` equal to `ANY_ADDR` does not revoke other permissions with specific `_who` and `_where` addresses that exist in parallel.\\n function revoke(\\n address _where,\\n address _who,\\n bytes32 _permissionId\\n ) external virtual auth(ROOT_PERMISSION_ID) {\\n _revoke(_where, _who, _permissionId);\\n }\\n\\n /// @notice Applies an array of permission operations on a single target contracts `_where`.\\n /// @param _where The address of the single target contract.\\n /// @param items The array of single-targeted permission operations to apply.\\n function applySingleTargetPermissions(\\n address _where,\\n PermissionLib.SingleTargetPermission[] calldata items\\n ) external virtual auth(ROOT_PERMISSION_ID) {\\n for (uint256 i; i < items.length; ) {\\n PermissionLib.SingleTargetPermission memory item = items[i];\\n\\n if (item.operation == PermissionLib.Operation.Grant) {\\n _grant(_where, item.who, item.permissionId);\\n } else if (item.operation == PermissionLib.Operation.Revoke) {\\n _revoke(_where, item.who, item.permissionId);\\n } else if (item.operation == PermissionLib.Operation.GrantWithCondition) {\\n revert GrantWithConditionNotSupported();\\n }\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n /// @notice Applies an array of permission operations on multiple target contracts `items[i].where`.\\n /// @param _items The array of multi-targeted permission operations to apply.\\n function applyMultiTargetPermissions(\\n PermissionLib.MultiTargetPermission[] calldata _items\\n ) external virtual auth(ROOT_PERMISSION_ID) {\\n for (uint256 i; i < _items.length; ) {\\n PermissionLib.MultiTargetPermission memory item = _items[i];\\n\\n if (item.operation == PermissionLib.Operation.Grant) {\\n _grant(item.where, item.who, item.permissionId);\\n } else if (item.operation == PermissionLib.Operation.Revoke) {\\n _revoke(item.where, item.who, item.permissionId);\\n } else if (item.operation == PermissionLib.Operation.GrantWithCondition) {\\n _grantWithCondition(\\n item.where,\\n item.who,\\n item.permissionId,\\n IPermissionCondition(item.condition)\\n );\\n }\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n /// @notice Checks if an address has permission on a contract via a permission identifier and considers if `ANY_ADDRESS` was used in the granting process.\\n /// @param _where The address of the target contract for which `_who` receives permission.\\n /// @param _who The address (EOA or contract) for which the permission is checked.\\n /// @param _permissionId The permission identifier.\\n /// @param _data The optional data passed to the `PermissionCondition` registered.\\n /// @return Returns true if `_who` has the permissions on the target contract via the specified permission identifier.\\n function isGranted(\\n address _where,\\n address _who,\\n bytes32 _permissionId,\\n bytes memory _data\\n ) public view virtual returns (bool) {\\n return\\n _isGranted(_where, _who, _permissionId, _data) || // check if `_who` has permission for `_permissionId` on `_where`\\n _isGranted(_where, ANY_ADDR, _permissionId, _data) || // check if anyone has permission for `_permissionId` on `_where`\\n _isGranted(ANY_ADDR, _who, _permissionId, _data); // check if `_who` has permission for `_permissionI` on any contract\\n }\\n\\n /// @notice Grants the `ROOT_PERMISSION_ID` permission to the initial owner during initialization of the permission manager.\\n /// @param _initialOwner The initial owner of the permission manager.\\n function _initializePermissionManager(address _initialOwner) internal {\\n _grant(address(this), _initialOwner, ROOT_PERMISSION_ID);\\n }\\n\\n /// @notice This method is used in the external `grant` method of the permission manager.\\n /// @param _where The address of the target contract for which `_who` receives permission.\\n /// @param _who The address (EOA or contract) owning the permission.\\n /// @param _permissionId The permission identifier.\\n /// @dev Note, that granting permissions with `_who` or `_where` equal to `ANY_ADDR` does not replace other permissions with specific `_who` and `_where` addresses that exist in parallel.\\n function _grant(address _where, address _who, bytes32 _permissionId) internal virtual {\\n if (_where == ANY_ADDR || _who == ANY_ADDR) {\\n revert PermissionsForAnyAddressDisallowed();\\n }\\n\\n bytes32 permHash = permissionHash(_where, _who, _permissionId);\\n\\n address currentFlag = permissionsHashed[permHash];\\n\\n // Means permHash is not currently set.\\n if (currentFlag == UNSET_FLAG) {\\n permissionsHashed[permHash] = ALLOW_FLAG;\\n\\n emit Granted(_permissionId, msg.sender, _where, _who, ALLOW_FLAG);\\n }\\n }\\n\\n /// @notice This method is used in the external `grantWithCondition` method of the permission manager.\\n /// @param _where The address of the target contract for which `_who` receives permission.\\n /// @param _who The address (EOA or contract) owning the permission.\\n /// @param _permissionId The permission identifier.\\n /// @param _condition An address either resolving to a `PermissionCondition` contract address or being the `ALLOW_FLAG` address (`address(2)`).\\n /// @dev Note, that granting permissions with `_who` or `_where` equal to `ANY_ADDR` does not replace other permissions with specific `_who` and `_where` addresses that exist in parallel.\\n function _grantWithCondition(\\n address _where,\\n address _who,\\n bytes32 _permissionId,\\n IPermissionCondition _condition\\n ) internal virtual {\\n address conditionAddr = address(_condition);\\n\\n if (!conditionAddr.isContract()) {\\n revert ConditionNotAContract(_condition);\\n }\\n\\n if (\\n !PermissionCondition(conditionAddr).supportsInterface(\\n type(IPermissionCondition).interfaceId\\n )\\n ) {\\n revert ConditionInterfacNotSupported(_condition);\\n }\\n\\n if (_where == ANY_ADDR && _who == ANY_ADDR) {\\n revert AnyAddressDisallowedForWhoAndWhere();\\n }\\n\\n if (_where == ANY_ADDR || _who == ANY_ADDR) {\\n if (\\n _permissionId == ROOT_PERMISSION_ID ||\\n isPermissionRestrictedForAnyAddr(_permissionId)\\n ) {\\n revert PermissionsForAnyAddressDisallowed();\\n }\\n }\\n\\n bytes32 permHash = permissionHash(_where, _who, _permissionId);\\n\\n address currentCondition = permissionsHashed[permHash];\\n\\n // Means permHash is not currently set.\\n if (currentCondition == UNSET_FLAG) {\\n permissionsHashed[permHash] = conditionAddr;\\n\\n emit Granted(_permissionId, msg.sender, _where, _who, conditionAddr);\\n } else if (currentCondition != conditionAddr) {\\n // Revert if `permHash` is already granted, but uses a different condition.\\n // If we don't revert, we either should:\\n // - allow overriding the condition on the same permission\\n // which could be confusing whoever granted the same permission first\\n // - or do nothing and succeed silently which could be confusing for the caller.\\n revert PermissionAlreadyGrantedForDifferentCondition({\\n where: _where,\\n who: _who,\\n permissionId: _permissionId,\\n currentCondition: currentCondition,\\n newCondition: conditionAddr\\n });\\n }\\n }\\n\\n /// @notice This method is used in the public `revoke` method of the permission manager.\\n /// @param _where The address of the target contract for which `_who` receives permission.\\n /// @param _who The address (EOA or contract) owning the permission.\\n /// @param _permissionId The permission identifier.\\n /// @dev Note, that revoking permissions with `_who` or `_where` equal to `ANY_ADDR` does not revoke other permissions with specific `_who` and `_where` addresses that might have been granted in parallel.\\n function _revoke(address _where, address _who, bytes32 _permissionId) internal virtual {\\n bytes32 permHash = permissionHash(_where, _who, _permissionId);\\n if (permissionsHashed[permHash] != UNSET_FLAG) {\\n permissionsHashed[permHash] = UNSET_FLAG;\\n\\n emit Revoked(_permissionId, msg.sender, _where, _who);\\n }\\n }\\n\\n /// @notice Checks if a caller is granted permissions on a target contract via a permission identifier and redirects the approval to a `PermissionCondition` if this was specified in the setup.\\n /// @param _where The address of the target contract for which `_who` receives permission.\\n /// @param _who The address (EOA or contract) owning the permission.\\n /// @param _permissionId The permission identifier.\\n /// @param _data The optional data passed to the `PermissionCondition` registered.\\n /// @return Returns true if `_who` has the permissions on the contract via the specified permissionId identifier.\\n function _isGranted(\\n address _where,\\n address _who,\\n bytes32 _permissionId,\\n bytes memory _data\\n ) internal view virtual returns (bool) {\\n address accessFlagOrCondition = permissionsHashed[\\n permissionHash(_where, _who, _permissionId)\\n ];\\n\\n if (accessFlagOrCondition == UNSET_FLAG) return false;\\n if (accessFlagOrCondition == ALLOW_FLAG) return true;\\n\\n // Since it's not a flag, assume it's a PermissionCondition and try-catch to skip failures\\n try\\n IPermissionCondition(accessFlagOrCondition).isGranted(\\n _where,\\n _who,\\n _permissionId,\\n _data\\n )\\n returns (bool allowed) {\\n if (allowed) return true;\\n } catch {}\\n\\n return false;\\n }\\n\\n /// @notice A private function to be used to check permissions on the permission manager contract (`address(this)`) itself.\\n /// @param _permissionId The permission identifier required to call the method this modifier is applied to.\\n function _auth(bytes32 _permissionId) internal view virtual {\\n if (!isGranted(address(this), msg.sender, _permissionId, msg.data)) {\\n revert Unauthorized({\\n where: address(this),\\n who: msg.sender,\\n permissionId: _permissionId\\n });\\n }\\n }\\n\\n /// @notice Generates the hash for the `permissionsHashed` mapping obtained from the word \\\"PERMISSION\\\", the contract address, the address owning the permission, and the permission identifier.\\n /// @param _where The address of the target contract for which `_who` receives permission.\\n /// @param _who The address (EOA or contract) owning the permission.\\n /// @param _permissionId The permission identifier.\\n /// @return The permission hash.\\n function permissionHash(\\n address _where,\\n address _who,\\n bytes32 _permissionId\\n ) internal pure virtual returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"PERMISSION\\\", _who, _where, _permissionId));\\n }\\n\\n /// @notice Decides if the granting permissionId is restricted when `_who == ANY_ADDR` or `_where == ANY_ADDR`.\\n /// @param _permissionId The permission identifier.\\n /// @return Whether or not the permission is restricted.\\n /// @dev By default, every permission is unrestricted and it is the derived contract's responsibility to override it. Note, that the `ROOT_PERMISSION_ID` is included and not required to be set it again.\\n function isPermissionRestrictedForAnyAddr(\\n bytes32 _permissionId\\n ) internal view virtual returns (bool) {\\n (_permissionId); // silence the warning.\\n return false;\\n }\\n\\n /// @notice This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain (see [OpenZeppelin's guide about storage gaps](https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps)).\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x7ca7d6598c32f07ab1ee5c7b03086d14871db06a1a3dff65bc574e43d65433db\",\"license\":\"AGPL-3.0-or-later\"},\"@aragon/osx/core/plugin/IPlugin.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-or-later\\n\\npragma solidity ^0.8.8;\\n\\n/// @title IPlugin\\n/// @author Aragon Association - 2022-2023\\n/// @notice An interface defining the traits of a plugin.\\ninterface IPlugin {\\n enum PluginType {\\n UUPS,\\n Cloneable,\\n Constructable\\n }\\n\\n /// @notice Returns the plugin's type\\n function pluginType() external view returns (PluginType);\\n}\\n\",\"keccak256\":\"0xcdb72c04ca35478e4d786fbbe12cf0e6de7d76aa0510028432312697f42c7355\",\"license\":\"AGPL-3.0-or-later\"},\"@aragon/osx/core/plugin/PluginUUPSUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-or-later\\n\\npragma solidity ^0.8.8;\\n\\nimport {UUPSUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\\\";\\nimport {IERC1822ProxiableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol\\\";\\nimport {ERC165Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\\\";\\n\\nimport {IDAO} from \\\"../dao/IDAO.sol\\\";\\nimport {DaoAuthorizableUpgradeable} from \\\"./dao-authorizable/DaoAuthorizableUpgradeable.sol\\\";\\nimport {IPlugin} from \\\"./IPlugin.sol\\\";\\n\\n/// @title PluginUUPSUpgradeable\\n/// @author Aragon Association - 2022-2023\\n/// @notice An abstract, upgradeable contract to inherit from when creating a plugin being deployed via the UUPS pattern (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)).\\nabstract contract PluginUUPSUpgradeable is\\n IPlugin,\\n ERC165Upgradeable,\\n UUPSUpgradeable,\\n DaoAuthorizableUpgradeable\\n{\\n // NOTE: When adding new state variables to the contract, the size of `_gap` has to be adapted below as well.\\n\\n /// @notice Disables the initializers on the implementation contract to prevent it from being left uninitialized.\\n constructor() {\\n _disableInitializers();\\n }\\n\\n /// @inheritdoc IPlugin\\n function pluginType() public pure override returns (PluginType) {\\n return PluginType.UUPS;\\n }\\n\\n /// @notice The ID of the permission required to call the `_authorizeUpgrade` function.\\n bytes32 public constant UPGRADE_PLUGIN_PERMISSION_ID = keccak256(\\\"UPGRADE_PLUGIN_PERMISSION\\\");\\n\\n /// @notice Initializes the plugin by storing the associated DAO.\\n /// @param _dao The DAO contract.\\n function __PluginUUPSUpgradeable_init(IDAO _dao) internal virtual onlyInitializing {\\n __DaoAuthorizableUpgradeable_init(_dao);\\n }\\n\\n /// @notice Checks if an interface is supported by this or its parent contract.\\n /// @param _interfaceId The ID of the interface.\\n /// @return Returns `true` if the interface is supported.\\n function supportsInterface(bytes4 _interfaceId) public view virtual override returns (bool) {\\n return\\n _interfaceId == type(IPlugin).interfaceId ||\\n _interfaceId == type(IERC1822ProxiableUpgradeable).interfaceId ||\\n super.supportsInterface(_interfaceId);\\n }\\n\\n /// @notice Returns the address of the implementation contract in the [proxy storage slot](https://eips.ethereum.org/EIPS/eip-1967) slot the [UUPS proxy](https://eips.ethereum.org/EIPS/eip-1822) is pointing to.\\n /// @return The address of the implementation contract.\\n function implementation() public view returns (address) {\\n return _getImplementation();\\n }\\n\\n /// @notice Internal method authorizing the upgrade of the contract via the [upgradeability mechanism for UUPS proxies](https://docs.openzeppelin.com/contracts/4.x/api/proxy#UUPSUpgradeable) (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)).\\n /// @dev The caller must have the `UPGRADE_PLUGIN_PERMISSION_ID` permission.\\n function _authorizeUpgrade(\\n address\\n ) internal virtual override auth(UPGRADE_PLUGIN_PERMISSION_ID) {}\\n\\n /// @notice This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain (see [OpenZeppelin's guide about storage gaps](https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps)).\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x5b12df9d646c59629dbaeb0a70df476a867a82887f5ef7d8b35697c01fcb45f3\",\"license\":\"AGPL-3.0-or-later\"},\"@aragon/osx/core/plugin/dao-authorizable/DaoAuthorizableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-or-later\\n\\npragma solidity ^0.8.8;\\n\\nimport {ContextUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\\\";\\n\\nimport {IDAO} from \\\"../../dao/IDAO.sol\\\";\\nimport {_auth} from \\\"../../utils/auth.sol\\\";\\n\\n/// @title DaoAuthorizableUpgradeable\\n/// @author Aragon Association - 2022-2023\\n/// @notice An abstract contract providing a meta-transaction compatible modifier for upgradeable or cloneable contracts to authorize function calls through an associated DAO.\\n/// @dev Make sure to call `__DaoAuthorizableUpgradeable_init` during initialization of the inheriting contract.\\nabstract contract DaoAuthorizableUpgradeable is ContextUpgradeable {\\n /// @notice The associated DAO managing the permissions of inheriting contracts.\\n IDAO private dao_;\\n\\n /// @notice Initializes the contract by setting the associated DAO.\\n /// @param _dao The associated DAO address.\\n function __DaoAuthorizableUpgradeable_init(IDAO _dao) internal onlyInitializing {\\n dao_ = _dao;\\n }\\n\\n /// @notice Returns the DAO contract.\\n /// @return The DAO contract.\\n function dao() public view returns (IDAO) {\\n return dao_;\\n }\\n\\n /// @notice A modifier to make functions on inheriting contracts authorized. Permissions to call the function are checked through the associated DAO's permission manager.\\n /// @param _permissionId The permission identifier required to call the method this modifier is applied to.\\n modifier auth(bytes32 _permissionId) {\\n _auth(dao_, address(this), _msgSender(), _permissionId, _msgData());\\n _;\\n }\\n\\n /// @notice This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain (see [OpenZeppelin's guide about storage gaps](https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps)).\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xd21dcde806070ad8f62acc81d986e517edb5a60ebdff8419660763018f7895e8\",\"license\":\"AGPL-3.0-or-later\"},\"@aragon/osx/core/utils/BitMap.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-or-later\\n\\npragma solidity 0.8.17;\\n\\n/// @param bitmap The `uint256` representation of bits.\\n/// @param index The index number to check whether 1 or 0 is set.\\n/// @return Returns `true` if the bit is set at `index` on `bitmap`.\\nfunction hasBit(uint256 bitmap, uint8 index) pure returns (bool) {\\n uint256 bitValue = bitmap & (1 << index);\\n return bitValue > 0;\\n}\\n\\n/// @param bitmap The `uint256` representation of bits.\\n/// @param index The index number to set the bit.\\n/// @return Returns a new number in which the bit is set at `index`.\\nfunction flipBit(uint256 bitmap, uint8 index) pure returns (uint256) {\\n return bitmap ^ (1 << index);\\n}\\n\",\"keccak256\":\"0x6a2eb612d06f0db7ebe43691966f16556ad0ec0ae54831b75c2b64e308626e8e\",\"license\":\"AGPL-3.0-or-later\"},\"@aragon/osx/core/utils/CallbackHandler.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-or-later\\n\\npragma solidity 0.8.17;\\n\\n/// @title CallbackHandler\\n/// @author Aragon Association - 2022-2023\\n/// @notice This contract handles callbacks by registering a magic number together with the callback function's selector. It provides the `_handleCallback` function that inheriting contracts have to call inside their `fallback()` function (`_handleCallback(msg.callbackSelector, msg.data)`). This allows to adaptively register ERC standards (e.g., [ERC-721](https://eips.ethereum.org/EIPS/eip-721), [ERC-1115](https://eips.ethereum.org/EIPS/eip-1155), or future versions of [ERC-165](https://eips.ethereum.org/EIPS/eip-165)) and returning the required magic numbers for the associated callback functions for the inheriting contract so that it doesn't need to be upgraded.\\n/// @dev This callback handling functionality is intented to be used by executor contracts (i.e., `DAO.sol`).\\nabstract contract CallbackHandler {\\n /// @notice A mapping between callback function selectors and magic return numbers.\\n mapping(bytes4 => bytes4) internal callbackMagicNumbers;\\n\\n /// @notice The magic number refering to unregistered callbacks.\\n bytes4 internal constant UNREGISTERED_CALLBACK = bytes4(0);\\n\\n /// @notice Thrown if the callback function is not registered.\\n /// @param callbackSelector The selector of the callback function.\\n /// @param magicNumber The magic number to be registered for the callback function selector.\\n error UnkownCallback(bytes4 callbackSelector, bytes4 magicNumber);\\n\\n /// @notice Emitted when `_handleCallback` is called.\\n /// @param sender Who called the callback.\\n /// @param sig The function signature.\\n /// @param data The calldata.\\n event CallbackReceived(address sender, bytes4 indexed sig, bytes data);\\n\\n /// @notice Handles callbacks to adaptively support ERC standards.\\n /// @dev This function is supposed to be called via `_handleCallback(msg.sig, msg.data)` in the `fallback()` function of the inheriting contract.\\n /// @param _callbackSelector The function selector of the callback function.\\n /// @param _data The calldata.\\n /// @return The magic number registered for the function selector triggering the fallback.\\n function _handleCallback(\\n bytes4 _callbackSelector,\\n bytes memory _data\\n ) internal virtual returns (bytes4) {\\n bytes4 magicNumber = callbackMagicNumbers[_callbackSelector];\\n if (magicNumber == UNREGISTERED_CALLBACK) {\\n revert UnkownCallback({callbackSelector: _callbackSelector, magicNumber: magicNumber});\\n }\\n\\n emit CallbackReceived({sender: msg.sender, sig: _callbackSelector, data: _data});\\n\\n return magicNumber;\\n }\\n\\n /// @notice Registers a magic number for a callback function selector.\\n /// @param _callbackSelector The selector of the callback function.\\n /// @param _magicNumber The magic number to be registered for the callback function selector.\\n function _registerCallback(bytes4 _callbackSelector, bytes4 _magicNumber) internal virtual {\\n callbackMagicNumbers[_callbackSelector] = _magicNumber;\\n }\\n\\n /// @notice This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain (see [OpenZeppelin's guide about storage gaps](https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps)).\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xeee37200b791d81fa46f614a49ad5b10acc9f9b4bef90e1984d0f374f70fa6ed\",\"license\":\"AGPL-3.0-or-later\"},\"@aragon/osx/core/utils/auth.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-or-later\\n\\npragma solidity ^0.8.8;\\n\\nimport {IDAO} from \\\"../dao/IDAO.sol\\\";\\n\\n/// @notice Thrown if a call is unauthorized in the associated DAO.\\n/// @param dao The associated DAO.\\n/// @param where The context in which the authorization reverted.\\n/// @param who The address (EOA or contract) missing the permission.\\n/// @param permissionId The permission identifier.\\nerror DaoUnauthorized(address dao, address where, address who, bytes32 permissionId);\\n\\n/// @notice A free function checking if a caller is granted permissions on a target contract via a permission identifier that redirects the approval to a `PermissionCondition` if this was specified in the setup.\\n/// @param _where The address of the target contract for which `who` receives permission.\\n/// @param _who The address (EOA or contract) owning the permission.\\n/// @param _permissionId The permission identifier.\\n/// @param _data The optional data passed to the `PermissionCondition` registered.\\nfunction _auth(\\n IDAO _dao,\\n address _where,\\n address _who,\\n bytes32 _permissionId,\\n bytes calldata _data\\n) view {\\n if (!_dao.hasPermission(_where, _who, _permissionId, _data))\\n revert DaoUnauthorized({\\n dao: address(_dao),\\n where: _where,\\n who: _who,\\n permissionId: _permissionId\\n });\\n}\\n\",\"keccak256\":\"0x1c9cf22583c8b5a08c6d2c02a68d9f05e58900a9bb27efa3b30abca2ecfabfe4\",\"license\":\"AGPL-3.0-or-later\"},\"@aragon/osx/framework/plugin/setup/IPluginSetup.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-or-later\\n\\npragma solidity ^0.8.8;\\n\\nimport {PermissionLib} from \\\"../../../core/permission/PermissionLib.sol\\\";\\nimport {IDAO} from \\\"../../../core/dao/IDAO.sol\\\";\\n\\n/// @title IPluginSetup\\n/// @author Aragon Association - 2022-2023\\n/// @notice The interface required for a plugin setup contract to be consumed by the `PluginSetupProcessor` for plugin installations, updates, and uninstallations.\\ninterface IPluginSetup {\\n /// @notice The data associated with a prepared setup.\\n /// @param helpers The address array of helpers (contracts or EOAs) associated with this plugin version after the installation or update.\\n /// @param permissions The array of multi-targeted permission operations to be applied by the `PluginSetupProcessor` to the installing or updating DAO.\\n struct PreparedSetupData {\\n address[] helpers;\\n PermissionLib.MultiTargetPermission[] permissions;\\n }\\n\\n /// @notice The payload for plugin updates and uninstallations containing the existing contracts as well as optional data to be consumed by the plugin setup.\\n /// @param plugin The address of the `Plugin`.\\n /// @param currentHelpers The address array of all current helpers (contracts or EOAs) associated with the plugin to update from.\\n /// @param data The bytes-encoded data containing the input parameters for the preparation of update/uninstall as specified in the corresponding ABI on the version's metadata.\\n struct SetupPayload {\\n address plugin;\\n address[] currentHelpers;\\n bytes data;\\n }\\n\\n /// @notice Prepares the installation of a plugin.\\n /// @param _dao The address of the installing DAO.\\n /// @param _data The bytes-encoded data containing the input parameters for the installation as specified in the plugin's build metadata JSON file.\\n /// @return plugin The address of the `Plugin` contract being prepared for installation.\\n /// @return preparedSetupData The deployed plugin's relevant data which consists of helpers and permissions.\\n function prepareInstallation(\\n address _dao,\\n bytes calldata _data\\n ) external returns (address plugin, PreparedSetupData memory preparedSetupData);\\n\\n /// @notice Prepares the update of a plugin.\\n /// @param _dao The address of the updating DAO.\\n /// @param _currentBuild The build number of the plugin to update from.\\n /// @param _payload The relevant data necessary for the `prepareUpdate`. See above.\\n /// @return initData The initialization data to be passed to upgradeable contracts when the update is applied in the `PluginSetupProcessor`.\\n /// @return preparedSetupData The deployed plugin's relevant data which consists of helpers and permissions.\\n function prepareUpdate(\\n address _dao,\\n uint16 _currentBuild,\\n SetupPayload calldata _payload\\n ) external returns (bytes memory initData, PreparedSetupData memory preparedSetupData);\\n\\n /// @notice Prepares the uninstallation of a plugin.\\n /// @param _dao The address of the uninstalling DAO.\\n /// @param _payload The relevant data necessary for the `prepareUninstallation`. See above.\\n /// @return permissions The array of multi-targeted permission operations to be applied by the `PluginSetupProcessor` to the uninstalling DAO.\\n function prepareUninstallation(\\n address _dao,\\n SetupPayload calldata _payload\\n ) external returns (PermissionLib.MultiTargetPermission[] memory permissions);\\n\\n /// @notice Returns the plugin implementation address.\\n /// @return The address of the plugin implementation contract.\\n /// @dev The implementation can be instantiated via the `new` keyword, cloned via the minimal clones pattern (see [ERC-1167](https://eips.ethereum.org/EIPS/eip-1167)), or proxied via the UUPS pattern (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)).\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0x81d1e60154e672372318f6fccf337b6094bb8fe1192e2f755b8cc0d645ff5332\",\"license\":\"AGPL-3.0-or-later\"},\"@aragon/osx/framework/plugin/setup/PluginSetup.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-or-later\\n\\npragma solidity ^0.8.8;\\n\\nimport {ERC165} from \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport {ERC165Checker} from \\\"@openzeppelin/contracts/utils/introspection/ERC165Checker.sol\\\";\\nimport {Clones} from \\\"@openzeppelin/contracts/proxy/Clones.sol\\\";\\n\\nimport {PermissionLib} from \\\"../../../core/permission/PermissionLib.sol\\\";\\nimport {createERC1967Proxy as createERC1967} from \\\"../../../utils/Proxy.sol\\\";\\nimport {IPluginSetup} from \\\"./IPluginSetup.sol\\\";\\n\\n/// @title PluginSetup\\n/// @author Aragon Association - 2022-2023\\n/// @notice An abstract contract that developers have to inherit from to write the setup of a plugin.\\nabstract contract PluginSetup is ERC165, IPluginSetup {\\n /// @inheritdoc IPluginSetup\\n function prepareUpdate(\\n address _dao,\\n uint16 _currentBuild,\\n SetupPayload calldata _payload\\n )\\n external\\n virtual\\n override\\n returns (bytes memory initData, PreparedSetupData memory preparedSetupData)\\n {}\\n\\n /// @notice A convenience function to create an [ERC-1967](https://eips.ethereum.org/EIPS/eip-1967) proxy contract pointing to an implementation and being associated to a DAO.\\n /// @param _implementation The address of the implementation contract to which the proxy is pointing to.\\n /// @param _data The data to initialize the storage of the proxy contract.\\n /// @return The address of the created proxy contract.\\n function createERC1967Proxy(\\n address _implementation,\\n bytes memory _data\\n ) internal returns (address) {\\n return createERC1967(_implementation, _data);\\n }\\n\\n /// @notice Checks if this or the parent contract supports an interface by its ID.\\n /// @param _interfaceId The ID of the interface.\\n /// @return Returns `true` if the interface is supported.\\n function supportsInterface(bytes4 _interfaceId) public view virtual override returns (bool) {\\n return\\n _interfaceId == type(IPluginSetup).interfaceId || super.supportsInterface(_interfaceId);\\n }\\n}\\n\",\"keccak256\":\"0x04ff3ec8a5b121ef3972dbb8140b7cf313f9ed514f8471841e3dcf5304ef6950\",\"license\":\"AGPL-3.0-or-later\"},\"@aragon/osx/plugins/utils/Addresslist.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-or-later\\n\\npragma solidity ^0.8.8;\\n\\nimport {CheckpointsUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/CheckpointsUpgradeable.sol\\\";\\n\\nimport {_uncheckedAdd, _uncheckedSub} from \\\"../../utils/UncheckedMath.sol\\\";\\n\\n/// @title Addresslist\\n/// @author Aragon Association - 2021-2023\\n/// @notice The majority voting implementation using a list of member addresses.\\n/// @dev This contract inherits from `MajorityVotingBase` and implements the `IMajorityVoting` interface.\\nabstract contract Addresslist {\\n using CheckpointsUpgradeable for CheckpointsUpgradeable.History;\\n\\n /// @notice The mapping containing the checkpointed history of the address list.\\n mapping(address => CheckpointsUpgradeable.History) private _addresslistCheckpoints;\\n\\n /// @notice The checkpointed history of the length of the address list.\\n CheckpointsUpgradeable.History private _addresslistLengthCheckpoints;\\n\\n /// @notice Thrown when the address list update is invalid, which can be caused by the addition of an existing member or removal of a non-existing member.\\n /// @param member The array of member addresses to be added or removed.\\n error InvalidAddresslistUpdate(address member);\\n\\n /// @notice Checks if an account is on the address list at a specific block number.\\n /// @param _account The account address being checked.\\n /// @param _blockNumber The block number.\\n /// @return Whether the account is listed at the specified block number.\\n function isListedAtBlock(\\n address _account,\\n uint256 _blockNumber\\n ) public view virtual returns (bool) {\\n return _addresslistCheckpoints[_account].getAtBlock(_blockNumber) == 1;\\n }\\n\\n /// @notice Checks if an account is currently on the address list.\\n /// @param _account The account address being checked.\\n /// @return Whether the account is currently listed.\\n function isListed(address _account) public view virtual returns (bool) {\\n return _addresslistCheckpoints[_account].latest() == 1;\\n }\\n\\n /// @notice Returns the length of the address list at a specific block number.\\n /// @param _blockNumber The specific block to get the count from. If `0`, then the latest checkpoint value is returned.\\n /// @return The address list length at the specified block number.\\n function addresslistLengthAtBlock(uint256 _blockNumber) public view virtual returns (uint256) {\\n return _addresslistLengthCheckpoints.getAtBlock(_blockNumber);\\n }\\n\\n /// @notice Returns the current length of the address list.\\n /// @return The current address list length.\\n function addresslistLength() public view virtual returns (uint256) {\\n return _addresslistLengthCheckpoints.latest();\\n }\\n\\n /// @notice Internal function to add new addresses to the address list.\\n /// @param _newAddresses The new addresses to be added.\\n function _addAddresses(address[] calldata _newAddresses) internal virtual {\\n for (uint256 i; i < _newAddresses.length; ) {\\n if (isListed(_newAddresses[i])) {\\n revert InvalidAddresslistUpdate(_newAddresses[i]);\\n }\\n\\n // Mark the address as listed\\n _addresslistCheckpoints[_newAddresses[i]].push(1);\\n\\n unchecked {\\n ++i;\\n }\\n }\\n _addresslistLengthCheckpoints.push(_uncheckedAdd, _newAddresses.length);\\n }\\n\\n /// @notice Internal function to remove existing addresses from the address list.\\n /// @param _exitingAddresses The existing addresses to be removed.\\n function _removeAddresses(address[] calldata _exitingAddresses) internal virtual {\\n for (uint256 i; i < _exitingAddresses.length; ) {\\n if (!isListed(_exitingAddresses[i])) {\\n revert InvalidAddresslistUpdate(_exitingAddresses[i]);\\n }\\n\\n // Mark the address as not listed\\n _addresslistCheckpoints[_exitingAddresses[i]].push(0);\\n\\n unchecked {\\n ++i;\\n }\\n }\\n _addresslistLengthCheckpoints.push(_uncheckedSub, _exitingAddresses.length);\\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 /// https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n uint256[48] private __gap;\\n}\\n\",\"keccak256\":\"0xd80d688df0b55e55406074a90c55be301edf73bcb68ad016db318d65bc05c868\",\"license\":\"AGPL-3.0-or-later\"},\"@aragon/osx/plugins/utils/Ratio.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-or-later\\n\\npragma solidity ^0.8.8;\\n\\n// The base value to encode real-valued ratios on the interval `[0,1]` as integers on the interval `[0, 10**6]`.\\nuint256 constant RATIO_BASE = 10 ** 6;\\n\\n/// @notice Thrown if a ratio value exceeds the maximal value of `10**6`.\\n/// @param limit The maximal value.\\n/// @param actual The actual value.\\nerror RatioOutOfBounds(uint256 limit, uint256 actual);\\n\\n/// @notice Applies a ratio to a value and ceils the remainder.\\n/// @param _value The value to which the ratio is applied.\\n/// @param _ratio The ratio that must be in the interval `[0, 10**6]`.\\n/// @return result The resulting value.\\nfunction _applyRatioCeiled(uint256 _value, uint256 _ratio) pure returns (uint256 result) {\\n if (_ratio > RATIO_BASE) {\\n revert RatioOutOfBounds({limit: RATIO_BASE, actual: _ratio});\\n }\\n\\n _value = _value * _ratio;\\n uint256 remainder = _value % RATIO_BASE;\\n result = _value / RATIO_BASE;\\n\\n // Check if ceiling is needed\\n if (remainder != 0) {\\n ++result;\\n }\\n}\\n\",\"keccak256\":\"0x9f7090abe53c6a3a2972e596efc483df082df5ae219e3cb5f039f6294bffdd81\",\"license\":\"AGPL-3.0-or-later\"},\"@aragon/osx/token/ERC20/IERC20MintableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-or-later\\n\\npragma solidity 0.8.17;\\n\\n/// @title IERC20MintableUpgradeable\\n/// @notice Interface to allow minting of [ERC-20](https://eips.ethereum.org/EIPS/eip-20) tokens.\\ninterface IERC20MintableUpgradeable {\\n /// @notice Mints [ERC-20](https://eips.ethereum.org/EIPS/eip-20) tokens for a receiving address.\\n /// @param _to The receiving address.\\n /// @param _amount The amount of tokens.\\n function mint(address _to, uint256 _amount) external;\\n}\\n\",\"keccak256\":\"0x67c5e5b94e83984da5427057e3945f1863c5d2a6f35fddd6abc1a11927167a46\",\"license\":\"AGPL-3.0-or-later\"},\"@aragon/osx/token/ERC20/governance/GovernanceERC20.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-or-later\\n\\npragma solidity 0.8.17;\\n\\nimport {IERC20PermitUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol\\\";\\nimport {IERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\nimport {IERC20MetadataUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\\\";\\nimport {ERC20VotesUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20VotesUpgradeable.sol\\\";\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {ERC165Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\\\";\\nimport {IVotesUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/governance/utils/IVotesUpgradeable.sol\\\";\\n\\nimport {DaoAuthorizableUpgradeable} from \\\"../../../core/plugin/dao-authorizable/DaoAuthorizableUpgradeable.sol\\\";\\nimport {IDAO} from \\\"../../../core/dao/IDAO.sol\\\";\\nimport {IERC20MintableUpgradeable} from \\\"../IERC20MintableUpgradeable.sol\\\";\\n\\n/// @title GovernanceERC20\\n/// @author Aragon Association\\n/// @notice An [OpenZeppelin `Votes`](https://docs.openzeppelin.com/contracts/4.x/api/governance#Votes) compatible [ERC-20](https://eips.ethereum.org/EIPS/eip-20) token that can be used for voting and is managed by a DAO.\\ncontract GovernanceERC20 is\\n IERC20MintableUpgradeable,\\n Initializable,\\n ERC165Upgradeable,\\n ERC20VotesUpgradeable,\\n DaoAuthorizableUpgradeable\\n{\\n /// @notice The permission identifier to mint new tokens\\n bytes32 public constant MINT_PERMISSION_ID = keccak256(\\\"MINT_PERMISSION\\\");\\n\\n /// @notice The settings for the initial mint of the token.\\n /// @param receivers The receivers of the tokens.\\n /// @param amounts The amounts of tokens to be minted for each receiver.\\n /// @dev The lengths of `receivers` and `amounts` must match.\\n struct MintSettings {\\n address[] receivers;\\n uint256[] amounts;\\n }\\n\\n /// @notice Thrown if the number of receivers and amounts specified in the mint settings do not match.\\n /// @param receiversArrayLength The length of the `receivers` array.\\n /// @param amountsArrayLength The length of the `amounts` array.\\n error MintSettingsArrayLengthMismatch(uint256 receiversArrayLength, uint256 amountsArrayLength);\\n\\n /// @notice Calls the initialize function.\\n /// @param _dao The managing DAO.\\n /// @param _name The name of the [ERC-20](https://eips.ethereum.org/EIPS/eip-20) governance token.\\n /// @param _symbol The symbol of the [ERC-20](https://eips.ethereum.org/EIPS/eip-20) governance token.\\n /// @param _mintSettings The token mint settings struct containing the `receivers` and `amounts`.\\n constructor(\\n IDAO _dao,\\n string memory _name,\\n string memory _symbol,\\n MintSettings memory _mintSettings\\n ) {\\n initialize(_dao, _name, _symbol, _mintSettings);\\n }\\n\\n /// @notice Initializes the contract and mints tokens to a list of receivers.\\n /// @param _dao The managing DAO.\\n /// @param _name The name of the [ERC-20](https://eips.ethereum.org/EIPS/eip-20) governance token.\\n /// @param _symbol The symbol of the [ERC-20](https://eips.ethereum.org/EIPS/eip-20) governance token.\\n /// @param _mintSettings The token mint settings struct containing the `receivers` and `amounts`.\\n function initialize(\\n IDAO _dao,\\n string memory _name,\\n string memory _symbol,\\n MintSettings memory _mintSettings\\n ) public initializer {\\n // Check mint settings\\n if (_mintSettings.receivers.length != _mintSettings.amounts.length) {\\n revert MintSettingsArrayLengthMismatch({\\n receiversArrayLength: _mintSettings.receivers.length,\\n amountsArrayLength: _mintSettings.amounts.length\\n });\\n }\\n\\n __ERC20_init(_name, _symbol);\\n __ERC20Permit_init(_name);\\n __DaoAuthorizableUpgradeable_init(_dao);\\n\\n for (uint256 i; i < _mintSettings.receivers.length; ) {\\n _mint(_mintSettings.receivers[i], _mintSettings.amounts[i]);\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n /// @notice Checks if this or the parent contract supports an interface by its ID.\\n /// @param _interfaceId The ID of the interface.\\n /// @return Returns `true` if the interface is supported.\\n function supportsInterface(bytes4 _interfaceId) public view virtual override returns (bool) {\\n return\\n _interfaceId == type(IERC20Upgradeable).interfaceId ||\\n _interfaceId == type(IERC20PermitUpgradeable).interfaceId ||\\n _interfaceId == type(IERC20MetadataUpgradeable).interfaceId ||\\n _interfaceId == type(IVotesUpgradeable).interfaceId ||\\n _interfaceId == type(IERC20MintableUpgradeable).interfaceId ||\\n super.supportsInterface(_interfaceId);\\n }\\n\\n /// @notice Mints tokens to an address.\\n /// @param to The address receiving the tokens.\\n /// @param amount The amount of tokens to be minted.\\n function mint(address to, uint256 amount) external override auth(MINT_PERMISSION_ID) {\\n _mint(to, amount);\\n }\\n\\n // https://forum.openzeppelin.com/t/self-delegation-in-erc20votes/17501/12?u=novaknole\\n /// @inheritdoc ERC20VotesUpgradeable\\n function _afterTokenTransfer(address from, address to, uint256 amount) internal override {\\n super._afterTokenTransfer(from, to, amount);\\n\\n // Automatically turn on delegation on mint/transfer but only for the first time.\\n if (to != address(0) && numCheckpoints(to) == 0 && delegates(to) == address(0)) {\\n _delegate(to, to);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf47bd02799c8ac3d021b348f857e6cc22c7782d3c99c88e59d3cb94921261134\",\"license\":\"AGPL-3.0-or-later\"},\"@aragon/osx/token/ERC20/governance/GovernanceWrappedERC20.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-or-later\\n\\npragma solidity 0.8.17;\\n\\nimport {ERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol\\\";\\nimport {ERC20WrapperUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20WrapperUpgradeable.sol\\\";\\nimport {IVotesUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/governance/utils/IVotesUpgradeable.sol\\\";\\nimport {IERC20PermitUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol\\\";\\nimport {IERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\nimport {IERC20MetadataUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\\\";\\nimport {ERC20VotesUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20VotesUpgradeable.sol\\\";\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {ERC165Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\\\";\\n\\nimport {DaoAuthorizableUpgradeable} from \\\"../../../core/plugin/dao-authorizable/DaoAuthorizableUpgradeable.sol\\\";\\nimport {IDAO} from \\\"../../../core/dao/IDAO.sol\\\";\\nimport {IGovernanceWrappedERC20} from \\\"./IGovernanceWrappedERC20.sol\\\";\\n\\n/// @title GovernanceWrappedERC20\\n/// @author Aragon Association\\n/// @notice Wraps an existing [ERC-20](https://eips.ethereum.org/EIPS/eip-20) token by inheriting from `ERC20WrapperUpgradeable` and allows to use it for voting by inheriting from `ERC20VotesUpgradeable`. The latter is compatible with [OpenZeppelin's `Votes`](https://docs.openzeppelin.com/contracts/4.x/api/governance#Votes) interface.\\n/// The contract also supports meta transactions. To use an `amount` of underlying tokens for voting, the token owner has to\\n/// 1. call `approve` for the tokens to be used by this contract\\n/// 2. call `depositFor` to wrap them, which safely transfers the underlying [ERC-20](https://eips.ethereum.org/EIPS/eip-20) tokens to the contract and mints wrapped [ERC-20](https://eips.ethereum.org/EIPS/eip-20) tokens.\\n/// To get the [ERC-20](https://eips.ethereum.org/EIPS/eip-20) tokens back, the owner of the wrapped tokens can call `withdrawFor`, which burns the wrapped [ERC-20](https://eips.ethereum.org/EIPS/eip-20) tokens and safely transfers the underlying tokens back to the owner.\\n/// @dev This contract intentionally has no public mint functionality because this is the responsibility of the underlying [ERC-20](https://eips.ethereum.org/EIPS/eip-20) token contract.\\ncontract GovernanceWrappedERC20 is\\n IGovernanceWrappedERC20,\\n Initializable,\\n ERC165Upgradeable,\\n ERC20VotesUpgradeable,\\n ERC20WrapperUpgradeable\\n{\\n /// @notice Calls the initialize function.\\n /// @param _token The underlying [ERC-20](https://eips.ethereum.org/EIPS/eip-20) token.\\n /// @param _name The name of the wrapped token.\\n /// @param _symbol The symbol of the wrapped token.\\n constructor(IERC20Upgradeable _token, string memory _name, string memory _symbol) {\\n initialize(_token, _name, _symbol);\\n }\\n\\n /// @notice Initializes the contract.\\n /// @param _token The underlying [ERC-20](https://eips.ethereum.org/EIPS/eip-20) token.\\n /// @param _name The name of the wrapped token.\\n /// @param _symbol The symbol of the wrapped token.\\n function initialize(\\n IERC20Upgradeable _token,\\n string memory _name,\\n string memory _symbol\\n ) public initializer {\\n __ERC20_init(_name, _symbol);\\n __ERC20Permit_init(_name);\\n __ERC20Wrapper_init(_token);\\n }\\n\\n /// @notice Checks if this or the parent contract supports an interface by its ID.\\n /// @param _interfaceId The ID of the interface.\\n /// @return Returns `true` if the interface is supported.\\n function supportsInterface(bytes4 _interfaceId) public view virtual override returns (bool) {\\n return\\n _interfaceId == type(IGovernanceWrappedERC20).interfaceId ||\\n _interfaceId == type(IERC20Upgradeable).interfaceId ||\\n _interfaceId == type(IERC20PermitUpgradeable).interfaceId ||\\n _interfaceId == type(IERC20MetadataUpgradeable).interfaceId ||\\n _interfaceId == type(IVotesUpgradeable).interfaceId ||\\n super.supportsInterface(_interfaceId);\\n }\\n\\n /// @inheritdoc ERC20WrapperUpgradeable\\n /// @dev Uses the `decimals` of the underlying [ERC-20](https://eips.ethereum.org/EIPS/eip-20) token.\\n function decimals()\\n public\\n view\\n override(ERC20Upgradeable, ERC20WrapperUpgradeable)\\n returns (uint8)\\n {\\n return ERC20WrapperUpgradeable.decimals();\\n }\\n\\n /// @inheritdoc IGovernanceWrappedERC20\\n function depositFor(\\n address account,\\n uint256 amount\\n ) public override(IGovernanceWrappedERC20, ERC20WrapperUpgradeable) returns (bool) {\\n return ERC20WrapperUpgradeable.depositFor(account, amount);\\n }\\n\\n /// @inheritdoc IGovernanceWrappedERC20\\n function withdrawTo(\\n address account,\\n uint256 amount\\n ) public override(IGovernanceWrappedERC20, ERC20WrapperUpgradeable) returns (bool) {\\n return ERC20WrapperUpgradeable.withdrawTo(account, amount);\\n }\\n\\n // https://forum.openzeppelin.com/t/self-delegation-in-erc20votes/17501/12?u=novaknole\\n /// @inheritdoc ERC20VotesUpgradeable\\n function _afterTokenTransfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal override(ERC20VotesUpgradeable, ERC20Upgradeable) {\\n super._afterTokenTransfer(from, to, amount);\\n\\n // Automatically turn on delegation on mint/transfer but only for the first time.\\n if (to != address(0) && numCheckpoints(to) == 0 && delegates(to) == address(0)) {\\n _delegate(to, to);\\n }\\n }\\n\\n /// @inheritdoc ERC20VotesUpgradeable\\n function _mint(\\n address to,\\n uint256 amount\\n ) internal override(ERC20VotesUpgradeable, ERC20Upgradeable) {\\n super._mint(to, amount);\\n }\\n\\n /// @inheritdoc ERC20VotesUpgradeable\\n function _burn(\\n address account,\\n uint256 amount\\n ) internal override(ERC20VotesUpgradeable, ERC20Upgradeable) {\\n super._burn(account, amount);\\n }\\n}\\n\",\"keccak256\":\"0xcb29f2737339e31aa9991a98e108c590df5eba6ed4edb88b1578595525abaf9b\",\"license\":\"AGPL-3.0-or-later\"},\"@aragon/osx/token/ERC20/governance/IGovernanceWrappedERC20.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-or-later\\n\\npragma solidity 0.8.17;\\n\\nimport {IERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\nimport {ERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol\\\";\\nimport {ERC20WrapperUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20WrapperUpgradeable.sol\\\";\\n\\ninterface IGovernanceWrappedERC20 {\\n /// @notice Deposits an amount of underlying token and mints the corresponding number of wrapped tokens for a receiving address.\\n /// @param account The address receiving the minted, wrapped tokens.\\n /// @param amount The amount of tokens to deposit.\\n function depositFor(address account, uint256 amount) external returns (bool);\\n\\n /// @notice Withdraws an amount of underlying tokens to a receiving address and burns the corresponding number of wrapped tokens.\\n /// @param account The address receiving the withdrawn, underlying tokens.\\n /// @param amount The amount of underlying tokens to withdraw.\\n function withdrawTo(address account, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x379383d14bc3f74effb585110ad2f13570374d6bd4e4e298fb6bb5213f37bba7\",\"license\":\"AGPL-3.0-or-later\"},\"@aragon/osx/utils/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-or-later\\n\\npragma solidity ^0.8.8;\\n\\nimport \\\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\\\";\\n\\n/// @notice Free function to create a [ERC-1967](https://eips.ethereum.org/EIPS/eip-1967) proxy contract based on the passed base contract address.\\n/// @param _logic The base contract address.\\n/// @param _data The constructor arguments for this contract.\\n/// @return The address of the proxy contract created.\\n/// @dev Initializes the upgradeable proxy with an initial implementation specified by _logic. If _data is non-empty, it\\u2019s used as data in a delegate call to _logic. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor (see [OpenZeppelin ERC1967Proxy-constructor](https://docs.openzeppelin.com/contracts/4.x/api/proxy#ERC1967Proxy-constructor-address-bytes-)).\\nfunction createERC1967Proxy(address _logic, bytes memory _data) returns (address) {\\n return address(new ERC1967Proxy(_logic, _data));\\n}\\n\",\"keccak256\":\"0x9d871292dfac2f42957e4d10eec56fd74dda0bd7803c01e849d2e9f5e2799fff\",\"license\":\"AGPL-3.0-or-later\"},\"@aragon/osx/utils/UncheckedMath.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-or-later\\n\\npragma solidity ^0.8.8;\\n\\n/// @notice Increments an unsigned integer by one without checking the result for overflow errors (using safe math).\\n/// @param i The number to be incremented.\\n/// @return The number incremented by one.\\nfunction _uncheckedIncrement(uint256 i) pure returns (uint256) {\\n unchecked {\\n ++i;\\n }\\n return i;\\n}\\n\\n/// @notice Adds two unsigned integers without checking the result for overflow errors (using safe math).\\n/// @param a The first summand.\\n/// @param b The second summand.\\n/// @return The sum.\\nfunction _uncheckedAdd(uint256 a, uint256 b) pure returns (uint256) {\\n unchecked {\\n return a + b;\\n }\\n}\\n\\n/// @notice Subtracts two unsigned integers without checking the result for overflow errors (using safe math).\\n/// @param a The minuend.\\n/// @param b The subtrahend.\\n/// @return The difference.\\nfunction _uncheckedSub(uint256 a, uint256 b) pure returns (uint256) {\\n unchecked {\\n return a - b;\\n }\\n}\\n\",\"keccak256\":\"0x69f00ee97ef1bd5ae895602a02650a56a97eddd716e63a729f446f9bffdebf85\",\"license\":\"AGPL-3.0-or-later\"},\"@aragon/osx/utils/protocol/IProtocolVersion.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-or-later\\n\\npragma solidity ^0.8.8;\\n\\n/// @title IProtocolVersion\\n/// @author Aragon Association - 2022-2023\\n/// @notice An interface defining the semantic OSx protocol version.\\ninterface IProtocolVersion {\\n /// @notice Returns the protocol version at which the current contract was built. Use it to check for future upgrades that might be applicable.\\n /// @return _version Returns the semantic OSx protocol version.\\n function protocolVersion() external view returns (uint8[3] memory _version);\\n}\\n\",\"keccak256\":\"0xd356df9b42e6ed5be9cae21d31d0d3c62460831ed28d9c342d85f3c18eb0437d\",\"license\":\"AGPL-3.0-or-later\"},\"@aragon/osx/utils/protocol/ProtocolVersion.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-or-later\\n\\npragma solidity 0.8.17;\\n\\nimport {IProtocolVersion} from \\\"./IProtocolVersion.sol\\\";\\n\\n/// @title ProtocolVersion\\n/// @author Aragon Association - 2023\\n/// @notice An abstract, stateless, non-upgradeable contract serves as a base for other contracts requiring awareness of the OSx protocol version.\\n/// @dev Do not add any new variables to this contract that would shift down storage in the inheritance chain.\\nabstract contract ProtocolVersion is IProtocolVersion {\\n // IMPORTANT: Do not add any storage variable, see the above notice.\\n\\n /// @inheritdoc IProtocolVersion\\n function protocolVersion() public pure returns (uint8[3] memory) {\\n return [1, 3, 0];\\n }\\n}\\n\",\"keccak256\":\"0x08399a097c107c0ab6f8733e40af26318498117d3a20e815e973602842b36671\",\"license\":\"AGPL-3.0-or-later\"},\"@openzeppelin/contracts-upgradeable/governance/utils/IVotesUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 a specific moment in the past. If the `clock()` is\\n * configured to use block numbers, this will return the value at the end of the corresponding block.\\n */\\n function getPastVotes(address account, uint256 timepoint) external view returns (uint256);\\n\\n /**\\n * @dev Returns the total supply of votes available at a specific moment in the past. If the `clock()` is\\n * configured to use block numbers, this will return the value at the end of the corresponding block.\\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 timepoint) 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(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) external;\\n}\\n\",\"keccak256\":\"0x2d600bbef9320309cd2a86c1d087eb9d6dbcc00430713ee54bbc5c5a2a11ba31\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/interfaces/IERC1967Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\\n *\\n * _Available since v4.8.3._\\n */\\ninterface IERC1967Upgradeable {\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Emitted when the beacon is changed.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n}\\n\",\"keccak256\":\"0x47d6e06872b12e72c79d1b5eb55842f860b5fb1207b2317c2358d2766b950a7b\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/interfaces/IERC5267Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)\\n\\npragma solidity ^0.8.0;\\n\\ninterface IERC5267Upgradeable {\\n /**\\n * @dev MAY be emitted to signal that the domain could have changed.\\n */\\n event EIP712DomainChanged();\\n\\n /**\\n * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712\\n * signature.\\n */\\n function eip712Domain()\\n external\\n view\\n returns (\\n bytes1 fields,\\n string memory name,\\n string memory version,\\n uint256 chainId,\\n address verifyingContract,\\n bytes32 salt,\\n uint256[] memory extensions\\n );\\n}\\n\",\"keccak256\":\"0xe562dab443278837fa50faddb76743399e942181881db8dccaea3bd1712994db\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/interfaces/IERC5805Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5805.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../governance/utils/IVotesUpgradeable.sol\\\";\\nimport \\\"./IERC6372Upgradeable.sol\\\";\\n\\ninterface IERC5805Upgradeable is IERC6372Upgradeable, IVotesUpgradeable {}\\n\",\"keccak256\":\"0x19848eec9045c8b91f1ab6b1853966443e3e36bcbc307593ed37a9f0df179d69\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/interfaces/IERC6372Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC6372.sol)\\n\\npragma solidity ^0.8.0;\\n\\ninterface IERC6372Upgradeable {\\n /**\\n * @dev Clock used for flagging checkpoints. Can be overridden to implement timestamp based checkpoints (and voting).\\n */\\n function clock() external view returns (uint48);\\n\\n /**\\n * @dev Description of the clock\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function CLOCK_MODE() external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x3026befd6d69d1b46960bdc35a2ad37c0e1352f26983ee3728dd61fd32aa308a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822ProxiableUpgradeable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x77c89f893e403efc6929ba842b7ccf6534d4ffe03afe31670b4a528c0ad78c0f\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeaconUpgradeable.sol\\\";\\nimport \\\"../../interfaces/IERC1967Upgradeable.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822Upgradeable.sol\\\";\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\nimport \\\"../../utils/StorageSlotUpgradeable.sol\\\";\\nimport \\\"../utils/Initializable.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n */\\nabstract contract ERC1967UpgradeUpgradeable is Initializable, IERC1967Upgradeable {\\n function __ERC1967Upgrade_init() internal onlyInitializing {\\n }\\n\\n function __ERC1967Upgrade_init_unchained() internal onlyInitializing {\\n }\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(AddressUpgradeable.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n AddressUpgradeable.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(AddressUpgradeable.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n AddressUpgradeable.functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);\\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[50] private __gap;\\n}\\n\",\"keccak256\":\"0x584ebdf9c1118a7c773f98788e3f3ede01982bdf8932aa06f5acc7d54876e161\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeaconUpgradeable {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0x24b86ac8c005b8c654fbf6ac34a5a4f61580d7273541e83e013e89d66fbf0908\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.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 * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n *\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!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 * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized != type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x89be10e757d242e9b18d5a32c9fbe2019f6d63052bbe46397a430a1d60d7f794\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/UUPSUpgradeable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../interfaces/draft-IERC1822Upgradeable.sol\\\";\\nimport \\\"../ERC1967/ERC1967UpgradeUpgradeable.sol\\\";\\nimport \\\"./Initializable.sol\\\";\\n\\n/**\\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\\n *\\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\\n * `UUPSUpgradeable` with a custom implementation of upgrades.\\n *\\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\\n *\\n * _Available since v4.1._\\n */\\nabstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {\\n function __UUPSUpgradeable_init() internal onlyInitializing {\\n }\\n\\n function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\\n }\\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\\n address private immutable __self = address(this);\\n\\n /**\\n * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\\n * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\\n * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\\n * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\\n * fail.\\n */\\n modifier onlyProxy() {\\n require(address(this) != __self, \\\"Function must be called through delegatecall\\\");\\n require(_getImplementation() == __self, \\\"Function must be called through active proxy\\\");\\n _;\\n }\\n\\n /**\\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\\n * callable on the implementing contract but not through proxies.\\n */\\n modifier notDelegated() {\\n require(address(this) == __self, \\\"UUPSUpgradeable: must not be called through delegatecall\\\");\\n _;\\n }\\n\\n /**\\n * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\\n */\\n function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\\n return _IMPLEMENTATION_SLOT;\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy to `newImplementation`.\\n *\\n * Calls {_authorizeUpgrade}.\\n *\\n * Emits an {Upgraded} event.\\n *\\n * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\\n */\\n function upgradeTo(address newImplementation) public virtual onlyProxy {\\n _authorizeUpgrade(newImplementation);\\n _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\\n * encoded in `data`.\\n *\\n * Calls {_authorizeUpgrade}.\\n *\\n * Emits an {Upgraded} event.\\n *\\n * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\\n */\\n function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {\\n _authorizeUpgrade(newImplementation);\\n _upgradeToAndCallUUPS(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\\n * {upgradeTo} and {upgradeToAndCall}.\\n *\\n * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\\n *\\n * ```solidity\\n * function _authorizeUpgrade(address) internal override onlyOwner {}\\n * ```\\n */\\n function _authorizeUpgrade(address newImplementation) 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[50] private __gap;\\n}\\n\",\"keccak256\":\"0xb607cb94c27e89750f5ae2ccebcb94e654e926f6125f4fd4c6262c89875118ad\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155ReceiverUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\n\\n/**\\n * @dev _Available since v3.1._\\n */\\ninterface IERC1155ReceiverUpgradeable is IERC165Upgradeable {\\n /**\\n * @dev Handles the receipt of a single ERC1155 token type. This function is\\n * called at the end of a `safeTransferFrom` after the balance has been updated.\\n *\\n * NOTE: To accept the transfer, this must return\\n * `bytes4(keccak256(\\\"onERC1155Received(address,address,uint256,uint256,bytes)\\\"))`\\n * (i.e. 0xf23a6e61, or its own function selector).\\n *\\n * @param operator The address which initiated the transfer (i.e. msg.sender)\\n * @param from The address which previously owned the token\\n * @param id The ID of the token being transferred\\n * @param value The amount of tokens being transferred\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC1155Received(address,address,uint256,uint256,bytes)\\\"))` if transfer is allowed\\n */\\n function onERC1155Received(\\n address operator,\\n address from,\\n uint256 id,\\n uint256 value,\\n bytes calldata data\\n ) external returns (bytes4);\\n\\n /**\\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\\n * is called at the end of a `safeBatchTransferFrom` after the balances have\\n * been updated.\\n *\\n * NOTE: To accept the transfer(s), this must return\\n * `bytes4(keccak256(\\\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\\\"))`\\n * (i.e. 0xbc197c81, or its own function selector).\\n *\\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\\n * @param from The address which previously owned the token\\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\\\"))` if transfer is allowed\\n */\\n function onERC1155BatchReceived(\\n address operator,\\n address from,\\n uint256[] calldata ids,\\n uint256[] calldata values,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xffcb29612efb57efc8f0d4897deb5abaeac830022c59a3aa17446d698dbc856b\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155Upgradeable is IERC165Upgradeable {\\n /**\\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] calldata accounts,\\n uint256[] calldata ids\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xf51f292659a77777c0ed7375a39683d8bee53b86a6e7bd0c76f34ce7aa37a3a8\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\\n * to implement supply mechanisms].\\n *\\n * The default value of {decimals} is 18. To change this, you should override\\n * this function so it returns a different value.\\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 * 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 default value returned by this function, unless\\n * it's 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(address from, address to, uint256 amount) 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(address from, address to, uint256 amount) 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 // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\\n // decrementing then incrementing.\\n _balances[to] += amount;\\n }\\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 unchecked {\\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\\n _balances[account] += amount;\\n }\\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 // Overflow not possible: amount <= accountBalance <= totalSupply.\\n _totalSupply -= amount;\\n }\\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(address owner, address spender, uint256 amount) 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(address owner, address spender, uint256 amount) 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(address from, address to, uint256 amount) 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(address from, address to, uint256 amount) 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\",\"keccak256\":\"0xd14a627157b9a411d2410713e5dd3a377e9064bd5c194a90748bbf27ea625784\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x0e1f0f5f62f67a881cd1a9597acbc0a5e4071f3c2c10449a183b922ae7272e3f\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PermitUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/ERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC20PermitUpgradeable.sol\\\";\\nimport \\\"../ERC20Upgradeable.sol\\\";\\nimport \\\"../../../utils/cryptography/ECDSAUpgradeable.sol\\\";\\nimport \\\"../../../utils/cryptography/EIP712Upgradeable.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\",\"keccak256\":\"0x3988ac03e4819acd4b5adf41de7d43c1471748ddc2d73d2c7aca1e3827402e5d\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20VotesUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/ERC20Votes.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./ERC20PermitUpgradeable.sol\\\";\\nimport \\\"../../../interfaces/IERC5805Upgradeable.sol\\\";\\nimport \\\"../../../utils/math/MathUpgradeable.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, ERC20PermitUpgradeable, IERC5805Upgradeable {\\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 Clock used for flagging checkpoints. Can be overridden to implement timestamp based checkpoints (and voting).\\n */\\n function clock() public view virtual override returns (uint48) {\\n return SafeCastUpgradeable.toUint48(block.number);\\n }\\n\\n /**\\n * @dev Description of the clock\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function CLOCK_MODE() public view virtual override returns (string memory) {\\n // Check that the clock was not modified\\n require(clock() == block.number, \\\"ERC20Votes: broken clock mode\\\");\\n return \\\"mode=blocknumber&from=default\\\";\\n }\\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 unchecked {\\n return pos == 0 ? 0 : _checkpoints[account][pos - 1].votes;\\n }\\n }\\n\\n /**\\n * @dev Retrieve the number of votes for `account` at the end of `timepoint`.\\n *\\n * Requirements:\\n *\\n * - `timepoint` must be in the past\\n */\\n function getPastVotes(address account, uint256 timepoint) public view virtual override returns (uint256) {\\n require(timepoint < clock(), \\\"ERC20Votes: future lookup\\\");\\n return _checkpointsLookup(_checkpoints[account], timepoint);\\n }\\n\\n /**\\n * @dev Retrieve the `totalSupply` at the end of `timepoint`. Note, this value is the sum of all balances.\\n * It is NOT the sum of all the delegated votes!\\n *\\n * Requirements:\\n *\\n * - `timepoint` must be in the past\\n */\\n function getPastTotalSupply(uint256 timepoint) public view virtual override returns (uint256) {\\n require(timepoint < clock(), \\\"ERC20Votes: future lookup\\\");\\n return _checkpointsLookup(_totalSupplyCheckpoints, timepoint);\\n }\\n\\n /**\\n * @dev Lookup a value in a list of (sorted) checkpoints.\\n */\\n function _checkpointsLookup(Checkpoint[] storage ckpts, uint256 timepoint) private view returns (uint256) {\\n // We run a binary search to look for the last (most recent) checkpoint taken before (or at) `timepoint`.\\n //\\n // Initially we check if the block is recent to narrow the search range.\\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 `timepoint`, we look in [low, mid)\\n // - If the middle checkpoint is before or equal to `timepoint`, 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 `timepoint`, we end up with an index that is\\n // past the end of the array, so we technically don't find a checkpoint after `timepoint`, but it works out\\n // the same.\\n uint256 length = ckpts.length;\\n\\n uint256 low = 0;\\n uint256 high = length;\\n\\n if (length > 5) {\\n uint256 mid = length - MathUpgradeable.sqrt(length);\\n if (_unsafeAccess(ckpts, mid).fromBlock > timepoint) {\\n high = mid;\\n } else {\\n low = mid + 1;\\n }\\n }\\n\\n while (low < high) {\\n uint256 mid = MathUpgradeable.average(low, high);\\n if (_unsafeAccess(ckpts, mid).fromBlock > timepoint) {\\n high = mid;\\n } else {\\n low = mid + 1;\\n }\\n }\\n\\n unchecked {\\n return high == 0 ? 0 : _unsafeAccess(ckpts, high - 1).votes;\\n }\\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 {IVotes-DelegateVotesChanged} event.\\n */\\n function _afterTokenTransfer(address from, address to, uint256 amount) 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 {IVotes-DelegateChanged} and {IVotes-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(address src, address dst, uint256 amount) 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\\n unchecked {\\n Checkpoint memory oldCkpt = pos == 0 ? Checkpoint(0, 0) : _unsafeAccess(ckpts, pos - 1);\\n\\n oldWeight = oldCkpt.votes;\\n newWeight = op(oldWeight, delta);\\n\\n if (pos > 0 && oldCkpt.fromBlock == clock()) {\\n _unsafeAccess(ckpts, pos - 1).votes = SafeCastUpgradeable.toUint224(newWeight);\\n } else {\\n ckpts.push(Checkpoint({fromBlock: SafeCastUpgradeable.toUint32(clock()), votes: SafeCastUpgradeable.toUint224(newWeight)}));\\n }\\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 Access an element of the array without performing bounds check. The position is assumed to be within bounds.\\n */\\n function _unsafeAccess(Checkpoint[] storage ckpts, uint256 pos) private pure returns (Checkpoint storage result) {\\n assembly {\\n mstore(0, ckpts.slot)\\n result.slot := add(keccak256(0, 0x20), pos)\\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[47] private __gap;\\n}\\n\",\"keccak256\":\"0x435286e01fcfb0bed104e44b9bf9d8abfe9f7b0a8f576e5bbef5eb91fe55e1d4\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20WrapperUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 private _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 require(underlyingToken != this, \\\"ERC20Wrapper: cannot self wrap\\\");\\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 Returns the address of the underlying ERC-20 token that is being wrapped.\\n */\\n function underlying() public view returns (IERC20Upgradeable) {\\n return _underlying;\\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 address sender = _msgSender();\\n require(sender != address(this), \\\"ERC20Wrapper: wrapper can't deposit\\\");\\n SafeERC20Upgradeable.safeTransferFrom(_underlying, sender, 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\",\"keccak256\":\"0x14bb62a60fcbc911c33ac0e5456bf31ed50b502c30be46ee15bd3b698e91bd81\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0x605434219ebbe4653f703640f06969faa5a1d78f0bfef878e5ddbb1ca369ceeb\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/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\",\"keccak256\":\"0xd60f939a3ca0199014d079b4dd66aa757954334947d81eb5c1d35d7a83061ab3\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/draft-IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n// EIP-2612 is Final as of 2022-11-01. This file is deprecated.\\n\\nimport \\\"./IERC20PermitUpgradeable.sol\\\";\\n\",\"keccak256\":\"0x5225f0310a2992589600ebddffd0dd512a61836bda672b46744b416765d7ac31\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20Upgradeable.sol\\\";\\nimport \\\"../extensions/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 /**\\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n /**\\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\\n */\\n function safeTransferFrom(IERC20Upgradeable token, address from, address to, uint256 value) 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(IERC20Upgradeable token, address spender, uint256 value) 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 /**\\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\\n }\\n\\n /**\\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\\n }\\n }\\n\\n /**\\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to\\n * 0 before setting it to a non-zero value.\\n */\\n function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\\n\\n if (!_callOptionalReturnBool(token, approvalCall)) {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\\n _callOptionalReturn(token, approvalCall);\\n }\\n }\\n\\n /**\\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\\n * Revert on invalid signature.\\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 require(returndata.length == 0 || abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation 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 * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\\n */\\n function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\\n // and not revert is the subcall reverts.\\n\\n (bool success, bytes memory returndata) = address(token).call(data);\\n return\\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token));\\n }\\n}\\n\",\"keccak256\":\"0x4dae161227d332808312ee2caf6384929321b83c16cc89b5642985fbec6b814c\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.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 IERC721ReceiverUpgradeable {\\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\",\"keccak256\":\"0xbb2ed8106d94aeae6858e2551a1e7174df73994b77b13ebd120ccaaef80155f5\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9c80f545915582e63fe206c6ce27cbe85a86fc10b9cd2a0e8c9488fb7c2ee422\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/CheckpointsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Checkpoints.sol)\\n// This file was procedurally generated from scripts/generate/templates/Checkpoints.js.\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/MathUpgradeable.sol\\\";\\nimport \\\"./math/SafeCastUpgradeable.sol\\\";\\n\\n/**\\n * @dev This library defines the `History` struct, for checkpointing values as they change at different points in\\n * time, and later looking up past values by block number. See {Votes} as an example.\\n *\\n * To create a history of checkpoints define a variable type `Checkpoints.History` in your contract, and store a new\\n * checkpoint for the current transaction block using the {push} function.\\n *\\n * _Available since v4.5._\\n */\\nlibrary CheckpointsUpgradeable {\\n struct History {\\n Checkpoint[] _checkpoints;\\n }\\n\\n struct Checkpoint {\\n uint32 _blockNumber;\\n uint224 _value;\\n }\\n\\n /**\\n * @dev Returns the value at a given block number. If a checkpoint is not available at that block, the closest one\\n * before it is returned, or zero otherwise. Because the number returned corresponds to that at the end of the\\n * block, the requested block number must be in the past, excluding the current block.\\n */\\n function getAtBlock(History storage self, uint256 blockNumber) internal view returns (uint256) {\\n require(blockNumber < block.number, \\\"Checkpoints: block not yet mined\\\");\\n uint32 key = SafeCastUpgradeable.toUint32(blockNumber);\\n\\n uint256 len = self._checkpoints.length;\\n uint256 pos = _upperBinaryLookup(self._checkpoints, key, 0, len);\\n return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;\\n }\\n\\n /**\\n * @dev Returns the value at a given block number. If a checkpoint is not available at that block, the closest one\\n * before it is returned, or zero otherwise. Similar to {upperLookup} but optimized for the case when the searched\\n * checkpoint is probably \\\"recent\\\", defined as being among the last sqrt(N) checkpoints where N is the number of\\n * checkpoints.\\n */\\n function getAtProbablyRecentBlock(History storage self, uint256 blockNumber) internal view returns (uint256) {\\n require(blockNumber < block.number, \\\"Checkpoints: block not yet mined\\\");\\n uint32 key = SafeCastUpgradeable.toUint32(blockNumber);\\n\\n uint256 len = self._checkpoints.length;\\n\\n uint256 low = 0;\\n uint256 high = len;\\n\\n if (len > 5) {\\n uint256 mid = len - MathUpgradeable.sqrt(len);\\n if (key < _unsafeAccess(self._checkpoints, mid)._blockNumber) {\\n high = mid;\\n } else {\\n low = mid + 1;\\n }\\n }\\n\\n uint256 pos = _upperBinaryLookup(self._checkpoints, key, low, high);\\n\\n return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;\\n }\\n\\n /**\\n * @dev Pushes a value onto a History so that it is stored as the checkpoint for the current block.\\n *\\n * Returns previous value and new value.\\n */\\n function push(History storage self, uint256 value) internal returns (uint256, uint256) {\\n return _insert(self._checkpoints, SafeCastUpgradeable.toUint32(block.number), SafeCastUpgradeable.toUint224(value));\\n }\\n\\n /**\\n * @dev Pushes a value onto a History, by updating the latest value using binary operation `op`. The new value will\\n * be set to `op(latest, delta)`.\\n *\\n * Returns previous value and new value.\\n */\\n function push(\\n History storage self,\\n function(uint256, uint256) view returns (uint256) op,\\n uint256 delta\\n ) internal returns (uint256, uint256) {\\n return push(self, op(latest(self), delta));\\n }\\n\\n /**\\n * @dev Returns the value in the most recent checkpoint, or zero if there are no checkpoints.\\n */\\n function latest(History storage self) internal view returns (uint224) {\\n uint256 pos = self._checkpoints.length;\\n return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;\\n }\\n\\n /**\\n * @dev Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value\\n * in the most recent checkpoint.\\n */\\n function latestCheckpoint(\\n History storage self\\n ) internal view returns (bool exists, uint32 _blockNumber, uint224 _value) {\\n uint256 pos = self._checkpoints.length;\\n if (pos == 0) {\\n return (false, 0, 0);\\n } else {\\n Checkpoint memory ckpt = _unsafeAccess(self._checkpoints, pos - 1);\\n return (true, ckpt._blockNumber, ckpt._value);\\n }\\n }\\n\\n /**\\n * @dev Returns the number of checkpoint.\\n */\\n function length(History storage self) internal view returns (uint256) {\\n return self._checkpoints.length;\\n }\\n\\n /**\\n * @dev Pushes a (`key`, `value`) pair into an ordered list of checkpoints, either by inserting a new checkpoint,\\n * or by updating the last one.\\n */\\n function _insert(Checkpoint[] storage self, uint32 key, uint224 value) private returns (uint224, uint224) {\\n uint256 pos = self.length;\\n\\n if (pos > 0) {\\n // Copying to memory is important here.\\n Checkpoint memory last = _unsafeAccess(self, pos - 1);\\n\\n // Checkpoint keys must be non-decreasing.\\n require(last._blockNumber <= key, \\\"Checkpoint: decreasing keys\\\");\\n\\n // Update or push new checkpoint\\n if (last._blockNumber == key) {\\n _unsafeAccess(self, pos - 1)._value = value;\\n } else {\\n self.push(Checkpoint({_blockNumber: key, _value: value}));\\n }\\n return (last._value, value);\\n } else {\\n self.push(Checkpoint({_blockNumber: key, _value: value}));\\n return (0, value);\\n }\\n }\\n\\n /**\\n * @dev Return the index of the last (most recent) checkpoint with key lower or equal than the search key, or `high` if there is none.\\n * `low` and `high` define a section where to do the search, with inclusive `low` and exclusive `high`.\\n *\\n * WARNING: `high` should not be greater than the array's length.\\n */\\n function _upperBinaryLookup(\\n Checkpoint[] storage self,\\n uint32 key,\\n uint256 low,\\n uint256 high\\n ) private view returns (uint256) {\\n while (low < high) {\\n uint256 mid = MathUpgradeable.average(low, high);\\n if (_unsafeAccess(self, mid)._blockNumber > key) {\\n high = mid;\\n } else {\\n low = mid + 1;\\n }\\n }\\n return high;\\n }\\n\\n /**\\n * @dev Return the index of the first (oldest) checkpoint with key is greater or equal than the search key, or `high` if there is none.\\n * `low` and `high` define a section where to do the search, with inclusive `low` and exclusive `high`.\\n *\\n * WARNING: `high` should not be greater than the array's length.\\n */\\n function _lowerBinaryLookup(\\n Checkpoint[] storage self,\\n uint32 key,\\n uint256 low,\\n uint256 high\\n ) private view returns (uint256) {\\n while (low < high) {\\n uint256 mid = MathUpgradeable.average(low, high);\\n if (_unsafeAccess(self, mid)._blockNumber < key) {\\n low = mid + 1;\\n } else {\\n high = mid;\\n }\\n }\\n return high;\\n }\\n\\n /**\\n * @dev Access an element of the array without performing bounds check. The position is assumed to be within bounds.\\n */\\n function _unsafeAccess(Checkpoint[] storage self, uint256 pos) private pure returns (Checkpoint storage result) {\\n assembly {\\n mstore(0, self.slot)\\n result.slot := add(keccak256(0, 0x20), pos)\\n }\\n }\\n\\n struct Trace224 {\\n Checkpoint224[] _checkpoints;\\n }\\n\\n struct Checkpoint224 {\\n uint32 _key;\\n uint224 _value;\\n }\\n\\n /**\\n * @dev Pushes a (`key`, `value`) pair into a Trace224 so that it is stored as the checkpoint.\\n *\\n * Returns previous value and new value.\\n */\\n function push(Trace224 storage self, uint32 key, uint224 value) internal returns (uint224, uint224) {\\n return _insert(self._checkpoints, key, value);\\n }\\n\\n /**\\n * @dev Returns the value in the first (oldest) checkpoint with key greater or equal than the search key, or zero if there is none.\\n */\\n function lowerLookup(Trace224 storage self, uint32 key) internal view returns (uint224) {\\n uint256 len = self._checkpoints.length;\\n uint256 pos = _lowerBinaryLookup(self._checkpoints, key, 0, len);\\n return pos == len ? 0 : _unsafeAccess(self._checkpoints, pos)._value;\\n }\\n\\n /**\\n * @dev Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero if there is none.\\n */\\n function upperLookup(Trace224 storage self, uint32 key) internal view returns (uint224) {\\n uint256 len = self._checkpoints.length;\\n uint256 pos = _upperBinaryLookup(self._checkpoints, key, 0, len);\\n return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;\\n }\\n\\n /**\\n * @dev Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero if there is none.\\n *\\n * NOTE: This is a variant of {upperLookup} that is optimised to find \\\"recent\\\" checkpoint (checkpoints with high keys).\\n */\\n function upperLookupRecent(Trace224 storage self, uint32 key) internal view returns (uint224) {\\n uint256 len = self._checkpoints.length;\\n\\n uint256 low = 0;\\n uint256 high = len;\\n\\n if (len > 5) {\\n uint256 mid = len - MathUpgradeable.sqrt(len);\\n if (key < _unsafeAccess(self._checkpoints, mid)._key) {\\n high = mid;\\n } else {\\n low = mid + 1;\\n }\\n }\\n\\n uint256 pos = _upperBinaryLookup(self._checkpoints, key, low, high);\\n\\n return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;\\n }\\n\\n /**\\n * @dev Returns the value in the most recent checkpoint, or zero if there are no checkpoints.\\n */\\n function latest(Trace224 storage self) internal view returns (uint224) {\\n uint256 pos = self._checkpoints.length;\\n return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;\\n }\\n\\n /**\\n * @dev Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value\\n * in the most recent checkpoint.\\n */\\n function latestCheckpoint(Trace224 storage self) internal view returns (bool exists, uint32 _key, uint224 _value) {\\n uint256 pos = self._checkpoints.length;\\n if (pos == 0) {\\n return (false, 0, 0);\\n } else {\\n Checkpoint224 memory ckpt = _unsafeAccess(self._checkpoints, pos - 1);\\n return (true, ckpt._key, ckpt._value);\\n }\\n }\\n\\n /**\\n * @dev Returns the number of checkpoint.\\n */\\n function length(Trace224 storage self) internal view returns (uint256) {\\n return self._checkpoints.length;\\n }\\n\\n /**\\n * @dev Pushes a (`key`, `value`) pair into an ordered list of checkpoints, either by inserting a new checkpoint,\\n * or by updating the last one.\\n */\\n function _insert(Checkpoint224[] storage self, uint32 key, uint224 value) private returns (uint224, uint224) {\\n uint256 pos = self.length;\\n\\n if (pos > 0) {\\n // Copying to memory is important here.\\n Checkpoint224 memory last = _unsafeAccess(self, pos - 1);\\n\\n // Checkpoint keys must be non-decreasing.\\n require(last._key <= key, \\\"Checkpoint: decreasing keys\\\");\\n\\n // Update or push new checkpoint\\n if (last._key == key) {\\n _unsafeAccess(self, pos - 1)._value = value;\\n } else {\\n self.push(Checkpoint224({_key: key, _value: value}));\\n }\\n return (last._value, value);\\n } else {\\n self.push(Checkpoint224({_key: key, _value: value}));\\n return (0, value);\\n }\\n }\\n\\n /**\\n * @dev Return the index of the last (most recent) checkpoint with key lower or equal than the search key, or `high` if there is none.\\n * `low` and `high` define a section where to do the search, with inclusive `low` and exclusive `high`.\\n *\\n * WARNING: `high` should not be greater than the array's length.\\n */\\n function _upperBinaryLookup(\\n Checkpoint224[] storage self,\\n uint32 key,\\n uint256 low,\\n uint256 high\\n ) private view returns (uint256) {\\n while (low < high) {\\n uint256 mid = MathUpgradeable.average(low, high);\\n if (_unsafeAccess(self, mid)._key > key) {\\n high = mid;\\n } else {\\n low = mid + 1;\\n }\\n }\\n return high;\\n }\\n\\n /**\\n * @dev Return the index of the first (oldest) checkpoint with key is greater or equal than the search key, or `high` if there is none.\\n * `low` and `high` define a section where to do the search, with inclusive `low` and exclusive `high`.\\n *\\n * WARNING: `high` should not be greater than the array's length.\\n */\\n function _lowerBinaryLookup(\\n Checkpoint224[] storage self,\\n uint32 key,\\n uint256 low,\\n uint256 high\\n ) private view returns (uint256) {\\n while (low < high) {\\n uint256 mid = MathUpgradeable.average(low, high);\\n if (_unsafeAccess(self, mid)._key < key) {\\n low = mid + 1;\\n } else {\\n high = mid;\\n }\\n }\\n return high;\\n }\\n\\n /**\\n * @dev Access an element of the array without performing bounds check. The position is assumed to be within bounds.\\n */\\n function _unsafeAccess(\\n Checkpoint224[] storage self,\\n uint256 pos\\n ) private pure returns (Checkpoint224 storage result) {\\n assembly {\\n mstore(0, self.slot)\\n result.slot := add(keccak256(0, 0x20), pos)\\n }\\n }\\n\\n struct Trace160 {\\n Checkpoint160[] _checkpoints;\\n }\\n\\n struct Checkpoint160 {\\n uint96 _key;\\n uint160 _value;\\n }\\n\\n /**\\n * @dev Pushes a (`key`, `value`) pair into a Trace160 so that it is stored as the checkpoint.\\n *\\n * Returns previous value and new value.\\n */\\n function push(Trace160 storage self, uint96 key, uint160 value) internal returns (uint160, uint160) {\\n return _insert(self._checkpoints, key, value);\\n }\\n\\n /**\\n * @dev Returns the value in the first (oldest) checkpoint with key greater or equal than the search key, or zero if there is none.\\n */\\n function lowerLookup(Trace160 storage self, uint96 key) internal view returns (uint160) {\\n uint256 len = self._checkpoints.length;\\n uint256 pos = _lowerBinaryLookup(self._checkpoints, key, 0, len);\\n return pos == len ? 0 : _unsafeAccess(self._checkpoints, pos)._value;\\n }\\n\\n /**\\n * @dev Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero if there is none.\\n */\\n function upperLookup(Trace160 storage self, uint96 key) internal view returns (uint160) {\\n uint256 len = self._checkpoints.length;\\n uint256 pos = _upperBinaryLookup(self._checkpoints, key, 0, len);\\n return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;\\n }\\n\\n /**\\n * @dev Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero if there is none.\\n *\\n * NOTE: This is a variant of {upperLookup} that is optimised to find \\\"recent\\\" checkpoint (checkpoints with high keys).\\n */\\n function upperLookupRecent(Trace160 storage self, uint96 key) internal view returns (uint160) {\\n uint256 len = self._checkpoints.length;\\n\\n uint256 low = 0;\\n uint256 high = len;\\n\\n if (len > 5) {\\n uint256 mid = len - MathUpgradeable.sqrt(len);\\n if (key < _unsafeAccess(self._checkpoints, mid)._key) {\\n high = mid;\\n } else {\\n low = mid + 1;\\n }\\n }\\n\\n uint256 pos = _upperBinaryLookup(self._checkpoints, key, low, high);\\n\\n return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;\\n }\\n\\n /**\\n * @dev Returns the value in the most recent checkpoint, or zero if there are no checkpoints.\\n */\\n function latest(Trace160 storage self) internal view returns (uint160) {\\n uint256 pos = self._checkpoints.length;\\n return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;\\n }\\n\\n /**\\n * @dev Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value\\n * in the most recent checkpoint.\\n */\\n function latestCheckpoint(Trace160 storage self) internal view returns (bool exists, uint96 _key, uint160 _value) {\\n uint256 pos = self._checkpoints.length;\\n if (pos == 0) {\\n return (false, 0, 0);\\n } else {\\n Checkpoint160 memory ckpt = _unsafeAccess(self._checkpoints, pos - 1);\\n return (true, ckpt._key, ckpt._value);\\n }\\n }\\n\\n /**\\n * @dev Returns the number of checkpoint.\\n */\\n function length(Trace160 storage self) internal view returns (uint256) {\\n return self._checkpoints.length;\\n }\\n\\n /**\\n * @dev Pushes a (`key`, `value`) pair into an ordered list of checkpoints, either by inserting a new checkpoint,\\n * or by updating the last one.\\n */\\n function _insert(Checkpoint160[] storage self, uint96 key, uint160 value) private returns (uint160, uint160) {\\n uint256 pos = self.length;\\n\\n if (pos > 0) {\\n // Copying to memory is important here.\\n Checkpoint160 memory last = _unsafeAccess(self, pos - 1);\\n\\n // Checkpoint keys must be non-decreasing.\\n require(last._key <= key, \\\"Checkpoint: decreasing keys\\\");\\n\\n // Update or push new checkpoint\\n if (last._key == key) {\\n _unsafeAccess(self, pos - 1)._value = value;\\n } else {\\n self.push(Checkpoint160({_key: key, _value: value}));\\n }\\n return (last._value, value);\\n } else {\\n self.push(Checkpoint160({_key: key, _value: value}));\\n return (0, value);\\n }\\n }\\n\\n /**\\n * @dev Return the index of the last (most recent) checkpoint with key lower or equal than the search key, or `high` if there is none.\\n * `low` and `high` define a section where to do the search, with inclusive `low` and exclusive `high`.\\n *\\n * WARNING: `high` should not be greater than the array's length.\\n */\\n function _upperBinaryLookup(\\n Checkpoint160[] storage self,\\n uint96 key,\\n uint256 low,\\n uint256 high\\n ) private view returns (uint256) {\\n while (low < high) {\\n uint256 mid = MathUpgradeable.average(low, high);\\n if (_unsafeAccess(self, mid)._key > key) {\\n high = mid;\\n } else {\\n low = mid + 1;\\n }\\n }\\n return high;\\n }\\n\\n /**\\n * @dev Return the index of the first (oldest) checkpoint with key is greater or equal than the search key, or `high` if there is none.\\n * `low` and `high` define a section where to do the search, with inclusive `low` and exclusive `high`.\\n *\\n * WARNING: `high` should not be greater than the array's length.\\n */\\n function _lowerBinaryLookup(\\n Checkpoint160[] storage self,\\n uint96 key,\\n uint256 low,\\n uint256 high\\n ) private view returns (uint256) {\\n while (low < high) {\\n uint256 mid = MathUpgradeable.average(low, high);\\n if (_unsafeAccess(self, mid)._key < key) {\\n low = mid + 1;\\n } else {\\n high = mid;\\n }\\n }\\n return high;\\n }\\n\\n /**\\n * @dev Access an element of the array without performing bounds check. The position is assumed to be within bounds.\\n */\\n function _unsafeAccess(\\n Checkpoint160[] storage self,\\n uint256 pos\\n ) private pure returns (Checkpoint160 storage result) {\\n assembly {\\n mstore(0, self.slot)\\n result.slot := add(keccak256(0, 0x20), pos)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x51ea916844ee2c53874c6895ce37acbca0250977b49b48909d75ad439f38f211\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0x798741e231b22b81e2dd2eddaaf8832dee4baf5cd8e2dbaa5c1dd12a1c053c4d\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)\\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```solidity\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._\\n * _Available since v4.9 for `string`, `bytes`._\\n */\\nlibrary StorageSlotUpgradeable {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n struct StringSlot {\\n string value;\\n }\\n\\n struct BytesSlot {\\n bytes value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\\n */\\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\\n */\\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := store.slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\\n */\\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\\n */\\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := store.slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0x07ac95acad040f1fb1f6120dd0aa5f702db69446e95f82613721879d30de0908\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/MathUpgradeable.sol\\\";\\nimport \\\"./math/SignedMathUpgradeable.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary StringsUpgradeable {\\n bytes16 private constant _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 unchecked {\\n uint256 length = MathUpgradeable.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMathUpgradeable.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n 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] = _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 /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0xb96dc79b65b7c37937919dcdb356a969ce0aa2e8338322bf4dc027a3c9c9a7eb\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (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 // Deprecated in v4.8\\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 }\\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(bytes32 hash, bytes32 r, bytes32 vs) 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(bytes32 hash, bytes32 r, bytes32 vs) 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(bytes32 hash, uint8 v, bytes32 r, bytes32 s) 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 \\u00f7 2 + 1, and for v in (302): v \\u2208 {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\\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(bytes32 hash, uint8 v, bytes32 r, bytes32 s) 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 message) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore(0x00, \\\"\\\\x19Ethereum Signed Message:\\\\n32\\\")\\n mstore(0x1c, hash)\\n message := keccak256(0x00, 0x3c)\\n }\\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 data) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40)\\n mstore(ptr, \\\"\\\\x19\\\\x01\\\")\\n mstore(add(ptr, 0x02), domainSeparator)\\n mstore(add(ptr, 0x22), structHash)\\n data := keccak256(ptr, 0x42)\\n }\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\\n * `validator` and `data` according to the version 0 of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x00\\\", validator, data));\\n }\\n}\\n\",\"keccak256\":\"0xa014f65d84b02827055d99993ccdbfb4b56b2c9e91eb278d82a93330659d06e4\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol)\\n\\npragma solidity ^0.8.8;\\n\\nimport \\\"./ECDSAUpgradeable.sol\\\";\\nimport \\\"../../interfaces/IERC5267Upgradeable.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 * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain\\n * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the\\n * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.\\n *\\n * _Available since v3.4._\\n *\\n * @custom:storage-size 52\\n */\\nabstract contract EIP712Upgradeable is Initializable, IERC5267Upgradeable {\\n bytes32 private constant _TYPE_HASH =\\n keccak256(\\\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\\\");\\n\\n /// @custom:oz-renamed-from _HASHED_NAME\\n bytes32 private _hashedName;\\n /// @custom:oz-renamed-from _HASHED_VERSION\\n bytes32 private _hashedVersion;\\n\\n string private _name;\\n string private _version;\\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 _name = name;\\n _version = version;\\n\\n // Reset prior values in storage if upgrading\\n _hashedName = 0;\\n _hashedVersion = 0;\\n }\\n\\n /**\\n * @dev Returns the domain separator for the current chain.\\n */\\n function _domainSeparatorV4() internal view returns (bytes32) {\\n return _buildDomainSeparator();\\n }\\n\\n function _buildDomainSeparator() private view returns (bytes32) {\\n return keccak256(abi.encode(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash(), 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 See {EIP-5267}.\\n *\\n * _Available since v4.9._\\n */\\n function eip712Domain()\\n public\\n view\\n virtual\\n override\\n returns (\\n bytes1 fields,\\n string memory name,\\n string memory version,\\n uint256 chainId,\\n address verifyingContract,\\n bytes32 salt,\\n uint256[] memory extensions\\n )\\n {\\n // If the hashed name and version in storage are non-zero, the contract hasn't been properly initialized\\n // and the EIP712 domain is not reliable, as it will be missing name and version.\\n require(_hashedName == 0 && _hashedVersion == 0, \\\"EIP712: Uninitialized\\\");\\n\\n return (\\n hex\\\"0f\\\", // 01111\\n _EIP712Name(),\\n _EIP712Version(),\\n block.chainid,\\n address(this),\\n bytes32(0),\\n new uint256[](0)\\n );\\n }\\n\\n /**\\n * @dev 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 _EIP712Name() internal virtual view returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev 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 _EIP712Version() internal virtual view returns (string memory) {\\n return _version;\\n }\\n\\n /**\\n * @dev The hash of the name parameter for the EIP712 domain.\\n *\\n * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Name` instead.\\n */\\n function _EIP712NameHash() internal view returns (bytes32) {\\n string memory name = _EIP712Name();\\n if (bytes(name).length > 0) {\\n return keccak256(bytes(name));\\n } else {\\n // If the name is empty, the contract may have been upgraded without initializing the new storage.\\n // We return the name hash in storage if non-zero, otherwise we assume the name is empty by design.\\n bytes32 hashedName = _hashedName;\\n if (hashedName != 0) {\\n return hashedName;\\n } else {\\n return keccak256(\\\"\\\");\\n }\\n }\\n }\\n\\n /**\\n * @dev The hash of the version parameter for the EIP712 domain.\\n *\\n * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Version` instead.\\n */\\n function _EIP712VersionHash() internal view returns (bytes32) {\\n string memory version = _EIP712Version();\\n if (bytes(version).length > 0) {\\n return keccak256(bytes(version));\\n } else {\\n // If the version is empty, the contract may have been upgraded without initializing the new storage.\\n // We return the version hash in storage if non-zero, otherwise we assume the version is empty by design.\\n bytes32 hashedVersion = _hashedVersion;\\n if (hashedVersion != 0) {\\n return hashedVersion;\\n } else {\\n return keccak256(\\\"\\\");\\n }\\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[48] private __gap;\\n}\\n\",\"keccak256\":\"0xeb8d6be406a373771724922eb41b5d593bc8e2dc705daa22cd1145cfc8f5a3a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165StorageUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165Storage.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./ERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.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 ERC165StorageUpgradeable is Initializable, ERC165Upgradeable {\\n function __ERC165Storage_init() internal onlyInitializing {\\n }\\n\\n function __ERC165Storage_init_unchained() internal onlyInitializing {\\n }\\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 /**\\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\",\"keccak256\":\"0x8abf30b22b9f34c48c1101400a3172483cfa4fdc5e4de6d040309463e6faee4a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\\n function __ERC165_init() internal onlyInitializing {\\n }\\n\\n function __ERC165_init_unchained() internal onlyInitializing {\\n }\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\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\",\"keccak256\":\"0x9a3b990bd56d139df3e454a9edf1c64668530b5a77fc32eb063bc206f958274a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.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 IERC165Upgradeable {\\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\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2bc0007987c229ae7624eb29be6a9b84f6a6a5872f76248b15208b131ea41c4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)\\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\\n * checks.\\n *\\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\\n * easily result in undesired exploitation or bugs, since developers usually\\n * assume that overflows raise errors. `SafeCast` restores this intuition by\\n * reverting the transaction when such an operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n *\\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\\n * all math on `uint256` and `int256` and then downcasting.\\n */\\nlibrary 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 downcasted) {\\n downcasted = int248(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 248 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int240 from int256, reverting on\\n * overflow (when the input is less than smallest int240 or\\n * greater than largest int240).\\n *\\n * Counterpart to Solidity's `int240` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 240 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\\n downcasted = int240(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 240 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int232 from int256, reverting on\\n * overflow (when the input is less than smallest int232 or\\n * greater than largest int232).\\n *\\n * Counterpart to Solidity's `int232` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 232 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\\n downcasted = int232(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 232 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int224 from int256, reverting on\\n * overflow (when the input is less than smallest int224 or\\n * greater than largest int224).\\n *\\n * Counterpart to Solidity's `int224` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 224 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\\n downcasted = int224(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 224 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int216 from int256, reverting on\\n * overflow (when the input is less than smallest int216 or\\n * greater than largest int216).\\n *\\n * Counterpart to Solidity's `int216` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 216 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\\n downcasted = int216(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 216 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int208 from int256, reverting on\\n * overflow (when the input is less than smallest int208 or\\n * greater than largest int208).\\n *\\n * Counterpart to Solidity's `int208` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 208 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\\n downcasted = int208(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 208 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int200 from int256, reverting on\\n * overflow (when the input is less than smallest int200 or\\n * greater than largest int200).\\n *\\n * Counterpart to Solidity's `int200` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 200 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\\n downcasted = int200(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 200 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int192 from int256, reverting on\\n * overflow (when the input is less than smallest int192 or\\n * greater than largest int192).\\n *\\n * Counterpart to Solidity's `int192` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 192 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\\n downcasted = int192(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 192 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int184 from int256, reverting on\\n * overflow (when the input is less than smallest int184 or\\n * greater than largest int184).\\n *\\n * Counterpart to Solidity's `int184` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 184 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\\n downcasted = int184(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 184 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int176 from int256, reverting on\\n * overflow (when the input is less than smallest int176 or\\n * greater than largest int176).\\n *\\n * Counterpart to Solidity's `int176` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 176 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\\n downcasted = int176(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 176 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int168 from int256, reverting on\\n * overflow (when the input is less than smallest int168 or\\n * greater than largest int168).\\n *\\n * Counterpart to Solidity's `int168` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 168 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\\n downcasted = int168(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 168 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int160 from int256, reverting on\\n * overflow (when the input is less than smallest int160 or\\n * greater than largest int160).\\n *\\n * Counterpart to Solidity's `int160` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 160 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\\n downcasted = int160(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 160 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int152 from int256, reverting on\\n * overflow (when the input is less than smallest int152 or\\n * greater than largest int152).\\n *\\n * Counterpart to Solidity's `int152` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 152 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\\n downcasted = int152(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 152 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int144 from int256, reverting on\\n * overflow (when the input is less than smallest int144 or\\n * greater than largest int144).\\n *\\n * Counterpart to Solidity's `int144` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 144 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\\n downcasted = int144(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 144 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int136 from int256, reverting on\\n * overflow (when the input is less than smallest int136 or\\n * greater than largest int136).\\n *\\n * Counterpart to Solidity's `int136` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 136 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\\n downcasted = int136(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 136 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int128 from int256, reverting on\\n * overflow (when the input is less than smallest int128 or\\n * greater than largest int128).\\n *\\n * Counterpart to Solidity's `int128` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 128 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\\n downcasted = int128(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 128 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int120 from int256, reverting on\\n * overflow (when the input is less than smallest int120 or\\n * greater than largest int120).\\n *\\n * Counterpart to Solidity's `int120` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 120 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\\n downcasted = int120(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 120 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int112 from int256, reverting on\\n * overflow (when the input is less than smallest int112 or\\n * greater than largest int112).\\n *\\n * Counterpart to Solidity's `int112` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 112 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\\n downcasted = int112(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 112 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int104 from int256, reverting on\\n * overflow (when the input is less than smallest int104 or\\n * greater than largest int104).\\n *\\n * Counterpart to Solidity's `int104` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 104 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\\n downcasted = int104(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 104 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int96 from int256, reverting on\\n * overflow (when the input is less than smallest int96 or\\n * greater than largest int96).\\n *\\n * Counterpart to Solidity's `int96` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 96 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\\n downcasted = int96(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 96 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int88 from int256, reverting on\\n * overflow (when the input is less than smallest int88 or\\n * greater than largest int88).\\n *\\n * Counterpart to Solidity's `int88` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 88 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\\n downcasted = int88(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 88 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int80 from int256, reverting on\\n * overflow (when the input is less than smallest int80 or\\n * greater than largest int80).\\n *\\n * Counterpart to Solidity's `int80` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 80 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\\n downcasted = int80(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 80 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int72 from int256, reverting on\\n * overflow (when the input is less than smallest int72 or\\n * greater than largest int72).\\n *\\n * Counterpart to Solidity's `int72` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 72 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\\n downcasted = int72(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 72 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int64 from int256, reverting on\\n * overflow (when the input is less than smallest int64 or\\n * greater than largest int64).\\n *\\n * Counterpart to Solidity's `int64` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 64 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\\n downcasted = int64(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 64 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int56 from int256, reverting on\\n * overflow (when the input is less than smallest int56 or\\n * greater than largest int56).\\n *\\n * Counterpart to Solidity's `int56` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 56 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\\n downcasted = int56(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 56 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int48 from int256, reverting on\\n * overflow (when the input is less than smallest int48 or\\n * greater than largest int48).\\n *\\n * Counterpart to Solidity's `int48` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 48 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\\n downcasted = int48(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 48 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int40 from int256, reverting on\\n * overflow (when the input is less than smallest int40 or\\n * greater than largest int40).\\n *\\n * Counterpart to Solidity's `int40` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 40 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\\n downcasted = int40(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 40 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int32 from int256, reverting on\\n * overflow (when the input is less than smallest int32 or\\n * greater than largest int32).\\n *\\n * Counterpart to Solidity's `int32` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 32 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\\n downcasted = int32(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 32 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int24 from int256, reverting on\\n * overflow (when the input is less than smallest int24 or\\n * greater than largest int24).\\n *\\n * Counterpart to Solidity's `int24` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 24 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\\n downcasted = int24(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 24 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int16 from int256, reverting on\\n * overflow (when the input is less than smallest int16 or\\n * greater than largest int16).\\n *\\n * Counterpart to Solidity's `int16` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 16 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\\n downcasted = int16(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 16 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int8 from int256, reverting on\\n * overflow (when the input is less than smallest int8 or\\n * greater than largest int8).\\n *\\n * Counterpart to Solidity's `int8` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 8 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\\n downcasted = int8(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 8 bits\\\");\\n }\\n\\n /**\\n * @dev Converts an unsigned uint256 into a signed int256.\\n *\\n * Requirements:\\n *\\n * - input must be less than or equal to maxInt256.\\n *\\n * _Available since v3.0._\\n */\\n function toInt256(uint256 value) internal pure returns (int256) {\\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\\n require(value <= uint256(type(int256).max), \\\"SafeCast: value doesn't fit in an int256\\\");\\n return int256(value);\\n }\\n}\\n\",\"keccak256\":\"0xcef50f95b43b038aa40aed25b62fc45906c681a5c1d504a4fdcf3bc6330a8d4b\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMathUpgradeable {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x88f6b7bba3ee33eeb741f9a0f5bc98b6e6e352d0fe4905377bb328590f84095a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC1271.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC1271 standard signature validation method for\\n * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC1271 {\\n /**\\n * @dev Should return whether the signature provided is valid for the provided data\\n * @param hash Hash of the data to be signed\\n * @param signature Signature byte array associated with _data\\n */\\n function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\\n}\\n\",\"keccak256\":\"0x0705a4b1b86d7b0bd8432118f226ba139c44b9dcaba0a6eafba2dd7d0639c544\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC1967.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\\n *\\n * _Available since v4.8.3._\\n */\\ninterface IERC1967 {\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Emitted when the beacon is changed.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n}\\n\",\"keccak256\":\"0x3cbef5ebc24b415252e2f8c0c9254555d30d9f085603b4b80d9b5ed20ab87e90\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x1d4afe6cb24200cc4545eed814ecf5847277dfe5d613a1707aad5fceecebcfff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Clones.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/Clones.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for\\n * deploying minimal proxy contracts, also known as \\\"clones\\\".\\n *\\n * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies\\n * > a minimal bytecode implementation that delegates all calls to a known, fixed address.\\n *\\n * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`\\n * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the\\n * deterministic method.\\n *\\n * _Available since v3.4._\\n */\\nlibrary Clones {\\n /**\\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\\n *\\n * This function uses the create opcode, which should never revert.\\n */\\n function clone(address implementation) internal returns (address instance) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\\n // of the `implementation` address with the bytecode before the address.\\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\\n instance := create(0, 0x09, 0x37)\\n }\\n require(instance != address(0), \\\"ERC1167: create failed\\\");\\n }\\n\\n /**\\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\\n *\\n * This function uses the create2 opcode and a `salt` to deterministically deploy\\n * the clone. Using the same `implementation` and `salt` multiple time will revert, since\\n * the clones cannot be deployed twice at the same address.\\n */\\n function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\\n // of the `implementation` address with the bytecode before the address.\\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\\n instance := create2(0, 0x09, 0x37, salt)\\n }\\n require(instance != address(0), \\\"ERC1167: create2 failed\\\");\\n }\\n\\n /**\\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\\n */\\n function predictDeterministicAddress(\\n address implementation,\\n bytes32 salt,\\n address deployer\\n ) internal pure returns (address predicted) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40)\\n mstore(add(ptr, 0x38), deployer)\\n mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)\\n mstore(add(ptr, 0x14), implementation)\\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)\\n mstore(add(ptr, 0x58), salt)\\n mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))\\n predicted := keccak256(add(ptr, 0x43), 0x55)\\n }\\n }\\n\\n /**\\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\\n */\\n function predictDeterministicAddress(\\n address implementation,\\n bytes32 salt\\n ) internal view returns (address predicted) {\\n return predictDeterministicAddress(implementation, salt, address(this));\\n }\\n}\\n\",\"keccak256\":\"0x01f055f5c26ba25d7f83e9aa9ba877fbea4d0bf22227de046ea67494bc932999\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0xa2b22da3032e50b55f95ec1d13336102d675f341167aa76db571ef7f8bb7975d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/IERC1967.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n */\\nabstract contract ERC1967Upgrade is IERC1967 {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n Address.isContract(IBeacon(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3b21ae06bf5957f73fa16754b0669c77b7abd8ba6c072d35c3281d446fdb86c2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overridden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xc130fe33f1b2132158531a87734153293f6d07bc263ff4ac90e85da9c82c0e27\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x006dd67219697fe68d7fbfdea512e7c4cb64a43565ed86171d67e844982da6fa\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)\\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```solidity\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._\\n * _Available since v4.9 for `string`, `bytes`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n struct StringSlot {\\n string value;\\n }\\n\\n struct BytesSlot {\\n bytes value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\\n */\\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\\n */\\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := store.slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\\n */\\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\\n */\\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := store.slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf09e68aa0dc6722a25bc46490e8d48ed864466d17313b8a0b254c36b54e49899\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165Checker.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/introspection/ERC165Checker.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Library used to query support of an interface declared via {IERC165}.\\n *\\n * Note that these functions return the actual result of the query: they do not\\n * `revert` if an interface is not supported. It is up to the caller to decide\\n * what to do in these cases.\\n */\\nlibrary ERC165Checker {\\n // As per the EIP-165 spec, no interface should ever match 0xffffffff\\n bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;\\n\\n /**\\n * @dev Returns true if `account` supports the {IERC165} interface.\\n */\\n function supportsERC165(address account) internal view returns (bool) {\\n // Any contract that implements ERC165 must explicitly indicate support of\\n // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid\\n return\\n supportsERC165InterfaceUnchecked(account, type(IERC165).interfaceId) &&\\n !supportsERC165InterfaceUnchecked(account, _INTERFACE_ID_INVALID);\\n }\\n\\n /**\\n * @dev Returns true if `account` supports the interface defined by\\n * `interfaceId`. Support for {IERC165} itself is queried automatically.\\n *\\n * See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {\\n // query support of both ERC165 as per the spec and support of _interfaceId\\n return supportsERC165(account) && supportsERC165InterfaceUnchecked(account, interfaceId);\\n }\\n\\n /**\\n * @dev Returns a boolean array where each value corresponds to the\\n * interfaces passed in and whether they're supported or not. This allows\\n * you to batch check interfaces for a contract where your expectation\\n * is that some interfaces may not be supported.\\n *\\n * See {IERC165-supportsInterface}.\\n *\\n * _Available since v3.4._\\n */\\n function getSupportedInterfaces(\\n address account,\\n bytes4[] memory interfaceIds\\n ) internal view returns (bool[] memory) {\\n // an array of booleans corresponding to interfaceIds and whether they're supported or not\\n bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);\\n\\n // query support of ERC165 itself\\n if (supportsERC165(account)) {\\n // query support of each interface in interfaceIds\\n for (uint256 i = 0; i < interfaceIds.length; i++) {\\n interfaceIdsSupported[i] = supportsERC165InterfaceUnchecked(account, interfaceIds[i]);\\n }\\n }\\n\\n return interfaceIdsSupported;\\n }\\n\\n /**\\n * @dev Returns true if `account` supports all the interfaces defined in\\n * `interfaceIds`. Support for {IERC165} itself is queried automatically.\\n *\\n * Batch-querying can lead to gas savings by skipping repeated checks for\\n * {IERC165} support.\\n *\\n * See {IERC165-supportsInterface}.\\n */\\n function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {\\n // query support of ERC165 itself\\n if (!supportsERC165(account)) {\\n return false;\\n }\\n\\n // query support of each interface in interfaceIds\\n for (uint256 i = 0; i < interfaceIds.length; i++) {\\n if (!supportsERC165InterfaceUnchecked(account, interfaceIds[i])) {\\n return false;\\n }\\n }\\n\\n // all interfaces supported\\n return true;\\n }\\n\\n /**\\n * @notice Query if a contract implements an interface, does not check ERC165 support\\n * @param account The address of the contract to query for support of an interface\\n * @param interfaceId The interface identifier, as specified in ERC-165\\n * @return true if the contract at account indicates support of the interface with\\n * identifier interfaceId, false otherwise\\n * @dev Assumes that account contains a contract that supports ERC165, otherwise\\n * the behavior of this method is undefined. This precondition can be checked\\n * with {supportsERC165}.\\n *\\n * Some precompiled contracts will falsely indicate support for a given interface, so caution\\n * should be exercised when using this function.\\n *\\n * Interface identification is specified in ERC-165.\\n */\\n function supportsERC165InterfaceUnchecked(address account, bytes4 interfaceId) internal view returns (bool) {\\n // prepare call\\n bytes memory encodedParams = abi.encodeWithSelector(IERC165.supportsInterface.selector, interfaceId);\\n\\n // perform static call\\n bool success;\\n uint256 returnSize;\\n uint256 returnValue;\\n assembly {\\n success := staticcall(30000, account, add(encodedParams, 0x20), mload(encodedParams), 0x00, 0x20)\\n returnSize := returndatasize()\\n returnValue := mload(0x00)\\n }\\n\\n return success && returnSize >= 0x20 && returnValue > 0;\\n }\\n}\\n\",\"keccak256\":\"0x5a08ad61f4e82b8a3323562661a86fb10b10190848073fdc13d4ac43710ffba5\",\"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\"},\"src/IVocdoniProposal.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-or-later\\n\\npragma solidity ^0.8.17;\\n\\nimport {IDAO} from \\\"@aragon/osx/core/dao/IDAO.sol\\\";\\n\\n/// @title IVocdoniProposal\\n/// @notice An interface to be implemented by DAO plugins that create and execute off-chain proposals.\\n/// @dev Slighly modified from the original Aragon OSx IProposal interface.\\ninterface IVocdoniProposal {\\n /// @notice Emitted when a proposal is created.\\n /// @param proposalId The ID of the proposal.\\n /// @param vochainProposalId The ID of the proposal in the Vochain.\\n /// @param creator The creator of the proposal.\\n /// @param startDate The start date of the proposal in seconds.\\n /// @param endDate The end date of the proposal in seconds.\\n /// @param expirationDate The expiration date of the proposal in seconds.\\n /// @param actions The actions that will be executed if the proposal passes.\\n /// @param allowFailureMap A bitmap allowing the proposal to succeed, even if individual actions might revert. If the bit at index `i` is 1, the proposal succeeds even if the `i`th action reverts. A failure map value of 0 requires every action to not revert.\\n event ProposalCreated(\\n uint256 indexed proposalId,\\n bytes32 indexed vochainProposalId,\\n address indexed creator,\\n uint64 startDate,\\n uint64 endDate,\\n uint64 expirationDate,\\n IDAO.Action[] actions,\\n uint256 allowFailureMap\\n );\\n\\n /// @notice Emitted when a proposal is executed.\\n /// @param proposalId The ID of the proposal.\\n event ProposalExecuted(uint256 indexed proposalId);\\n\\n /// @notice Returns the proposal count determining the next proposal ID.\\n /// @return The proposal count.\\n function proposalCount() external view returns (uint256);\\n}\",\"keccak256\":\"0xda5accfb99b3ebbf8cffa727daa842d2eece8e0f0132de95dd7da013631f79a0\",\"license\":\"AGPL-3.0-or-later\"},\"src/IVocdoniVoting.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-or-later\\npragma solidity ^0.8.17;\\n\\nimport {IDAO} from \\\"@aragon/osx/core/dao/IDAO.sol\\\";\\n\\n/// @title IVocdoniVoting\\n/// @author Vocdoni\\n/// @notice The Vocdoni off-chain voting contract interface for the OSX plugin.\\n/// @notice The voting Proposal is managed off-chain on the Vocdoni blockchain.\\ninterface IVocdoniVoting {\\n /// @notice Adds new committee members.\\n /// @param _members The addresses of the new committee members.\\n function addCommitteeMembers(address[] calldata _members) external;\\n\\n /// @notice Removes committee members.\\n /// @param _members The addresses of the committee members to remove.\\n function removeCommitteeMembers(address[] calldata _members) external;\\n\\n /// @notice Returns whether an address is a committee member.\\n /// @param _member The address to check.\\n /// @return Whether the address is a committee member.\\n function isCommitteeMember(address _member) external view returns (bool);\\n\\n /// @notice Sets the tally of a given proposal.\\n /// @param _proposalId The ID of the proposal to set the tally of.\\n /// @param _tally The tally to set.\\n function setTally(uint256 _proposalId, uint256[][] memory _tally) external;\\n\\n /// @notice Approves a proposal tally.\\n /// @param _proposalId The ID of the proposal to approve.\\n function approveTally(uint256 _proposalId, bool _tryExecution) external;\\n\\n /// @notice Executes a proposal.\\n /// @param _proposalId The ID of the proposal to execute.\\n function executeProposal(uint256 _proposalId) external;\\n}\",\"keccak256\":\"0xa6534e2bd9cdc55036c3a7830a8df21a31a764111750d968a074f399b5a9d0f7\",\"license\":\"AGPL-3.0-or-later\"},\"src/VocdoniProposalUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-or-later\\n\\npragma solidity ^0.8.17;\\n\\nimport {CountersUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol\\\";\\nimport {ERC165Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\\\";\\nimport {IVocdoniProposal} from \\\"./IVocdoniProposal.sol\\\";\\nimport {IDAO} from \\\"@aragon/osx/core/dao/IDAO.sol\\\";\\n\\n/// @title VocdoniProposalUpgradeable\\n/// @notice An abstract contract containing the traits and internal functionality to create and execute off-chain proposals that can be inherited by upgradeable DAO plugins.\\n/// @dev Slighly modified from the original Aragon OSx ProposalUpgradeable contract.\\nabstract contract VocdoniProposalUpgradeable is IVocdoniProposal, ERC165Upgradeable {\\n using CountersUpgradeable for CountersUpgradeable.Counter;\\n\\n /// @notice The incremental ID for proposals and executions.\\n CountersUpgradeable.Counter private proposalCounter;\\n\\n /// @inheritdoc IVocdoniProposal\\n function proposalCount() public view override returns (uint256) {\\n return proposalCounter.current();\\n }\\n\\n /// @notice Checks if this or the parent contract supports an interface by its ID.\\n /// @param _interfaceId The ID of the interface.\\n /// @return Returns `true` if the interface is supported.\\n function supportsInterface(bytes4 _interfaceId) public view virtual override returns (bool) {\\n return _interfaceId == type(IVocdoniProposal).interfaceId || super.supportsInterface(_interfaceId);\\n }\\n\\n /// @notice Creates a proposal ID.\\n /// @return proposalId The proposal ID.\\n function _createProposalId() internal returns (uint256 proposalId) {\\n proposalId = proposalCount();\\n proposalCounter.increment();\\n }\\n\\n /// @notice Internal function to execute a proposal.\\n /// @param _proposalId The ID of the proposal to be executed.\\n /// @param _actions The array of actions to be executed.\\n /// @param _allowFailureMap A bitmap allowing the proposal to succeed, even if individual actions might revert. If the bit at index `i` is 1, the proposal succeeds even if the `i`th action reverts. A failure map value of 0 requires every action to not revert.\\n /// @return execResults The array with the results of the executed actions.\\n /// @return failureMap The failure map encoding which actions have failed.\\n function _executeProposal(\\n IDAO _dao,\\n uint256 _proposalId,\\n IDAO.Action[] memory _actions,\\n uint256 _allowFailureMap\\n ) internal virtual returns (bytes[] memory execResults, uint256 failureMap) {\\n (execResults, failureMap) = _dao.execute(bytes32(_proposalId), _actions, _allowFailureMap);\\n emit ProposalExecuted({proposalId: _proposalId});\\n }\\n\\n /// @notice This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain (see [OpenZeppelin's guide about storage gaps](https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps)).\\n uint256[49] private __gap;\\n}\",\"keccak256\":\"0x3240107303697bc71836820f21a7871cfaa4755d30fa0b398885a6b7cfa00df3\",\"license\":\"AGPL-3.0-or-later\"},\"src/VocdoniVoting.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-or-later\\npragma solidity ^0.8.17;\\n\\n\\nimport {SafeCastUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol\\\";\\nimport {IVotesUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/governance/utils/IVotesUpgradeable.sol\\\";\\nimport {IERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\n\\nimport {IDAO} from \\\"@aragon/osx/core/dao/IDAO.sol\\\";\\nimport {PluginUUPSUpgradeable} from \\\"@aragon/osx/core/plugin/PluginUUPSUpgradeable.sol\\\";\\nimport {RATIO_BASE, RatioOutOfBounds} from \\\"@aragon/osx/plugins/utils/Ratio.sol\\\";\\nimport {Addresslist} from \\\"@aragon/osx/plugins/utils/Addresslist.sol\\\";\\n\\nimport {VocdoniProposalUpgradeable} from \\\"./VocdoniProposalUpgradeable.sol\\\";\\nimport {IVocdoniVoting} from \\\"./IVocdoniVoting.sol\\\";\\n\\n/// @title VocdoniVoting\\n/// @author Vocdoni\\n/// @notice The Vocdoni off-chain voting data contract for the OSX plugin.\\n/// @notice The voting Proposal is managed off-chain on the Vocdoni blockchain.\\ncontract VocdoniVoting is IVocdoniVoting, PluginUUPSUpgradeable, VocdoniProposalUpgradeable, Addresslist {\\n\\n using SafeCastUpgradeable for uint256;\\n\\n /// @notice The [ERC-165](https://eips.ethereum.org/EIPS/eip-165) interface ID of the contract.\\n bytes4 internal constant VOCDONI_INTERFACE_ID =\\n this.initialize.selector ^\\n this.addCommitteeMembers.selector ^\\n this.removeCommitteeMembers.selector ^\\n this.isCommitteeMember.selector ^\\n this.setTally.selector ^\\n this.approveTally.selector ^\\n this.executeProposal.selector;\\n\\n /// @notice The ID of the permission required to update the plugin settings.\\n bytes32 public constant UPDATE_PLUGIN_SETTINGS_PERMISSION_ID =\\n keccak256(\\\"UPDATE_PLUGIN_SETTINGS_PERMISSION\\\");\\n\\n /// @notice The ID of the permission required to add/remove committee members.\\n bytes32 public constant UPDATE_PLUGIN_COMMITTEE_PERMISSION_ID =\\n keccak256(\\\"UPDATE_PLUGIN_COMMITTEE_PERMISSION\\\");\\n\\n /// @notice Emitted when the plugin settings are updated.\\n /// @param onlyCommitteeProposalCreation If true, only committee members can create proposals.\\n /// @param minTallyApprovals The minimum number of approvals required for a tally to be considered accepted.\\n /// @param minDuration The minimum duration of a propsal.\\n /// @param minParticipation The minimum participation value. Its value has to be in the interval [0, 10^6] defined by `RATIO_BASE = 10**6`.\\n /// @param supportThreshold The support threshold value. Its value has to be in the interval [0, 10^6] defined by `RATIO_BASE = 10**6`.\\n /// @param daoTokenAddress The address of the DAO token.\\n /// @param censusStrategy The predicate of the census strategy to be used in the proposals. See: https://github.com/vocdoni/census3 \\n /// @param minProposerVotingPower The minimum voting power required to create a proposal. Voting power is extracted from the DAO token\\n event PluginSettingsUpdated(\\n bool onlyCommitteeProposalCreation,\\n uint16 minTallyApprovals,\\n uint64 minDuration,\\n uint32 minParticipation,\\n uint32 supportThreshold,\\n address daoTokenAddress,\\n string censusStrategy,\\n uint256 minProposerVotingPower\\n );\\n\\n /// @notice Emitted when one or more committee members are added.\\n /// @param newMembers The addresses of the new committee members.\\n event CommitteeMembersAdded(address[] indexed newMembers);\\n\\n /// @notice Emitted when one or more committee member are removed.\\n /// @param removedMembers The addresses of the removed committee members.\\n event CommitteeMembersRemoved(address[] indexed removedMembers);\\n\\n /// @notice Emitted when the tally of a proposal is set.\\n /// @param proposalId The ID of the proposal.\\n /// @param tally The tally.\\n event TallySet(uint256 indexed proposalId, uint256[][] tally);\\n\\n /// @notice Emitted when the tally of a proposal is approved.\\n /// @param proposalId The ID of the proposal.\\n event TallyApproved(uint256 indexed proposalId);\\n\\n /// @notice Thrown if the address list length is out of bounds.\\n /// @param limit The limit value.\\n /// @param actual The actual value.\\n error AddresslistLengthOutOfBounds(uint16 limit, uint256 actual);\\n\\n /// @notice Thrown if the minimal approvals value is out of bounds (less than 1 or greater than the number of members in the address list).\\n /// @param limit The maximal value.\\n /// @param actual The actual value.\\n error MinApprovalsOutOfBounds(uint16 limit, uint16 actual);\\n\\n /// @notice Thrown if the minimal duration value is out of bounds (less than one hour or greater than 1 year).\\n /// @param limit The limit value.\\n /// @param actual The actual value.\\n error MinDurationOutOfBounds(uint64 limit, uint64 actual);\\n\\n /// @notice Thrown if the start date is invalid.\\n /// @param limit The limit value.\\n /// @param actual The actual value.\\n error InvalidStartDate(uint64 limit, uint64 actual);\\n\\n /// @notice Thrown if the end date is invalid.\\n /// @param limit The limit value.\\n /// @param actual The actual value.\\n error InvalidEndDate(uint64 limit, uint64 actual);\\n\\n /// @notice Thrown if the expiration date is invalid.\\n /// @param limit The expiration date.\\n /// @param actual The actual value.\\n error InvalidExpirationDate(uint64 limit, uint64 actual);\\n\\n /// @notice Thrown if the plugin settings are updated too recently.\\n /// @param lastUpdate The block number of the last update.\\n error PluginSettingsUpdatedTooRecently(uint64 lastUpdate, uint64 securityBlock);\\n\\n /// @notice Thrown if the proposal is already executed.\\n /// @param proposalId The ID of the proposal.\\n error ProposalAlreadyExecuted(uint256 proposalId);\\n\\n /// @notice Thrown if the proposal tally is invalid.\\n /// @param tally The tally of the proposal.\\n error InvalidTally(uint256[][] tally);\\n\\n /// @notice Thrown if the proposal tally is already set and approved.\\n /// @param approvals The number of approvals.\\n /// @param minApprovals The minimum number of approvals required.\\n error TallyAlreadyApproved(uint256 approvals, uint16 minApprovals);\\n\\n /// @notice Thrown if the proposal tally is not approved by enough committee members.\\n /// @param minApprovals The minimum number of approvals required.\\n /// @param actualApprovals The actual number of approvals.\\n error NotEnoughApprovals(uint16 minApprovals, uint16 actualApprovals);\\n\\n /// @notice Thrown if an address is not valid or not supported\\n /// @param addr The address\\n error InvalidAddress(address addr);\\n\\n /// @notice Thrown if the prosal is not in the tally phase\\n /// @param startDate The start date of the proposal\\n /// @param endDate The end date of the proposal\\n /// @param expirationDate The expiration date of the proposal\\n /// @param currentTimestamp The current timestamp\\n error ProposalNotInTallyPhase(uint64 startDate, uint64 endDate, uint64 expirationDate, uint256 currentTimestamp);\\n\\n /// @notice Thrown if the msg.sender does not have enough voting power\\n /// @param required The required voting power\\n error NotEnoughVotingPower(uint256 required);\\n\\n /// @notice Thrown if the msg.sender is not a committee member\\n /// @param sender The sender\\n error OnlyCommittee(address sender);\\n\\n /// @notice Thrown if the support threshold is not reached\\n /// @param currentSupport The current support\\n /// @param supportThreshold The support threshold\\n error SupportThresholdNotReached(uint256 currentSupport, uint32 supportThreshold);\\n\\n /// @notice Thrown if the minimum participation is not reached\\n /// @param currentParticipation The current participation\\n /// @param minParticipation The minimum participation\\n error MinParticipationNotReached(uint256 currentParticipation,uint32 minParticipation);\\n\\n /// @notice A container for the Vocdoni voting plugin settings\\n /// @param onlyCommitteeProposalCreation If true, only committee members can create proposals.\\n /// @param minTallyApprovals The minimum number of approvals required for the tally to be considered valid.\\n /// @param minParticipation The minimum participation value. Its value has to be in the interval [0, 10^6] defined by `RATIO_BASE = 10**6`.\\n /// @param supportThreshold The support threshold value. Its value has to be in the interval [0, 10^6] defined by `RATIO_BASE = 10**6`.\\n /// @param minDuration The minimum duration of a proposal.\\n /// @param daoTokenAddress The address of the DAO token.\\n /// @param minProposerVotingPower The minimum voting power required to create a proposal. Voting power is extracted from the DAO token\\n /// @param censusStrategy The predicate of the census strategy to be used in the proposals. See: https://github.com/vocdoni/census3\\n struct PluginSettings {\\n bool onlyCommitteeProposalCreation;\\n uint16 minTallyApprovals;\\n uint32 minParticipation;\\n uint32 supportThreshold;\\n uint64 minDuration;\\n address daoTokenAddress;\\n uint256 minProposerVotingPower;\\n string censusStrategy;\\n }\\n\\n /// @notice A container for the proposal parameters.\\n /// @param censusBlock The block number used to generate the census of the proposal\\n /// @param securityBlock Block number used for limiting contract usage when plugin settings are updated\\n /// @param startDate The timestamp when the proposal starts.\\n /// @param endDate The timestamp when the proposal ends. At this point the tally can be set.\\n /// @param expirationDate The timestamp when the proposal expires. Proposal can't be executed after.\\n struct ProposalParameters {\\n uint64 censusBlock;\\n uint64 securityBlock;\\n uint64 startDate;\\n uint64 endDate;\\n uint64 expirationDate;\\n }\\n\\n /// @notice A container for proposal-related information.\\n /// @param executed Whether the proposal is executed or not.\\n /// @param vochainProposalId The ID of the proposal in the Vochain.\\n /// @param allowFailureMap A bitmap allowing the proposal to succeed, even if individual actions might revert. If the bit at index `i` is 1,\\n // the proposal succeeds even if the `i`th action reverts. A failure map value of 0 requires every action to not revert.\\n /// @param parameters The parameters of the proposal.\\n /// @param tally The tally of the proposal.\\n /// @dev tally only supports [[Yes, No, Abstain]] schema in this order. i.e [[10, 5, 2]] means 10 Yes, 5 No, 2 Abstain.\\n /// @param approvers The approvers of the tally.\\n /// @param actions The actions to be executed when the proposal passes.\\n struct Proposal {\\n bool executed;\\n bytes32 vochainProposalId;\\n uint256 allowFailureMap;\\n ProposalParameters parameters;\\n uint256[][] tally;\\n address[] approvers;\\n IDAO.Action[] actions;\\n }\\n\\n /// @notice A mapping between proposal IDs and proposal information.\\n mapping(uint256 => Proposal) private proposals;\\n\\n /// @notice The current plugin settings.\\n PluginSettings private pluginSettings;\\n\\n /// @notice Keeps track at which block number the plugin settings have been changed the last time.\\n /// @dev This variable prevents executing a proposal if plugin settings have been changed.\\n uint64 private lastPluginSettingsChange;\\n\\n \\n /// @notice Initializes the plugin.\\n /// @param _dao The DAO address.\\n /// @param _committeeAddresses The addresses of the committee.\\n /// @param _pluginSettings The initial plugin settings.\\n function initialize(IDAO _dao, address[] calldata _committeeAddresses, PluginSettings memory _pluginSettings) external initializer {\\n __PluginUUPSUpgradeable_init(_dao);\\n \\n if (_committeeAddresses.length > type(uint16).max) {\\n revert AddresslistLengthOutOfBounds({limit: type(uint16).max, actual: _committeeAddresses.length});\\n }\\n \\n _addAddresses(_committeeAddresses);\\n \\n emit CommitteeMembersAdded({newMembers: _committeeAddresses});\\n \\n _updatePluginSettings(_pluginSettings);\\n }\\n\\n /// @notice Checks if this or the parent contract supports an interface by its ID.\\n /// @param _interfaceId The ID of the interface.\\n /// @return Returns `true` if the interface is supported.\\n function supportsInterface(\\n bytes4 _interfaceId\\n )\\n public\\n view\\n virtual\\n override(PluginUUPSUpgradeable, VocdoniProposalUpgradeable)\\n returns (bool)\\n {\\n return\\n _interfaceId == VOCDONI_INTERFACE_ID ||\\n _interfaceId == type(IVocdoniVoting).interfaceId ||\\n _interfaceId == type(Addresslist).interfaceId ||\\n super.supportsInterface(_interfaceId);\\n }\\n\\n /// @inheritdoc IVocdoniVoting\\n function addCommitteeMembers(\\n address[] calldata _members\\n ) external override auth(UPDATE_PLUGIN_COMMITTEE_PERMISSION_ID) {\\n uint256 newAddresslistLength = addresslistLength() + _members.length;\\n\\n // Check if the new address list length would be greater than `type(uint16).max`, the maximal number of approvals.\\n if (newAddresslistLength > type(uint16).max) {\\n revert AddresslistLengthOutOfBounds({\\n limit: type(uint16).max,\\n actual: newAddresslistLength\\n });\\n }\\n\\n _addAddresses(_members);\\n\\n emit CommitteeMembersAdded({newMembers: _members});\\n }\\n\\n /// @inheritdoc IVocdoniVoting\\n function removeCommitteeMembers(\\n address[] calldata _members\\n ) external override auth(UPDATE_PLUGIN_COMMITTEE_PERMISSION_ID) {\\n uint16 newAddresslistLength = uint16(addresslistLength() - _members.length);\\n\\n // Check if the new address list length would become less than the current minimum number of approvals required.\\n if (newAddresslistLength < pluginSettings.minTallyApprovals) {\\n revert MinApprovalsOutOfBounds({\\n limit: newAddresslistLength,\\n actual: pluginSettings.minTallyApprovals\\n });\\n }\\n\\n _removeAddresses(_members);\\n\\n emit CommitteeMembersRemoved({removedMembers: _members});\\n }\\n\\n /// @inheritdoc IVocdoniVoting\\n function isCommitteeMember(address _member) public view override returns (bool) {\\n return _isCommitteeMember(_member);\\n }\\n\\n /// @notice Internal function for checking whether an address is a committee member.\\n /// @param _member The address to check.\\n /// @return Whether the address is a committee member.\\n function _isCommitteeMember(address _member) internal view returns (bool) {\\n return isListed(_member);\\n }\\n\\n /// @notice Updates the plugin settings.\\n /// @param _pluginSettings The new plugin settings.\\n /// @dev The called must have the UPDATE_PLUGIN_SETTINGS_PERMISSION_ID permission.\\n function updatePluginSettings(PluginSettings memory _pluginSettings) public auth(UPDATE_PLUGIN_SETTINGS_PERMISSION_ID) {\\n _updatePluginSettings(_pluginSettings);\\n }\\n\\n /// @notice Internal function for updating the plugin settings.\\n /// @param _pluginSettings The new plugin settings.\\n function _updatePluginSettings(PluginSettings memory _pluginSettings) private {\\n if (pluginSettings.supportThreshold > RATIO_BASE - 1) {\\n revert RatioOutOfBounds({\\n limit: RATIO_BASE - 1,\\n actual: pluginSettings.supportThreshold\\n });\\n }\\n \\n // Require the minimum participation value to be in the interval [0, 10^6], because `>=` comparision is used in the participation criterion.\\n if (pluginSettings.minParticipation > RATIO_BASE) {\\n revert RatioOutOfBounds({limit: RATIO_BASE, actual: pluginSettings.minParticipation});\\n }\\n\\n if (pluginSettings.minDuration > 365 days) {\\n revert MinDurationOutOfBounds({limit: 365 days, actual: pluginSettings.minDuration});\\n }\\n \\n // update plugin settings\\n pluginSettings = _pluginSettings;\\n lastPluginSettingsChange = uint64(block.number);\\n\\n emit PluginSettingsUpdated({\\n onlyCommitteeProposalCreation: _pluginSettings.onlyCommitteeProposalCreation,\\n minTallyApprovals: _pluginSettings.minTallyApprovals,\\n minDuration: _pluginSettings.minDuration,\\n minParticipation: _pluginSettings.minParticipation,\\n supportThreshold: _pluginSettings.supportThreshold,\\n daoTokenAddress: _pluginSettings.daoTokenAddress,\\n censusStrategy: _pluginSettings.censusStrategy,\\n minProposerVotingPower: _pluginSettings.minProposerVotingPower\\n });\\n }\\n\\n /// @notice Returns a proposal.\\n /// @param _proposalId The ID of the proposal to return.\\n /// @return executed Whether the proposal is executed or not.\\n /// @return approvers The approvers of the tally.\\n /// @return vochainProposalId The ID of the proposal in the Vochain.\\n /// @return parameters The parameters of the proposal.\\n /// @return allowFailureMap The allow failure map of the proposal.\\n /// @return tally The tally of the proposal.\\n /// @return actions The actions of the proposal.\\n function getProposal(uint256 _proposalId) public view returns (\\n bool executed,\\n address[] memory approvers,\\n bytes32 vochainProposalId,\\n ProposalParameters memory parameters,\\n uint256 allowFailureMap,\\n uint256[][] memory tally,\\n IDAO.Action[] memory actions\\n \\n ) {\\n Proposal storage proposal = proposals[_proposalId];\\n executed = proposal.executed;\\n approvers = proposal.approvers;\\n vochainProposalId = proposal.vochainProposalId;\\n parameters = proposal.parameters;\\n allowFailureMap = proposal.allowFailureMap;\\n tally = proposal.tally;\\n actions = proposal.actions;\\n }\\n\\n /// @notice Internal function for creating a proposal.\\n /// @param _vochainProposalId The Vocdoni proposal ID.\\n /// @param _allowFailureMap The allow failure map of the proposal.\\n /// @param _parameters The parameters of the proposal.\\n /// @param _actions The actions of the proposal.\\n /// @return The ID of the created proposal.\\n function createProposal(\\n bytes32 _vochainProposalId,\\n uint256 _allowFailureMap,\\n ProposalParameters memory _parameters,\\n IDAO.Action[] memory _actions\\n ) external returns (uint256) {\\n if (pluginSettings.onlyCommitteeProposalCreation &&\\n !_isCommitteeMember(_msgSender())\\n ) {\\n revert OnlyCommittee({\\n sender: _msgSender()\\n });\\n }\\n \\n if (pluginSettings.minProposerVotingPower != 0 &&\\n // Because of the checks in `VocdoniVotingSetup`, we can assume that `votingToken` is an [ERC-20](https://eips.ethereum.org/EIPS/eip-20) token.\\n IVotesUpgradeable(pluginSettings.daoTokenAddress).getVotes(_msgSender()) < pluginSettings.minProposerVotingPower &&\\n IERC20Upgradeable(pluginSettings.daoTokenAddress).balanceOf(_msgSender()) < pluginSettings.minProposerVotingPower\\n ) {\\n revert NotEnoughVotingPower({\\n required: pluginSettings.minProposerVotingPower\\n });\\n }\\n\\n\\n (_parameters.startDate,\\n _parameters.endDate,\\n _parameters.expirationDate) = _validateProposalDates(\\n _parameters.startDate,\\n _parameters.endDate,\\n _parameters.expirationDate\\n );\\n\\n uint256 _proposalId = _createProposalId();\\n \\n Proposal storage proposal = proposals[_proposalId];\\n \\n proposal.vochainProposalId = _vochainProposalId;\\n proposal.parameters.startDate = _parameters.startDate;\\n proposal.parameters.endDate = _parameters.endDate;\\n proposal.parameters.expirationDate = _parameters.expirationDate;\\n proposal.parameters.censusBlock = _parameters.censusBlock;\\n proposal.allowFailureMap = _allowFailureMap;\\n proposal.parameters.securityBlock = block.number.toUint64() - 1;\\n for (uint16 i = 0; i < _actions.length; i++) {\\n proposal.actions.push(_actions[i]);\\n }\\n\\n emit ProposalCreated(\\n _proposalId,\\n _vochainProposalId,\\n _msgSender(),\\n _parameters.startDate,\\n _parameters.endDate,\\n _parameters.expirationDate,\\n _actions,\\n _allowFailureMap\\n );\\n\\n return _proposalId;\\n }\\n\\n /// @inheritdoc IVocdoniVoting\\n function setTally(uint256 _proposalId, uint256[][] memory _tally) public override {\\n _setTally(_proposalId, _tally);\\n } \\n\\n /// @notice Internal function for setting the tally of a given proposal.\\n /// @param _proposalId The ID of the proposal to set the tally of.\\n /// @param _tally The tally to set.\\n /// @dev The caller must be a committee member if the ONLY_COMMITTEE_SET_TALLY flag is set.\\n function _setTally(uint256 _proposalId, uint256[][] memory _tally) internal {\\n if (!_isCommitteeMember(_msgSender())) {\\n revert OnlyCommittee({\\n sender: _msgSender()\\n });\\n }\\n\\n Proposal storage proposal = proposals[_proposalId];\\n // if plugin settings changed since proposal creation, the proposal is no longer valid and the tally cannot be set\\n if (lastPluginSettingsChange >= proposal.parameters.securityBlock) {\\n revert PluginSettingsUpdatedTooRecently({\\n lastUpdate: lastPluginSettingsChange,\\n securityBlock: proposal.parameters.securityBlock\\n });\\n }\\n\\n if (!_isProposalOnTallyPhase(proposal)) {\\n revert ProposalNotInTallyPhase({\\n startDate: proposal.parameters.startDate,\\n endDate: proposal.parameters.endDate,\\n expirationDate: proposal.parameters.expirationDate,\\n currentTimestamp: block.timestamp\\n });\\n }\\n \\n if (_tally.length != 1) {\\n revert InvalidTally({tally: _tally});\\n }\\n\\n if (_tally[0].length != 3) {\\n revert InvalidTally({tally: _tally});\\n }\\n \\n // tally already set\\n if (proposal.tally.length != 0) {\\n // check proposal not already approved\\n if (proposal.approvers.length >= pluginSettings.minTallyApprovals) {\\n revert TallyAlreadyApproved({\\n approvals: proposal.approvers.length,\\n minApprovals: pluginSettings.minTallyApprovals\\n });\\n }\\n // check if the new tally is different\\n if (_tally[0][0] == proposal.tally[0][0] &&\\n _tally[0][1] == proposal.tally[0][1] &&\\n _tally[0][2] == proposal.tally[0][2]\\n ) {\\n revert InvalidTally({tally: _tally});\\n }\\n // reset approvers\\n proposal.approvers = new address[](0);\\n }\\n \\n proposal.tally = _tally;\\n proposal.approvers.push(_msgSender());\\n\\n emit TallySet({proposalId: _proposalId, tally: _tally});\\n emit TallyApproved({proposalId: _proposalId});\\n }\\n\\n /// @inheritdoc IVocdoniVoting\\n function approveTally(uint256 _proposalId, bool _tryExecution) public override {\\n return _approveTally(_proposalId, _tryExecution);\\n }\\n\\n /// @notice Internal function for approving a proposal tally.\\n /// @param _proposalId The ID of the proposal to approve.\\n /// @dev The caller must be a committee member if the ONLY_COMMITTEE_APPROVE_TALLY flag is set.\\n function _approveTally(uint256 _proposalId, bool _tryExecution) internal {\\n if (!_isCommitteeMember(_msgSender())) {\\n revert OnlyCommittee({\\n sender: _msgSender()\\n });\\n }\\n\\n Proposal storage proposal = proposals[_proposalId];\\n \\n if (proposal.tally.length == 0) {\\n revert InvalidTally(proposal.tally);\\n }\\n\\n if (hasApprovedTally(_proposalId)) {\\n revert TallyAlreadyApproved({\\n approvals: proposal.approvers.length,\\n minApprovals: pluginSettings.minTallyApprovals\\n });\\n }\\n \\n proposal.approvers.push(_msgSender());\\n \\n emit TallyApproved({proposalId: _proposalId});\\n \\n if (_tryExecution) {\\n _checkTallyAndExecute(_proposalId);\\n }\\n }\\n\\n /// @inheritdoc IVocdoniVoting\\n function executeProposal(uint256 _proposalId) public override {\\n _executeProposal(_proposalId);\\n }\\n\\n /// @notice Internal function for executing a proposal.\\n /// @param _proposalId The ID of the proposal to execute.\\n /// @dev The caller must be a committee member if the ONLY_COMMITTEE_EXECUTE flag is set.\\n function _executeProposal(uint256 _proposalId) internal {\\n Proposal storage proposal = proposals[_proposalId];\\n\\n if (!_isProposalOnTallyPhase(proposal)) {\\n revert ProposalNotInTallyPhase(\\n proposal.parameters.startDate,\\n proposal.parameters.endDate,\\n proposal.parameters.expirationDate,\\n block.timestamp\\n );\\n }\\n \\n _checkTallyAndExecute(_proposalId);\\n }\\n\\n /// @notice Internal function to check if a proposal is on the tally phase.\\n /// @param _proposal The proposal to check\\n function _isProposalOnTallyPhase(Proposal storage _proposal) internal view returns (bool) {\\n uint64 currentBlockTimestamp = uint64(block.timestamp);\\n /// [... startDate ............ endDate ............ expirationDate ...]\\n /// [............. Voting phase ....... Tally phase ...................]\\n if (_proposal.parameters.startDate < currentBlockTimestamp &&\\n _proposal.parameters.endDate <= currentBlockTimestamp &&\\n _proposal.parameters.expirationDate > currentBlockTimestamp &&\\n !_proposal.executed) {\\n return true;\\n }\\n return false;\\n }\\n\\n /// @notice Internal function to check the tally and execute a proposal if the tally\\n /// number of YES votes is greater than the tally number of NO votes.\\n function _checkTallyAndExecute(uint256 _proposalId) internal {\\n Proposal storage proposal = proposals[_proposalId];\\n\\n if(proposal.tally.length == 0) {\\n revert InvalidTally({\\n tally: proposal.tally\\n });\\n }\\n \\n if (proposal.approvers.length < pluginSettings.minTallyApprovals) {\\n revert NotEnoughApprovals({\\n minApprovals: pluginSettings.minTallyApprovals,\\n actualApprovals: proposal.approvers.length.toUint16()\\n });\\n }\\n \\n uint256 _currentParticipation = proposal.tally[0][0] + proposal.tally[0][1] + proposal.tally[0][2];\\n if (_currentParticipation < pluginSettings.minParticipation) {\\n revert MinParticipationNotReached({\\n currentParticipation: _currentParticipation,\\n minParticipation: pluginSettings.minParticipation\\n });\\n }\\n \\n uint256 _currentSupport = (RATIO_BASE - pluginSettings.supportThreshold) * proposal.tally[0][0];\\n if (_currentSupport <= pluginSettings.supportThreshold * proposal.tally[0][1]) {\\n revert SupportThresholdNotReached({\\n currentSupport: _currentSupport,\\n supportThreshold: pluginSettings.supportThreshold\\n });\\n }\\n \\n proposal.executed = true;\\n _executeProposal(\\n dao(),\\n _proposalId,\\n proposal.actions,\\n proposal.allowFailureMap\\n );\\n }\\n\\n\\n function _validateProposalDates(uint64 _startDate, uint64 _endDate, uint64 _expirationDate)\\n internal\\n view\\n virtual\\n returns(\\n uint64 startDate,\\n uint64 endDate,\\n uint64 expirationDate\\n ) {\\n uint64 currentBlockTimestamp = block.timestamp.toUint64();\\n // check proposal start date and set it to the current block timestamp if it is 0\\n if (_startDate == 0) {\\n startDate = currentBlockTimestamp;\\n } else {\\n startDate = _startDate;\\n if (startDate < currentBlockTimestamp) {\\n revert InvalidStartDate({\\n limit: currentBlockTimestamp,\\n actual: startDate\\n });\\n }\\n }\\n // check proposal end date and set it to the start date + min duration if it is 0\\n uint64 earliestEndDate = startDate + pluginSettings.minDuration; \\n // Since `minDuration` is limited to 1 year, `startDate + minDuration`\\n // can only overflow if the `startDate` is after `type(uint64).max - minDuration`. \\n // In this case, the proposal creation will revert and another date can be picked.\\n if (_endDate == 0) {\\n endDate = earliestEndDate;\\n } else {\\n endDate = _endDate;\\n if (endDate < earliestEndDate) {\\n revert InvalidEndDate({\\n limit: earliestEndDate,\\n actual: endDate\\n });\\n }\\n }\\n // check proposal expiration date and set it to the (endDate + min duration) if it is 0\\n uint64 earliestExpirationDate = endDate + pluginSettings.minDuration;\\n if (_expirationDate == 0) {\\n expirationDate = earliestExpirationDate;\\n } else {\\n expirationDate = _expirationDate;\\n if (expirationDate < earliestExpirationDate) {\\n revert InvalidExpirationDate({\\n limit: earliestExpirationDate,\\n actual: expirationDate\\n });\\n }\\n }\\n }\\n\\n /// @notice Gets the plugin settings.\\n /// @return The plugin settings.\\n function getPluginSettings() public view returns (PluginSettings memory) {\\n return pluginSettings;\\n }\\n\\n /// @notice Returns true if msg.sender has approved the given proposal tally\\n /// @param _proposalId The ID of the proposal.\\n /// @return Whether the msg.sender has approved the proposal tally.\\n function hasApprovedTally(uint256 _proposalId) public view returns (bool) {\\n Proposal storage proposal = proposals[_proposalId];\\n for (uint16 i = 0; i < proposal.approvers.length; i++) {\\n if (proposal.approvers[i] == _msgSender()) {\\n return true;\\n }\\n }\\n return false;\\n }\\n\\n /// @notice This empty reserved space is put in place to allow future versions to add new variables\\n /// without shifting down storage in the inheritance chain (see [OpenZeppelin's guide about storage gaps]\\n /// (https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps)).\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x337238391705e83a0bde383388e103948bd1c053ca09b3e094ed3a55ba648fbb\",\"license\":\"AGPL-3.0-or-later\"},\"src/VocdoniVotingSetup.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-or-later\\npragma solidity ^0.8.17;\\n\\nimport {IDAO} from \\\"@aragon/osx/core/dao/IDAO.sol\\\";\\nimport {DAO} from \\\"@aragon/osx/core/dao/DAO.sol\\\";\\nimport {PermissionLib} from \\\"@aragon/osx/core/permission/PermissionLib.sol\\\";\\nimport {PluginSetup, IPluginSetup} from \\\"@aragon/osx/framework/plugin/setup/PluginSetup.sol\\\";\\nimport {VocdoniVoting} from \\\"./VocdoniVoting.sol\\\";\\n\\nimport {Clones} from \\\"@openzeppelin/contracts/proxy/Clones.sol\\\";\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\nimport {ERC165Checker} from \\\"@openzeppelin/contracts/utils/introspection/ERC165Checker.sol\\\";\\nimport {IERC20Upgradeable} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\nimport {IVotesUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/governance/utils/IVotesUpgradeable.sol\\\";\\n\\nimport {GovernanceERC20} from \\\"@aragon/osx/token/ERC20/governance/GovernanceERC20.sol\\\";\\nimport {GovernanceWrappedERC20} from \\\"@aragon/osx/token/ERC20/governance/GovernanceWrappedERC20.sol\\\";\\nimport {IGovernanceWrappedERC20} from \\\"@aragon/osx/token/ERC20/governance/IGovernanceWrappedERC20.sol\\\";\\n\\n/// @title VocdoniVotingSetup\\n/// @author Vocdoni\\n/// @notice The setup contract of the `VocdoniVoting` plugin.\\ncontract VocdoniVotingSetup is PluginSetup {\\n using Address for address;\\n using Clones for address;\\n using ERC165Checker for address;\\n\\n /// @notice The address of `VocdoniVoting` plugin logic contract to be used in creating proxy contracts.\\n VocdoniVoting private immutable vocdoniVoting;\\n\\n /// @notice The address of the `GovernanceERC20` base contract.\\n address public immutable governanceERC20Base;\\n\\n /// @notice The address of the `GovernanceWrappedERC20` base contract.\\n address public immutable governanceWrappedERC20Base;\\n\\n /// @notice The token settings struct.\\n /// @param addr The token address. If this is `address(0)`, a new `GovernanceERC20` token is deployed. If not, the existing token is wrapped as an `GovernanceWrappedERC20`.\\n /// @param name The token name. This parameter is only relevant if the token address is `address(0)`.\\n /// @param symbol The token symbol. This parameter is only relevant if the token address is `address(0)`.\\n struct TokenSettings {\\n address addr;\\n string name;\\n string symbol;\\n }\\n\\n /// @notice Thrown if token address is passed which is not a token.\\n /// @param token The token address\\n error TokenNotContract(address token);\\n\\n /// @notice Thrown if token address is not ERC20.\\n /// @param token The token address\\n error TokenNotERC20(address token);\\n\\n /// @notice Thrown if passed helpers array is of wrong length.\\n /// @param length The array length of passed helpers.\\n error WrongHelpersArrayLength(uint256 length);\\n\\n /// @notice The contract constructor, that deploys the `VocdoniVoting` plugin logic contract.\\n constructor(\\n GovernanceERC20 _governanceERC20Base,\\n GovernanceWrappedERC20 _governanceWrappedERC20Base\\n ) { \\n governanceERC20Base = address(_governanceERC20Base);\\n governanceWrappedERC20Base = address(_governanceWrappedERC20Base);\\n vocdoniVoting = new VocdoniVoting();\\n }\\n\\n /// @inheritdoc IPluginSetup\\n function prepareInstallation(address _dao, bytes calldata _data)\\n external\\n returns (address plugin, PreparedSetupData memory preparedSetupData)\\n {\\n // Decode `_data` to extract the params needed for deploying and initializing `VocdoniVoting` plugin.\\n (\\n address[] memory committee,\\n VocdoniVoting.PluginSettings memory pluginSettings,\\n TokenSettings memory tokenSettings,\\n // only used for GovernanceERC20(token is not passed)\\n GovernanceERC20.MintSettings memory mintSettings\\n ) =\\n abi.decode(\\n _data,\\n (\\n address[],\\n VocdoniVoting.PluginSettings,\\n TokenSettings,\\n GovernanceERC20.MintSettings\\n )\\n );\\n\\n address token = tokenSettings.addr;\\n\\n // Prepare helpers.\\n address[] memory helpers = new address[](1);\\n\\n if (token != address(0)) {\\n if (!token.isContract()) {\\n revert TokenNotContract(token);\\n }\\n\\n if (!_isERC20(token)) {\\n revert TokenNotERC20(token);\\n }\\n\\n // [0] = IERC20Upgradeable, [1] = IVotesUpgradeable, [2] = IGovernanceWrappedERC20\\n bool[] memory supportedIds = _getTokenInterfaceIds(token);\\n\\n if (\\n // If token supports none of them\\n // it's simply ERC20 which gets checked by _isERC20\\n // Currently, not a satisfiable check.\\n (!supportedIds[0] && !supportedIds[1] && !supportedIds[2]) ||\\n // If token supports IERC20, but neither\\n // IVotes nor IGovernanceWrappedERC20, it needs wrapping.\\n (supportedIds[0] && !supportedIds[1] && !supportedIds[2])\\n ) {\\n token = governanceWrappedERC20Base.clone();\\n // User already has a token. We need to wrap it in\\n // GovernanceWrappedERC20 in order to make the token\\n // include governance functionality.\\n GovernanceWrappedERC20(token).initialize(\\n IERC20Upgradeable(tokenSettings.addr),\\n tokenSettings.name,\\n tokenSettings.symbol\\n );\\n }\\n } else {\\n // Clone a `GovernanceERC20`.\\n token = governanceERC20Base.clone();\\n GovernanceERC20(token).initialize(\\n IDAO(_dao),\\n tokenSettings.name,\\n tokenSettings.symbol,\\n mintSettings\\n );\\n }\\n\\n helpers[0] = token;\\n\\n // Prepare and Deploy the plugin proxy.\\n plugin = createERC1967Proxy(\\n address(vocdoniVoting),\\n abi.encodeWithSelector(VocdoniVoting.initialize.selector, _dao, committee, pluginSettings)\\n );\\n\\n // Prepare permissions\\n PermissionLib.MultiTargetPermission[]\\n memory permissions = new PermissionLib.MultiTargetPermission[](\\n tokenSettings.addr != address(0) ? 4 : 5\\n );\\n\\n // Set permissions to be granted.\\n // Grant the list of permissions of the plugin to the DAO.\\n permissions[0] = PermissionLib.MultiTargetPermission(\\n PermissionLib.Operation.Grant,\\n plugin,\\n _dao,\\n PermissionLib.NO_CONDITION,\\n vocdoniVoting.UPDATE_PLUGIN_SETTINGS_PERMISSION_ID()\\n );\\n\\n permissions[1] = PermissionLib.MultiTargetPermission(\\n PermissionLib.Operation.Grant,\\n plugin,\\n _dao,\\n PermissionLib.NO_CONDITION,\\n vocdoniVoting.UPDATE_PLUGIN_COMMITTEE_PERMISSION_ID()\\n );\\n\\n permissions[2] = PermissionLib.MultiTargetPermission(\\n PermissionLib.Operation.Grant,\\n plugin,\\n _dao,\\n PermissionLib.NO_CONDITION,\\n vocdoniVoting.UPGRADE_PLUGIN_PERMISSION_ID()\\n );\\n\\n // Grant `EXECUTE_PERMISSION` of the DAO to the plugin.\\n permissions[3] = PermissionLib.MultiTargetPermission(\\n PermissionLib.Operation.Grant,\\n _dao,\\n plugin,\\n PermissionLib.NO_CONDITION,\\n DAO(payable(_dao)).EXECUTE_PERMISSION_ID()\\n );\\n\\n if (tokenSettings.addr == address(0)) {\\n bytes32 tokenMintPermission = GovernanceERC20(token).MINT_PERMISSION_ID();\\n\\n permissions[4] = PermissionLib.MultiTargetPermission(\\n PermissionLib.Operation.Grant,\\n token,\\n _dao,\\n PermissionLib.NO_CONDITION,\\n tokenMintPermission\\n );\\n }\\n\\n preparedSetupData.helpers = helpers;\\n preparedSetupData.permissions = permissions;\\n }\\n\\n /// @inheritdoc IPluginSetup\\n function prepareUninstallation(address _dao, SetupPayload calldata _payload)\\n external\\n view\\n returns (PermissionLib.MultiTargetPermission[] memory permissions)\\n {\\n // Prepare permissions.\\n uint256 helperLength = _payload.currentHelpers.length;\\n if (helperLength != 1) {\\n revert WrongHelpersArrayLength({length: helperLength});\\n }\\n\\n // token can be either GovernanceERC20, GovernanceWrappedERC20, or IVotesUpgradeable, which\\n // does not follow the GovernanceERC20 and GovernanceWrappedERC20 standard.\\n address token = _payload.currentHelpers[0];\\n\\n bool[] memory supportedIds = _getTokenInterfaceIds(token);\\n\\n bool isGovernanceERC20 = supportedIds[0] && supportedIds[1] && !supportedIds[2];\\n\\n permissions = new PermissionLib.MultiTargetPermission[](isGovernanceERC20 ? 5 : 4);\\n\\n // Set permissions to be Revoked.\\n permissions[0] = PermissionLib.MultiTargetPermission(\\n PermissionLib.Operation.Revoke,\\n _payload.plugin,\\n _dao,\\n PermissionLib.NO_CONDITION,\\n vocdoniVoting.UPDATE_PLUGIN_SETTINGS_PERMISSION_ID()\\n );\\n\\n permissions[1] = PermissionLib.MultiTargetPermission(\\n PermissionLib.Operation.Revoke,\\n _payload.plugin,\\n _dao,\\n PermissionLib.NO_CONDITION,\\n vocdoniVoting.UPDATE_PLUGIN_COMMITTEE_PERMISSION_ID()\\n );\\n\\n permissions[2] = PermissionLib.MultiTargetPermission(\\n PermissionLib.Operation.Revoke,\\n _payload.plugin,\\n _dao,\\n PermissionLib.NO_CONDITION,\\n vocdoniVoting.UPGRADE_PLUGIN_PERMISSION_ID()\\n );\\n\\n permissions[3] = PermissionLib.MultiTargetPermission(\\n PermissionLib.Operation.Revoke,\\n _dao,\\n _payload.plugin,\\n PermissionLib.NO_CONDITION,\\n DAO(payable(_dao)).EXECUTE_PERMISSION_ID()\\n );\\n\\n // Revocation of permission is necessary only if the deployed token is GovernanceERC20,\\n // as GovernanceWrapped does not possess this permission. Only return the following\\n // if it's type of GovernanceERC20, otherwise revoking this permission wouldn't have any effect.\\n if (isGovernanceERC20) {\\n permissions[4] = PermissionLib.MultiTargetPermission(\\n PermissionLib.Operation.Revoke,\\n token,\\n _dao,\\n PermissionLib.NO_CONDITION,\\n GovernanceERC20(token).MINT_PERMISSION_ID()\\n );\\n }\\n }\\n\\n /// @inheritdoc IPluginSetup\\n function implementation() external view virtual override returns (address) {\\n return address(vocdoniVoting);\\n }\\n\\n /// @notice Retrieves the interface identifiers supported by the token contract.\\n /// @dev It is crucial to verify if the provided token address represents a valid contract before using the below.\\n /// @param token The token address\\n function _getTokenInterfaceIds(address token) private view returns (bool[] memory) {\\n bytes4[] memory interfaceIds = new bytes4[](3);\\n interfaceIds[0] = type(IERC20Upgradeable).interfaceId;\\n interfaceIds[1] = type(IVotesUpgradeable).interfaceId;\\n interfaceIds[2] = type(IGovernanceWrappedERC20).interfaceId;\\n return token.getSupportedInterfaces(interfaceIds);\\n }\\n\\n /// @notice Unsatisfiably determines if the contract is an ERC20 token.\\n /// @dev It's important to first check whether token is a contract prior to this call.\\n /// @param token The token address\\n function _isERC20(address token) private view returns (bool) {\\n (bool success, bytes memory data) = token.staticcall(\\n abi.encodeWithSelector(IERC20Upgradeable.balanceOf.selector, address(this))\\n );\\n return success && data.length == 0x20;\\n }\\n}\\n\",\"keccak256\":\"0x48dc07a48c99dfba215109562b39a507a46d719c2a11bafe4eafcd54d9039f3b\",\"license\":\"AGPL-3.0-or-later\"}},\"version\":1}", + "bytecode": "0x60e06040523480156200001157600080fd5b5060405162008561380380620085618339810160408190526200003491620000af565b6001600160a01b0380831660a052811660c052604051620000559062000088565b604051809103906000f08015801562000072573d6000803e3d6000fd5b506001600160a01b031660805250620000ee9050565b61548380620030de83390190565b6001600160a01b0381168114620000ac57600080fd5b50565b60008060408385031215620000c357600080fd5b8251620000d08162000096565b6020840151909250620000e38162000096565b809150509250929050565b60805160a05160c051612f826200015c600039600081816101800152610c3b01526000818160be0152610d1d0152600081816101080152818161049f015281816105cd015281816106fb01528181610e2f0152818161102301528181611141015261125f0152612f826000f3fe60806040523480156200001157600080fd5b5060043610620000875760003560e01c80639cb0a12411620000625780639cb0a124146200012d578063a8a9c29e1462000153578063e89b6b91146200017a578063f10832f114620001a257600080fd5b806301ffc9a7146200008c578063599cb1a614620000b85780635c60da1b1462000106575b600080fd5b620000a36200009d36600462001b04565b620001c9565b60405190151581526020015b60405180910390f35b620000e07f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001620000af565b7f0000000000000000000000000000000000000000000000000000000000000000620000e0565b620001446200013e36600462001b86565b62000263565b604051620000af919062001c67565b6200016a6200016436600462001cc7565b620009d1565b604051620000af92919062001e5e565b620000e07f000000000000000000000000000000000000000000000000000000000000000081565b620001b9620001b336600462001e90565b620009f9565b604051620000af92919062001f1a565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f99718b500000000000000000000000000000000000000000000000000000000014806200025d57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b6060600062000276602084018462001f4b565b91505060018114620002bc576040517ff14c61fc000000000000000000000000000000000000000000000000000000008152600481018290526024015b60405180910390fd5b6000620002cd602085018562001f4b565b6000818110620002e157620002e162001fbd565b9050602002016020810190620002f8919062001fec565b90506000620003078262001523565b905060008160008151811062000321576200032162001fbd565b602002602001015180156200035057508160018151811062000347576200034762001fbd565b60200260200101515b8015620003785750816002815181106200036e576200036e62001fbd565b6020026020010151155b905080620003885760046200038b565b60055b60ff1667ffffffffffffffff811115620003a957620003a96200200a565b6040519080825280602002602001820160405280156200042257816020015b6040805160a0810182526000808252602080830182905292820181905260608201819052608082015282527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff909201910181620003c85790505b506040805160a0810190915260018152909550602080820190620004499089018962001fec565b73ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020017f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663e2c801b66040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000509573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200052f919062002039565b8152508560008151811062000548576200054862001fbd565b60209081029190910101526040805160a081019091528060018152602090810190620005779089018962001fec565b73ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020017f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166368d35a656040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000637573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200065d919062002039565b8152508560018151811062000676576200067662001fbd565b60209081029190910101526040805160a081019091528060018152602090810190620006a59089018962001fec565b73ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020017f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663c9c4bfca6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000765573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200078b919062002039565b81525085600281518110620007a457620007a462001fbd565b60209081029190910101526040805160a0810190915280600181526020018873ffffffffffffffffffffffffffffffffffffffff168152602001876000016020810190620007f3919062001fec565b73ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff16630729d0546040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000877573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200089d919062002039565b81525085600381518110620008b657620008b662001fbd565b60200260200101819052508015620009c7576040805160a0810190915280600181526020018473ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1663b2d2989c6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200097c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620009a2919062002039565b81525085600481518110620009bb57620009bb62001fbd565b60200260200101819052505b5050505092915050565b6060620009f1604051806040016040528060608152602001606081525090565b935093915050565b600062000a19604051806040016040528060608152602001606081525090565b600080808062000a2c87890189620023de565b81516040805160018082528183019092529599509397509195509350916000916020808301908036833701905050905073ffffffffffffffffffffffffffffffffffffffff82161562000d175773ffffffffffffffffffffffffffffffffffffffff82163b62000ae1576040517f18aca2db00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83166004820152602401620002b3565b62000aec82620016e0565b62000b3c576040517ffa8925f100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83166004820152602401620002b3565b600062000b498362001523565b90508060008151811062000b615762000b6162001fbd565b602002602001015115801562000b9257508060018151811062000b885762000b8862001fbd565b6020026020010151155b801562000bba57508060028151811062000bb05762000bb062001fbd565b6020026020010151155b8062000c2f57508060008151811062000bd75762000bd762001fbd565b6020026020010151801562000c0757508060018151811062000bfd5762000bfd62001fbd565b6020026020010151155b801562000c2f57508060028151811062000c255762000c2562001fbd565b6020026020010151155b1562000d105762000c767f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16620017d2565b8551602087015160408089015190517f9065714700000000000000000000000000000000000000000000000000000000815293965073ffffffffffffffffffffffffffffffffffffffff87169363906571479362000cdb939092909160040162002547565b600060405180830381600087803b15801562000cf657600080fd5b505af115801562000d0b573d6000803e3d6000fd5b505050505b5062000dd8565b62000d587f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16620017d2565b91508173ffffffffffffffffffffffffffffffffffffffff1663dab27fa98c86602001518760400151876040518563ffffffff1660e01b815260040162000da3949392919062002596565b600060405180830381600087803b15801562000dbe57600080fd5b505af115801562000dd3573d6000803e3d6000fd5b505050505b818160008151811062000def5762000def62001fbd565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505062000ef07f000000000000000000000000000000000000000000000000000000000000000063038d6c9d60e01b8d898960405160240162000e6d939291906200264b565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526200189c565b845190985060009073ffffffffffffffffffffffffffffffffffffffff1662000f1b57600562000f1e565b60045b60ff1667ffffffffffffffff81111562000f3c5762000f3c6200200a565b60405190808252806020026020018201604052801562000fb557816020015b6040805160a0810182526000808252602080830182905292820181905260608201819052608082015282527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90920191018162000f5b5790505b506040805160a0810190915290915080600081526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020017f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663e2c801b66040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200108d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620010b3919062002039565b81525081600081518110620010cc57620010cc62001fbd565b60209081029190910101526040805160a0810190915280600081526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020017f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166368d35a656040518163ffffffff1660e01b8152600401602060405180830381865afa158015620011ab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620011d1919062002039565b81525081600181518110620011ea57620011ea62001fbd565b60209081029190910101526040805160a0810190915280600081526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020017f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663c9c4bfca6040518163ffffffff1660e01b8152600401602060405180830381865afa158015620012c9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620012ef919062002039565b8152508160028151811062001308576200130862001fbd565b60209081029190910101526040805160a0810190915280600081526020018d73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff16630729d0546040518163ffffffff1660e01b8152600401602060405180830381865afa158015620013c7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620013ed919062002039565b8152508160038151811062001406576200140662001fbd565b6020908102919091010152845173ffffffffffffffffffffffffffffffffffffffff166200150b5760008373ffffffffffffffffffffffffffffffffffffffff1663b2d2989c6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200147c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620014a2919062002039565b6040805160a08101909152909150806000815273ffffffffffffffffffffffffffffffffffffffff80871660208301528f16604082015260006060820152608001829052825183906004908110620014fe57620014fe62001fbd565b6020026020010181905250505b90875260208701525094989397509295505050505050565b60408051600380825260808201909252606091600091906020820184803683370190505090507f36372b07000000000000000000000000000000000000000000000000000000008160008151811062001580576200158062001fbd565b60200260200101907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815250507fe90fb3f6000000000000000000000000000000000000000000000000000000008160018151811062001603576200160362001fbd565b60200260200101907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815250507f0f13099a000000000000000000000000000000000000000000000000000000008160028151811062001686576200168662001fbd565b7fffffffff0000000000000000000000000000000000000000000000000000000090921660209283029190910190910152620016d973ffffffffffffffffffffffffffffffffffffffff841682620018aa565b9392505050565b604080513060248083019190915282518083039091018152604490910182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f70a082310000000000000000000000000000000000000000000000000000000017905290516000918291829173ffffffffffffffffffffffffffffffffffffffff86169162001774919062002742565b600060405180830381855afa9150503d8060008114620017b1576040519150601f19603f3d011682016040523d82523d6000602084013e620017b6565b606091505b5091509150818015620017ca575080516020145b949350505050565b6000763d602d80600a3d3981f3363d3d373d3d3d363d730000008260601b60e81c176000526e5af43d82803e903d91602b57fd5bf38260781b17602052603760096000f0905073ffffffffffffffffffffffffffffffffffffffff811662001897576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f455243313136373a20637265617465206661696c6564000000000000000000006044820152606401620002b3565b919050565b6000620016d9838362001980565b60606000825167ffffffffffffffff811115620018cb57620018cb6200200a565b604051908082528060200260200182016040528015620018f5578160200160208202803683370190505b5090506200190384620019bc565b15620016d95760005b835181101562001978576200193e8585838151811062001930576200193062001fbd565b602002602001015162001a25565b82828151811062001953576200195362001fbd565b91151560209283029190910190910152806200196f8162002760565b9150506200190c565b509392505050565b60008282604051620019929062001af6565b6200199f929190620027c0565b604051809103906000f08015801562001978573d6000803e3d6000fd5b6000620019ea827f01ffc9a70000000000000000000000000000000000000000000000000000000062001a25565b80156200025d575062001a1e827fffffffff0000000000000000000000000000000000000000000000000000000062001a25565b1592915050565b604080517fffffffff000000000000000000000000000000000000000000000000000000008316602480830191909152825180830390910181526044909101909152602080820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a700000000000000000000000000000000000000000000000000000000178152825160009392849283928392918391908a617530fa92503d9150600051905082801562001ade575060208210155b801562001aeb5750600081115b979650505050505050565b61078480620027f283390190565b60006020828403121562001b1757600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114620016d957600080fd5b803573ffffffffffffffffffffffffffffffffffffffff811681146200189757600080fd5b60006060828403121562001b8057600080fd5b50919050565b6000806040838503121562001b9a57600080fd5b62001ba58362001b48565b9150602083013567ffffffffffffffff81111562001bc257600080fd5b62001bd08582860162001b6d565b9150509250929050565b600081516003811062001c16577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b83525060208181015173ffffffffffffffffffffffffffffffffffffffff90811691840191909152604080830151821690840152606080830151909116908301526080908101519082015260a00190565b6020808252825182820181905260009190848201906040850190845b8181101562001ca85762001c9983855162001bda565b93850193925060010162001c83565b50909695505050505050565b803561ffff811681146200189757600080fd5b60008060006060848603121562001cdd57600080fd5b62001ce88462001b48565b925062001cf86020850162001cb4565b9150604084013567ffffffffffffffff81111562001d1557600080fd5b62001d238682870162001b6d565b9150509250925092565b60005b8381101562001d4a57818101518382015260200162001d30565b50506000910152565b6000815180845262001d6d81602086016020860162001d2d565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600081518084526020808501945080840160005b8381101562001de757815173ffffffffffffffffffffffffffffffffffffffff168752958201959082019060010162001db3565b509495945050505050565b600081516040845262001e09604085018262001d9f565b60208481015186830387830152805180845290820193509091600091908301905b8083101562001e535762001e4082865162001bda565b9150838501945060018301925062001e2a565b509695505050505050565b60408152600062001e73604083018562001d53565b828103602084015262001e87818562001df2565b95945050505050565b60008060006040848603121562001ea657600080fd5b62001eb18462001b48565b9250602084013567ffffffffffffffff8082111562001ecf57600080fd5b818601915086601f83011262001ee457600080fd5b81358181111562001ef457600080fd5b87602082850101111562001f0757600080fd5b6020830194508093505050509250925092565b73ffffffffffffffffffffffffffffffffffffffff83168152604060208201526000620017ca604083018462001df2565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811262001f8157600080fd5b83018035915067ffffffffffffffff82111562001f9d57600080fd5b6020019150600581901b360382131562001fb657600080fd5b9250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121562001fff57600080fd5b620016d98262001b48565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000602082840312156200204c57600080fd5b5051919050565b6040805190810167ffffffffffffffff811182821017156200207957620020796200200a565b60405290565b604051610100810167ffffffffffffffff811182821017156200207957620020796200200a565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715620020f057620020f06200200a565b604052919050565b600067ffffffffffffffff8211156200211557620021156200200a565b5060051b60200190565b600082601f8301126200213157600080fd5b813560206200214a6200214483620020f8565b620020a6565b82815260059290921b840181019181810190868411156200216a57600080fd5b8286015b8481101562001e5357620021828162001b48565b83529183019183016200216e565b803580151581146200189757600080fd5b803563ffffffff811681146200189757600080fd5b803567ffffffffffffffff811681146200189757600080fd5b600082601f830112620021e157600080fd5b813567ffffffffffffffff811115620021fe57620021fe6200200a565b6200223160207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601620020a6565b8181528460208386010111156200224757600080fd5b816020850160208301376000918101602001919091529392505050565b6000606082840312156200227757600080fd5b6040516060810167ffffffffffffffff82821081831117156200229e576200229e6200200a565b81604052829350620022b08562001b48565b83526020850135915080821115620022c757600080fd5b620022d586838701620021cf565b60208401526040850135915080821115620022ef57600080fd5b50620022fe85828601620021cf565b6040830152505092915050565b6000604082840312156200231e57600080fd5b6200232862002053565b9050813567ffffffffffffffff808211156200234357600080fd5b62002351858386016200211f565b83526020915081840135818111156200236957600080fd5b84019050601f810185136200237d57600080fd5b80356200238e6200214482620020f8565b81815260059190911b82018301908381019087831115620023ae57600080fd5b928401925b82841015620023ce57833582529284019290840190620023b3565b8085870152505050505092915050565b60008060008060808587031215620023f557600080fd5b843567ffffffffffffffff808211156200240e57600080fd5b6200241c888389016200211f565b955060208701359150808211156200243357600080fd5b9086019061010082890312156200244957600080fd5b620024536200207f565b6200245e8362002190565b81526200246e6020840162001cb4565b60208201526200248160408401620021a1565b60408201526200249460608401620021a1565b6060820152620024a760808401620021b6565b6080820152620024ba60a0840162001b48565b60a082015260c083013560c082015260e083013582811115620024dc57600080fd5b620024ea8a828601620021cf565b60e083015250945060408701359150808211156200250757600080fd5b620025158883890162002264565b935060608701359150808211156200252c57600080fd5b506200253b878288016200230b565b91505092959194509250565b73ffffffffffffffffffffffffffffffffffffffff8416815260606020820152600062002578606083018562001d53565b82810360408401526200258c818562001d53565b9695505050505050565b73ffffffffffffffffffffffffffffffffffffffff8516815260006020608081840152620025c8608084018762001d53565b8381036040850152620025dc818762001d53565b90508381036060850152845160408252620025fb604083018262001d9f565b8684015183820393850193909352825180825290840192840191506000905b808210156200263c57825184529284019291840191600191909101906200261a565b50919998505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff841681526060602082015260006200267c606083018562001d9f565b828103604084015261010084511515825261ffff60208601511660208301526040850151620026b3604084018263ffffffff169052565b506060850151620026cc606084018263ffffffff169052565b506080850151620026e9608084018267ffffffffffffffff169052565b5060a08501516200271260a084018273ffffffffffffffffffffffffffffffffffffffff169052565b5060c085015160c083015260e08501518160e0840152620027368284018262001d53565b98975050505050505050565b600082516200275681846020870162001d2d565b9190910192915050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203620027b9577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b5060010190565b73ffffffffffffffffffffffffffffffffffffffff83168152604060208201526000620017ca604083018462001d5356fe608060405260405161078438038061078483398101604081905261002291610319565b61002e82826000610035565b5050610436565b61003e8361006b565b60008251118061004b5750805b156100665761006483836100ab60201b6100291760201c565b505b505050565b610074816100d7565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606100d0838360405180606001604052806027815260200161075d602791396101a9565b9392505050565b6100ea8161022260201b6100551760201c565b6101515760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084015b60405180910390fd5b806101887f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b61023160201b6100711760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b6060600080856001600160a01b0316856040516101c691906103e7565b600060405180830381855af49150503d8060008114610201576040519150601f19603f3d011682016040523d82523d6000602084013e610206565b606091505b50909250905061021886838387610234565b9695505050505050565b6001600160a01b03163b151590565b90565b606083156102a357825160000361029c576001600160a01b0385163b61029c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610148565b50816102ad565b6102ad83836102b5565b949350505050565b8151156102c55781518083602001fd5b8060405162461bcd60e51b81526004016101489190610403565b634e487b7160e01b600052604160045260246000fd5b60005b838110156103105781810151838201526020016102f8565b50506000910152565b6000806040838503121561032c57600080fd5b82516001600160a01b038116811461034357600080fd5b60208401519092506001600160401b038082111561036057600080fd5b818501915085601f83011261037457600080fd5b815181811115610386576103866102df565b604051601f8201601f19908116603f011681019083821181831017156103ae576103ae6102df565b816040528281528860208487010111156103c757600080fd5b6103d88360208301602088016102f5565b80955050505050509250929050565b600082516103f98184602087016102f5565b9190910192915050565b60208152600082518060208401526104228160408501602087016102f5565b601f01601f19169190910160400192915050565b610318806104456000396000f3fe60806040523661001357610011610017565b005b6100115b610027610022610074565b6100b9565b565b606061004e83836040518060600160405280602781526020016102e5602791396100dd565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b90565b60006100b47f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b905090565b3660008037600080366000845af43d6000803e8080156100d8573d6000f35b3d6000fd5b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516101079190610277565b600060405180830381855af49150503d8060008114610142576040519150601f19603f3d011682016040523d82523d6000602084013e610147565b606091505b509150915061015886838387610162565b9695505050505050565b606083156101fd5782516000036101f65773ffffffffffffffffffffffffffffffffffffffff85163b6101f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064015b60405180910390fd5b5081610207565b610207838361020f565b949350505050565b81511561021f5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101ed9190610293565b60005b8381101561026e578181015183820152602001610256565b50506000910152565b60008251610289818460208701610253565b9190910192915050565b60208152600082518060208401526102b2816040850160208701610253565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a164736f6c6343000811000a416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a164736f6c6343000811000a60a0604052306080523480156200001557600080fd5b506200002062000026565b620000e7565b600054610100900460ff1615620000935760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811614620000e5576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6080516153646200011f6000396000818161090b015281816109bb01528181610b6101528181610c110152610d5601526153646000f3fe6080604052600436106101ac5760003560e01c806368d35a65116100ec578063c7f758a81161008a578063e2c801b611610064578063e2c801b6146104e2578063e636d84b14610516578063f794062e14610536578063fada5c5b1461055657600080fd5b8063c7f758a814610466578063c9c4bfca14610499578063da35c664146104cd57600080fd5b8063849cbe9d116100c6578063849cbe9d146103e457806386f0e4ed14610404578063a1d4259314610426578063b1bb8d261461044657600080fd5b806368d35a65146103705780636a6b2d86146103a457806380317232146103c457600080fd5b80633659cfe61161015957806341de68301161013357806341de6830146103175780634f1ef2861461033357806352d1902d146103465780635c60da1b1461035b57600080fd5b80633659cfe61461028b57806339ac11ff146102ab5780634162169f146102cb57600080fd5b80630d61b5191161018a5780630d61b519146102285780630f525a261461024857806327f1608d1461026857600080fd5b806301ffc9a7146101b1578063038d6c9d146101e65780630d0d0bcd14610208575b600080fd5b3480156101bd57600080fd5b506101d16101cc3660046140ac565b610576565b60405190151581526020015b60405180910390f35b3480156101f257600080fd5b506102066102013660046143ff565b61066a565b005b34801561021457600080fd5b5061020661022336600461447b565b6108a0565b34801561023457600080fd5b506102066102433660046144ab565b6108ae565b34801561025457600080fd5b506102066102633660046144e8565b6108ba565b34801561027457600080fd5b5061027d6108c4565b6040519081526020016101dd565b34801561029757600080fd5b506102066102a63660046145fb565b6108f4565b3480156102b757600080fd5b506102066102c6366004614618565b610af6565b3480156102d757600080fd5b5060c95473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101dd565b34801561032357600080fd5b5060006040516101dd919061464d565b61020661034136600461468e565b610b4a565b34801561035257600080fd5b5061027d610d3c565b34801561036757600080fd5b506102f2610e29565b34801561037c57600080fd5b5061027d7ffab288b6b9cb53626ebb83c9311148c2be1def872412367cd65e82a9521b524281565b3480156103b057600080fd5b5061027d6103bf3660046144ab565b610e6e565b3480156103d057600080fd5b506102066103df3660046146de565b610e7c565b3480156103f057600080fd5b506102066103ff3660046146de565b610f70565b34801561041057600080fd5b50610419611081565b6040516101dd919061478e565b34801561043257600080fd5b5061027d610441366004614932565b6111f6565b34801561045257600080fd5b506101d1610461366004614a08565b6116da565b34801561047257600080fd5b506104866104813660046144ab565b611714565b6040516101dd9796959493929190614b7d565b3480156104a557600080fd5b5061027d7f821b6e3a557148015a918c89e5d092e878a69854a2d1a410635f771bd5a8a3f581565b3480156104d957600080fd5b5061027d611a0f565b3480156104ee57600080fd5b5061027d7f466d2da9531a54b43e3d2bf44c5531ee51046862cbec6aecc512537816c35efe81565b34801561052257600080fd5b506101d16105313660046145fb565b611a1b565b34801561054257600080fd5b506101d16105513660046145fb565b611a26565b34801561056257600080fd5b506101d16105713660046144ab565b611a7d565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167fee289c8b00000000000000000000000000000000000000000000000000000000148061060957507fffffffff0000000000000000000000000000000000000000000000000000000082167feda5f01600000000000000000000000000000000000000000000000000000000145b8061065557507fffffffff0000000000000000000000000000000000000000000000000000000082167f0bb5c60300000000000000000000000000000000000000000000000000000000145b80610664575061066482611b1b565b92915050565b600054610100900460ff161580801561068a5750600054600160ff909116105b806106a45750303b1580156106a4575060005460ff166001145b610735576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055801561079357600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b61079c85611b71565b61ffff8311156107e3576040517f125ae34000000000000000000000000000000000000000000000000000000000815261ffff60048201526024810184905260440161072c565b6107ed8484611c11565b83836040516107fd929190614c69565b604051908190038120907f1a88aae304f687af7ff0d4ff69a63f0093c5d391ca7fa344b896406980dd870390600090a261083682611d3a565b801561089957600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050565b6108aa82826120db565b5050565b6108b781612215565b50565b6108aa82826122c9565b60006108d1610160612791565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16905090565b73ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001630036109b9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c0000000000000000000000000000000000000000606482015260840161072c565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16610a2e7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1614610ad1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f6163746976652070726f78790000000000000000000000000000000000000000606482015260840161072c565b610ada816127ef565b604080516000808252602082019092526108b791839190612835565b60c9547f466d2da9531a54b43e3d2bf44c5531ee51046862cbec6aecc512537816c35efe90610b419073ffffffffffffffffffffffffffffffffffffffff1630335b84600036612a34565b6108aa82611d3a565b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000163003610c0f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c0000000000000000000000000000000000000000606482015260840161072c565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16610c847f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1614610d27576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f6163746976652070726f78790000000000000000000000000000000000000000606482015260840161072c565b610d30826127ef565b6108aa82826001612835565b60003073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610e03576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c0000000000000000606482015260840161072c565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5b90565b6000610e697f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b905090565b600061066461016083612b3c565b60c9547ffab288b6b9cb53626ebb83c9311148c2be1def872412367cd65e82a9521b524290610ec29073ffffffffffffffffffffffffffffffffffffffff163033610b38565b600082610ecd6108c4565b610ed79190614ce7565b905061ffff811115610f20576040517f125ae34000000000000000000000000000000000000000000000000000000000815261ffff60048201526024810182905260440161072c565b610f2a8484611c11565b8383604051610f3a929190614c69565b604051908190038120907f1a88aae304f687af7ff0d4ff69a63f0093c5d391ca7fa344b896406980dd870390600090a250505050565b60c9547ffab288b6b9cb53626ebb83c9311148c2be1def872412367cd65e82a9521b524290610fb69073ffffffffffffffffffffffffffffffffffffffff163033610b38565b600082610fc16108c4565b610fcb9190614cfa565b6101925490915061ffff6101009091048116908216101561103157610192546040517f2f621d5a00000000000000000000000000000000000000000000000000000000815261ffff8084166004830152610100909204909116602482015260440161072c565b61103b8484612c33565b838360405161104b929190614c69565b604051908190038120907feb65c42c0c383b4f607e60cb67a387bf8ac32dcd2dad8cc3effeb2f5965b8b1290600090a250505050565b604080516101008101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c082019290925260e0810191909152604080516101008082018352610192805460ff81161515845291820461ffff1660208401526301000000820463ffffffff90811694840194909452670100000000000000820490931660608301526b010000000000000000000000900467ffffffffffffffff1660808201526101935473ffffffffffffffffffffffffffffffffffffffff1660a08201526101945460c0820152610195805491929160e08401919061116f90614d0d565b80601f016020809104026020016040519081016040528092919081815260200182805461119b90614d0d565b80156111e85780601f106111bd576101008083540402835291602001916111e8565b820191906000526020600020905b8154815290600101906020018083116111cb57829003601f168201915b505050505081525050905090565b6101925460009060ff168015611212575061121033612c9f565b155b1561126457335b6040517f67cc490600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff909116600482015260240161072c565b61019454158015906113245750610194546101935473ffffffffffffffffffffffffffffffffffffffff16639ab24eb0336040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815273ffffffffffffffffffffffffffffffffffffffff9091166004820152602401602060405180830381865afa1580156112fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113229190614d60565b105b80156113de5750610194546101935473ffffffffffffffffffffffffffffffffffffffff166370a08231336040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815273ffffffffffffffffffffffffffffffffffffffff9091166004820152602401602060405180830381865afa1580156113b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113dc9190614d60565b105b1561141d57610194546040517f903c7204000000000000000000000000000000000000000000000000000000008152600481019190915260240161072c565b611434836040015184606001518560800151612caa565b67ffffffffffffffff90811660808701529081166060860152166040840152600061145d612e9c565b600081815261019160205260409081902060018082018a90559187015160038201805460608a015160808b015160048601805467ffffffffffffffff9283167fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000918216179091558c51821692821678010000000000000000000000000000000000000000000000000277ffffffffffffffffffffffffffffffffffffffffffffffff9290961670010000000000000000000000000000000002919091166fffffffffffffffffffffffffffffffff9093169290921793909317169190911790556002810188905591925061155043612eb7565b61155a9190614d79565b60038201805467ffffffffffffffff9290921668010000000000000000027fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff90921691909117905560005b84518161ffff1610156116695781600701858261ffff16815181106115cc576115cc614da1565b602090810291909101810151825460018082018555600094855293839020825160039092020180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9092169190911781559181015192820192909255604082015160028201906116539082614e16565b505050808061166190614f30565b9150506115a5565b503373ffffffffffffffffffffffffffffffffffffffff1687837f784842613a953948c527397436300b06839500577a2fe1e958cefafddc9f394f886040015189606001518a608001518a8d6040516116c6959493929190614f51565b60405180910390a45090505b949350505050565b73ffffffffffffffffffffffffffffffffffffffff8216600090815261015f6020526040812061170a9083612b3c565b6001149392505050565b6040805160a081018252600080825260208201819052918101829052606081810183905260808201839052908290600085815261019160209081526040808320805460068201805484518187028101870190955280855260ff9092169950606094859492908301828280156117bf57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311611794575b5050505060018301546040805160a081018252600386015467ffffffffffffffff80821683526801000000000000000082048116602080850191909152700100000000000000000000000000000000830482168486015278010000000000000000000000000000000000000000000000009092048116606084015260048801541660808301526002870154600588018054855181850281018501909652808652979e50949c50919a50909850909391925060009084015b828210156118e2576000848152602090819020830180546040805182850281018501909152818152928301828280156118ce57602002820191906000526020600020905b8154815260200190600101908083116118ba575b505050505081526020019060010190611876565b50505050925080600701805480602002602001604051908101604052809291908181526020016000905b828210156119fd5760008481526020908190206040805160608101825260038602909201805473ffffffffffffffffffffffffffffffffffffffff1683526001810154938301939093526002830180549293929184019161196c90614d0d565b80601f016020809104026020016040519081016040528092919081815260200182805461199890614d0d565b80156119e55780601f106119ba576101008083540402835291602001916119e5565b820191906000526020600020905b8154815290600101906020018083116119c857829003601f168201915b5050505050815250508152602001906001019061190c565b50505050915050919395979092949650565b6000610e6961012d5490565b600061066482612c9f565b73ffffffffffffffffffffffffffffffffffffffff8116600090815261015f60205260408120611a5590612791565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001149050919050565b600081815261019160205260408120815b600682015461ffff82161015611b11573373ffffffffffffffffffffffffffffffffffffffff16826006018261ffff1681548110611ace57611ace614da1565b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1603611aff575060019392505050565b80611b0981614f30565b915050611a8e565b5060009392505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167fda35c664000000000000000000000000000000000000000000000000000000001480610664575061066482612f55565b600054610100900460ff16611c08576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840161072c565b6108b781613038565b60005b81811015611d2457611c46838383818110611c3157611c31614da1565b905060200201602081019061055191906145fb565b15611cbd57828282818110611c5d57611c5d614da1565b9050602002016020810190611c7291906145fb565b6040517fc0b7477d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff909116600482015260240161072c565b611d1a600161015f6000868686818110611cd957611cd9614da1565b9050602002016020810190611cee91906145fb565b73ffffffffffffffffffffffffffffffffffffffff168152602081019190915260400160002090613116565b5050600101611c14565b50611d3461016061316183613165565b50505050565b611d486001620f4240614cfa565b61019254670100000000000000900463ffffffff161115611dc157611d716001620f4240614cfa565b610192546040517fcc80c1950000000000000000000000000000000000000000000000000000000081526004810192909252670100000000000000900463ffffffff16602482015260440161072c565b61019254620f4240630100000090910463ffffffff161115611e2b57610192546040517fcc80c195000000000000000000000000000000000000000000000000000000008152620f42406004820152630100000090910463ffffffff16602482015260440161072c565b610192546301e133806b01000000000000000000000090910467ffffffffffffffff161115611eaf57610192546040517fc51033ee0000000000000000000000000000000000000000000000000000000081526301e1338060048201526b01000000000000000000000090910467ffffffffffffffff16602482015260440161072c565b8051610192805460208401516040850151606086015160808701517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000009094169515157fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000ff169590951761010061ffff90931692909202919091177fffffffffffffffffffffffffffffffffffffffffff0000000000000000ffffff16630100000063ffffffff928316027fffffffffffffffffffffffffffffffffffffffffff00000000ffffffffffffff16176701000000000000009190941602929092177fffffffffffffffffffffffffff0000000000000000ffffffffffffffffffffff166b01000000000000000000000067ffffffffffffffff9093169290920291909117815560a082015161019380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff90921691909117905560c08201516101945560e08201518291906101959061203b9082614e16565b505061019680547fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000164367ffffffffffffffff1617905550805160208201516080830151604080850151606086015160a087015160e088015160c089015194517f06d7ad97013d2d39753fe9b99ef2bd2516092d23267e591f549c6a4bfc78f1a2986120d09890979096909594939291614f98565b60405180910390a150565b6120e433612c9f565b6120ee5733611219565b600082815261019160205260408120600581015490910361214057806005016040517f71e9270800000000000000000000000000000000000000000000000000000000815260040161072c9190615016565b61214983611a7d565b1561219b576006810154610192546040517f1906bddf0000000000000000000000000000000000000000000000000000000081526004810192909252610100900461ffff16602482015260440161072c565b6006810180546001810182556000918252602082200180547fffffffffffffffffffffffff0000000000000000000000000000000000000000163317905560405184917f8ed92fb430e18e0bc33f2cac2e25c32d5806397bc5692f98896867d8bde13ff691a2811561221057612210836131b2565b505050565b60008181526101916020526040902061222d8161363e565b6122c05760038101546004808301546040517f1d3974ab00000000000000000000000000000000000000000000000000000000815267ffffffffffffffff700100000000000000000000000000000000850481169382019390935278010000000000000000000000000000000000000000000000009093048216602484015216604482015242606482015260840161072c565b6108aa826131b2565b6122d233612c9f565b6122dc5733611219565b60008281526101916020526040902060038101546101965467ffffffffffffffff680100000000000000009092048216911610612370576101965460038201546040517f4f3d100700000000000000000000000000000000000000000000000000000000815267ffffffffffffffff928316600482015268010000000000000000909104909116602482015260440161072c565b6123798161363e565b61240c5760038101546004808301546040517f1d3974ab00000000000000000000000000000000000000000000000000000000815267ffffffffffffffff700100000000000000000000000000000000850481169382019390935278010000000000000000000000000000000000000000000000009093048216602484015216604482015242606482015260840161072c565b815160011461244957816040517f71e9270800000000000000000000000000000000000000000000000000000000815260040161072c91906150c2565b8160008151811061245c5761245c614da1565b6020026020010151516003146124a057816040517f71e9270800000000000000000000000000000000000000000000000000000000815260040161072c91906150c2565b6005810154156126d25761019254600682015461010090910461ffff161161250f576006810154610192546040517f1906bddf0000000000000000000000000000000000000000000000000000000081526004810192909252610100900461ffff16602482015260440161072c565b8060050160008154811061252557612525614da1565b9060005260206000200160008154811061254157612541614da1565b90600052602060002001548260008151811061255f5761255f614da1565b602002602001015160008151811061257957612579614da1565b60200260200101511480156125fd57508060050160008154811061259f5761259f614da1565b906000526020600020016001815481106125bb576125bb614da1565b9060005260206000200154826000815181106125d9576125d9614da1565b60200260200101516001815181106125f3576125f3614da1565b6020026020010151145b801561267857508060050160008154811061261a5761261a614da1565b9060005260206000200160028154811061263657612636614da1565b90600052602060002001548260008151811061265457612654614da1565b602002602001015160028151811061266e5761266e614da1565b6020026020010151145b156126b157816040517f71e9270800000000000000000000000000000000000000000000000000000000815260040161072c91906150c2565b60408051600081526020810191829052516126d0916006840191613f42565b505b81516126e79060058301906020850190613fc8565b50600681018054600181018255600091825260209091200180547fffffffffffffffffffffffff0000000000000000000000000000000000000000163317905560405183907fb0441bed37ecf9efe628cbd58a2cff7c1289f751684f259fde3968a92f23107b906127599085906150c2565b60405180910390a260405183907f8ed92fb430e18e0bc33f2cac2e25c32d5806397bc5692f98896867d8bde13ff690600090a2505050565b805460009080156127e5576127b9836127ab600184614cfa565b600091825260209091200190565b5464010000000090047bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166127e8565b60005b9392505050565b60c9547f821b6e3a557148015a918c89e5d092e878a69854a2d1a410635f771bd5a8a3f5906108aa9073ffffffffffffffffffffffffffffffffffffffff163033610b38565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff161561286857612210836136dc565b8273ffffffffffffffffffffffffffffffffffffffff166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156128ed575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526128ea91810190614d60565b60015b612979576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201527f6f6e206973206e6f742055555053000000000000000000000000000000000000606482015260840161072c565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc8114612a28576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f7860448201527f6961626c65555549440000000000000000000000000000000000000000000000606482015260840161072c565b506122108383836137e6565b6040517ffdef910600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff87169063fdef910690612a8e90889088908890889088906004016150d5565b602060405180830381865afa158015612aab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612acf9190615154565b612b34576040517f32dbe3b400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff80881660048301528087166024830152851660448201526064810184905260840161072c565b505050505050565b6000438210612ba7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f436865636b706f696e74733a20626c6f636b206e6f7420796574206d696e6564604482015260640161072c565b6000612bb28361380b565b84549091506000612bc5868483856138a1565b90508015612c0857612bdc866127ab600184614cfa565b5464010000000090047bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16612c0b565b60005b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169695505050505050565b60005b81811015612c8f57612c53838383818110611c3157611c31614da1565b612c6957828282818110611c5d57611c5d614da1565b612c85600061015f6000868686818110611cd957611cd9614da1565b5050600101612c36565b50611d346101606138ff83613165565b600061066482611a26565b600080600080612cb942612eb7565b90508667ffffffffffffffff16600003612cd557809350612d3a565b8693508067ffffffffffffffff168467ffffffffffffffff161015612d3a576040517f6a8ef97200000000000000000000000000000000000000000000000000000000815267ffffffffffffffff80831660048301528516602482015260440161072c565b61019254600090612d64906b010000000000000000000000900467ffffffffffffffff1686615171565b90508667ffffffffffffffff16600003612d8057809350612de5565b8693508067ffffffffffffffff168467ffffffffffffffff161015612de5576040517fad5724b200000000000000000000000000000000000000000000000000000000815267ffffffffffffffff80831660048301528516602482015260440161072c565b61019254600090612e0f906b010000000000000000000000900467ffffffffffffffff1686615171565b90508667ffffffffffffffff16600003612e2b57809350612e90565b8693508067ffffffffffffffff168467ffffffffffffffff161015612e90576040517faa600bb500000000000000000000000000000000000000000000000000000000815267ffffffffffffffff80831660048301528516602482015260440161072c565b50505093509350939050565b6000612ea6611a0f565b9050610e2661012d80546001019055565b600067ffffffffffffffff821115612f51576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203660448201527f3420626974730000000000000000000000000000000000000000000000000000606482015260840161072c565b5090565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f41de6830000000000000000000000000000000000000000000000000000000001480612fe857507fffffffff0000000000000000000000000000000000000000000000000000000082167f52d1902d00000000000000000000000000000000000000000000000000000000145b8061066457507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610664565b600054610100900460ff166130cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840161072c565b60c980547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b600080613134846131264361380b565b61312f86613904565b6139b2565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff91821693501690505b9250929050565b0190565b6000806131a5856131a061317888612791565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16868863ffffffff16565b613116565b915091505b935093915050565b600081815261019160205260408120600581015490910361320457806005016040517f71e9270800000000000000000000000000000000000000000000000000000000815260040161072c9190615016565b61019254600682015461010090910461ffff16111561327a5761019254600682015461010090910461ffff169061323a90613bc3565b6040517fb5d6b86700000000000000000000000000000000000000000000000000000000815261ffff92831660048201529116602482015260440161072c565b60008160050160008154811061329257613292614da1565b906000526020600020016002815481106132ae576132ae614da1565b9060005260206000200154826005016000815481106132cf576132cf614da1565b906000526020600020016001815481106132eb576132eb614da1565b90600052602060002001548360050160008154811061330c5761330c614da1565b9060005260206000200160008154811061332857613328614da1565b906000526020600020015461333d9190614ce7565b6133479190614ce7565b610192549091506301000000900463ffffffff168110156133ae57610192546040517f6a210adb00000000000000000000000000000000000000000000000000000000815260048101839052630100000090910463ffffffff16602482015260440161072c565b6000826005016000815481106133c6576133c6614da1565b906000526020600020016000815481106133e2576133e2614da1565b6000918252602090912001546101925461341090670100000000000000900463ffffffff16620f4240614cfa565b61341a9190615192565b90508260050160008154811061343257613432614da1565b9060005260206000200160018154811061344e5761344e614da1565b600091825260209091200154610192546134799190670100000000000000900463ffffffff16615192565b81116134cf57610192546040517ffb47ec080000000000000000000000000000000000000000000000000000000081526004810183905267010000000000000090910463ffffffff16602482015260440161072c565b82547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001178355612b3461351a60c95473ffffffffffffffffffffffffffffffffffffffff1690565b8585600701805480602002602001604051908101604052809291908181526020016000905b828210156136305760008481526020908190206040805160608101825260038602909201805473ffffffffffffffffffffffffffffffffffffffff1683526001810154938301939093526002830180549293929184019161359f90614d0d565b80601f01602080910402602001604051908101604052809291908181526020018280546135cb90614d0d565b80156136185780601f106135ed57610100808354040283529160200191613618565b820191906000526020600020905b8154815290600101906020018083116135fb57829003601f168201915b5050505050815250508152602001906001019061353f565b505050508660020154613c57565b6003810154600090429067ffffffffffffffff808316700100000000000000000000000000000000909204161080156136a45750600383015467ffffffffffffffff80831678010000000000000000000000000000000000000000000000009092041611155b80156136c05750600483015467ffffffffffffffff8083169116115b80156136ce5750825460ff16155b156127e55750600192915050565b73ffffffffffffffffffffffffffffffffffffffff81163b613780576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161072c565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6137ef83613d51565b6000825111806137fc5750805b1561221057611d348383613d9e565b600063ffffffff821115612f51576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201527f3220626974730000000000000000000000000000000000000000000000000000606482015260840161072c565b60005b818310156138f75760006138b88484613dc3565b60008781526020902090915063ffffffff86169082015463ffffffff1611156138e3578092506138f1565b6138ee816001614ce7565b93505b506138a4565b509392505050565b900390565b60007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff821115612f51576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203260448201527f3234206269747300000000000000000000000000000000000000000000000000606482015260840161072c565b825460009081908015613b545760006139d0876127ab600185614cfa565b60408051808201909152905463ffffffff8082168084526401000000009092047bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1660208401529192509087161015613a81576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f436865636b706f696e743a2064656372656173696e67206b6579730000000000604482015260640161072c565b805163ffffffff808816911603613adf5784613aa2886127ab600186614cfa565b80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092166401000000000263ffffffff909216919091179055613b44565b6040805180820190915263ffffffff80881682527bffffffffffffffffffffffffffffffffffffffffffffffffffffffff80881660208085019182528b54600181018d5560008d81529190912094519151909216640100000000029216919091179101555b6020015192508391506131aa9050565b50506040805180820190915263ffffffff80851682527bffffffffffffffffffffffffffffffffffffffffffffffffffffffff80851660208085019182528854600181018a5560008a8152918220955192519093166401000000000291909316179201919091559050816131aa565b600061ffff821115612f51576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203160448201527f3620626974730000000000000000000000000000000000000000000000000000606482015260840161072c565b6040517fc71bf32400000000000000000000000000000000000000000000000000000000815260609060009073ffffffffffffffffffffffffffffffffffffffff87169063c71bf32490613cb3908890889088906004016151a9565b6000604051808303816000875af1158015613cd2573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052613d1891908101906151d2565b604051919350915085907f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f90600090a294509492505050565b613d5a816136dc565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606127e8838360405180606001604052806027815260200161533160279139613dde565b6000613dd260028484186152c6565b6127e890848416614ce7565b60606000808573ffffffffffffffffffffffffffffffffffffffff1685604051613e089190615301565b600060405180830381855af49150503d8060008114613e43576040519150601f19603f3d011682016040523d82523d6000602084013e613e48565b606091505b5091509150613e5986838387613e63565b9695505050505050565b60608315613ef9578251600003613ef25773ffffffffffffffffffffffffffffffffffffffff85163b613ef2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161072c565b50816116d2565b6116d28383815115613f0e5781518083602001fd5b806040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072c919061531d565b828054828255906000526020600020908101928215613fbc579160200282015b82811115613fbc57825182547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909116178255602090920191600190910190613f62565b50612f51929150614021565b828054828255906000526020600020908101928215614015579160200282015b828111156140155782518051614005918491602090910190614036565b5091602001919060010190613fe8565b50612f51929150614071565b5b80821115612f515760008155600101614022565b828054828255906000526020600020908101928215613fbc579160200282015b82811115613fbc578251825591602001919060010190614056565b80821115612f51576000614085828261408e565b50600101614071565b50805460008255906000526020600020908101906108b79190614021565b6000602082840312156140be57600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146127e857600080fd5b73ffffffffffffffffffffffffffffffffffffffff811681146108b757600080fd5b60008083601f84011261412257600080fd5b50813567ffffffffffffffff81111561413a57600080fd5b6020830191508360208260051b850101111561315a57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610100810167ffffffffffffffff811182821017156141a8576141a8614155565b60405290565b6040516060810167ffffffffffffffff811182821017156141a8576141a8614155565b60405160a0810167ffffffffffffffff811182821017156141a8576141a8614155565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561423b5761423b614155565b604052919050565b80151581146108b757600080fd5b803561425c81614243565b919050565b803561ffff8116811461425c57600080fd5b803563ffffffff8116811461425c57600080fd5b803567ffffffffffffffff8116811461425c57600080fd5b803561425c816140ee565b600067ffffffffffffffff8211156142c4576142c4614155565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f83011261430157600080fd5b813561431461430f826142aa565b6141f4565b81815284602083860101111561432957600080fd5b816020850160208301376000918101602001919091529392505050565b6000610100828403121561435957600080fd5b614361614184565b905061436c82614251565b815261437a60208301614261565b602082015261438b60408301614273565b604082015261439c60608301614273565b60608201526143ad60808301614287565b60808201526143be60a0830161429f565b60a082015260c082013560c082015260e082013567ffffffffffffffff8111156143e757600080fd5b6143f3848285016142f0565b60e08301525092915050565b6000806000806060858703121561441557600080fd5b8435614420816140ee565b9350602085013567ffffffffffffffff8082111561443d57600080fd5b61444988838901614110565b9095509350604087013591508082111561446257600080fd5b5061446f87828801614346565b91505092959194509250565b6000806040838503121561448e57600080fd5b8235915060208301356144a081614243565b809150509250929050565b6000602082840312156144bd57600080fd5b5035919050565b600067ffffffffffffffff8211156144de576144de614155565b5060051b60200190565b60008060408084860312156144fc57600080fd5b8335925060208085013567ffffffffffffffff8082111561451c57600080fd5b818701915087601f83011261453057600080fd5b813561453e61430f826144c4565b81815260059190911b8301840190848101908a83111561455d57600080fd5b8585015b838110156145e9578035858111156145795760008081fd5b8601603f81018d1361458b5760008081fd5b8781013561459b61430f826144c4565b81815260059190911b82018a0190898101908f8311156145bb5760008081fd5b928b01925b828410156145d95783358252928a0192908a01906145c0565b8652505050918601918601614561565b50809750505050505050509250929050565b60006020828403121561460d57600080fd5b81356127e8816140ee565b60006020828403121561462a57600080fd5b813567ffffffffffffffff81111561464157600080fd5b6116d284828501614346565b6020810160038310614688577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b91905290565b600080604083850312156146a157600080fd5b82356146ac816140ee565b9150602083013567ffffffffffffffff8111156146c857600080fd5b6146d4858286016142f0565b9150509250929050565b600080602083850312156146f157600080fd5b823567ffffffffffffffff81111561470857600080fd5b61471485828601614110565b90969095509350505050565b60005b8381101561473b578181015183820152602001614723565b50506000910152565b6000815180845261475c816020860160208601614720565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6020815281511515602082015261ffff6020830151166040820152600060408301516147c2606084018263ffffffff169052565b50606083015163ffffffff8116608084015250608083015167ffffffffffffffff811660a08401525060a083015173ffffffffffffffffffffffffffffffffffffffff811660c08401525060c083015160e083015260e08301516101008081850152506116d2610120840182614744565b600082601f83011261484457600080fd5b8135602061485461430f836144c4565b82815260059290921b8401810191818101908684111561487357600080fd5b8286015b8481101561492757803567ffffffffffffffff808211156148985760008081fd5b81890191506060807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0848d030112156148d15760008081fd5b6148d96141ae565b878401356148e6816140ee565b8152604084810135898301529184013591838311156149055760008081fd5b6149138d8a858801016142f0565b908201528652505050918301918301614877565b509695505050505050565b60008060008084860361010081121561494a57600080fd5b853594506020860135935060a07fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08201121561498557600080fd5b5061498e6141d1565b61499a60408701614287565b81526149a860608701614287565b60208201526149b960808701614287565b60408201526149ca60a08701614287565b60608201526149db60c08701614287565b6080820152915060e085013567ffffffffffffffff8111156149fc57600080fd5b61446f87828801614833565b60008060408385031215614a1b57600080fd5b8235614a26816140ee565b946020939093013593505050565b600082825180855260208086019550808260051b8401018186016000805b85811015614ac3578684037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0018a52825180518086529086019086860190845b81811015614aae57835183529288019291880191600101614a92565b50509a86019a94505091840191600101614a52565b509198975050505050505050565b600082825180855260208086019550808260051b84010181860160005b84811015614b70578583037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe00189528151805173ffffffffffffffffffffffffffffffffffffffff1684528481015185850152604090810151606091850182905290614b5c81860183614744565b9a86019a9450505090830190600101614aee565b5090979650505050505050565b8715158152610160602080830182905288519183018290526000916101808401918a810191845b81811015614bd657835173ffffffffffffffffffffffffffffffffffffffff1685529382019392820192600101614ba4565b50505050876040840152614c2c606084018867ffffffffffffffff808251168352806020830151166020840152806040830151166040840152806060830151166060840152806080830151166080840152505050565b85610100840152828103610120840152614c468186614a34565b9050828103610140840152614c5b8185614ad1565b9a9950505050505050505050565b60008184825b85811015614cad578135614c82816140ee565b73ffffffffffffffffffffffffffffffffffffffff1683526020928301929190910190600101614c6f565b509095945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561066457610664614cb8565b8181038181111561066457610664614cb8565b600181811c90821680614d2157607f821691505b602082108103614d5a577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b600060208284031215614d7257600080fd5b5051919050565b67ffffffffffffffff828116828216039080821115614d9a57614d9a614cb8565b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b601f82111561221057600081815260208120601f850160051c81016020861015614df75750805b601f850160051c820191505b81811015612b3457828155600101614e03565b815167ffffffffffffffff811115614e3057614e30614155565b614e4481614e3e8454614d0d565b84614dd0565b602080601f831160018114614e975760008415614e615750858301515b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600386901b1c1916600185901b178555612b34565b6000858152602081207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08616915b82811015614ee457888601518255948401946001909101908401614ec5565b5085821015614f2057878501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600388901b60f8161c191681555b5050505050600190811b01905550565b600061ffff808316818103614f4757614f47614cb8565b6001019392505050565b600067ffffffffffffffff8088168352808716602084015280861660408401525060a06060830152614f8660a0830185614ad1565b90508260808301529695505050505050565b60006101008a1515835261ffff8a16602084015267ffffffffffffffff8916604084015263ffffffff808916606085015280881660808501525073ffffffffffffffffffffffffffffffffffffffff861660a08401528060c084015261500081840186614744565b9150508260e08301529998505050505050505050565b6000602080830181845280855480835260408601915060408160051b87010192506000878152848120815b838110156150b4578886037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc001855281548087528284528784208888019190855b8281101561509e5781548452928a019260019182019101615082565b5091975050509386019360019182019101615041565b509398975050505050505050565b6020815260006127e86020830184614a34565b600073ffffffffffffffffffffffffffffffffffffffff808816835280871660208401525084604083015260806060830152826080830152828460a0840137600060a0848401015260a07fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f85011683010190509695505050505050565b60006020828403121561516657600080fd5b81516127e881614243565b67ffffffffffffffff818116838216019080821115614d9a57614d9a614cb8565b808202811582820484141761066457610664614cb8565b8381526060602082015260006151c26060830185614ad1565b9050826040830152949350505050565b60008060408084860312156151e657600080fd5b835167ffffffffffffffff808211156151fe57600080fd5b818601915086601f83011261521257600080fd5b8151602061522261430f836144c4565b82815260059290921b8401810191818101908a84111561524157600080fd5b8286015b848110156152b25780518681111561525d5760008081fd5b8701603f81018d1361526f5760008081fd5b8481015161527f61430f826142aa565b8181528e8b8385010111156152945760008081fd5b6152a3828883018d8601614720565b85525050918301918301615245565b509890910151979997985050505050505050565b6000826152fc577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b60008251615313818460208701614720565b9190910192915050565b6020815260006127e8602083018461474456fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a164736f6c6343000811000a", + "deployedBytecode": "0x60806040523480156200001157600080fd5b5060043610620000875760003560e01c80639cb0a12411620000625780639cb0a124146200012d578063a8a9c29e1462000153578063e89b6b91146200017a578063f10832f114620001a257600080fd5b806301ffc9a7146200008c578063599cb1a614620000b85780635c60da1b1462000106575b600080fd5b620000a36200009d36600462001b04565b620001c9565b60405190151581526020015b60405180910390f35b620000e07f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001620000af565b7f0000000000000000000000000000000000000000000000000000000000000000620000e0565b620001446200013e36600462001b86565b62000263565b604051620000af919062001c67565b6200016a6200016436600462001cc7565b620009d1565b604051620000af92919062001e5e565b620000e07f000000000000000000000000000000000000000000000000000000000000000081565b620001b9620001b336600462001e90565b620009f9565b604051620000af92919062001f1a565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f99718b500000000000000000000000000000000000000000000000000000000014806200025d57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b6060600062000276602084018462001f4b565b91505060018114620002bc576040517ff14c61fc000000000000000000000000000000000000000000000000000000008152600481018290526024015b60405180910390fd5b6000620002cd602085018562001f4b565b6000818110620002e157620002e162001fbd565b9050602002016020810190620002f8919062001fec565b90506000620003078262001523565b905060008160008151811062000321576200032162001fbd565b602002602001015180156200035057508160018151811062000347576200034762001fbd565b60200260200101515b8015620003785750816002815181106200036e576200036e62001fbd565b6020026020010151155b905080620003885760046200038b565b60055b60ff1667ffffffffffffffff811115620003a957620003a96200200a565b6040519080825280602002602001820160405280156200042257816020015b6040805160a0810182526000808252602080830182905292820181905260608201819052608082015282527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff909201910181620003c85790505b506040805160a0810190915260018152909550602080820190620004499089018962001fec565b73ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020017f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663e2c801b66040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000509573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200052f919062002039565b8152508560008151811062000548576200054862001fbd565b60209081029190910101526040805160a081019091528060018152602090810190620005779089018962001fec565b73ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020017f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166368d35a656040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000637573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200065d919062002039565b8152508560018151811062000676576200067662001fbd565b60209081029190910101526040805160a081019091528060018152602090810190620006a59089018962001fec565b73ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020017f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663c9c4bfca6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000765573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200078b919062002039565b81525085600281518110620007a457620007a462001fbd565b60209081029190910101526040805160a0810190915280600181526020018873ffffffffffffffffffffffffffffffffffffffff168152602001876000016020810190620007f3919062001fec565b73ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff16630729d0546040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000877573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200089d919062002039565b81525085600381518110620008b657620008b662001fbd565b60200260200101819052508015620009c7576040805160a0810190915280600181526020018473ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1663b2d2989c6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200097c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620009a2919062002039565b81525085600481518110620009bb57620009bb62001fbd565b60200260200101819052505b5050505092915050565b6060620009f1604051806040016040528060608152602001606081525090565b935093915050565b600062000a19604051806040016040528060608152602001606081525090565b600080808062000a2c87890189620023de565b81516040805160018082528183019092529599509397509195509350916000916020808301908036833701905050905073ffffffffffffffffffffffffffffffffffffffff82161562000d175773ffffffffffffffffffffffffffffffffffffffff82163b62000ae1576040517f18aca2db00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83166004820152602401620002b3565b62000aec82620016e0565b62000b3c576040517ffa8925f100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83166004820152602401620002b3565b600062000b498362001523565b90508060008151811062000b615762000b6162001fbd565b602002602001015115801562000b9257508060018151811062000b885762000b8862001fbd565b6020026020010151155b801562000bba57508060028151811062000bb05762000bb062001fbd565b6020026020010151155b8062000c2f57508060008151811062000bd75762000bd762001fbd565b6020026020010151801562000c0757508060018151811062000bfd5762000bfd62001fbd565b6020026020010151155b801562000c2f57508060028151811062000c255762000c2562001fbd565b6020026020010151155b1562000d105762000c767f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16620017d2565b8551602087015160408089015190517f9065714700000000000000000000000000000000000000000000000000000000815293965073ffffffffffffffffffffffffffffffffffffffff87169363906571479362000cdb939092909160040162002547565b600060405180830381600087803b15801562000cf657600080fd5b505af115801562000d0b573d6000803e3d6000fd5b505050505b5062000dd8565b62000d587f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16620017d2565b91508173ffffffffffffffffffffffffffffffffffffffff1663dab27fa98c86602001518760400151876040518563ffffffff1660e01b815260040162000da3949392919062002596565b600060405180830381600087803b15801562000dbe57600080fd5b505af115801562000dd3573d6000803e3d6000fd5b505050505b818160008151811062000def5762000def62001fbd565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505062000ef07f000000000000000000000000000000000000000000000000000000000000000063038d6c9d60e01b8d898960405160240162000e6d939291906200264b565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526200189c565b845190985060009073ffffffffffffffffffffffffffffffffffffffff1662000f1b57600562000f1e565b60045b60ff1667ffffffffffffffff81111562000f3c5762000f3c6200200a565b60405190808252806020026020018201604052801562000fb557816020015b6040805160a0810182526000808252602080830182905292820181905260608201819052608082015282527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90920191018162000f5b5790505b506040805160a0810190915290915080600081526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020017f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663e2c801b66040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200108d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620010b3919062002039565b81525081600081518110620010cc57620010cc62001fbd565b60209081029190910101526040805160a0810190915280600081526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020017f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166368d35a656040518163ffffffff1660e01b8152600401602060405180830381865afa158015620011ab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620011d1919062002039565b81525081600181518110620011ea57620011ea62001fbd565b60209081029190910101526040805160a0810190915280600081526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020017f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663c9c4bfca6040518163ffffffff1660e01b8152600401602060405180830381865afa158015620012c9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620012ef919062002039565b8152508160028151811062001308576200130862001fbd565b60209081029190910101526040805160a0810190915280600081526020018d73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff16630729d0546040518163ffffffff1660e01b8152600401602060405180830381865afa158015620013c7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620013ed919062002039565b8152508160038151811062001406576200140662001fbd565b6020908102919091010152845173ffffffffffffffffffffffffffffffffffffffff166200150b5760008373ffffffffffffffffffffffffffffffffffffffff1663b2d2989c6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200147c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620014a2919062002039565b6040805160a08101909152909150806000815273ffffffffffffffffffffffffffffffffffffffff80871660208301528f16604082015260006060820152608001829052825183906004908110620014fe57620014fe62001fbd565b6020026020010181905250505b90875260208701525094989397509295505050505050565b60408051600380825260808201909252606091600091906020820184803683370190505090507f36372b07000000000000000000000000000000000000000000000000000000008160008151811062001580576200158062001fbd565b60200260200101907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815250507fe90fb3f6000000000000000000000000000000000000000000000000000000008160018151811062001603576200160362001fbd565b60200260200101907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815250507f0f13099a000000000000000000000000000000000000000000000000000000008160028151811062001686576200168662001fbd565b7fffffffff0000000000000000000000000000000000000000000000000000000090921660209283029190910190910152620016d973ffffffffffffffffffffffffffffffffffffffff841682620018aa565b9392505050565b604080513060248083019190915282518083039091018152604490910182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f70a082310000000000000000000000000000000000000000000000000000000017905290516000918291829173ffffffffffffffffffffffffffffffffffffffff86169162001774919062002742565b600060405180830381855afa9150503d8060008114620017b1576040519150601f19603f3d011682016040523d82523d6000602084013e620017b6565b606091505b5091509150818015620017ca575080516020145b949350505050565b6000763d602d80600a3d3981f3363d3d373d3d3d363d730000008260601b60e81c176000526e5af43d82803e903d91602b57fd5bf38260781b17602052603760096000f0905073ffffffffffffffffffffffffffffffffffffffff811662001897576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f455243313136373a20637265617465206661696c6564000000000000000000006044820152606401620002b3565b919050565b6000620016d9838362001980565b60606000825167ffffffffffffffff811115620018cb57620018cb6200200a565b604051908082528060200260200182016040528015620018f5578160200160208202803683370190505b5090506200190384620019bc565b15620016d95760005b835181101562001978576200193e8585838151811062001930576200193062001fbd565b602002602001015162001a25565b82828151811062001953576200195362001fbd565b91151560209283029190910190910152806200196f8162002760565b9150506200190c565b509392505050565b60008282604051620019929062001af6565b6200199f929190620027c0565b604051809103906000f08015801562001978573d6000803e3d6000fd5b6000620019ea827f01ffc9a70000000000000000000000000000000000000000000000000000000062001a25565b80156200025d575062001a1e827fffffffff0000000000000000000000000000000000000000000000000000000062001a25565b1592915050565b604080517fffffffff000000000000000000000000000000000000000000000000000000008316602480830191909152825180830390910181526044909101909152602080820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a700000000000000000000000000000000000000000000000000000000178152825160009392849283928392918391908a617530fa92503d9150600051905082801562001ade575060208210155b801562001aeb5750600081115b979650505050505050565b61078480620027f283390190565b60006020828403121562001b1757600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114620016d957600080fd5b803573ffffffffffffffffffffffffffffffffffffffff811681146200189757600080fd5b60006060828403121562001b8057600080fd5b50919050565b6000806040838503121562001b9a57600080fd5b62001ba58362001b48565b9150602083013567ffffffffffffffff81111562001bc257600080fd5b62001bd08582860162001b6d565b9150509250929050565b600081516003811062001c16577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b83525060208181015173ffffffffffffffffffffffffffffffffffffffff90811691840191909152604080830151821690840152606080830151909116908301526080908101519082015260a00190565b6020808252825182820181905260009190848201906040850190845b8181101562001ca85762001c9983855162001bda565b93850193925060010162001c83565b50909695505050505050565b803561ffff811681146200189757600080fd5b60008060006060848603121562001cdd57600080fd5b62001ce88462001b48565b925062001cf86020850162001cb4565b9150604084013567ffffffffffffffff81111562001d1557600080fd5b62001d238682870162001b6d565b9150509250925092565b60005b8381101562001d4a57818101518382015260200162001d30565b50506000910152565b6000815180845262001d6d81602086016020860162001d2d565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600081518084526020808501945080840160005b8381101562001de757815173ffffffffffffffffffffffffffffffffffffffff168752958201959082019060010162001db3565b509495945050505050565b600081516040845262001e09604085018262001d9f565b60208481015186830387830152805180845290820193509091600091908301905b8083101562001e535762001e4082865162001bda565b9150838501945060018301925062001e2a565b509695505050505050565b60408152600062001e73604083018562001d53565b828103602084015262001e87818562001df2565b95945050505050565b60008060006040848603121562001ea657600080fd5b62001eb18462001b48565b9250602084013567ffffffffffffffff8082111562001ecf57600080fd5b818601915086601f83011262001ee457600080fd5b81358181111562001ef457600080fd5b87602082850101111562001f0757600080fd5b6020830194508093505050509250925092565b73ffffffffffffffffffffffffffffffffffffffff83168152604060208201526000620017ca604083018462001df2565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811262001f8157600080fd5b83018035915067ffffffffffffffff82111562001f9d57600080fd5b6020019150600581901b360382131562001fb657600080fd5b9250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121562001fff57600080fd5b620016d98262001b48565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000602082840312156200204c57600080fd5b5051919050565b6040805190810167ffffffffffffffff811182821017156200207957620020796200200a565b60405290565b604051610100810167ffffffffffffffff811182821017156200207957620020796200200a565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715620020f057620020f06200200a565b604052919050565b600067ffffffffffffffff8211156200211557620021156200200a565b5060051b60200190565b600082601f8301126200213157600080fd5b813560206200214a6200214483620020f8565b620020a6565b82815260059290921b840181019181810190868411156200216a57600080fd5b8286015b8481101562001e5357620021828162001b48565b83529183019183016200216e565b803580151581146200189757600080fd5b803563ffffffff811681146200189757600080fd5b803567ffffffffffffffff811681146200189757600080fd5b600082601f830112620021e157600080fd5b813567ffffffffffffffff811115620021fe57620021fe6200200a565b6200223160207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601620020a6565b8181528460208386010111156200224757600080fd5b816020850160208301376000918101602001919091529392505050565b6000606082840312156200227757600080fd5b6040516060810167ffffffffffffffff82821081831117156200229e576200229e6200200a565b81604052829350620022b08562001b48565b83526020850135915080821115620022c757600080fd5b620022d586838701620021cf565b60208401526040850135915080821115620022ef57600080fd5b50620022fe85828601620021cf565b6040830152505092915050565b6000604082840312156200231e57600080fd5b6200232862002053565b9050813567ffffffffffffffff808211156200234357600080fd5b62002351858386016200211f565b83526020915081840135818111156200236957600080fd5b84019050601f810185136200237d57600080fd5b80356200238e6200214482620020f8565b81815260059190911b82018301908381019087831115620023ae57600080fd5b928401925b82841015620023ce57833582529284019290840190620023b3565b8085870152505050505092915050565b60008060008060808587031215620023f557600080fd5b843567ffffffffffffffff808211156200240e57600080fd5b6200241c888389016200211f565b955060208701359150808211156200243357600080fd5b9086019061010082890312156200244957600080fd5b620024536200207f565b6200245e8362002190565b81526200246e6020840162001cb4565b60208201526200248160408401620021a1565b60408201526200249460608401620021a1565b6060820152620024a760808401620021b6565b6080820152620024ba60a0840162001b48565b60a082015260c083013560c082015260e083013582811115620024dc57600080fd5b620024ea8a828601620021cf565b60e083015250945060408701359150808211156200250757600080fd5b620025158883890162002264565b935060608701359150808211156200252c57600080fd5b506200253b878288016200230b565b91505092959194509250565b73ffffffffffffffffffffffffffffffffffffffff8416815260606020820152600062002578606083018562001d53565b82810360408401526200258c818562001d53565b9695505050505050565b73ffffffffffffffffffffffffffffffffffffffff8516815260006020608081840152620025c8608084018762001d53565b8381036040850152620025dc818762001d53565b90508381036060850152845160408252620025fb604083018262001d9f565b8684015183820393850193909352825180825290840192840191506000905b808210156200263c57825184529284019291840191600191909101906200261a565b50919998505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff841681526060602082015260006200267c606083018562001d9f565b828103604084015261010084511515825261ffff60208601511660208301526040850151620026b3604084018263ffffffff169052565b506060850151620026cc606084018263ffffffff169052565b506080850151620026e9608084018267ffffffffffffffff169052565b5060a08501516200271260a084018273ffffffffffffffffffffffffffffffffffffffff169052565b5060c085015160c083015260e08501518160e0840152620027368284018262001d53565b98975050505050505050565b600082516200275681846020870162001d2d565b9190910192915050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203620027b9577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b5060010190565b73ffffffffffffffffffffffffffffffffffffffff83168152604060208201526000620017ca604083018462001d5356fe608060405260405161078438038061078483398101604081905261002291610319565b61002e82826000610035565b5050610436565b61003e8361006b565b60008251118061004b5750805b156100665761006483836100ab60201b6100291760201c565b505b505050565b610074816100d7565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606100d0838360405180606001604052806027815260200161075d602791396101a9565b9392505050565b6100ea8161022260201b6100551760201c565b6101515760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084015b60405180910390fd5b806101887f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b61023160201b6100711760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b6060600080856001600160a01b0316856040516101c691906103e7565b600060405180830381855af49150503d8060008114610201576040519150601f19603f3d011682016040523d82523d6000602084013e610206565b606091505b50909250905061021886838387610234565b9695505050505050565b6001600160a01b03163b151590565b90565b606083156102a357825160000361029c576001600160a01b0385163b61029c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610148565b50816102ad565b6102ad83836102b5565b949350505050565b8151156102c55781518083602001fd5b8060405162461bcd60e51b81526004016101489190610403565b634e487b7160e01b600052604160045260246000fd5b60005b838110156103105781810151838201526020016102f8565b50506000910152565b6000806040838503121561032c57600080fd5b82516001600160a01b038116811461034357600080fd5b60208401519092506001600160401b038082111561036057600080fd5b818501915085601f83011261037457600080fd5b815181811115610386576103866102df565b604051601f8201601f19908116603f011681019083821181831017156103ae576103ae6102df565b816040528281528860208487010111156103c757600080fd5b6103d88360208301602088016102f5565b80955050505050509250929050565b600082516103f98184602087016102f5565b9190910192915050565b60208152600082518060208401526104228160408501602087016102f5565b601f01601f19169190910160400192915050565b610318806104456000396000f3fe60806040523661001357610011610017565b005b6100115b610027610022610074565b6100b9565b565b606061004e83836040518060600160405280602781526020016102e5602791396100dd565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b90565b60006100b47f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b905090565b3660008037600080366000845af43d6000803e8080156100d8573d6000f35b3d6000fd5b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516101079190610277565b600060405180830381855af49150503d8060008114610142576040519150601f19603f3d011682016040523d82523d6000602084013e610147565b606091505b509150915061015886838387610162565b9695505050505050565b606083156101fd5782516000036101f65773ffffffffffffffffffffffffffffffffffffffff85163b6101f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064015b60405180910390fd5b5081610207565b610207838361020f565b949350505050565b81511561021f5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101ed9190610293565b60005b8381101561026e578181015183820152602001610256565b50506000910152565b60008251610289818460208701610253565b9190910192915050565b60208152600082518060208401526102b2816040850160208701610253565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a164736f6c6343000811000a416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a164736f6c6343000811000a", + "devdoc": { + "author": "Vocdoni", + "errors": { + "TokenNotContract(address)": [ + { + "params": { + "token": "The token address" + } + } + ], + "TokenNotERC20(address)": [ + { + "params": { + "token": "The token address" + } + } + ], + "WrongHelpersArrayLength(uint256)": [ + { + "params": { + "length": "The array length of passed helpers." + } + } + ] + }, + "kind": "dev", + "methods": { + "implementation()": { + "details": "The implementation can be instantiated via the `new` keyword, cloned via the minimal clones pattern (see [ERC-1167](https://eips.ethereum.org/EIPS/eip-1167)), or proxied via the UUPS pattern (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)).", + "returns": { + "_0": "The address of the plugin implementation contract." + } + }, + "prepareInstallation(address,bytes)": { + "params": { + "_dao": "The address of the installing DAO.", + "_data": "The bytes-encoded data containing the input parameters for the installation as specified in the plugin's build metadata JSON file." + }, + "returns": { + "plugin": "The address of the `Plugin` contract being prepared for installation.", + "preparedSetupData": "The deployed plugin's relevant data which consists of helpers and permissions." + } + }, + "prepareUninstallation(address,(address,address[],bytes))": { + "params": { + "_dao": "The address of the uninstalling DAO.", + "_payload": "The relevant data necessary for the `prepareUninstallation`. See above." + }, + "returns": { + "permissions": "The array of multi-targeted permission operations to be applied by the `PluginSetupProcessor` to the uninstalling DAO." + } + }, + "prepareUpdate(address,uint16,(address,address[],bytes))": { + "params": { + "_currentBuild": "The build number of the plugin to update from.", + "_dao": "The address of the updating DAO.", + "_payload": "The relevant data necessary for the `prepareUpdate`. See above." + }, + "returns": { + "initData": "The initialization data to be passed to upgradeable contracts when the update is applied in the `PluginSetupProcessor`.", + "preparedSetupData": "The deployed plugin's relevant data which consists of helpers and permissions." + } + }, + "supportsInterface(bytes4)": { + "params": { + "_interfaceId": "The ID of the interface." + }, + "returns": { + "_0": "Returns `true` if the interface is supported." + } + } + }, + "title": "VocdoniVotingSetup", + "version": 1 + }, + "userdoc": { + "errors": { + "TokenNotContract(address)": [ + { + "notice": "Thrown if token address is passed which is not a token." + } + ], + "TokenNotERC20(address)": [ + { + "notice": "Thrown if token address is not ERC20." + } + ], + "WrongHelpersArrayLength(uint256)": [ + { + "notice": "Thrown if passed helpers array is of wrong length." + } + ] + }, + "kind": "user", + "methods": { + "constructor": { + "notice": "The contract constructor, that deploys the `VocdoniVoting` plugin logic contract." + }, + "governanceERC20Base()": { + "notice": "The address of the `GovernanceERC20` base contract." + }, + "governanceWrappedERC20Base()": { + "notice": "The address of the `GovernanceWrappedERC20` base contract." + }, + "implementation()": { + "notice": "Returns the plugin implementation address." + }, + "prepareInstallation(address,bytes)": { + "notice": "Prepares the installation of a plugin." + }, + "prepareUninstallation(address,(address,address[],bytes))": { + "notice": "Prepares the uninstallation of a plugin." + }, + "prepareUpdate(address,uint16,(address,address[],bytes))": { + "notice": "Prepares the update of a plugin." + }, + "supportsInterface(bytes4)": { + "notice": "Checks if this or the parent contract supports an interface by its ID." + } + }, + "notice": "The setup contract of the `VocdoniVoting` plugin.", + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/goerli/solcInputs/a4b1fde8af8923e78e9eb969c5556451.json b/packages/contracts/deployments/goerli/solcInputs/a4b1fde8af8923e78e9eb969c5556451.json new file mode 100644 index 00000000..f5b65072 --- /dev/null +++ b/packages/contracts/deployments/goerli/solcInputs/a4b1fde8af8923e78e9eb969c5556451.json @@ -0,0 +1,435 @@ +{ + "language": "Solidity", + "sources": { + "@aragon/osx/core/dao/DAO.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity 0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165StorageUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155ReceiverUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\";\nimport \"@openzeppelin/contracts/interfaces/IERC1271.sol\";\n\nimport {IProtocolVersion} from \"../../utils/protocol/IProtocolVersion.sol\";\nimport {ProtocolVersion} from \"../../utils/protocol/ProtocolVersion.sol\";\nimport {PermissionManager} from \"../permission/PermissionManager.sol\";\nimport {CallbackHandler} from \"../utils/CallbackHandler.sol\";\nimport {hasBit, flipBit} from \"../utils/BitMap.sol\";\nimport {IEIP4824} from \"./IEIP4824.sol\";\nimport {IDAO} from \"./IDAO.sol\";\n\n/// @title DAO\n/// @author Aragon Association - 2021-2023\n/// @notice This contract is the entry point to the Aragon DAO framework and provides our users a simple and easy to use public interface.\n/// @dev Public API of the Aragon DAO framework.\ncontract DAO is\n IEIP4824,\n Initializable,\n IERC1271,\n ERC165StorageUpgradeable,\n IDAO,\n UUPSUpgradeable,\n ProtocolVersion,\n PermissionManager,\n CallbackHandler\n{\n using SafeERC20Upgradeable for IERC20Upgradeable;\n using AddressUpgradeable for address;\n\n /// @notice The ID of the permission required to call the `execute` function.\n bytes32 public constant EXECUTE_PERMISSION_ID = keccak256(\"EXECUTE_PERMISSION\");\n\n /// @notice The ID of the permission required to call the `_authorizeUpgrade` function.\n bytes32 public constant UPGRADE_DAO_PERMISSION_ID = keccak256(\"UPGRADE_DAO_PERMISSION\");\n\n /// @notice The ID of the permission required to call the `setMetadata` function.\n bytes32 public constant SET_METADATA_PERMISSION_ID = keccak256(\"SET_METADATA_PERMISSION\");\n\n /// @notice The ID of the permission required to call the `setTrustedForwarder` function.\n bytes32 public constant SET_TRUSTED_FORWARDER_PERMISSION_ID =\n keccak256(\"SET_TRUSTED_FORWARDER_PERMISSION\");\n\n /// @notice The ID of the permission required to call the `setSignatureValidator` function.\n bytes32 public constant SET_SIGNATURE_VALIDATOR_PERMISSION_ID =\n keccak256(\"SET_SIGNATURE_VALIDATOR_PERMISSION\");\n\n /// @notice The ID of the permission required to call the `registerStandardCallback` function.\n bytes32 public constant REGISTER_STANDARD_CALLBACK_PERMISSION_ID =\n keccak256(\"REGISTER_STANDARD_CALLBACK_PERMISSION\");\n\n /// @notice The internal constant storing the maximal action array length.\n uint256 internal constant MAX_ACTIONS = 256;\n\n /// @notice The first out of two values to which the `_reentrancyStatus` state variable (used by the `nonReentrant` modifier) can be set inidicating that a function was not entered.\n uint256 private constant _NOT_ENTERED = 1;\n\n /// @notice The second out of two values to which the `_reentrancyStatus` state variable (used by the `nonReentrant` modifier) can be set inidicating that a function was entered.\n uint256 private constant _ENTERED = 2;\n\n /// @notice The [ERC-1271](https://eips.ethereum.org/EIPS/eip-1271) signature validator contract.\n /// @dev Added in v1.0.0.\n IERC1271 public signatureValidator;\n\n /// @notice The address of the trusted forwarder verifying meta transactions.\n /// @dev Added in v1.0.0.\n address private trustedForwarder;\n\n /// @notice The [EIP-4824](https://eips.ethereum.org/EIPS/eip-4824) DAO URI.\n /// @dev Added in v1.0.0.\n string private _daoURI;\n\n /// @notice The state variable for the reentrancy guard of the `execute` function.\n /// @dev Added in v1.3.0. The variable can be of value `_NOT_ENTERED = 1` or `_ENTERED = 2` in usage and is initialized with `_NOT_ENTERED`.\n uint256 private _reentrancyStatus;\n\n /// @notice Thrown if a call is reentrant.\n error ReentrantCall();\n\n /// @notice Thrown if the action array length is larger than `MAX_ACTIONS`.\n error TooManyActions();\n\n /// @notice Thrown if action execution has failed.\n /// @param index The index of the action in the action array that failed.\n error ActionFailed(uint256 index);\n\n /// @notice Thrown if an action has insufficent gas left.\n error InsufficientGas();\n\n /// @notice Thrown if the deposit amount is zero.\n error ZeroAmount();\n\n /// @notice Thrown if there is a mismatch between the expected and actually deposited amount of native tokens.\n /// @param expected The expected native token amount.\n /// @param actual The actual native token amount deposited.\n error NativeTokenDepositAmountMismatch(uint256 expected, uint256 actual);\n\n /// @notice Thrown if an upgrade is not supported from a specific protocol version .\n error ProtocolVersionUpgradeNotSupported(uint8[3] protocolVersion);\n\n /// @notice Emitted when a new DAO URI is set.\n /// @param daoURI The new URI.\n event NewURI(string daoURI);\n\n /// @notice A modifier to protect a function from calling itself, directly or indirectly (reentrancy).\n /// @dev Currently, this modifier is only applied to the `execute()` function. If this is used multiple times, private `_beforeNonReentrant()` and `_afterNonReentrant()` functions should be created to prevent code duplication.\n modifier nonReentrant() {\n if (_reentrancyStatus == _ENTERED) {\n revert ReentrantCall();\n }\n _reentrancyStatus = _ENTERED;\n\n _;\n\n _reentrancyStatus = _NOT_ENTERED;\n }\n\n /// @notice Disables the initializers on the implementation contract to prevent it from being left uninitialized.\n constructor() {\n _disableInitializers();\n }\n\n /// @notice Initializes the DAO by\n /// - setting the reentrancy status variable to `_NOT_ENTERED`\n /// - registering the [ERC-165](https://eips.ethereum.org/EIPS/eip-165) interface ID\n /// - setting the trusted forwarder for meta transactions\n /// - giving the `ROOT_PERMISSION_ID` permission to the initial owner (that should be revoked and transferred to the DAO after setup).\n /// @dev This method is required to support [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822).\n /// @param _metadata IPFS hash that points to all the metadata (logo, description, tags, etc.) of a DAO.\n /// @param _initialOwner The initial owner of the DAO having the `ROOT_PERMISSION_ID` permission.\n /// @param _trustedForwarder The trusted forwarder responsible for verifying meta transactions.\n /// @param daoURI_ The DAO URI required to support [ERC-4824](https://eips.ethereum.org/EIPS/eip-4824).\n function initialize(\n bytes calldata _metadata,\n address _initialOwner,\n address _trustedForwarder,\n string calldata daoURI_\n ) external reinitializer(2) {\n _reentrancyStatus = _NOT_ENTERED; // added in v1.3.0\n\n _registerInterface(type(IDAO).interfaceId);\n _registerInterface(type(IERC1271).interfaceId);\n _registerInterface(type(IEIP4824).interfaceId);\n _registerInterface(type(IProtocolVersion).interfaceId); // added in v1.3.0\n _registerTokenInterfaces();\n\n _setMetadata(_metadata);\n _setTrustedForwarder(_trustedForwarder);\n _setDaoURI(daoURI_);\n __PermissionManager_init(_initialOwner);\n }\n\n /// @notice Initializes the DAO after an upgrade from a previous protocol version.\n /// @param _previousProtocolVersion The semantic protocol version number of the previous DAO implementation contract this upgrade is transitioning from.\n /// @param _initData The initialization data to be passed to via `upgradeToAndCall` (see [ERC-1967](https://docs.openzeppelin.com/contracts/4.x/api/proxy#ERC1967Upgrade)).\n function initializeFrom(\n uint8[3] calldata _previousProtocolVersion,\n bytes calldata _initData\n ) external reinitializer(2) {\n _initData; // Silences the unused function parameter warning.\n\n // Check that the contract is not upgrading from a different major release.\n if (_previousProtocolVersion[0] != 1) {\n revert ProtocolVersionUpgradeNotSupported(_previousProtocolVersion);\n }\n\n // Initialize `_reentrancyStatus` that was added in v1.3.0.\n // Register Interface `ProtocolVersion` that was added in v1.3.0.\n if (_previousProtocolVersion[1] <= 2) {\n _reentrancyStatus = _NOT_ENTERED;\n _registerInterface(type(IProtocolVersion).interfaceId);\n }\n }\n\n /// @inheritdoc PermissionManager\n function isPermissionRestrictedForAnyAddr(\n bytes32 _permissionId\n ) internal pure override returns (bool) {\n return\n _permissionId == EXECUTE_PERMISSION_ID ||\n _permissionId == UPGRADE_DAO_PERMISSION_ID ||\n _permissionId == SET_METADATA_PERMISSION_ID ||\n _permissionId == SET_TRUSTED_FORWARDER_PERMISSION_ID ||\n _permissionId == SET_SIGNATURE_VALIDATOR_PERMISSION_ID ||\n _permissionId == REGISTER_STANDARD_CALLBACK_PERMISSION_ID;\n }\n\n /// @notice Internal method authorizing the upgrade of the contract via the [upgradeability mechanism for UUPS proxies](https://docs.openzeppelin.com/contracts/4.x/api/proxy#UUPSUpgradeable) (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)).\n /// @dev The caller must have the `UPGRADE_DAO_PERMISSION_ID` permission.\n function _authorizeUpgrade(address) internal virtual override auth(UPGRADE_DAO_PERMISSION_ID) {}\n\n /// @inheritdoc IDAO\n function setTrustedForwarder(\n address _newTrustedForwarder\n ) external override auth(SET_TRUSTED_FORWARDER_PERMISSION_ID) {\n _setTrustedForwarder(_newTrustedForwarder);\n }\n\n /// @inheritdoc IDAO\n function getTrustedForwarder() external view virtual override returns (address) {\n return trustedForwarder;\n }\n\n /// @inheritdoc IDAO\n function hasPermission(\n address _where,\n address _who,\n bytes32 _permissionId,\n bytes memory _data\n ) external view override returns (bool) {\n return isGranted(_where, _who, _permissionId, _data);\n }\n\n /// @inheritdoc IDAO\n function setMetadata(\n bytes calldata _metadata\n ) external override auth(SET_METADATA_PERMISSION_ID) {\n _setMetadata(_metadata);\n }\n\n /// @inheritdoc IDAO\n function execute(\n bytes32 _callId,\n Action[] calldata _actions,\n uint256 _allowFailureMap\n )\n external\n override\n nonReentrant\n auth(EXECUTE_PERMISSION_ID)\n returns (bytes[] memory execResults, uint256 failureMap)\n {\n // Check that the action array length is within bounds.\n if (_actions.length > MAX_ACTIONS) {\n revert TooManyActions();\n }\n\n execResults = new bytes[](_actions.length);\n\n uint256 gasBefore;\n uint256 gasAfter;\n\n for (uint256 i = 0; i < _actions.length; ) {\n gasBefore = gasleft();\n\n (bool success, bytes memory result) = _actions[i].to.call{value: _actions[i].value}(\n _actions[i].data\n );\n gasAfter = gasleft();\n\n // Check if failure is allowed\n if (!hasBit(_allowFailureMap, uint8(i))) {\n // Check if the call failed.\n if (!success) {\n revert ActionFailed(i);\n }\n } else {\n // Check if the call failed.\n if (!success) {\n // Make sure that the action call did not fail because 63/64 of `gasleft()` was insufficient to execute the external call `.to.call` (see [ERC-150](https://eips.ethereum.org/EIPS/eip-150)).\n // In specific scenarios, i.e. proposal execution where the last action in the action array is allowed to fail, the account calling `execute` could force-fail this action by setting a gas limit\n // where 63/64 is insufficient causing the `.to.call` to fail, but where the remaining 1/64 gas are sufficient to successfully finish the `execute` call.\n if (gasAfter < gasBefore / 64) {\n revert InsufficientGas();\n }\n\n // Store that this action failed.\n failureMap = flipBit(failureMap, uint8(i));\n }\n }\n\n execResults[i] = result;\n\n unchecked {\n ++i;\n }\n }\n\n emit Executed({\n actor: msg.sender,\n callId: _callId,\n actions: _actions,\n allowFailureMap: _allowFailureMap,\n failureMap: failureMap,\n execResults: execResults\n });\n }\n\n /// @inheritdoc IDAO\n function deposit(\n address _token,\n uint256 _amount,\n string calldata _reference\n ) external payable override {\n if (_amount == 0) revert ZeroAmount();\n\n if (_token == address(0)) {\n if (msg.value != _amount)\n revert NativeTokenDepositAmountMismatch({expected: _amount, actual: msg.value});\n } else {\n if (msg.value != 0)\n revert NativeTokenDepositAmountMismatch({expected: 0, actual: msg.value});\n\n IERC20Upgradeable(_token).safeTransferFrom(msg.sender, address(this), _amount);\n }\n\n emit Deposited(msg.sender, _token, _amount, _reference);\n }\n\n /// @inheritdoc IDAO\n function setSignatureValidator(\n address _signatureValidator\n ) external override auth(SET_SIGNATURE_VALIDATOR_PERMISSION_ID) {\n signatureValidator = IERC1271(_signatureValidator);\n\n emit SignatureValidatorSet({signatureValidator: _signatureValidator});\n }\n\n /// @inheritdoc IDAO\n function isValidSignature(\n bytes32 _hash,\n bytes memory _signature\n ) external view override(IDAO, IERC1271) returns (bytes4) {\n if (address(signatureValidator) == address(0)) {\n // Return the invalid magic number\n return bytes4(0);\n }\n // Forward the call to the set signature validator contract\n return signatureValidator.isValidSignature(_hash, _signature);\n }\n\n /// @notice Emits the `NativeTokenDeposited` event to track native token deposits that weren't made via the deposit method.\n /// @dev This call is bound by the gas limitations for `send`/`transfer` calls introduced by [ERC-2929](https://eips.ethereum.org/EIPS/eip-2929).\n /// Gas cost increases in future hard forks might break this function. As an alternative, [ERC-2930](https://eips.ethereum.org/EIPS/eip-2930)-type transactions using access lists can be employed.\n receive() external payable {\n emit NativeTokenDeposited(msg.sender, msg.value);\n }\n\n /// @notice Fallback to handle future versions of the [ERC-165](https://eips.ethereum.org/EIPS/eip-165) standard.\n /// @param _input An alias being equivalent to `msg.data`. This feature of the fallback function was introduced with the [solidity compiler version 0.7.6](https://github.com/ethereum/solidity/releases/tag/v0.7.6)\n /// @return The magic number registered for the function selector triggering the fallback.\n fallback(bytes calldata _input) external returns (bytes memory) {\n bytes4 magicNumber = _handleCallback(msg.sig, _input);\n return abi.encode(magicNumber);\n }\n\n /// @notice Emits the MetadataSet event if new metadata is set.\n /// @param _metadata Hash of the IPFS metadata object.\n function _setMetadata(bytes calldata _metadata) internal {\n emit MetadataSet(_metadata);\n }\n\n /// @notice Sets the trusted forwarder on the DAO and emits the associated event.\n /// @param _trustedForwarder The trusted forwarder address.\n function _setTrustedForwarder(address _trustedForwarder) internal {\n trustedForwarder = _trustedForwarder;\n\n emit TrustedForwarderSet(_trustedForwarder);\n }\n\n /// @notice Registers the [ERC-721](https://eips.ethereum.org/EIPS/eip-721) and [ERC-1155](https://eips.ethereum.org/EIPS/eip-1155) interfaces and callbacks.\n function _registerTokenInterfaces() private {\n _registerInterface(type(IERC721ReceiverUpgradeable).interfaceId);\n _registerInterface(type(IERC1155ReceiverUpgradeable).interfaceId);\n\n _registerCallback(\n IERC721ReceiverUpgradeable.onERC721Received.selector,\n IERC721ReceiverUpgradeable.onERC721Received.selector\n );\n _registerCallback(\n IERC1155ReceiverUpgradeable.onERC1155Received.selector,\n IERC1155ReceiverUpgradeable.onERC1155Received.selector\n );\n _registerCallback(\n IERC1155ReceiverUpgradeable.onERC1155BatchReceived.selector,\n IERC1155ReceiverUpgradeable.onERC1155BatchReceived.selector\n );\n }\n\n /// @inheritdoc IDAO\n function registerStandardCallback(\n bytes4 _interfaceId,\n bytes4 _callbackSelector,\n bytes4 _magicNumber\n ) external override auth(REGISTER_STANDARD_CALLBACK_PERMISSION_ID) {\n _registerInterface(_interfaceId);\n _registerCallback(_callbackSelector, _magicNumber);\n emit StandardCallbackRegistered(_interfaceId, _callbackSelector, _magicNumber);\n }\n\n /// @inheritdoc IEIP4824\n function daoURI() external view returns (string memory) {\n return _daoURI;\n }\n\n /// @notice Updates the set DAO URI to a new value.\n /// @param newDaoURI The new DAO URI to be set.\n function setDaoURI(string calldata newDaoURI) external auth(SET_METADATA_PERMISSION_ID) {\n _setDaoURI(newDaoURI);\n }\n\n /// @notice Sets the new [ERC-4824](https://eips.ethereum.org/EIPS/eip-4824) DAO URI and emits the associated event.\n /// @param daoURI_ The new DAO URI.\n function _setDaoURI(string calldata daoURI_) internal {\n _daoURI = daoURI_;\n\n emit NewURI(daoURI_);\n }\n\n /// @notice This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain (see [OpenZeppelin's guide about storage gaps](https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps)).\n uint256[46] private __gap;\n}\n" + }, + "@aragon/osx/core/dao/IDAO.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity ^0.8.8;\n\n/// @title IDAO\n/// @author Aragon Association - 2022-2023\n/// @notice The interface required for DAOs within the Aragon App DAO framework.\ninterface IDAO {\n /// @notice The action struct to be consumed by the DAO's `execute` function resulting in an external call.\n /// @param to The address to call.\n /// @param value The native token value to be sent with the call.\n /// @param data The bytes-encoded function selector and calldata for the call.\n struct Action {\n address to;\n uint256 value;\n bytes data;\n }\n\n /// @notice Checks if an address has permission on a contract via a permission identifier and considers if `ANY_ADDRESS` was used in the granting process.\n /// @param _where The address of the contract.\n /// @param _who The address of a EOA or contract to give the permissions.\n /// @param _permissionId The permission identifier.\n /// @param _data The optional data passed to the `PermissionCondition` registered.\n /// @return Returns true if the address has permission, false if not.\n function hasPermission(\n address _where,\n address _who,\n bytes32 _permissionId,\n bytes memory _data\n ) external view returns (bool);\n\n /// @notice Updates the DAO metadata (e.g., an IPFS hash).\n /// @param _metadata The IPFS hash of the new metadata object.\n function setMetadata(bytes calldata _metadata) external;\n\n /// @notice Emitted when the DAO metadata is updated.\n /// @param metadata The IPFS hash of the new metadata object.\n event MetadataSet(bytes metadata);\n\n /// @notice Executes a list of actions. If a zero allow-failure map is provided, a failing action reverts the entire execution. If a non-zero allow-failure map is provided, allowed actions can fail without the entire call being reverted.\n /// @param _callId The ID of the call. The definition of the value of `callId` is up to the calling contract and can be used, e.g., as a nonce.\n /// @param _actions The array of actions.\n /// @param _allowFailureMap A bitmap allowing execution to succeed, even if individual actions might revert. If the bit at index `i` is 1, the execution succeeds even if the `i`th action reverts. A failure map value of 0 requires every action to not revert.\n /// @return The array of results obtained from the executed actions in `bytes`.\n /// @return The resulting failure map containing the actions have actually failed.\n function execute(\n bytes32 _callId,\n Action[] memory _actions,\n uint256 _allowFailureMap\n ) external returns (bytes[] memory, uint256);\n\n /// @notice Emitted when a proposal is executed.\n /// @param actor The address of the caller.\n /// @param callId The ID of the call.\n /// @param actions The array of actions executed.\n /// @param allowFailureMap The allow failure map encoding which actions are allowed to fail.\n /// @param failureMap The failure map encoding which actions have failed.\n /// @param execResults The array with the results of the executed actions.\n /// @dev The value of `callId` is defined by the component/contract calling the execute function. A `Plugin` implementation can use it, for example, as a nonce.\n event Executed(\n address indexed actor,\n bytes32 callId,\n Action[] actions,\n uint256 allowFailureMap,\n uint256 failureMap,\n bytes[] execResults\n );\n\n /// @notice Emitted when a standard callback is registered.\n /// @param interfaceId The ID of the interface.\n /// @param callbackSelector The selector of the callback function.\n /// @param magicNumber The magic number to be registered for the callback function selector.\n event StandardCallbackRegistered(\n bytes4 interfaceId,\n bytes4 callbackSelector,\n bytes4 magicNumber\n );\n\n /// @notice Deposits (native) tokens to the DAO contract with a reference string.\n /// @param _token The address of the token or address(0) in case of the native token.\n /// @param _amount The amount of tokens to deposit.\n /// @param _reference The reference describing the deposit reason.\n function deposit(address _token, uint256 _amount, string calldata _reference) external payable;\n\n /// @notice Emitted when a token deposit has been made to the DAO.\n /// @param sender The address of the sender.\n /// @param token The address of the deposited token.\n /// @param amount The amount of tokens deposited.\n /// @param _reference The reference describing the deposit reason.\n event Deposited(\n address indexed sender,\n address indexed token,\n uint256 amount,\n string _reference\n );\n\n /// @notice Emitted when a native token deposit has been made to the DAO.\n /// @dev This event is intended to be emitted in the `receive` function and is therefore bound by the gas limitations for `send`/`transfer` calls introduced by [ERC-2929](https://eips.ethereum.org/EIPS/eip-2929).\n /// @param sender The address of the sender.\n /// @param amount The amount of native tokens deposited.\n event NativeTokenDeposited(address sender, uint256 amount);\n\n /// @notice Setter for the trusted forwarder verifying the meta transaction.\n /// @param _trustedForwarder The trusted forwarder address.\n function setTrustedForwarder(address _trustedForwarder) external;\n\n /// @notice Getter for the trusted forwarder verifying the meta transaction.\n /// @return The trusted forwarder address.\n function getTrustedForwarder() external view returns (address);\n\n /// @notice Emitted when a new TrustedForwarder is set on the DAO.\n /// @param forwarder the new forwarder address.\n event TrustedForwarderSet(address forwarder);\n\n /// @notice Setter for the [ERC-1271](https://eips.ethereum.org/EIPS/eip-1271) signature validator contract.\n /// @param _signatureValidator The address of the signature validator.\n function setSignatureValidator(address _signatureValidator) external;\n\n /// @notice Emitted when the signature validator address is updated.\n /// @param signatureValidator The address of the signature validator.\n event SignatureValidatorSet(address signatureValidator);\n\n /// @notice Checks whether a signature is valid for the provided hash by forwarding the call to the set [ERC-1271](https://eips.ethereum.org/EIPS/eip-1271) signature validator contract.\n /// @param _hash The hash of the data to be signed.\n /// @param _signature The signature byte array associated with `_hash`.\n /// @return Returns the `bytes4` magic value `0x1626ba7e` if the signature is valid.\n function isValidSignature(bytes32 _hash, bytes memory _signature) external returns (bytes4);\n\n /// @notice Registers an ERC standard having a callback by registering its [ERC-165](https://eips.ethereum.org/EIPS/eip-165) interface ID and callback function signature.\n /// @param _interfaceId The ID of the interface.\n /// @param _callbackSelector The selector of the callback function.\n /// @param _magicNumber The magic number to be registered for the function signature.\n function registerStandardCallback(\n bytes4 _interfaceId,\n bytes4 _callbackSelector,\n bytes4 _magicNumber\n ) external;\n}\n" + }, + "@aragon/osx/core/dao/IEIP4824.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity 0.8.17;\n\n/// @title EIP-4824 Common Interfaces for DAOs\n/// @dev See https://eips.ethereum.org/EIPS/eip-4824\n/// @author Aragon Association - 2021-2023\ninterface IEIP4824 {\n /// @notice A distinct Uniform Resource Identifier (URI) pointing to a JSON object following the \"EIP-4824 DAO JSON-LD Schema\". This JSON file splits into four URIs: membersURI, proposalsURI, activityLogURI, and governanceURI. The membersURI should point to a JSON file that conforms to the \"EIP-4824 Members JSON-LD Schema\". The proposalsURI should point to a JSON file that conforms to the \"EIP-4824 Proposals JSON-LD Schema\". The activityLogURI should point to a JSON file that conforms to the \"EIP-4824 Activity Log JSON-LD Schema\". The governanceURI should point to a flatfile, normatively a .md file. Each of the JSON files named above can be statically hosted or dynamically-generated.\n /// @return _daoURI The DAO URI.\n function daoURI() external view returns (string memory _daoURI);\n}\n" + }, + "@aragon/osx/core/permission/IPermissionCondition.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity ^0.8.8;\n\n/// @title IPermissionCondition\n/// @author Aragon Association - 2021-2023\n/// @notice This interface can be implemented to support more customary permissions depending on on- or off-chain state, e.g., by querying token ownershop or a secondary condition, respectively.\ninterface IPermissionCondition {\n /// @notice This method is used to check if a call is permitted.\n /// @param _where The address of the target contract.\n /// @param _who The address (EOA or contract) for which the permissions are checked.\n /// @param _permissionId The permission identifier.\n /// @param _data Optional data passed to the `PermissionCondition` implementation.\n /// @return allowed Returns true if the call is permitted.\n function isGranted(\n address _where,\n address _who,\n bytes32 _permissionId,\n bytes calldata _data\n ) external view returns (bool allowed);\n}\n" + }, + "@aragon/osx/core/permission/PermissionCondition.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity ^0.8.8;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nimport {IPermissionCondition} from \"./IPermissionCondition.sol\";\n\n/// @title PermissionCondition\n/// @author Aragon Association - 2023\n/// @notice An abstract contract for non-upgradeable contracts instantiated via the `new` keyword to inherit from to support customary permissions depending on arbitrary on-chain state.\nabstract contract PermissionCondition is ERC165, IPermissionCondition {\n /// @notice Checks if an interface is supported by this or its parent contract.\n /// @param _interfaceId The ID of the interface.\n /// @return Returns `true` if the interface is supported.\n function supportsInterface(bytes4 _interfaceId) public view override returns (bool) {\n return\n _interfaceId == type(IPermissionCondition).interfaceId ||\n super.supportsInterface(_interfaceId);\n }\n}\n" + }, + "@aragon/osx/core/permission/PermissionLib.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity ^0.8.8;\n\n/// @title PermissionLib\n/// @author Aragon Association - 2021-2023\n/// @notice A library containing objects for permission processing.\nlibrary PermissionLib {\n /// @notice A constant expressing that no condition is applied to a permission.\n address public constant NO_CONDITION = address(0);\n\n /// @notice The types of permission operations available in the `PermissionManager`.\n /// @param Grant The grant operation setting a permission without a condition.\n /// @param Revoke The revoke operation removing a permission (that was granted with or without a condition).\n /// @param GrantWithCondition The grant operation setting a permission with a condition.\n enum Operation {\n Grant,\n Revoke,\n GrantWithCondition\n }\n\n /// @notice A struct containing the information for a permission to be applied on a single target contract without a condition.\n /// @param operation The permission operation type.\n /// @param who The address (EOA or contract) receiving the permission.\n /// @param permissionId The permission identifier.\n struct SingleTargetPermission {\n Operation operation;\n address who;\n bytes32 permissionId;\n }\n\n /// @notice A struct containing the information for a permission to be applied on multiple target contracts, optionally, with a condition.\n /// @param operation The permission operation type.\n /// @param where The address of the target contract for which `who` receives permission.\n /// @param who The address (EOA or contract) receiving the permission.\n /// @param condition The `PermissionCondition` that will be asked for authorization on calls connected to the specified permission identifier.\n /// @param permissionId The permission identifier.\n struct MultiTargetPermission {\n Operation operation;\n address where;\n address who;\n address condition;\n bytes32 permissionId;\n }\n}\n" + }, + "@aragon/osx/core/permission/PermissionManager.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity ^0.8.8;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\";\n\nimport {IPermissionCondition} from \"./IPermissionCondition.sol\";\nimport {PermissionCondition} from \"./PermissionCondition.sol\";\nimport \"./PermissionLib.sol\";\n\n/// @title PermissionManager\n/// @author Aragon Association - 2021-2023\n/// @notice The abstract permission manager used in a DAO, its associated plugins, and other framework-related components.\nabstract contract PermissionManager is Initializable {\n using AddressUpgradeable for address;\n\n /// @notice The ID of the permission required to call the `grant`, `grantWithCondition`, `revoke`, and `bulk` function.\n bytes32 public constant ROOT_PERMISSION_ID = keccak256(\"ROOT_PERMISSION\");\n\n /// @notice A special address encoding permissions that are valid for any address `who` or `where`.\n address internal constant ANY_ADDR = address(type(uint160).max);\n\n /// @notice A special address encoding if a permissions is not set and therefore not allowed.\n address internal constant UNSET_FLAG = address(0);\n\n /// @notice A special address encoding if a permission is allowed.\n address internal constant ALLOW_FLAG = address(2);\n\n /// @notice A mapping storing permissions as hashes (i.e., `permissionHash(where, who, permissionId)`) and their status encoded by an address (unset, allowed, or redirecting to a `PermissionCondition`).\n mapping(bytes32 => address) internal permissionsHashed;\n\n /// @notice Thrown if a call is unauthorized.\n /// @param where The context in which the authorization reverted.\n /// @param who The address (EOA or contract) missing the permission.\n /// @param permissionId The permission identifier.\n error Unauthorized(address where, address who, bytes32 permissionId);\n\n /// @notice Thrown if a permission has been already granted with a different condition.\n /// @dev This makes sure that condition on the same permission can not be overwriten by a different condition.\n /// @param where The address of the target contract to grant `_who` permission to.\n /// @param who The address (EOA or contract) to which the permission has already been granted.\n /// @param permissionId The permission identifier.\n /// @param currentCondition The current condition set for permissionId.\n /// @param newCondition The new condition it tries to set for permissionId.\n error PermissionAlreadyGrantedForDifferentCondition(\n address where,\n address who,\n bytes32 permissionId,\n address currentCondition,\n address newCondition\n );\n\n /// @notice Thrown if a condition address is not a contract.\n /// @param condition The address that is not a contract.\n error ConditionNotAContract(IPermissionCondition condition);\n\n /// @notice Thrown if a condition contract does not support the `IPermissionCondition` interface.\n /// @param condition The address that is not a contract.\n error ConditionInterfacNotSupported(IPermissionCondition condition);\n\n /// @notice Thrown for `ROOT_PERMISSION_ID` or `EXECUTE_PERMISSION_ID` permission grants where `who` or `where` is `ANY_ADDR`.\n\n error PermissionsForAnyAddressDisallowed();\n\n /// @notice Thrown for permission grants where `who` and `where` are both `ANY_ADDR`.\n error AnyAddressDisallowedForWhoAndWhere();\n\n /// @notice Thrown if `Operation.GrantWithCondition` is requested as an operation but the method does not support it.\n error GrantWithConditionNotSupported();\n\n /// @notice Emitted when a permission `permission` is granted in the context `here` to the address `_who` for the contract `_where`.\n /// @param permissionId The permission identifier.\n /// @param here The address of the context in which the permission is granted.\n /// @param where The address of the target contract for which `_who` receives permission.\n /// @param who The address (EOA or contract) receiving the permission.\n /// @param condition The address `ALLOW_FLAG` for regular permissions or, alternatively, the `IPermissionCondition` contract implementation to be used.\n event Granted(\n bytes32 indexed permissionId,\n address indexed here,\n address where,\n address indexed who,\n address condition\n );\n\n /// @notice Emitted when a permission `permission` is revoked in the context `here` from the address `_who` for the contract `_where`.\n /// @param permissionId The permission identifier.\n /// @param here The address of the context in which the permission is revoked.\n /// @param where The address of the target contract for which `_who` loses permission.\n /// @param who The address (EOA or contract) losing the permission.\n event Revoked(\n bytes32 indexed permissionId,\n address indexed here,\n address where,\n address indexed who\n );\n\n /// @notice A modifier to make functions on inheriting contracts authorized. Permissions to call the function are checked through this permission manager.\n /// @param _permissionId The permission identifier required to call the method this modifier is applied to.\n modifier auth(bytes32 _permissionId) {\n _auth(_permissionId);\n _;\n }\n\n /// @notice Initialization method to set the initial owner of the permission manager.\n /// @dev The initial owner is granted the `ROOT_PERMISSION_ID` permission.\n /// @param _initialOwner The initial owner of the permission manager.\n function __PermissionManager_init(address _initialOwner) internal onlyInitializing {\n _initializePermissionManager(_initialOwner);\n }\n\n /// @notice Grants permission to an address to call methods in a contract guarded by an auth modifier with the specified permission identifier.\n /// @dev Requires the `ROOT_PERMISSION_ID` permission.\n /// @param _where The address of the target contract for which `_who` receives permission.\n /// @param _who The address (EOA or contract) receiving the permission.\n /// @param _permissionId The permission identifier.\n /// @dev Note, that granting permissions with `_who` or `_where` equal to `ANY_ADDR` does not replace other permissions with specific `_who` and `_where` addresses that exist in parallel.\n function grant(\n address _where,\n address _who,\n bytes32 _permissionId\n ) external virtual auth(ROOT_PERMISSION_ID) {\n _grant(_where, _who, _permissionId);\n }\n\n /// @notice Grants permission to an address to call methods in a target contract guarded by an auth modifier with the specified permission identifier if the referenced condition permits it.\n /// @dev Requires the `ROOT_PERMISSION_ID` permission\n /// @param _where The address of the target contract for which `_who` receives permission.\n /// @param _who The address (EOA or contract) receiving the permission.\n /// @param _permissionId The permission identifier.\n /// @param _condition The `PermissionCondition` that will be asked for authorization on calls connected to the specified permission identifier.\n /// @dev Note, that granting permissions with `_who` or `_where` equal to `ANY_ADDR` does not replace other permissions with specific `_who` and `_where` addresses that exist in parallel.\n function grantWithCondition(\n address _where,\n address _who,\n bytes32 _permissionId,\n IPermissionCondition _condition\n ) external virtual auth(ROOT_PERMISSION_ID) {\n _grantWithCondition(_where, _who, _permissionId, _condition);\n }\n\n /// @notice Revokes permission from an address to call methods in a target contract guarded by an auth modifier with the specified permission identifier.\n /// @dev Requires the `ROOT_PERMISSION_ID` permission.\n /// @param _where The address of the target contract for which `_who` loses permission.\n /// @param _who The address (EOA or contract) losing the permission.\n /// @param _permissionId The permission identifier.\n /// @dev Note, that revoking permissions with `_who` or `_where` equal to `ANY_ADDR` does not revoke other permissions with specific `_who` and `_where` addresses that exist in parallel.\n function revoke(\n address _where,\n address _who,\n bytes32 _permissionId\n ) external virtual auth(ROOT_PERMISSION_ID) {\n _revoke(_where, _who, _permissionId);\n }\n\n /// @notice Applies an array of permission operations on a single target contracts `_where`.\n /// @param _where The address of the single target contract.\n /// @param items The array of single-targeted permission operations to apply.\n function applySingleTargetPermissions(\n address _where,\n PermissionLib.SingleTargetPermission[] calldata items\n ) external virtual auth(ROOT_PERMISSION_ID) {\n for (uint256 i; i < items.length; ) {\n PermissionLib.SingleTargetPermission memory item = items[i];\n\n if (item.operation == PermissionLib.Operation.Grant) {\n _grant(_where, item.who, item.permissionId);\n } else if (item.operation == PermissionLib.Operation.Revoke) {\n _revoke(_where, item.who, item.permissionId);\n } else if (item.operation == PermissionLib.Operation.GrantWithCondition) {\n revert GrantWithConditionNotSupported();\n }\n\n unchecked {\n ++i;\n }\n }\n }\n\n /// @notice Applies an array of permission operations on multiple target contracts `items[i].where`.\n /// @param _items The array of multi-targeted permission operations to apply.\n function applyMultiTargetPermissions(\n PermissionLib.MultiTargetPermission[] calldata _items\n ) external virtual auth(ROOT_PERMISSION_ID) {\n for (uint256 i; i < _items.length; ) {\n PermissionLib.MultiTargetPermission memory item = _items[i];\n\n if (item.operation == PermissionLib.Operation.Grant) {\n _grant(item.where, item.who, item.permissionId);\n } else if (item.operation == PermissionLib.Operation.Revoke) {\n _revoke(item.where, item.who, item.permissionId);\n } else if (item.operation == PermissionLib.Operation.GrantWithCondition) {\n _grantWithCondition(\n item.where,\n item.who,\n item.permissionId,\n IPermissionCondition(item.condition)\n );\n }\n\n unchecked {\n ++i;\n }\n }\n }\n\n /// @notice Checks if an address has permission on a contract via a permission identifier and considers if `ANY_ADDRESS` was used in the granting process.\n /// @param _where The address of the target contract for which `_who` receives permission.\n /// @param _who The address (EOA or contract) for which the permission is checked.\n /// @param _permissionId The permission identifier.\n /// @param _data The optional data passed to the `PermissionCondition` registered.\n /// @return Returns true if `_who` has the permissions on the target contract via the specified permission identifier.\n function isGranted(\n address _where,\n address _who,\n bytes32 _permissionId,\n bytes memory _data\n ) public view virtual returns (bool) {\n return\n _isGranted(_where, _who, _permissionId, _data) || // check if `_who` has permission for `_permissionId` on `_where`\n _isGranted(_where, ANY_ADDR, _permissionId, _data) || // check if anyone has permission for `_permissionId` on `_where`\n _isGranted(ANY_ADDR, _who, _permissionId, _data); // check if `_who` has permission for `_permissionI` on any contract\n }\n\n /// @notice Grants the `ROOT_PERMISSION_ID` permission to the initial owner during initialization of the permission manager.\n /// @param _initialOwner The initial owner of the permission manager.\n function _initializePermissionManager(address _initialOwner) internal {\n _grant(address(this), _initialOwner, ROOT_PERMISSION_ID);\n }\n\n /// @notice This method is used in the external `grant` method of the permission manager.\n /// @param _where The address of the target contract for which `_who` receives permission.\n /// @param _who The address (EOA or contract) owning the permission.\n /// @param _permissionId The permission identifier.\n /// @dev Note, that granting permissions with `_who` or `_where` equal to `ANY_ADDR` does not replace other permissions with specific `_who` and `_where` addresses that exist in parallel.\n function _grant(address _where, address _who, bytes32 _permissionId) internal virtual {\n if (_where == ANY_ADDR || _who == ANY_ADDR) {\n revert PermissionsForAnyAddressDisallowed();\n }\n\n bytes32 permHash = permissionHash(_where, _who, _permissionId);\n\n address currentFlag = permissionsHashed[permHash];\n\n // Means permHash is not currently set.\n if (currentFlag == UNSET_FLAG) {\n permissionsHashed[permHash] = ALLOW_FLAG;\n\n emit Granted(_permissionId, msg.sender, _where, _who, ALLOW_FLAG);\n }\n }\n\n /// @notice This method is used in the external `grantWithCondition` method of the permission manager.\n /// @param _where The address of the target contract for which `_who` receives permission.\n /// @param _who The address (EOA or contract) owning the permission.\n /// @param _permissionId The permission identifier.\n /// @param _condition An address either resolving to a `PermissionCondition` contract address or being the `ALLOW_FLAG` address (`address(2)`).\n /// @dev Note, that granting permissions with `_who` or `_where` equal to `ANY_ADDR` does not replace other permissions with specific `_who` and `_where` addresses that exist in parallel.\n function _grantWithCondition(\n address _where,\n address _who,\n bytes32 _permissionId,\n IPermissionCondition _condition\n ) internal virtual {\n address conditionAddr = address(_condition);\n\n if (!conditionAddr.isContract()) {\n revert ConditionNotAContract(_condition);\n }\n\n if (\n !PermissionCondition(conditionAddr).supportsInterface(\n type(IPermissionCondition).interfaceId\n )\n ) {\n revert ConditionInterfacNotSupported(_condition);\n }\n\n if (_where == ANY_ADDR && _who == ANY_ADDR) {\n revert AnyAddressDisallowedForWhoAndWhere();\n }\n\n if (_where == ANY_ADDR || _who == ANY_ADDR) {\n if (\n _permissionId == ROOT_PERMISSION_ID ||\n isPermissionRestrictedForAnyAddr(_permissionId)\n ) {\n revert PermissionsForAnyAddressDisallowed();\n }\n }\n\n bytes32 permHash = permissionHash(_where, _who, _permissionId);\n\n address currentCondition = permissionsHashed[permHash];\n\n // Means permHash is not currently set.\n if (currentCondition == UNSET_FLAG) {\n permissionsHashed[permHash] = conditionAddr;\n\n emit Granted(_permissionId, msg.sender, _where, _who, conditionAddr);\n } else if (currentCondition != conditionAddr) {\n // Revert if `permHash` is already granted, but uses a different condition.\n // If we don't revert, we either should:\n // - allow overriding the condition on the same permission\n // which could be confusing whoever granted the same permission first\n // - or do nothing and succeed silently which could be confusing for the caller.\n revert PermissionAlreadyGrantedForDifferentCondition({\n where: _where,\n who: _who,\n permissionId: _permissionId,\n currentCondition: currentCondition,\n newCondition: conditionAddr\n });\n }\n }\n\n /// @notice This method is used in the public `revoke` method of the permission manager.\n /// @param _where The address of the target contract for which `_who` receives permission.\n /// @param _who The address (EOA or contract) owning the permission.\n /// @param _permissionId The permission identifier.\n /// @dev Note, that revoking permissions with `_who` or `_where` equal to `ANY_ADDR` does not revoke other permissions with specific `_who` and `_where` addresses that might have been granted in parallel.\n function _revoke(address _where, address _who, bytes32 _permissionId) internal virtual {\n bytes32 permHash = permissionHash(_where, _who, _permissionId);\n if (permissionsHashed[permHash] != UNSET_FLAG) {\n permissionsHashed[permHash] = UNSET_FLAG;\n\n emit Revoked(_permissionId, msg.sender, _where, _who);\n }\n }\n\n /// @notice Checks if a caller is granted permissions on a target contract via a permission identifier and redirects the approval to a `PermissionCondition` if this was specified in the setup.\n /// @param _where The address of the target contract for which `_who` receives permission.\n /// @param _who The address (EOA or contract) owning the permission.\n /// @param _permissionId The permission identifier.\n /// @param _data The optional data passed to the `PermissionCondition` registered.\n /// @return Returns true if `_who` has the permissions on the contract via the specified permissionId identifier.\n function _isGranted(\n address _where,\n address _who,\n bytes32 _permissionId,\n bytes memory _data\n ) internal view virtual returns (bool) {\n address accessFlagOrCondition = permissionsHashed[\n permissionHash(_where, _who, _permissionId)\n ];\n\n if (accessFlagOrCondition == UNSET_FLAG) return false;\n if (accessFlagOrCondition == ALLOW_FLAG) return true;\n\n // Since it's not a flag, assume it's a PermissionCondition and try-catch to skip failures\n try\n IPermissionCondition(accessFlagOrCondition).isGranted(\n _where,\n _who,\n _permissionId,\n _data\n )\n returns (bool allowed) {\n if (allowed) return true;\n } catch {}\n\n return false;\n }\n\n /// @notice A private function to be used to check permissions on the permission manager contract (`address(this)`) itself.\n /// @param _permissionId The permission identifier required to call the method this modifier is applied to.\n function _auth(bytes32 _permissionId) internal view virtual {\n if (!isGranted(address(this), msg.sender, _permissionId, msg.data)) {\n revert Unauthorized({\n where: address(this),\n who: msg.sender,\n permissionId: _permissionId\n });\n }\n }\n\n /// @notice Generates the hash for the `permissionsHashed` mapping obtained from the word \"PERMISSION\", the contract address, the address owning the permission, and the permission identifier.\n /// @param _where The address of the target contract for which `_who` receives permission.\n /// @param _who The address (EOA or contract) owning the permission.\n /// @param _permissionId The permission identifier.\n /// @return The permission hash.\n function permissionHash(\n address _where,\n address _who,\n bytes32 _permissionId\n ) internal pure virtual returns (bytes32) {\n return keccak256(abi.encodePacked(\"PERMISSION\", _who, _where, _permissionId));\n }\n\n /// @notice Decides if the granting permissionId is restricted when `_who == ANY_ADDR` or `_where == ANY_ADDR`.\n /// @param _permissionId The permission identifier.\n /// @return Whether or not the permission is restricted.\n /// @dev By default, every permission is unrestricted and it is the derived contract's responsibility to override it. Note, that the `ROOT_PERMISSION_ID` is included and not required to be set it again.\n function isPermissionRestrictedForAnyAddr(\n bytes32 _permissionId\n ) internal view virtual returns (bool) {\n (_permissionId); // silence the warning.\n return false;\n }\n\n /// @notice This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain (see [OpenZeppelin's guide about storage gaps](https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps)).\n uint256[49] private __gap;\n}\n" + }, + "@aragon/osx/core/plugin/dao-authorizable/DaoAuthorizableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity ^0.8.8;\n\nimport {ContextUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\n\nimport {IDAO} from \"../../dao/IDAO.sol\";\nimport {_auth} from \"../../utils/auth.sol\";\n\n/// @title DaoAuthorizableUpgradeable\n/// @author Aragon Association - 2022-2023\n/// @notice An abstract contract providing a meta-transaction compatible modifier for upgradeable or cloneable contracts to authorize function calls through an associated DAO.\n/// @dev Make sure to call `__DaoAuthorizableUpgradeable_init` during initialization of the inheriting contract.\nabstract contract DaoAuthorizableUpgradeable is ContextUpgradeable {\n /// @notice The associated DAO managing the permissions of inheriting contracts.\n IDAO private dao_;\n\n /// @notice Initializes the contract by setting the associated DAO.\n /// @param _dao The associated DAO address.\n function __DaoAuthorizableUpgradeable_init(IDAO _dao) internal onlyInitializing {\n dao_ = _dao;\n }\n\n /// @notice Returns the DAO contract.\n /// @return The DAO contract.\n function dao() public view returns (IDAO) {\n return dao_;\n }\n\n /// @notice A modifier to make functions on inheriting contracts authorized. Permissions to call the function are checked through the associated DAO's permission manager.\n /// @param _permissionId The permission identifier required to call the method this modifier is applied to.\n modifier auth(bytes32 _permissionId) {\n _auth(dao_, address(this), _msgSender(), _permissionId, _msgData());\n _;\n }\n\n /// @notice This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain (see [OpenZeppelin's guide about storage gaps](https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps)).\n uint256[49] private __gap;\n}\n" + }, + "@aragon/osx/core/plugin/IPlugin.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity ^0.8.8;\n\n/// @title IPlugin\n/// @author Aragon Association - 2022-2023\n/// @notice An interface defining the traits of a plugin.\ninterface IPlugin {\n enum PluginType {\n UUPS,\n Cloneable,\n Constructable\n }\n\n /// @notice Returns the plugin's type\n function pluginType() external view returns (PluginType);\n}\n" + }, + "@aragon/osx/core/plugin/PluginUUPSUpgradeable.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity ^0.8.8;\n\nimport {UUPSUpgradeable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\nimport {IERC1822ProxiableUpgradeable} from \"@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol\";\nimport {ERC165Upgradeable} from \"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\";\n\nimport {IDAO} from \"../dao/IDAO.sol\";\nimport {DaoAuthorizableUpgradeable} from \"./dao-authorizable/DaoAuthorizableUpgradeable.sol\";\nimport {IPlugin} from \"./IPlugin.sol\";\n\n/// @title PluginUUPSUpgradeable\n/// @author Aragon Association - 2022-2023\n/// @notice An abstract, upgradeable contract to inherit from when creating a plugin being deployed via the UUPS pattern (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)).\nabstract contract PluginUUPSUpgradeable is\n IPlugin,\n ERC165Upgradeable,\n UUPSUpgradeable,\n DaoAuthorizableUpgradeable\n{\n // NOTE: When adding new state variables to the contract, the size of `_gap` has to be adapted below as well.\n\n /// @notice Disables the initializers on the implementation contract to prevent it from being left uninitialized.\n constructor() {\n _disableInitializers();\n }\n\n /// @inheritdoc IPlugin\n function pluginType() public pure override returns (PluginType) {\n return PluginType.UUPS;\n }\n\n /// @notice The ID of the permission required to call the `_authorizeUpgrade` function.\n bytes32 public constant UPGRADE_PLUGIN_PERMISSION_ID = keccak256(\"UPGRADE_PLUGIN_PERMISSION\");\n\n /// @notice Initializes the plugin by storing the associated DAO.\n /// @param _dao The DAO contract.\n function __PluginUUPSUpgradeable_init(IDAO _dao) internal virtual onlyInitializing {\n __DaoAuthorizableUpgradeable_init(_dao);\n }\n\n /// @notice Checks if an interface is supported by this or its parent contract.\n /// @param _interfaceId The ID of the interface.\n /// @return Returns `true` if the interface is supported.\n function supportsInterface(bytes4 _interfaceId) public view virtual override returns (bool) {\n return\n _interfaceId == type(IPlugin).interfaceId ||\n _interfaceId == type(IERC1822ProxiableUpgradeable).interfaceId ||\n super.supportsInterface(_interfaceId);\n }\n\n /// @notice Returns the address of the implementation contract in the [proxy storage slot](https://eips.ethereum.org/EIPS/eip-1967) slot the [UUPS proxy](https://eips.ethereum.org/EIPS/eip-1822) is pointing to.\n /// @return The address of the implementation contract.\n function implementation() public view returns (address) {\n return _getImplementation();\n }\n\n /// @notice Internal method authorizing the upgrade of the contract via the [upgradeability mechanism for UUPS proxies](https://docs.openzeppelin.com/contracts/4.x/api/proxy#UUPSUpgradeable) (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)).\n /// @dev The caller must have the `UPGRADE_PLUGIN_PERMISSION_ID` permission.\n function _authorizeUpgrade(\n address\n ) internal virtual override auth(UPGRADE_PLUGIN_PERMISSION_ID) {}\n\n /// @notice This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain (see [OpenZeppelin's guide about storage gaps](https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps)).\n uint256[50] private __gap;\n}\n" + }, + "@aragon/osx/core/utils/auth.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity ^0.8.8;\n\nimport {IDAO} from \"../dao/IDAO.sol\";\n\n/// @notice Thrown if a call is unauthorized in the associated DAO.\n/// @param dao The associated DAO.\n/// @param where The context in which the authorization reverted.\n/// @param who The address (EOA or contract) missing the permission.\n/// @param permissionId The permission identifier.\nerror DaoUnauthorized(address dao, address where, address who, bytes32 permissionId);\n\n/// @notice A free function checking if a caller is granted permissions on a target contract via a permission identifier that redirects the approval to a `PermissionCondition` if this was specified in the setup.\n/// @param _where The address of the target contract for which `who` receives permission.\n/// @param _who The address (EOA or contract) owning the permission.\n/// @param _permissionId The permission identifier.\n/// @param _data The optional data passed to the `PermissionCondition` registered.\nfunction _auth(\n IDAO _dao,\n address _where,\n address _who,\n bytes32 _permissionId,\n bytes calldata _data\n) view {\n if (!_dao.hasPermission(_where, _who, _permissionId, _data))\n revert DaoUnauthorized({\n dao: address(_dao),\n where: _where,\n who: _who,\n permissionId: _permissionId\n });\n}\n" + }, + "@aragon/osx/core/utils/BitMap.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity 0.8.17;\n\n/// @param bitmap The `uint256` representation of bits.\n/// @param index The index number to check whether 1 or 0 is set.\n/// @return Returns `true` if the bit is set at `index` on `bitmap`.\nfunction hasBit(uint256 bitmap, uint8 index) pure returns (bool) {\n uint256 bitValue = bitmap & (1 << index);\n return bitValue > 0;\n}\n\n/// @param bitmap The `uint256` representation of bits.\n/// @param index The index number to set the bit.\n/// @return Returns a new number in which the bit is set at `index`.\nfunction flipBit(uint256 bitmap, uint8 index) pure returns (uint256) {\n return bitmap ^ (1 << index);\n}\n" + }, + "@aragon/osx/core/utils/CallbackHandler.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity 0.8.17;\n\n/// @title CallbackHandler\n/// @author Aragon Association - 2022-2023\n/// @notice This contract handles callbacks by registering a magic number together with the callback function's selector. It provides the `_handleCallback` function that inheriting contracts have to call inside their `fallback()` function (`_handleCallback(msg.callbackSelector, msg.data)`). This allows to adaptively register ERC standards (e.g., [ERC-721](https://eips.ethereum.org/EIPS/eip-721), [ERC-1115](https://eips.ethereum.org/EIPS/eip-1155), or future versions of [ERC-165](https://eips.ethereum.org/EIPS/eip-165)) and returning the required magic numbers for the associated callback functions for the inheriting contract so that it doesn't need to be upgraded.\n/// @dev This callback handling functionality is intented to be used by executor contracts (i.e., `DAO.sol`).\nabstract contract CallbackHandler {\n /// @notice A mapping between callback function selectors and magic return numbers.\n mapping(bytes4 => bytes4) internal callbackMagicNumbers;\n\n /// @notice The magic number refering to unregistered callbacks.\n bytes4 internal constant UNREGISTERED_CALLBACK = bytes4(0);\n\n /// @notice Thrown if the callback function is not registered.\n /// @param callbackSelector The selector of the callback function.\n /// @param magicNumber The magic number to be registered for the callback function selector.\n error UnkownCallback(bytes4 callbackSelector, bytes4 magicNumber);\n\n /// @notice Emitted when `_handleCallback` is called.\n /// @param sender Who called the callback.\n /// @param sig The function signature.\n /// @param data The calldata.\n event CallbackReceived(address sender, bytes4 indexed sig, bytes data);\n\n /// @notice Handles callbacks to adaptively support ERC standards.\n /// @dev This function is supposed to be called via `_handleCallback(msg.sig, msg.data)` in the `fallback()` function of the inheriting contract.\n /// @param _callbackSelector The function selector of the callback function.\n /// @param _data The calldata.\n /// @return The magic number registered for the function selector triggering the fallback.\n function _handleCallback(\n bytes4 _callbackSelector,\n bytes memory _data\n ) internal virtual returns (bytes4) {\n bytes4 magicNumber = callbackMagicNumbers[_callbackSelector];\n if (magicNumber == UNREGISTERED_CALLBACK) {\n revert UnkownCallback({callbackSelector: _callbackSelector, magicNumber: magicNumber});\n }\n\n emit CallbackReceived({sender: msg.sender, sig: _callbackSelector, data: _data});\n\n return magicNumber;\n }\n\n /// @notice Registers a magic number for a callback function selector.\n /// @param _callbackSelector The selector of the callback function.\n /// @param _magicNumber The magic number to be registered for the callback function selector.\n function _registerCallback(bytes4 _callbackSelector, bytes4 _magicNumber) internal virtual {\n callbackMagicNumbers[_callbackSelector] = _magicNumber;\n }\n\n /// @notice This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain (see [OpenZeppelin's guide about storage gaps](https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps)).\n uint256[49] private __gap;\n}\n" + }, + "@aragon/osx/framework/dao/DAOFactory.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity 0.8.17;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nimport {IProtocolVersion} from \"../../utils/protocol/IProtocolVersion.sol\";\nimport {ProtocolVersion} from \"../../utils/protocol/ProtocolVersion.sol\";\nimport {DAO} from \"../../core/dao/DAO.sol\";\nimport {PermissionLib} from \"../../core/permission/PermissionLib.sol\";\nimport {createERC1967Proxy} from \"../../utils/Proxy.sol\";\nimport {PluginRepo} from \"../plugin/repo/PluginRepo.sol\";\nimport {PluginSetupProcessor} from \"../plugin/setup/PluginSetupProcessor.sol\";\nimport {hashHelpers, PluginSetupRef} from \"../plugin/setup/PluginSetupProcessorHelpers.sol\";\nimport {IPluginSetup} from \"../plugin/setup/IPluginSetup.sol\";\nimport {DAORegistry} from \"./DAORegistry.sol\";\n\n/// @title DAOFactory\n/// @author Aragon Association - 2022-2023\n/// @notice This contract is used to create a DAO.\ncontract DAOFactory is ERC165, ProtocolVersion {\n /// @notice The DAO base contract, to be used for creating new `DAO`s via `createERC1967Proxy` function.\n address public immutable daoBase;\n\n /// @notice The DAO registry listing the `DAO` contracts created via this contract.\n DAORegistry public immutable daoRegistry;\n\n /// @notice The plugin setup processor for installing plugins on the newly created `DAO`s.\n PluginSetupProcessor public immutable pluginSetupProcessor;\n\n /// @notice The container for the DAO settings to be set during the DAO initialization.\n /// @param trustedForwarder The address of the trusted forwarder required for meta transactions.\n /// @param daoURI The DAO uri used with [EIP-4824](https://eips.ethereum.org/EIPS/eip-4824).\n /// @param subdomain The ENS subdomain to be registered for the DAO contract.\n /// @param metadata The metadata of the DAO.\n struct DAOSettings {\n address trustedForwarder;\n string daoURI;\n string subdomain;\n bytes metadata;\n }\n\n /// @notice The container with the information required to install a plugin on the DAO.\n /// @param pluginSetupRef The `PluginSetupRepo` address of the plugin and the version tag.\n /// @param data The bytes-encoded data containing the input parameters for the installation as specified in the plugin's build metadata JSON file.\n struct PluginSettings {\n PluginSetupRef pluginSetupRef;\n bytes data;\n }\n\n /// @notice Thrown if `PluginSettings` array is empty, and no plugin is provided.\n error NoPluginProvided();\n\n /// @notice The constructor setting the registry and plugin setup processor and creating the base contracts for the factory.\n /// @param _registry The DAO registry to register the DAO by its name.\n /// @param _pluginSetupProcessor The address of PluginSetupProcessor.\n constructor(DAORegistry _registry, PluginSetupProcessor _pluginSetupProcessor) {\n daoRegistry = _registry;\n pluginSetupProcessor = _pluginSetupProcessor;\n\n daoBase = address(new DAO());\n }\n\n /// @notice Checks if this or the parent contract supports an interface by its ID.\n /// @param _interfaceId The ID of the interface.\n /// @return Returns `true` if the interface is supported.\n function supportsInterface(bytes4 _interfaceId) public view virtual override returns (bool) {\n return\n _interfaceId == type(IProtocolVersion).interfaceId ||\n super.supportsInterface(_interfaceId);\n }\n\n /// @notice Creates a new DAO, registers it on the DAO registry, and installs a list of plugins via the plugin setup processor.\n /// @param _daoSettings The DAO settings to be set during the DAO initialization.\n /// @param _pluginSettings The array containing references to plugins and their settings to be installed after the DAO has been created.\n function createDao(\n DAOSettings calldata _daoSettings,\n PluginSettings[] calldata _pluginSettings\n ) external returns (DAO createdDao) {\n // Check if no plugin is provided.\n if (_pluginSettings.length == 0) {\n revert NoPluginProvided();\n }\n\n // Create DAO.\n createdDao = _createDAO(_daoSettings);\n\n // Register DAO.\n daoRegistry.register(createdDao, msg.sender, _daoSettings.subdomain);\n\n // Get Permission IDs\n bytes32 rootPermissionID = createdDao.ROOT_PERMISSION_ID();\n bytes32 applyInstallationPermissionID = pluginSetupProcessor\n .APPLY_INSTALLATION_PERMISSION_ID();\n\n // Grant the temporary permissions.\n // Grant Temporarly `ROOT_PERMISSION` to `pluginSetupProcessor`.\n createdDao.grant(address(createdDao), address(pluginSetupProcessor), rootPermissionID);\n\n // Grant Temporarly `APPLY_INSTALLATION_PERMISSION` on `pluginSetupProcessor` to this `DAOFactory`.\n createdDao.grant(\n address(pluginSetupProcessor),\n address(this),\n applyInstallationPermissionID\n );\n\n // Install plugins on the newly created DAO.\n for (uint256 i; i < _pluginSettings.length; ++i) {\n // Prepare plugin.\n (\n address plugin,\n IPluginSetup.PreparedSetupData memory preparedSetupData\n ) = pluginSetupProcessor.prepareInstallation(\n address(createdDao),\n PluginSetupProcessor.PrepareInstallationParams(\n _pluginSettings[i].pluginSetupRef,\n _pluginSettings[i].data\n )\n );\n\n // Apply plugin.\n pluginSetupProcessor.applyInstallation(\n address(createdDao),\n PluginSetupProcessor.ApplyInstallationParams(\n _pluginSettings[i].pluginSetupRef,\n plugin,\n preparedSetupData.permissions,\n hashHelpers(preparedSetupData.helpers)\n )\n );\n }\n\n // Set the rest of DAO's permissions.\n _setDAOPermissions(createdDao);\n\n // Revoke the temporarly granted permissions.\n // Revoke Temporarly `ROOT_PERMISSION` from `pluginSetupProcessor`.\n createdDao.revoke(address(createdDao), address(pluginSetupProcessor), rootPermissionID);\n\n // Revoke `APPLY_INSTALLATION_PERMISSION` on `pluginSetupProcessor` from this `DAOFactory` .\n createdDao.revoke(\n address(pluginSetupProcessor),\n address(this),\n applyInstallationPermissionID\n );\n\n // Revoke Temporarly `ROOT_PERMISSION_ID` from `pluginSetupProcessor` that implicitly granted to this `DaoFactory`\n // at the create dao step `address(this)` being the initial owner of the new created DAO.\n createdDao.revoke(address(createdDao), address(this), rootPermissionID);\n }\n\n /// @notice Deploys a new DAO `ERC1967` proxy, and initialize it with this contract as the intial owner.\n /// @param _daoSettings The trusted forwarder, name and metadata hash of the DAO it creates.\n function _createDAO(DAOSettings calldata _daoSettings) internal returns (DAO dao) {\n // create dao\n dao = DAO(payable(createERC1967Proxy(daoBase, bytes(\"\"))));\n\n // initialize the DAO and give the `ROOT_PERMISSION_ID` permission to this contract.\n dao.initialize(\n _daoSettings.metadata,\n address(this),\n _daoSettings.trustedForwarder,\n _daoSettings.daoURI\n );\n }\n\n /// @notice Sets the required permissions for the new DAO.\n /// @param _dao The DAO instance just created.\n function _setDAOPermissions(DAO _dao) internal {\n // set permissionIds on the dao itself.\n PermissionLib.SingleTargetPermission[]\n memory items = new PermissionLib.SingleTargetPermission[](6);\n\n // Grant DAO all the permissions required\n items[0] = PermissionLib.SingleTargetPermission(\n PermissionLib.Operation.Grant,\n address(_dao),\n _dao.ROOT_PERMISSION_ID()\n );\n items[1] = PermissionLib.SingleTargetPermission(\n PermissionLib.Operation.Grant,\n address(_dao),\n _dao.UPGRADE_DAO_PERMISSION_ID()\n );\n items[2] = PermissionLib.SingleTargetPermission(\n PermissionLib.Operation.Grant,\n address(_dao),\n _dao.SET_SIGNATURE_VALIDATOR_PERMISSION_ID()\n );\n items[3] = PermissionLib.SingleTargetPermission(\n PermissionLib.Operation.Grant,\n address(_dao),\n _dao.SET_TRUSTED_FORWARDER_PERMISSION_ID()\n );\n items[4] = PermissionLib.SingleTargetPermission(\n PermissionLib.Operation.Grant,\n address(_dao),\n _dao.SET_METADATA_PERMISSION_ID()\n );\n items[5] = PermissionLib.SingleTargetPermission(\n PermissionLib.Operation.Grant,\n address(_dao),\n _dao.REGISTER_STANDARD_CALLBACK_PERMISSION_ID()\n );\n\n _dao.applySingleTargetPermissions(address(_dao), items);\n }\n}\n" + }, + "@aragon/osx/framework/dao/DAORegistry.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity 0.8.17;\n\nimport {IDAO} from \"../../core/dao/IDAO.sol\";\nimport {ENSSubdomainRegistrar} from \"../utils/ens/ENSSubdomainRegistrar.sol\";\nimport {InterfaceBasedRegistry} from \"../utils/InterfaceBasedRegistry.sol\";\nimport {isSubdomainValid} from \"../utils/RegistryUtils.sol\";\n\n/// @title Register your unique DAO subdomain\n/// @author Aragon Association - 2022-2023\n/// @notice This contract provides the possibility to register a DAO.\ncontract DAORegistry is InterfaceBasedRegistry {\n /// @notice The ID of the permission required to call the `register` function.\n bytes32 public constant REGISTER_DAO_PERMISSION_ID = keccak256(\"REGISTER_DAO_PERMISSION\");\n\n /// @notice The ENS subdomain registrar registering the DAO subdomains.\n ENSSubdomainRegistrar public subdomainRegistrar;\n\n /// @notice Thrown if the DAO subdomain doesn't match the regex `[0-9a-z\\-]`\n error InvalidDaoSubdomain(string subdomain);\n\n /// @notice Emitted when a new DAO is registered.\n /// @param dao The address of the DAO contract.\n /// @param creator The address of the creator.\n /// @param subdomain The DAO subdomain.\n event DAORegistered(address indexed dao, address indexed creator, string subdomain);\n\n /// @dev Used to disallow initializing the implementation contract by an attacker for extra safety.\n constructor() {\n _disableInitializers();\n }\n\n /// @notice Initializes the contract.\n /// @param _managingDao the managing DAO address.\n /// @param _subdomainRegistrar The `ENSSubdomainRegistrar` where `ENS` subdomain will be registered.\n function initialize(\n IDAO _managingDao,\n ENSSubdomainRegistrar _subdomainRegistrar\n ) external initializer {\n __InterfaceBasedRegistry_init(_managingDao, type(IDAO).interfaceId);\n subdomainRegistrar = _subdomainRegistrar;\n }\n\n /// @notice Registers a DAO by its address. If a non-empty subdomain name is provided that is not taken already, the DAO becomes the owner of the ENS name.\n /// @dev A subdomain is unique within the Aragon DAO framework and can get stored here.\n /// @param dao The address of the DAO contract.\n /// @param creator The address of the creator.\n /// @param subdomain The DAO subdomain.\n function register(\n IDAO dao,\n address creator,\n string calldata subdomain\n ) external auth(REGISTER_DAO_PERMISSION_ID) {\n address daoAddr = address(dao);\n\n _register(daoAddr);\n\n if ((bytes(subdomain).length > 0)) {\n if (!isSubdomainValid(subdomain)) {\n revert InvalidDaoSubdomain({subdomain: subdomain});\n }\n\n bytes32 labelhash = keccak256(bytes(subdomain));\n\n subdomainRegistrar.registerSubnode(labelhash, daoAddr);\n }\n\n emit DAORegistered(daoAddr, creator, subdomain);\n }\n\n /// @notice This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain (see [OpenZeppelin's guide about storage gaps](https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps)).\n uint256[49] private __gap;\n}\n" + }, + "@aragon/osx/framework/plugin/repo/IPluginRepo.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity 0.8.17;\n\n/// @title IPluginRepo\n/// @author Aragon Association - 2022-2023\n/// @notice The interface required for a plugin repository.\ninterface IPluginRepo {\n /// @notice Updates the metadata for release with content `@fromHex(_releaseMetadata)`.\n /// @param _release The release number.\n /// @param _releaseMetadata The release metadata URI.\n function updateReleaseMetadata(uint8 _release, bytes calldata _releaseMetadata) external;\n\n /// @notice Creates a new plugin version as the latest build for an existing release number or the first build for a new release number for the provided `PluginSetup` contract address and metadata.\n /// @param _release The release number.\n /// @param _pluginSetupAddress The address of the plugin setup contract.\n /// @param _buildMetadata The build metadata URI.\n /// @param _releaseMetadata The release metadata URI.\n function createVersion(\n uint8 _release,\n address _pluginSetupAddress,\n bytes calldata _buildMetadata,\n bytes calldata _releaseMetadata\n ) external;\n}\n" + }, + "@aragon/osx/framework/plugin/repo/PluginRepo.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity 0.8.17;\n\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {ERC165Upgradeable} from \"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\";\nimport {UUPSUpgradeable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\nimport {AddressUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\";\nimport {ERC165CheckerUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165CheckerUpgradeable.sol\";\n\nimport {IProtocolVersion} from \"../../../utils/protocol/IProtocolVersion.sol\";\nimport {ProtocolVersion} from \"../../../utils/protocol/ProtocolVersion.sol\";\nimport {PermissionManager} from \"../../../core/permission/PermissionManager.sol\";\nimport {PluginSetup} from \"../setup/PluginSetup.sol\";\nimport {IPluginSetup} from \"../setup/PluginSetup.sol\";\nimport {IPluginRepo} from \"./IPluginRepo.sol\";\n\n/// @title PluginRepo\n/// @author Aragon Association - 2020 - 2023\n/// @notice The plugin repository contract required for managing and publishing different plugin versions within the Aragon DAO framework.\ncontract PluginRepo is\n Initializable,\n ERC165Upgradeable,\n IPluginRepo,\n UUPSUpgradeable,\n ProtocolVersion,\n PermissionManager\n{\n using AddressUpgradeable for address;\n using ERC165CheckerUpgradeable for address;\n\n /// @notice The struct describing the tag of a version obtained by a release and build number as `RELEASE.BUILD`.\n /// @param release The release number.\n /// @param build The build number\n /// @dev Releases can include a storage layout or the addition of new functions. Builds include logic changes or updates of the UI.\n struct Tag {\n uint8 release;\n uint16 build;\n }\n\n /// @notice The struct describing a plugin version (release and build).\n /// @param tag The version tag.\n /// @param pluginSetup The setup contract associated with this version.\n /// @param buildMetadata The build metadata URI.\n struct Version {\n Tag tag;\n address pluginSetup;\n bytes buildMetadata;\n }\n\n /// @notice The ID of the permission required to call the `createVersion` function.\n bytes32 public constant MAINTAINER_PERMISSION_ID = keccak256(\"MAINTAINER_PERMISSION\");\n\n /// @notice The ID of the permission required to call the `createVersion` function.\n bytes32 public constant UPGRADE_REPO_PERMISSION_ID = keccak256(\"UPGRADE_REPO_PERMISSION\");\n\n /// @notice The mapping between release and build numbers.\n mapping(uint8 => uint16) internal buildsPerRelease;\n\n /// @notice The mapping between the version hash and the corresponding version information.\n mapping(bytes32 => Version) internal versions;\n\n /// @notice The mapping between the plugin setup address and its corresponding version hash.\n mapping(address => bytes32) internal latestTagHashForPluginSetup;\n\n /// @notice The ID of the latest release.\n /// @dev The maximum release number is 255.\n uint8 public latestRelease;\n\n /// @notice Thrown if a version does not exist.\n /// @param versionHash The tag hash.\n error VersionHashDoesNotExist(bytes32 versionHash);\n\n /// @notice Thrown if a plugin setup contract does not inherit from `PluginSetup`.\n error InvalidPluginSetupInterface();\n\n /// @notice Thrown if a release number is zero.\n error ReleaseZeroNotAllowed();\n\n /// @notice Thrown if a release number is incremented by more than one.\n /// @param latestRelease The latest release number.\n /// @param newRelease The new release number.\n error InvalidReleaseIncrement(uint8 latestRelease, uint8 newRelease);\n\n /// @notice Thrown if the same plugin setup contract exists already in a previous releases.\n /// @param release The release number of the already existing plugin setup.\n /// @param build The build number of the already existing plugin setup.\n /// @param pluginSetup The plugin setup contract address.\n error PluginSetupAlreadyInPreviousRelease(uint8 release, uint16 build, address pluginSetup);\n\n /// @notice Thrown if the metadata URI is empty.\n error EmptyReleaseMetadata();\n\n /// @notice Thrown if release does not exist.\n error ReleaseDoesNotExist();\n\n /// @notice Thrown if the same plugin setup exists in previous releases.\n /// @param release The release number.\n /// @param build The build number.\n /// @param pluginSetup The address of the plugin setup contract.\n /// @param buildMetadata The build metadata URI.\n event VersionCreated(\n uint8 release,\n uint16 build,\n address indexed pluginSetup,\n bytes buildMetadata\n );\n\n /// @notice Thrown when a release's metadata was updated.\n /// @param release The release number.\n /// @param releaseMetadata The release metadata URI.\n event ReleaseMetadataUpdated(uint8 release, bytes releaseMetadata);\n\n /// @dev Used to disallow initializing the implementation contract by an attacker for extra safety.\n constructor() {\n _disableInitializers();\n }\n\n /// @notice Initializes the contract by\n /// - initializing the permission manager\n /// - granting the `MAINTAINER_PERMISSION_ID` permission to the initial owner.\n /// @dev This method is required to support [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822).\n function initialize(address initialOwner) external initializer {\n __PermissionManager_init(initialOwner);\n\n _grant(address(this), initialOwner, MAINTAINER_PERMISSION_ID);\n _grant(address(this), initialOwner, UPGRADE_REPO_PERMISSION_ID);\n }\n\n /// @inheritdoc IPluginRepo\n function createVersion(\n uint8 _release,\n address _pluginSetup,\n bytes calldata _buildMetadata,\n bytes calldata _releaseMetadata\n ) external auth(MAINTAINER_PERMISSION_ID) {\n if (!_pluginSetup.supportsInterface(type(IPluginSetup).interfaceId)) {\n revert InvalidPluginSetupInterface();\n }\n\n if (_release == 0) {\n revert ReleaseZeroNotAllowed();\n }\n\n // Check that the release number is not incremented by more than one\n if (_release - latestRelease > 1) {\n revert InvalidReleaseIncrement({latestRelease: latestRelease, newRelease: _release});\n }\n\n if (_release > latestRelease) {\n latestRelease = _release;\n\n if (_releaseMetadata.length == 0) {\n revert EmptyReleaseMetadata();\n }\n }\n\n // Make sure the same plugin setup wasn't used in previous releases.\n Version storage version = versions[latestTagHashForPluginSetup[_pluginSetup]];\n if (version.tag.release != 0 && version.tag.release != _release) {\n revert PluginSetupAlreadyInPreviousRelease(\n version.tag.release,\n version.tag.build,\n _pluginSetup\n );\n }\n\n uint16 build = ++buildsPerRelease[_release];\n\n Tag memory tag = Tag(_release, build);\n bytes32 _tagHash = tagHash(tag);\n\n versions[_tagHash] = Version(tag, _pluginSetup, _buildMetadata);\n\n latestTagHashForPluginSetup[_pluginSetup] = _tagHash;\n\n emit VersionCreated({\n release: _release,\n build: build,\n pluginSetup: _pluginSetup,\n buildMetadata: _buildMetadata\n });\n\n if (_releaseMetadata.length > 0) {\n emit ReleaseMetadataUpdated(_release, _releaseMetadata);\n }\n }\n\n /// @inheritdoc IPluginRepo\n function updateReleaseMetadata(\n uint8 _release,\n bytes calldata _releaseMetadata\n ) external auth(MAINTAINER_PERMISSION_ID) {\n if (_release == 0) {\n revert ReleaseZeroNotAllowed();\n }\n\n if (_release > latestRelease) {\n revert ReleaseDoesNotExist();\n }\n\n if (_releaseMetadata.length == 0) {\n revert EmptyReleaseMetadata();\n }\n\n emit ReleaseMetadataUpdated(_release, _releaseMetadata);\n }\n\n /// @notice Returns the latest version for a given release number.\n /// @param _release The release number.\n /// @return The latest version of this release.\n function getLatestVersion(uint8 _release) public view returns (Version memory) {\n uint16 latestBuild = uint16(buildsPerRelease[_release]);\n return getVersion(tagHash(Tag(_release, latestBuild)));\n }\n\n /// @notice Returns the latest version for a given plugin setup.\n /// @param _pluginSetup The plugin setup address\n /// @return The latest version associated with the plugin Setup.\n function getLatestVersion(address _pluginSetup) public view returns (Version memory) {\n return getVersion(latestTagHashForPluginSetup[_pluginSetup]);\n }\n\n /// @notice Returns the version associated with a tag.\n /// @param _tag The version tag.\n /// @return The version associated with the tag.\n function getVersion(Tag calldata _tag) public view returns (Version memory) {\n return getVersion(tagHash(_tag));\n }\n\n /// @notice Returns the version for a tag hash.\n /// @param _tagHash The tag hash.\n /// @return The version associated with a tag hash.\n function getVersion(bytes32 _tagHash) public view returns (Version memory) {\n Version storage version = versions[_tagHash];\n\n if (version.tag.release == 0) {\n revert VersionHashDoesNotExist(_tagHash);\n }\n\n return version;\n }\n\n /// @notice Gets the total number of builds for a given release number.\n /// @param _release The release number.\n /// @return The number of builds of this release.\n function buildCount(uint8 _release) public view returns (uint256) {\n return buildsPerRelease[_release];\n }\n\n /// @notice The hash of the version tag obtained from the packed, bytes-encoded release and build number.\n /// @param _tag The version tag.\n /// @return The version tag hash.\n function tagHash(Tag memory _tag) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(_tag.release, _tag.build));\n }\n\n /// @notice Internal method authorizing the upgrade of the contract via the [upgradeability mechanism for UUPS proxies](https://docs.openzeppelin.com/contracts/4.x/api/proxy#UUPSUpgradeable) (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)).\n /// @dev The caller must have the `UPGRADE_REPO_PERMISSION_ID` permission.\n function _authorizeUpgrade(\n address\n ) internal virtual override auth(UPGRADE_REPO_PERMISSION_ID) {}\n\n /// @notice Checks if this or the parent contract supports an interface by its ID.\n /// @param _interfaceId The ID of the interface.\n /// @return Returns `true` if the interface is supported.\n function supportsInterface(bytes4 _interfaceId) public view virtual override returns (bool) {\n return\n _interfaceId == type(IPluginRepo).interfaceId ||\n _interfaceId == type(IProtocolVersion).interfaceId ||\n super.supportsInterface(_interfaceId);\n }\n}\n" + }, + "@aragon/osx/framework/plugin/repo/PluginRepoFactory.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity 0.8.17;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nimport {PermissionLib} from \"../../../core/permission/PermissionLib.sol\";\nimport {IProtocolVersion} from \"../../../utils/protocol/IProtocolVersion.sol\";\nimport {ProtocolVersion} from \"../../../utils/protocol/ProtocolVersion.sol\";\nimport {createERC1967Proxy} from \"../../../utils/Proxy.sol\";\nimport {PluginRepoRegistry} from \"./PluginRepoRegistry.sol\";\nimport {PluginRepo} from \"./PluginRepo.sol\";\n\n/// @title PluginRepoFactory\n/// @author Aragon Association - 2022-2023\n/// @notice This contract creates `PluginRepo` proxies and registers them on a `PluginRepoRegistry` contract.\ncontract PluginRepoFactory is ERC165, ProtocolVersion {\n /// @notice The Aragon plugin registry contract.\n PluginRepoRegistry public pluginRepoRegistry;\n\n /// @notice The address of the `PluginRepo` base contract to proxy to..\n address public pluginRepoBase;\n\n /// @notice Initializes the addresses of the Aragon plugin registry and `PluginRepo` base contract to proxy to.\n /// @param _pluginRepoRegistry The aragon plugin registry address.\n constructor(PluginRepoRegistry _pluginRepoRegistry) {\n pluginRepoRegistry = _pluginRepoRegistry;\n\n pluginRepoBase = address(new PluginRepo());\n }\n\n /// @notice Checks if this or the parent contract supports an interface by its ID.\n /// @param _interfaceId The ID of the interface.\n /// @return Returns `true` if the interface is supported.\n function supportsInterface(bytes4 _interfaceId) public view virtual override returns (bool) {\n return\n _interfaceId == type(IProtocolVersion).interfaceId ||\n super.supportsInterface(_interfaceId);\n }\n\n /// @notice Creates a plugin repository proxy pointing to the `pluginRepoBase` implementation and registers it in the Aragon plugin registry.\n /// @param _subdomain The plugin repository subdomain.\n /// @param _initialOwner The plugin maintainer address.\n function createPluginRepo(\n string calldata _subdomain,\n address _initialOwner\n ) external returns (PluginRepo) {\n return _createPluginRepo(_subdomain, _initialOwner);\n }\n\n /// @notice Creates and registers a `PluginRepo` with an ENS subdomain and publishes an initial version `1.1`.\n /// @param _subdomain The plugin repository subdomain.\n /// @param _pluginSetup The plugin factory contract associated with the plugin version.\n /// @param _maintainer The maintainer of the plugin repo. This address has permission to update metadata, upgrade the repo logic, and manage the repo permissions.\n /// @param _releaseMetadata The release metadata URI.\n /// @param _buildMetadata The build metadata URI.\n /// @dev After the creation of the `PluginRepo` and release of the first version by the factory, ownership is transferred to the `_maintainer` address.\n function createPluginRepoWithFirstVersion(\n string calldata _subdomain,\n address _pluginSetup,\n address _maintainer,\n bytes memory _releaseMetadata,\n bytes memory _buildMetadata\n ) external returns (PluginRepo pluginRepo) {\n // Sets `address(this)` as initial owner which is later replaced with the maintainer address.\n pluginRepo = _createPluginRepo(_subdomain, address(this));\n\n pluginRepo.createVersion(1, _pluginSetup, _buildMetadata, _releaseMetadata);\n\n // Setup permissions and transfer ownership from `address(this)` to `_maintainer`.\n _setPluginRepoPermissions(pluginRepo, _maintainer);\n }\n\n /// @notice Set the final permissions for the published plugin repository maintainer. All permissions are revoked from the plugin factory and granted to the specified plugin maintainer.\n /// @param pluginRepo The plugin repository instance just created.\n /// @param maintainer The plugin maintainer address.\n /// @dev The plugin maintainer is granted the `MAINTAINER_PERMISSION_ID`, `UPGRADE_REPO_PERMISSION_ID`, and `ROOT_PERMISSION_ID`.\n function _setPluginRepoPermissions(PluginRepo pluginRepo, address maintainer) internal {\n // Set permissions on the `PluginRepo`s `PermissionManager`\n PermissionLib.SingleTargetPermission[]\n memory items = new PermissionLib.SingleTargetPermission[](6);\n\n bytes32 rootPermissionID = pluginRepo.ROOT_PERMISSION_ID();\n bytes32 maintainerPermissionID = pluginRepo.MAINTAINER_PERMISSION_ID();\n bytes32 upgradePermissionID = pluginRepo.UPGRADE_REPO_PERMISSION_ID();\n\n // Grant the plugin maintainer all the permissions required\n items[0] = PermissionLib.SingleTargetPermission(\n PermissionLib.Operation.Grant,\n maintainer,\n maintainerPermissionID\n );\n items[1] = PermissionLib.SingleTargetPermission(\n PermissionLib.Operation.Grant,\n maintainer,\n upgradePermissionID\n );\n items[2] = PermissionLib.SingleTargetPermission(\n PermissionLib.Operation.Grant,\n maintainer,\n rootPermissionID\n );\n\n // Revoke permissions from the plugin repository factory (`address(this)`).\n items[3] = PermissionLib.SingleTargetPermission(\n PermissionLib.Operation.Revoke,\n address(this),\n rootPermissionID\n );\n items[4] = PermissionLib.SingleTargetPermission(\n PermissionLib.Operation.Revoke,\n address(this),\n maintainerPermissionID\n );\n items[5] = PermissionLib.SingleTargetPermission(\n PermissionLib.Operation.Revoke,\n address(this),\n upgradePermissionID\n );\n\n pluginRepo.applySingleTargetPermissions(address(pluginRepo), items);\n }\n\n /// @notice Internal method creating a `PluginRepo` via the [ERC-1967](https://eips.ethereum.org/EIPS/eip-1967) proxy pattern from the provided base contract and registering it in the Aragon plugin registry.\n /// @dev Passing an empty `_subdomain` will cause the transaction to revert.\n /// @param _subdomain The plugin repository subdomain.\n /// @param _initialOwner The initial owner address.\n function _createPluginRepo(\n string calldata _subdomain,\n address _initialOwner\n ) internal returns (PluginRepo pluginRepo) {\n pluginRepo = PluginRepo(\n createERC1967Proxy(\n pluginRepoBase,\n abi.encodeWithSelector(PluginRepo.initialize.selector, _initialOwner)\n )\n );\n\n pluginRepoRegistry.registerPluginRepo(_subdomain, address(pluginRepo));\n }\n}\n" + }, + "@aragon/osx/framework/plugin/repo/PluginRepoRegistry.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity 0.8.17;\n\nimport {IDAO} from \"../../../core/dao/IDAO.sol\";\nimport {ENSSubdomainRegistrar} from \"../../utils/ens/ENSSubdomainRegistrar.sol\";\nimport {InterfaceBasedRegistry} from \"../../utils/InterfaceBasedRegistry.sol\";\nimport {isSubdomainValid} from \"../../utils/RegistryUtils.sol\";\nimport {IPluginRepo} from \"./IPluginRepo.sol\";\n\n/// @title PluginRepoRegistry\n/// @author Aragon Association - 2022-2023\n/// @notice This contract maintains an address-based registry of plugin repositories in the Aragon App DAO framework.\ncontract PluginRepoRegistry is InterfaceBasedRegistry {\n /// @notice The ID of the permission required to call the `register` function.\n bytes32 public constant REGISTER_PLUGIN_REPO_PERMISSION_ID =\n keccak256(\"REGISTER_PLUGIN_REPO_PERMISSION\");\n\n /// @notice The ENS subdomain registrar registering the PluginRepo subdomains.\n ENSSubdomainRegistrar public subdomainRegistrar;\n\n /// @notice Emitted if a new plugin repository is registered.\n /// @param subdomain The subdomain of the plugin repository.\n /// @param pluginRepo The address of the plugin repository.\n event PluginRepoRegistered(string subdomain, address pluginRepo);\n\n /// @notice Thrown if the plugin subdomain doesn't match the regex `[0-9a-z\\-]`\n error InvalidPluginSubdomain(string subdomain);\n\n /// @notice Thrown if the plugin repository subdomain is empty.\n error EmptyPluginRepoSubdomain();\n\n /// @dev Used to disallow initializing the implementation contract by an attacker for extra safety.\n constructor() {\n _disableInitializers();\n }\n\n /// @notice Initializes the contract by setting calling the `InterfaceBasedRegistry` base class initialize method.\n /// @param _dao The address of the managing DAO.\n /// @param _subdomainRegistrar The `ENSSubdomainRegistrar` where `ENS` subdomain will be registered.\n function initialize(IDAO _dao, ENSSubdomainRegistrar _subdomainRegistrar) external initializer {\n bytes4 pluginRepoInterfaceId = type(IPluginRepo).interfaceId;\n __InterfaceBasedRegistry_init(_dao, pluginRepoInterfaceId);\n\n subdomainRegistrar = _subdomainRegistrar;\n }\n\n /// @notice Registers a plugin repository with a subdomain and address.\n /// @param subdomain The subdomain of the PluginRepo.\n /// @param pluginRepo The address of the PluginRepo contract.\n function registerPluginRepo(\n string calldata subdomain,\n address pluginRepo\n ) external auth(REGISTER_PLUGIN_REPO_PERMISSION_ID) {\n if (!(bytes(subdomain).length > 0)) {\n revert EmptyPluginRepoSubdomain();\n }\n\n if (!isSubdomainValid(subdomain)) {\n revert InvalidPluginSubdomain({subdomain: subdomain});\n }\n\n bytes32 labelhash = keccak256(bytes(subdomain));\n subdomainRegistrar.registerSubnode(labelhash, pluginRepo);\n\n _register(pluginRepo);\n\n emit PluginRepoRegistered(subdomain, pluginRepo);\n }\n\n /// @notice This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain (see [OpenZeppelin's guide about storage gaps](https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps)).\n uint256[49] private __gap;\n}\n" + }, + "@aragon/osx/framework/plugin/setup/IPluginSetup.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity ^0.8.8;\n\nimport {PermissionLib} from \"../../../core/permission/PermissionLib.sol\";\nimport {IDAO} from \"../../../core/dao/IDAO.sol\";\n\n/// @title IPluginSetup\n/// @author Aragon Association - 2022-2023\n/// @notice The interface required for a plugin setup contract to be consumed by the `PluginSetupProcessor` for plugin installations, updates, and uninstallations.\ninterface IPluginSetup {\n /// @notice The data associated with a prepared setup.\n /// @param helpers The address array of helpers (contracts or EOAs) associated with this plugin version after the installation or update.\n /// @param permissions The array of multi-targeted permission operations to be applied by the `PluginSetupProcessor` to the installing or updating DAO.\n struct PreparedSetupData {\n address[] helpers;\n PermissionLib.MultiTargetPermission[] permissions;\n }\n\n /// @notice The payload for plugin updates and uninstallations containing the existing contracts as well as optional data to be consumed by the plugin setup.\n /// @param plugin The address of the `Plugin`.\n /// @param currentHelpers The address array of all current helpers (contracts or EOAs) associated with the plugin to update from.\n /// @param data The bytes-encoded data containing the input parameters for the preparation of update/uninstall as specified in the corresponding ABI on the version's metadata.\n struct SetupPayload {\n address plugin;\n address[] currentHelpers;\n bytes data;\n }\n\n /// @notice Prepares the installation of a plugin.\n /// @param _dao The address of the installing DAO.\n /// @param _data The bytes-encoded data containing the input parameters for the installation as specified in the plugin's build metadata JSON file.\n /// @return plugin The address of the `Plugin` contract being prepared for installation.\n /// @return preparedSetupData The deployed plugin's relevant data which consists of helpers and permissions.\n function prepareInstallation(\n address _dao,\n bytes calldata _data\n ) external returns (address plugin, PreparedSetupData memory preparedSetupData);\n\n /// @notice Prepares the update of a plugin.\n /// @param _dao The address of the updating DAO.\n /// @param _currentBuild The build number of the plugin to update from.\n /// @param _payload The relevant data necessary for the `prepareUpdate`. See above.\n /// @return initData The initialization data to be passed to upgradeable contracts when the update is applied in the `PluginSetupProcessor`.\n /// @return preparedSetupData The deployed plugin's relevant data which consists of helpers and permissions.\n function prepareUpdate(\n address _dao,\n uint16 _currentBuild,\n SetupPayload calldata _payload\n ) external returns (bytes memory initData, PreparedSetupData memory preparedSetupData);\n\n /// @notice Prepares the uninstallation of a plugin.\n /// @param _dao The address of the uninstalling DAO.\n /// @param _payload The relevant data necessary for the `prepareUninstallation`. See above.\n /// @return permissions The array of multi-targeted permission operations to be applied by the `PluginSetupProcessor` to the uninstalling DAO.\n function prepareUninstallation(\n address _dao,\n SetupPayload calldata _payload\n ) external returns (PermissionLib.MultiTargetPermission[] memory permissions);\n\n /// @notice Returns the plugin implementation address.\n /// @return The address of the plugin implementation contract.\n /// @dev The implementation can be instantiated via the `new` keyword, cloned via the minimal clones pattern (see [ERC-1167](https://eips.ethereum.org/EIPS/eip-1167)), or proxied via the UUPS pattern (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)).\n function implementation() external view returns (address);\n}\n" + }, + "@aragon/osx/framework/plugin/setup/PluginSetup.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity ^0.8.8;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {ERC165Checker} from \"@openzeppelin/contracts/utils/introspection/ERC165Checker.sol\";\nimport {Clones} from \"@openzeppelin/contracts/proxy/Clones.sol\";\n\nimport {PermissionLib} from \"../../../core/permission/PermissionLib.sol\";\nimport {createERC1967Proxy as createERC1967} from \"../../../utils/Proxy.sol\";\nimport {IPluginSetup} from \"./IPluginSetup.sol\";\n\n/// @title PluginSetup\n/// @author Aragon Association - 2022-2023\n/// @notice An abstract contract that developers have to inherit from to write the setup of a plugin.\nabstract contract PluginSetup is ERC165, IPluginSetup {\n /// @inheritdoc IPluginSetup\n function prepareUpdate(\n address _dao,\n uint16 _currentBuild,\n SetupPayload calldata _payload\n )\n external\n virtual\n override\n returns (bytes memory initData, PreparedSetupData memory preparedSetupData)\n {}\n\n /// @notice A convenience function to create an [ERC-1967](https://eips.ethereum.org/EIPS/eip-1967) proxy contract pointing to an implementation and being associated to a DAO.\n /// @param _implementation The address of the implementation contract to which the proxy is pointing to.\n /// @param _data The data to initialize the storage of the proxy contract.\n /// @return The address of the created proxy contract.\n function createERC1967Proxy(\n address _implementation,\n bytes memory _data\n ) internal returns (address) {\n return createERC1967(_implementation, _data);\n }\n\n /// @notice Checks if this or the parent contract supports an interface by its ID.\n /// @param _interfaceId The ID of the interface.\n /// @return Returns `true` if the interface is supported.\n function supportsInterface(bytes4 _interfaceId) public view virtual override returns (bool) {\n return\n _interfaceId == type(IPluginSetup).interfaceId || super.supportsInterface(_interfaceId);\n }\n}\n" + }, + "@aragon/osx/framework/plugin/setup/PluginSetupProcessor.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity 0.8.17;\n\nimport {ERC165Checker} from \"@openzeppelin/contracts/utils/introspection/ERC165Checker.sol\";\n\nimport {DAO, IDAO} from \"../../../core/dao/DAO.sol\";\nimport {PermissionLib} from \"../../../core/permission/PermissionLib.sol\";\nimport {PluginUUPSUpgradeable} from \"../../../core/plugin/PluginUUPSUpgradeable.sol\";\nimport {IPlugin} from \"../../../core/plugin/IPlugin.sol\";\n\nimport {PluginRepoRegistry} from \"../repo/PluginRepoRegistry.sol\";\nimport {PluginRepo} from \"../repo/PluginRepo.sol\";\n\nimport {IPluginSetup} from \"./IPluginSetup.sol\";\nimport {PluginSetup} from \"./PluginSetup.sol\";\nimport {PluginSetupRef, hashHelpers, hashPermissions, _getPreparedSetupId, _getAppliedSetupId, _getPluginInstallationId, PreparationType} from \"./PluginSetupProcessorHelpers.sol\";\n\n/// @title PluginSetupProcessor\n/// @author Aragon Association - 2022-2023\n/// @notice This contract processes the preparation and application of plugin setups (installation, update, uninstallation) on behalf of a requesting DAO.\n/// @dev This contract is temporarily granted the `ROOT_PERMISSION_ID` permission on the applying DAO and therefore is highly security critical.\ncontract PluginSetupProcessor {\n using ERC165Checker for address;\n\n /// @notice The ID of the permission required to call the `applyInstallation` function.\n bytes32 public constant APPLY_INSTALLATION_PERMISSION_ID =\n keccak256(\"APPLY_INSTALLATION_PERMISSION\");\n\n /// @notice The ID of the permission required to call the `applyUpdate` function.\n bytes32 public constant APPLY_UPDATE_PERMISSION_ID = keccak256(\"APPLY_UPDATE_PERMISSION\");\n\n /// @notice The ID of the permission required to call the `applyUninstallation` function.\n bytes32 public constant APPLY_UNINSTALLATION_PERMISSION_ID =\n keccak256(\"APPLY_UNINSTALLATION_PERMISSION\");\n\n /// @notice The hash obtained from the bytes-encoded empty array to be used for UI updates being required to submit an empty permission array.\n /// @dev The hash is computed via `keccak256(abi.encode([]))`.\n bytes32 private constant EMPTY_ARRAY_HASH =\n 0x569e75fc77c1a856f6daaf9e69d8a9566ca34aa47f9133711ce065a571af0cfd;\n\n /// @notice The hash obtained from the bytes-encoded zero value.\n /// @dev The hash is computed via `keccak256(abi.encode(0))`.\n bytes32 private constant ZERO_BYTES_HASH =\n 0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563;\n\n /// @notice A struct containing information related to plugin setups that have been applied.\n /// @param blockNumber The block number at which the `applyInstallation`, `applyUpdate` or `applyUninstallation` was executed.\n /// @param currentAppliedSetupId The current setup id that plugin holds. Needed to confirm that `prepareUpdate` or `prepareUninstallation` happens for the plugin's current/valid dependencies.\n /// @param preparedSetupIdToBlockNumber The mapping between prepared setup IDs and block numbers at which `prepareInstallation`, `prepareUpdate` or `prepareUninstallation` was executed.\n struct PluginState {\n uint256 blockNumber;\n bytes32 currentAppliedSetupId;\n mapping(bytes32 => uint256) preparedSetupIdToBlockNumber;\n }\n\n /// @notice A mapping between the plugin installation ID (obtained from the DAO and plugin address) and the plugin state information.\n /// @dev This variable is public on purpose to allow future versions to access and migrate the storage.\n mapping(bytes32 => PluginState) public states;\n\n /// @notice The struct containing the parameters for the `prepareInstallation` function.\n /// @param pluginSetupRef The reference to the plugin setup to be used for the installation.\n /// @param data The bytes-encoded data containing the input parameters for the installation preparation as specified in the corresponding ABI on the version's metadata.\n struct PrepareInstallationParams {\n PluginSetupRef pluginSetupRef;\n bytes data;\n }\n\n /// @notice The struct containing the parameters for the `applyInstallation` function.\n /// @param pluginSetupRef The reference to the plugin setup used for the installation.\n /// @param plugin The address of the plugin contract to be installed.\n /// @param permissions The array of multi-targeted permission operations to be applied by the `PluginSetupProcessor` to the DAO.\n /// @param helpersHash The hash of helpers that were deployed in `prepareInstallation`. This helps to derive the setup ID.\n struct ApplyInstallationParams {\n PluginSetupRef pluginSetupRef;\n address plugin;\n PermissionLib.MultiTargetPermission[] permissions;\n bytes32 helpersHash;\n }\n\n /// @notice The struct containing the parameters for the `prepareUpdate` function.\n /// @param currentVersionTag The tag of the current plugin version to update from.\n /// @param newVersionTag The tag of the new plugin version to update to.\n /// @param pluginSetupRepo The plugin setup repository address on which the plugin exists.\n /// @param setupPayload The payload containing the plugin and helper contract addresses deployed in a preparation step as well as optional data to be consumed by the plugin setup.\n /// This includes the bytes-encoded data containing the input parameters for the update preparation as specified in the corresponding ABI on the version's metadata.\n struct PrepareUpdateParams {\n PluginRepo.Tag currentVersionTag;\n PluginRepo.Tag newVersionTag;\n PluginRepo pluginSetupRepo;\n IPluginSetup.SetupPayload setupPayload;\n }\n\n /// @notice The struct containing the parameters for the `applyUpdate` function.\n /// @param plugin The address of the plugin contract to be updated.\n /// @param pluginSetupRef The reference to the plugin setup used for the update.\n /// @param initData The encoded data (function selector and arguments) to be provided to `upgradeToAndCall`.\n /// @param permissions The array of multi-targeted permission operations to be applied by the `PluginSetupProcessor` to the DAO.\n /// @param helpersHash The hash of helpers that were deployed in `prepareUpdate`. This helps to derive the setup ID.\n struct ApplyUpdateParams {\n address plugin;\n PluginSetupRef pluginSetupRef;\n bytes initData;\n PermissionLib.MultiTargetPermission[] permissions;\n bytes32 helpersHash;\n }\n\n /// @notice The struct containing the parameters for the `prepareUninstallation` function.\n /// @param pluginSetupRef The reference to the plugin setup to be used for the uninstallation.\n /// @param setupPayload The payload containing the plugin and helper contract addresses deployed in a preparation step as well as optional data to be consumed by the plugin setup.\n /// This includes the bytes-encoded data containing the input parameters for the uninstallation preparation as specified in the corresponding ABI on the version's metadata.\n struct PrepareUninstallationParams {\n PluginSetupRef pluginSetupRef;\n IPluginSetup.SetupPayload setupPayload;\n }\n\n /// @notice The struct containing the parameters for the `applyInstallation` function.\n /// @param plugin The address of the plugin contract to be uninstalled.\n /// @param pluginSetupRef The reference to the plugin setup used for the uninstallation.\n /// @param permissions The array of multi-targeted permission operations to be applied by the `PluginSetupProcess.\n struct ApplyUninstallationParams {\n address plugin;\n PluginSetupRef pluginSetupRef;\n PermissionLib.MultiTargetPermission[] permissions;\n }\n\n /// @notice The plugin repo registry listing the `PluginRepo` contracts versioning the `PluginSetup` contracts.\n PluginRepoRegistry public repoRegistry;\n\n /// @notice Thrown if a setup is unauthorized and cannot be applied because of a missing permission of the associated DAO.\n /// @param dao The address of the DAO to which the plugin belongs.\n /// @param caller The address (EOA or contract) that requested the application of a setup on the associated DAO.\n /// @param permissionId The permission identifier.\n /// @dev This is thrown if the `APPLY_INSTALLATION_PERMISSION_ID`, `APPLY_UPDATE_PERMISSION_ID`, or APPLY_UNINSTALLATION_PERMISSION_ID is missing.\n error SetupApplicationUnauthorized(address dao, address caller, bytes32 permissionId);\n\n /// @notice Thrown if a plugin is not upgradeable.\n /// @param plugin The address of the plugin contract.\n error PluginNonupgradeable(address plugin);\n\n /// @notice Thrown if the upgrade of an `UUPSUpgradeable` proxy contract (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)) failed.\n /// @param proxy The address of the proxy.\n /// @param implementation The address of the implementation contract.\n /// @param initData The initialization data to be passed to the upgradeable plugin contract via `upgradeToAndCall`.\n error PluginProxyUpgradeFailed(address proxy, address implementation, bytes initData);\n\n /// @notice Thrown if a contract does not support the `IPlugin` interface.\n /// @param plugin The address of the contract.\n error IPluginNotSupported(address plugin);\n\n /// @notice Thrown if a plugin repository does not exist on the plugin repo registry.\n error PluginRepoNonexistent();\n\n /// @notice Thrown if a plugin setup was already prepared indicated by the prepared setup ID.\n /// @param preparedSetupId The prepared setup ID.\n error SetupAlreadyPrepared(bytes32 preparedSetupId);\n\n /// @notice Thrown if a prepared setup ID is not eligible to be applied. This can happen if another setup has been already applied or if the setup wasn't prepared in the first place.\n /// @param preparedSetupId The prepared setup ID.\n error SetupNotApplicable(bytes32 preparedSetupId);\n\n /// @notice Thrown if the update version is invalid.\n /// @param currentVersionTag The tag of the current version to update from.\n /// @param newVersionTag The tag of the new version to update to.\n error InvalidUpdateVersion(PluginRepo.Tag currentVersionTag, PluginRepo.Tag newVersionTag);\n\n /// @notice Thrown if plugin is already installed and one tries to prepare or apply install on it.\n error PluginAlreadyInstalled();\n\n /// @notice Thrown if the applied setup ID resulting from the supplied setup payload does not match with the current applied setup ID.\n /// @param currentAppliedSetupId The current applied setup ID with which the data in the supplied payload must match.\n /// @param appliedSetupId The applied setup ID obtained from the data in the supplied setup payload.\n error InvalidAppliedSetupId(bytes32 currentAppliedSetupId, bytes32 appliedSetupId);\n\n /// @notice Emitted with a prepared plugin installation to store data relevant for the application step.\n /// @param sender The sender that prepared the plugin installation.\n /// @param dao The address of the DAO to which the plugin belongs.\n /// @param preparedSetupId The prepared setup ID obtained from the supplied data.\n /// @param pluginSetupRepo The repository storing the `PluginSetup` contracts of all versions of a plugin.\n /// @param versionTag The version tag of the plugin setup of the prepared installation.\n /// @param data The bytes-encoded data containing the input parameters for the preparation as specified in the corresponding ABI on the version's metadata.\n /// @param plugin The address of the plugin contract.\n /// @param preparedSetupData The deployed plugin's relevant data which consists of helpers and permissions.\n event InstallationPrepared(\n address indexed sender,\n address indexed dao,\n bytes32 preparedSetupId,\n PluginRepo indexed pluginSetupRepo,\n PluginRepo.Tag versionTag,\n bytes data,\n address plugin,\n IPluginSetup.PreparedSetupData preparedSetupData\n );\n\n /// @notice Emitted after a plugin installation was applied.\n /// @param dao The address of the DAO to which the plugin belongs.\n /// @param plugin The address of the plugin contract.\n /// @param preparedSetupId The prepared setup ID.\n /// @param appliedSetupId The applied setup ID.\n event InstallationApplied(\n address indexed dao,\n address indexed plugin,\n bytes32 preparedSetupId,\n bytes32 appliedSetupId\n );\n\n /// @notice Emitted with a prepared plugin update to store data relevant for the application step.\n /// @param sender The sender that prepared the plugin update.\n /// @param dao The address of the DAO to which the plugin belongs.\n /// @param preparedSetupId The prepared setup ID.\n /// @param pluginSetupRepo The repository storing the `PluginSetup` contracts of all versions of a plugin.\n /// @param versionTag The version tag of the plugin setup of the prepared update.\n /// @param setupPayload The payload containing the plugin and helper contract addresses deployed in a preparation step as well as optional data to be consumed by the plugin setup.\n /// @param preparedSetupData The deployed plugin's relevant data which consists of helpers and permissions.\n /// @param initData The initialization data to be passed to the upgradeable plugin contract.\n event UpdatePrepared(\n address indexed sender,\n address indexed dao,\n bytes32 preparedSetupId,\n PluginRepo indexed pluginSetupRepo,\n PluginRepo.Tag versionTag,\n IPluginSetup.SetupPayload setupPayload,\n IPluginSetup.PreparedSetupData preparedSetupData,\n bytes initData\n );\n\n /// @notice Emitted after a plugin update was applied.\n /// @param dao The address of the DAO to which the plugin belongs.\n /// @param plugin The address of the plugin contract.\n /// @param preparedSetupId The prepared setup ID.\n /// @param appliedSetupId The applied setup ID.\n event UpdateApplied(\n address indexed dao,\n address indexed plugin,\n bytes32 preparedSetupId,\n bytes32 appliedSetupId\n );\n\n /// @notice Emitted with a prepared plugin uninstallation to store data relevant for the application step.\n /// @param sender The sender that prepared the plugin uninstallation.\n /// @param dao The address of the DAO to which the plugin belongs.\n /// @param preparedSetupId The prepared setup ID.\n /// @param pluginSetupRepo The repository storing the `PluginSetup` contracts of all versions of a plugin.\n /// @param versionTag The version tag of the plugin to used for install preparation.\n /// @param setupPayload The payload containing the plugin and helper contract addresses deployed in a preparation step as well as optional data to be consumed by the plugin setup.\n /// @param permissions The list of multi-targeted permission operations to be applied to the installing DAO.\n event UninstallationPrepared(\n address indexed sender,\n address indexed dao,\n bytes32 preparedSetupId,\n PluginRepo indexed pluginSetupRepo,\n PluginRepo.Tag versionTag,\n IPluginSetup.SetupPayload setupPayload,\n PermissionLib.MultiTargetPermission[] permissions\n );\n\n /// @notice Emitted after a plugin installation was applied.\n /// @param dao The address of the DAO to which the plugin belongs.\n /// @param plugin The address of the plugin contract.\n /// @param preparedSetupId The prepared setup ID.\n event UninstallationApplied(\n address indexed dao,\n address indexed plugin,\n bytes32 preparedSetupId\n );\n\n /// @notice A modifier to check if a caller has the permission to apply a prepared setup.\n /// @param _dao The address of the DAO.\n /// @param _permissionId The permission identifier.\n modifier canApply(address _dao, bytes32 _permissionId) {\n _canApply(_dao, _permissionId);\n _;\n }\n\n /// @notice Constructs the plugin setup processor by setting the associated plugin repo registry.\n /// @param _repoRegistry The plugin repo registry contract.\n constructor(PluginRepoRegistry _repoRegistry) {\n repoRegistry = _repoRegistry;\n }\n\n /// @notice Prepares the installation of a plugin.\n /// @param _dao The address of the installing DAO.\n /// @param _params The struct containing the parameters for the `prepareInstallation` function.\n /// @return plugin The prepared plugin contract address.\n /// @return preparedSetupData The data struct containing the array of helper contracts and permissions that the setup has prepared.\n function prepareInstallation(\n address _dao,\n PrepareInstallationParams calldata _params\n ) external returns (address plugin, IPluginSetup.PreparedSetupData memory preparedSetupData) {\n PluginRepo pluginSetupRepo = _params.pluginSetupRef.pluginSetupRepo;\n\n // Check that the plugin repository exists on the plugin repo registry.\n if (!repoRegistry.entries(address(pluginSetupRepo))) {\n revert PluginRepoNonexistent();\n }\n\n // reverts if not found\n PluginRepo.Version memory version = pluginSetupRepo.getVersion(\n _params.pluginSetupRef.versionTag\n );\n\n // Prepare the installation\n (plugin, preparedSetupData) = PluginSetup(version.pluginSetup).prepareInstallation(\n _dao,\n _params.data\n );\n\n bytes32 pluginInstallationId = _getPluginInstallationId(_dao, plugin);\n\n bytes32 preparedSetupId = _getPreparedSetupId(\n _params.pluginSetupRef,\n hashPermissions(preparedSetupData.permissions),\n hashHelpers(preparedSetupData.helpers),\n bytes(\"\"),\n PreparationType.Installation\n );\n\n PluginState storage pluginState = states[pluginInstallationId];\n\n // Check if this plugin is already installed.\n if (pluginState.currentAppliedSetupId != bytes32(0)) {\n revert PluginAlreadyInstalled();\n }\n\n // Check if this setup has already been prepared before and is pending.\n if (pluginState.blockNumber < pluginState.preparedSetupIdToBlockNumber[preparedSetupId]) {\n revert SetupAlreadyPrepared({preparedSetupId: preparedSetupId});\n }\n\n pluginState.preparedSetupIdToBlockNumber[preparedSetupId] = block.number;\n\n emit InstallationPrepared({\n sender: msg.sender,\n dao: _dao,\n preparedSetupId: preparedSetupId,\n pluginSetupRepo: pluginSetupRepo,\n versionTag: _params.pluginSetupRef.versionTag,\n data: _params.data,\n plugin: plugin,\n preparedSetupData: preparedSetupData\n });\n\n return (plugin, preparedSetupData);\n }\n\n /// @notice Applies the permissions of a prepared installation to a DAO.\n /// @param _dao The address of the installing DAO.\n /// @param _params The struct containing the parameters for the `applyInstallation` function.\n function applyInstallation(\n address _dao,\n ApplyInstallationParams calldata _params\n ) external canApply(_dao, APPLY_INSTALLATION_PERMISSION_ID) {\n bytes32 pluginInstallationId = _getPluginInstallationId(_dao, _params.plugin);\n\n PluginState storage pluginState = states[pluginInstallationId];\n\n bytes32 preparedSetupId = _getPreparedSetupId(\n _params.pluginSetupRef,\n hashPermissions(_params.permissions),\n _params.helpersHash,\n bytes(\"\"),\n PreparationType.Installation\n );\n\n // Check if this plugin is already installed.\n if (pluginState.currentAppliedSetupId != bytes32(0)) {\n revert PluginAlreadyInstalled();\n }\n\n validatePreparedSetupId(pluginInstallationId, preparedSetupId);\n\n bytes32 appliedSetupId = _getAppliedSetupId(_params.pluginSetupRef, _params.helpersHash);\n\n pluginState.currentAppliedSetupId = appliedSetupId;\n pluginState.blockNumber = block.number;\n\n // Process the permissions, which requires the `ROOT_PERMISSION_ID` from the installing DAO.\n if (_params.permissions.length > 0) {\n DAO(payable(_dao)).applyMultiTargetPermissions(_params.permissions);\n }\n\n emit InstallationApplied({\n dao: _dao,\n plugin: _params.plugin,\n preparedSetupId: preparedSetupId,\n appliedSetupId: appliedSetupId\n });\n }\n\n /// @notice Prepares the update of an UUPS upgradeable plugin.\n /// @param _dao The address of the DAO For which preparation of update happens.\n /// @param _params The struct containing the parameters for the `prepareUpdate` function.\n /// @return initData The initialization data to be passed to upgradeable contracts when the update is applied\n /// @return preparedSetupData The data struct containing the array of helper contracts and permissions that the setup has prepared.\n /// @dev The list of `_params.setupPayload.currentHelpers` has to be specified in the same order as they were returned from previous setups preparation steps (the latest `prepareInstallation` or `prepareUpdate` step that has happend) on which the update is prepared for.\n function prepareUpdate(\n address _dao,\n PrepareUpdateParams calldata _params\n )\n external\n returns (bytes memory initData, IPluginSetup.PreparedSetupData memory preparedSetupData)\n {\n if (\n _params.currentVersionTag.release != _params.newVersionTag.release ||\n _params.currentVersionTag.build >= _params.newVersionTag.build\n ) {\n revert InvalidUpdateVersion({\n currentVersionTag: _params.currentVersionTag,\n newVersionTag: _params.newVersionTag\n });\n }\n\n bytes32 pluginInstallationId = _getPluginInstallationId(_dao, _params.setupPayload.plugin);\n\n PluginState storage pluginState = states[pluginInstallationId];\n\n bytes32 currentHelpersHash = hashHelpers(_params.setupPayload.currentHelpers);\n\n bytes32 appliedSetupId = _getAppliedSetupId(\n PluginSetupRef(_params.currentVersionTag, _params.pluginSetupRepo),\n currentHelpersHash\n );\n\n // The following check implicitly confirms that plugin is currently installed.\n // Otherwise, `currentAppliedSetupId` would not be set.\n if (pluginState.currentAppliedSetupId != appliedSetupId) {\n revert InvalidAppliedSetupId({\n currentAppliedSetupId: pluginState.currentAppliedSetupId,\n appliedSetupId: appliedSetupId\n });\n }\n\n PluginRepo.Version memory currentVersion = _params.pluginSetupRepo.getVersion(\n _params.currentVersionTag\n );\n\n PluginRepo.Version memory newVersion = _params.pluginSetupRepo.getVersion(\n _params.newVersionTag\n );\n\n bytes32 preparedSetupId;\n\n // If the current and new plugin setup are identical, this is an UI update.\n // In this case, the permission hash is set to the empty array hash and the `prepareUpdate` call is skipped to avoid side effects.\n if (currentVersion.pluginSetup == newVersion.pluginSetup) {\n preparedSetupId = _getPreparedSetupId(\n PluginSetupRef(_params.newVersionTag, _params.pluginSetupRepo),\n EMPTY_ARRAY_HASH,\n currentHelpersHash,\n bytes(\"\"),\n PreparationType.Update\n );\n\n // Because UI updates do not change the plugin functionality, the array of helpers\n // associated with this plugin version `preparedSetupData.helpers` and being returned must\n // equal `_params.setupPayload.currentHelpers` returned by the previous setup step (installation or update )\n // that this update is transitioning from.\n preparedSetupData.helpers = _params.setupPayload.currentHelpers;\n } else {\n // Check that plugin is `PluginUUPSUpgradable`.\n if (!_params.setupPayload.plugin.supportsInterface(type(IPlugin).interfaceId)) {\n revert IPluginNotSupported({plugin: _params.setupPayload.plugin});\n }\n if (IPlugin(_params.setupPayload.plugin).pluginType() != IPlugin.PluginType.UUPS) {\n revert PluginNonupgradeable({plugin: _params.setupPayload.plugin});\n }\n\n // Prepare the update.\n (initData, preparedSetupData) = PluginSetup(newVersion.pluginSetup).prepareUpdate(\n _dao,\n _params.currentVersionTag.build,\n _params.setupPayload\n );\n\n preparedSetupId = _getPreparedSetupId(\n PluginSetupRef(_params.newVersionTag, _params.pluginSetupRepo),\n hashPermissions(preparedSetupData.permissions),\n hashHelpers(preparedSetupData.helpers),\n initData,\n PreparationType.Update\n );\n }\n\n // Check if this setup has already been prepared before and is pending.\n if (pluginState.blockNumber < pluginState.preparedSetupIdToBlockNumber[preparedSetupId]) {\n revert SetupAlreadyPrepared({preparedSetupId: preparedSetupId});\n }\n\n pluginState.preparedSetupIdToBlockNumber[preparedSetupId] = block.number;\n\n // Avoid stack too deep.\n emitPrepareUpdateEvent(_dao, preparedSetupId, _params, preparedSetupData, initData);\n\n return (initData, preparedSetupData);\n }\n\n /// @notice Applies the permissions of a prepared update of an UUPS upgradeable proxy contract to a DAO.\n /// @param _dao The address of the updating DAO.\n /// @param _params The struct containing the parameters for the `applyInstallation` function.\n function applyUpdate(\n address _dao,\n ApplyUpdateParams calldata _params\n ) external canApply(_dao, APPLY_UPDATE_PERMISSION_ID) {\n bytes32 pluginInstallationId = _getPluginInstallationId(_dao, _params.plugin);\n\n PluginState storage pluginState = states[pluginInstallationId];\n\n bytes32 preparedSetupId = _getPreparedSetupId(\n _params.pluginSetupRef,\n hashPermissions(_params.permissions),\n _params.helpersHash,\n _params.initData,\n PreparationType.Update\n );\n\n validatePreparedSetupId(pluginInstallationId, preparedSetupId);\n\n bytes32 appliedSetupId = _getAppliedSetupId(_params.pluginSetupRef, _params.helpersHash);\n\n pluginState.blockNumber = block.number;\n pluginState.currentAppliedSetupId = appliedSetupId;\n\n PluginRepo.Version memory version = _params.pluginSetupRef.pluginSetupRepo.getVersion(\n _params.pluginSetupRef.versionTag\n );\n\n address currentImplementation = PluginUUPSUpgradeable(_params.plugin).implementation();\n address newImplementation = PluginSetup(version.pluginSetup).implementation();\n\n if (currentImplementation != newImplementation) {\n _upgradeProxy(_params.plugin, newImplementation, _params.initData);\n }\n\n // Process the permissions, which requires the `ROOT_PERMISSION_ID` from the updating DAO.\n if (_params.permissions.length > 0) {\n DAO(payable(_dao)).applyMultiTargetPermissions(_params.permissions);\n }\n\n emit UpdateApplied({\n dao: _dao,\n plugin: _params.plugin,\n preparedSetupId: preparedSetupId,\n appliedSetupId: appliedSetupId\n });\n }\n\n /// @notice Prepares the uninstallation of a plugin.\n /// @param _dao The address of the uninstalling DAO.\n /// @param _params The struct containing the parameters for the `prepareUninstallation` function.\n /// @return permissions The list of multi-targeted permission operations to be applied to the uninstalling DAO.\n /// @dev The list of `_params.setupPayload.currentHelpers` has to be specified in the same order as they were returned from previous setups preparation steps (the latest `prepareInstallation` or `prepareUpdate` step that has happend) on which the uninstallation was prepared for.\n function prepareUninstallation(\n address _dao,\n PrepareUninstallationParams calldata _params\n ) external returns (PermissionLib.MultiTargetPermission[] memory permissions) {\n bytes32 pluginInstallationId = _getPluginInstallationId(_dao, _params.setupPayload.plugin);\n\n PluginState storage pluginState = states[pluginInstallationId];\n\n bytes32 appliedSetupId = _getAppliedSetupId(\n _params.pluginSetupRef,\n hashHelpers(_params.setupPayload.currentHelpers)\n );\n\n if (pluginState.currentAppliedSetupId != appliedSetupId) {\n revert InvalidAppliedSetupId({\n currentAppliedSetupId: pluginState.currentAppliedSetupId,\n appliedSetupId: appliedSetupId\n });\n }\n\n PluginRepo.Version memory version = _params.pluginSetupRef.pluginSetupRepo.getVersion(\n _params.pluginSetupRef.versionTag\n );\n\n permissions = PluginSetup(version.pluginSetup).prepareUninstallation(\n _dao,\n _params.setupPayload\n );\n\n bytes32 preparedSetupId = _getPreparedSetupId(\n _params.pluginSetupRef,\n hashPermissions(permissions),\n ZERO_BYTES_HASH,\n bytes(\"\"),\n PreparationType.Uninstallation\n );\n\n // Check if this setup has already been prepared before and is pending.\n if (pluginState.blockNumber < pluginState.preparedSetupIdToBlockNumber[preparedSetupId]) {\n revert SetupAlreadyPrepared({preparedSetupId: preparedSetupId});\n }\n\n pluginState.preparedSetupIdToBlockNumber[preparedSetupId] = block.number;\n\n emit UninstallationPrepared({\n sender: msg.sender,\n dao: _dao,\n preparedSetupId: preparedSetupId,\n pluginSetupRepo: _params.pluginSetupRef.pluginSetupRepo,\n versionTag: _params.pluginSetupRef.versionTag,\n setupPayload: _params.setupPayload,\n permissions: permissions\n });\n }\n\n /// @notice Applies the permissions of a prepared uninstallation to a DAO.\n /// @param _dao The address of the DAO.\n /// @param _dao The address of the uninstalling DAO.\n /// @param _params The struct containing the parameters for the `applyUninstallation` function.\n /// @dev The list of `_params.setupPayload.currentHelpers` has to be specified in the same order as they were returned from previous setups preparation steps (the latest `prepareInstallation` or `prepareUpdate` step that has happend) on which the uninstallation was prepared for.\n function applyUninstallation(\n address _dao,\n ApplyUninstallationParams calldata _params\n ) external canApply(_dao, APPLY_UNINSTALLATION_PERMISSION_ID) {\n bytes32 pluginInstallationId = _getPluginInstallationId(_dao, _params.plugin);\n\n PluginState storage pluginState = states[pluginInstallationId];\n\n bytes32 preparedSetupId = _getPreparedSetupId(\n _params.pluginSetupRef,\n hashPermissions(_params.permissions),\n ZERO_BYTES_HASH,\n bytes(\"\"),\n PreparationType.Uninstallation\n );\n\n validatePreparedSetupId(pluginInstallationId, preparedSetupId);\n\n // Since the plugin is uninstalled, only the current block number must be updated.\n pluginState.blockNumber = block.number;\n pluginState.currentAppliedSetupId = bytes32(0);\n\n // Process the permissions, which requires the `ROOT_PERMISSION_ID` from the uninstalling DAO.\n if (_params.permissions.length > 0) {\n DAO(payable(_dao)).applyMultiTargetPermissions(_params.permissions);\n }\n\n emit UninstallationApplied({\n dao: _dao,\n plugin: _params.plugin,\n preparedSetupId: preparedSetupId\n });\n }\n\n /// @notice Validates that a setup ID can be applied for `applyInstallation`, `applyUpdate`, or `applyUninstallation`.\n /// @param pluginInstallationId The plugin installation ID obtained from the hash of `abi.encode(daoAddress, pluginAddress)`.\n /// @param preparedSetupId The prepared setup ID to be validated.\n /// @dev If the block number stored in `states[pluginInstallationId].blockNumber` exceeds the one stored in `pluginState.preparedSetupIdToBlockNumber[preparedSetupId]`, the prepared setup with `preparedSetupId` is outdated and not applicable anymore.\n function validatePreparedSetupId(\n bytes32 pluginInstallationId,\n bytes32 preparedSetupId\n ) public view {\n PluginState storage pluginState = states[pluginInstallationId];\n if (pluginState.blockNumber >= pluginState.preparedSetupIdToBlockNumber[preparedSetupId]) {\n revert SetupNotApplicable({preparedSetupId: preparedSetupId});\n }\n }\n\n /// @notice Upgrades a UUPS upgradeable proxy contract (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)).\n /// @param _proxy The address of the proxy.\n /// @param _implementation The address of the implementation contract.\n /// @param _initData The initialization data to be passed to the upgradeable plugin contract via `upgradeToAndCall`.\n function _upgradeProxy(\n address _proxy,\n address _implementation,\n bytes memory _initData\n ) private {\n if (_initData.length > 0) {\n try\n PluginUUPSUpgradeable(_proxy).upgradeToAndCall(_implementation, _initData)\n {} catch Error(string memory reason) {\n revert(reason);\n } catch (bytes memory /*lowLevelData*/) {\n revert PluginProxyUpgradeFailed({\n proxy: _proxy,\n implementation: _implementation,\n initData: _initData\n });\n }\n } else {\n try PluginUUPSUpgradeable(_proxy).upgradeTo(_implementation) {} catch Error(\n string memory reason\n ) {\n revert(reason);\n } catch (bytes memory /*lowLevelData*/) {\n revert PluginProxyUpgradeFailed({\n proxy: _proxy,\n implementation: _implementation,\n initData: _initData\n });\n }\n }\n }\n\n /// @notice Checks if a caller can apply a setup. The caller can be either the DAO to which the plugin setup is applied to or another account to which the DAO has granted the respective permission.\n /// @param _dao The address of the applying DAO.\n /// @param _permissionId The permission ID.\n function _canApply(address _dao, bytes32 _permissionId) private view {\n if (\n msg.sender != _dao &&\n !DAO(payable(_dao)).hasPermission(address(this), msg.sender, _permissionId, bytes(\"\"))\n ) {\n revert SetupApplicationUnauthorized({\n dao: _dao,\n caller: msg.sender,\n permissionId: _permissionId\n });\n }\n }\n\n /// @notice A helper to emit the `UpdatePrepared` event from the supplied, structured data.\n /// @param _dao The address of the updating DAO.\n /// @param _preparedSetupId The prepared setup ID.\n /// @param _params The struct containing the parameters for the `prepareUpdate` function.\n /// @param _preparedSetupData The deployed plugin's relevant data which consists of helpers and permissions.\n /// @param _initData The initialization data to be passed to upgradeable contracts when the update is applied\n /// @dev This functions exists to avoid stack-too-deep errors.\n function emitPrepareUpdateEvent(\n address _dao,\n bytes32 _preparedSetupId,\n PrepareUpdateParams calldata _params,\n IPluginSetup.PreparedSetupData memory _preparedSetupData,\n bytes memory _initData\n ) private {\n emit UpdatePrepared({\n sender: msg.sender,\n dao: _dao,\n preparedSetupId: _preparedSetupId,\n pluginSetupRepo: _params.pluginSetupRepo,\n versionTag: _params.newVersionTag,\n setupPayload: _params.setupPayload,\n preparedSetupData: _preparedSetupData,\n initData: _initData\n });\n }\n}\n" + }, + "@aragon/osx/framework/plugin/setup/PluginSetupProcessorHelpers.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity 0.8.17;\n\nimport {PermissionLib} from \"../../../core/permission/PermissionLib.sol\";\nimport {PluginRepo} from \"../repo/PluginRepo.sol\";\nimport {PluginSetup} from \"./PluginSetup.sol\";\n\n/// @notice The struct containing a reference to a plugin setup by specifying the containing plugin repository and the associated version tag.\n/// @param versionTag The tag associated with the plugin setup version.\n/// @param pluginSetupRepo The plugin setup repository.\nstruct PluginSetupRef {\n PluginRepo.Tag versionTag;\n PluginRepo pluginSetupRepo;\n}\n\n/// @notice The different types describing a prepared setup.\n/// @param None The default indicating the lack of a preparation type.\n/// @param Installation The prepared setup installs a new plugin.\n/// @param Update The prepared setup updates an existing plugin.\n/// @param Uninstallation The prepared setup uninstalls an existing plugin.\nenum PreparationType {\n None,\n Installation,\n Update,\n Uninstallation\n}\n\n/// @notice Returns an ID for plugin installation by hashing the DAO and plugin address.\n/// @param _dao The address of the DAO conducting the setup.\n/// @param _plugin The plugin address.\nfunction _getPluginInstallationId(address _dao, address _plugin) pure returns (bytes32) {\n return keccak256(abi.encode(_dao, _plugin));\n}\n\n/// @notice Returns an ID for prepared setup obtained from hashing characterizing elements.\n/// @param _pluginSetupRef The reference of the plugin setup containing plugin setup repo and version tag.\n/// @param _permissionsHash The hash of the permission operations requested by the setup.\n/// @param _helpersHash The hash of the helper contract addresses.\n/// @param _data The bytes-encoded initialize data for the upgrade that is returned by `prepareUpdate`.\n/// @param _preparationType The type of preparation the plugin is currently undergoing. Without this, it is possible to call `applyUpdate` even after `applyInstallation` is called.\n/// @return The prepared setup id.\nfunction _getPreparedSetupId(\n PluginSetupRef memory _pluginSetupRef,\n bytes32 _permissionsHash,\n bytes32 _helpersHash,\n bytes memory _data,\n PreparationType _preparationType\n) pure returns (bytes32) {\n return\n keccak256(\n abi.encode(\n _pluginSetupRef.versionTag,\n _pluginSetupRef.pluginSetupRepo,\n _permissionsHash,\n _helpersHash,\n keccak256(_data),\n _preparationType\n )\n );\n}\n\n/// @notice Returns an identifier for applied installations.\n/// @param _pluginSetupRef The reference of the plugin setup containing plugin setup repo and version tag.\n/// @param _helpersHash The hash of the helper contract addresses.\n/// @return The applied setup id.\nfunction _getAppliedSetupId(\n PluginSetupRef memory _pluginSetupRef,\n bytes32 _helpersHash\n) pure returns (bytes32) {\n return\n keccak256(\n abi.encode(_pluginSetupRef.versionTag, _pluginSetupRef.pluginSetupRepo, _helpersHash)\n );\n}\n\n/// @notice Returns a hash of an array of helper addresses (contracts or EOAs).\n/// @param _helpers The array of helper addresses (contracts or EOAs) to be hashed.\nfunction hashHelpers(address[] memory _helpers) pure returns (bytes32) {\n return keccak256(abi.encode(_helpers));\n}\n\n/// @notice Returns a hash of an array of multi-targeted permission operations.\n/// @param _permissions The array of of multi-targeted permission operations.\n/// @return The hash of the array of permission operations.\nfunction hashPermissions(\n PermissionLib.MultiTargetPermission[] memory _permissions\n) pure returns (bytes32) {\n return keccak256(abi.encode(_permissions));\n}\n" + }, + "@aragon/osx/framework/utils/ens/ENSSubdomainRegistrar.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity 0.8.17;\n\nimport \"@ensdomains/ens-contracts/contracts/registry/ENS.sol\";\nimport \"@ensdomains/ens-contracts/contracts/resolvers/Resolver.sol\";\n\nimport {UUPSUpgradeable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\n\nimport {DaoAuthorizableUpgradeable} from \"../../../core/plugin/dao-authorizable/DaoAuthorizableUpgradeable.sol\";\nimport {IDAO} from \"../../../core/dao/IDAO.sol\";\n\n/// @title ENSSubdomainRegistrar\n/// @author Aragon Association - 2022-2023\n/// @notice This contract registers ENS subdomains under a parent domain specified in the initialization process and maintains ownership of the subdomain since only the resolver address is set. This contract must either be the domain node owner or an approved operator of the node owner. The default resolver being used is the one specified in the parent domain.\ncontract ENSSubdomainRegistrar is UUPSUpgradeable, DaoAuthorizableUpgradeable {\n /// @notice The ID of the permission required to call the `_authorizeUpgrade` function.\n bytes32 public constant UPGRADE_REGISTRAR_PERMISSION_ID =\n keccak256(\"UPGRADE_REGISTRAR_PERMISSION\");\n\n /// @notice The ID of the permission required to call the `registerSubnode` and `setDefaultResolver` function.\n bytes32 public constant REGISTER_ENS_SUBDOMAIN_PERMISSION_ID =\n keccak256(\"REGISTER_ENS_SUBDOMAIN_PERMISSION\");\n\n /// @notice The ENS registry contract\n ENS public ens;\n\n /// @notice The namehash of the domain on which subdomains are registered.\n bytes32 public node;\n\n /// @notice The address of the ENS resolver resolving the names to an address.\n address public resolver;\n\n /// @notice Thrown if the subnode is already registered.\n /// @param subnode The subnode namehash.\n /// @param nodeOwner The node owner address.\n error AlreadyRegistered(bytes32 subnode, address nodeOwner);\n\n /// @notice Thrown if node's resolver is invalid.\n /// @param node The node namehash.\n /// @param resolver The node resolver address.\n error InvalidResolver(bytes32 node, address resolver);\n\n /// @dev Used to disallow initializing the implementation contract by an attacker for extra safety.\n constructor() {\n _disableInitializers();\n }\n\n /// @notice Initializes the component by\n /// - checking that the contract is the domain node owner or an approved operator\n /// - initializing the underlying component\n /// - registering the [ERC-165](https://eips.ethereum.org/EIPS/eip-165) interface ID\n /// - setting the ENS contract, the domain node hash, and resolver.\n /// @param _managingDao The interface of the DAO managing the components permissions.\n /// @param _ens The interface of the ENS registry to be used.\n /// @param _node The ENS parent domain node under which the subdomains are to be registered.\n function initialize(IDAO _managingDao, ENS _ens, bytes32 _node) external initializer {\n __DaoAuthorizableUpgradeable_init(_managingDao);\n\n ens = _ens;\n node = _node;\n\n address nodeResolver = ens.resolver(_node);\n\n if (nodeResolver == address(0)) {\n revert InvalidResolver({node: _node, resolver: nodeResolver});\n }\n\n resolver = nodeResolver;\n }\n\n /// @notice Internal method authorizing the upgrade of the contract via the [upgradeability mechanism for UUPS proxies](https://docs.openzeppelin.com/contracts/4.x/api/proxy#UUPSUpgradeable) (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)).\n /// @dev The caller must have the `UPGRADE_REGISTRAR_PERMISSION_ID` permission.\n function _authorizeUpgrade(\n address\n ) internal virtual override auth(UPGRADE_REGISTRAR_PERMISSION_ID) {}\n\n /// @notice Registers a new subdomain with this registrar as the owner and set the target address in the resolver.\n /// @dev It reverts with no message if this contract isn't the owner nor an approved operator for the given node.\n /// @param _label The labelhash of the subdomain name.\n /// @param _targetAddress The address to which the subdomain resolves.\n function registerSubnode(\n bytes32 _label,\n address _targetAddress\n ) external auth(REGISTER_ENS_SUBDOMAIN_PERMISSION_ID) {\n bytes32 subnode = keccak256(abi.encodePacked(node, _label));\n address currentOwner = ens.owner(subnode);\n\n if (currentOwner != address(0)) {\n revert AlreadyRegistered(subnode, currentOwner);\n }\n\n ens.setSubnodeOwner(node, _label, address(this));\n ens.setResolver(subnode, resolver);\n Resolver(resolver).setAddr(subnode, _targetAddress);\n }\n\n /// @notice Sets the default resolver contract address that the subdomains being registered will use.\n /// @param _resolver The resolver contract to be used.\n function setDefaultResolver(\n address _resolver\n ) external auth(REGISTER_ENS_SUBDOMAIN_PERMISSION_ID) {\n if (_resolver == address(0)) {\n revert InvalidResolver({node: node, resolver: _resolver});\n }\n\n resolver = _resolver;\n }\n\n /// @notice This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain (see [OpenZeppelin's guide about storage gaps](https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps)).\n uint256[47] private __gap;\n}\n" + }, + "@aragon/osx/framework/utils/InterfaceBasedRegistry.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity 0.8.17;\n\nimport {UUPSUpgradeable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\nimport {ERC165CheckerUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165CheckerUpgradeable.sol\";\n\nimport {DaoAuthorizableUpgradeable} from \"../../core/plugin/dao-authorizable/DaoAuthorizableUpgradeable.sol\";\nimport {IDAO} from \"../../core/dao/IDAO.sol\";\n\n/// @title InterfaceBasedRegistry\n/// @author Aragon Association - 2022-2023\n/// @notice An [ERC-165](https://eips.ethereum.org/EIPS/eip-165)-based registry for contracts\nabstract contract InterfaceBasedRegistry is UUPSUpgradeable, DaoAuthorizableUpgradeable {\n using ERC165CheckerUpgradeable for address;\n\n /// @notice The ID of the permission required to call the `_authorizeUpgrade` function.\n bytes32 public constant UPGRADE_REGISTRY_PERMISSION_ID =\n keccak256(\"UPGRADE_REGISTRY_PERMISSION\");\n\n /// @notice The [ERC-165](https://eips.ethereum.org/EIPS/eip-165) interface ID that the target contracts being registered must support.\n bytes4 public targetInterfaceId;\n\n /// @notice The mapping containing the registry entries returning true for registered contract addresses.\n mapping(address => bool) public entries;\n\n /// @notice Thrown if the contract is already registered.\n /// @param registrant The address of the contract to be registered.\n error ContractAlreadyRegistered(address registrant);\n\n /// @notice Thrown if the contract does not support the required interface.\n /// @param registrant The address of the contract to be registered.\n error ContractInterfaceInvalid(address registrant);\n\n /// @notice Thrown if the contract does not support ERC165.\n /// @param registrant The address of the contract.\n error ContractERC165SupportInvalid(address registrant);\n\n /// @notice Initializes the component.\n /// @dev This is required for the UUPS upgradability pattern.\n /// @param _managingDao The interface of the DAO managing the components permissions.\n /// @param _targetInterfaceId The [ERC-165](https://eips.ethereum.org/EIPS/eip-165) interface id of the contracts to be registered.\n function __InterfaceBasedRegistry_init(\n IDAO _managingDao,\n bytes4 _targetInterfaceId\n ) internal virtual onlyInitializing {\n __DaoAuthorizableUpgradeable_init(_managingDao);\n\n targetInterfaceId = _targetInterfaceId;\n }\n\n /// @notice Internal method authorizing the upgrade of the contract via the [upgradeability mechanism for UUPS proxies](https://docs.openzeppelin.com/contracts/4.x/api/proxy#UUPSUpgradeable) (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)).\n /// @dev The caller must have the `UPGRADE_REGISTRY_PERMISSION_ID` permission.\n function _authorizeUpgrade(\n address\n ) internal virtual override auth(UPGRADE_REGISTRY_PERMISSION_ID) {}\n\n /// @notice Register an [ERC-165](https://eips.ethereum.org/EIPS/eip-165) contract address.\n /// @dev The managing DAO needs to grant REGISTER_PERMISSION_ID to registrar.\n /// @param _registrant The address of an [ERC-165](https://eips.ethereum.org/EIPS/eip-165) contract.\n function _register(address _registrant) internal {\n if (entries[_registrant]) {\n revert ContractAlreadyRegistered({registrant: _registrant});\n }\n\n // Will revert if address is not a contract or doesn't fully support targetInterfaceId + ERC165.\n if (!_registrant.supportsInterface(targetInterfaceId)) {\n revert ContractInterfaceInvalid(_registrant);\n }\n\n entries[_registrant] = true;\n }\n\n /// @notice This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain (see [OpenZeppelin's guide about storage gaps](https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps)).\n uint256[48] private __gap;\n}\n" + }, + "@aragon/osx/framework/utils/RegistryUtils.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity 0.8.17;\n\n/// @notice Validates that a subdomain name is composed only from characters in the allowed character set:\n/// - the lowercase letters `a-z`\n/// - the digits `0-9`\n/// - the hyphen `-`\n/// @dev This function allows empty (zero-length) subdomains. If this should not be allowed, make sure to add a respective check when using this function in your code.\n/// @param subDomain The name of the DAO.\n/// @return `true` if the name is valid or `false` if at least one char is invalid.\n/// @dev Aborts on the first invalid char found.\nfunction isSubdomainValid(string calldata subDomain) pure returns (bool) {\n bytes calldata nameBytes = bytes(subDomain);\n uint256 nameLength = nameBytes.length;\n for (uint256 i; i < nameLength; i++) {\n uint8 char = uint8(nameBytes[i]);\n\n // if char is between a-z\n if (char > 96 && char < 123) {\n continue;\n }\n\n // if char is between 0-9\n if (char > 47 && char < 58) {\n continue;\n }\n\n // if char is -\n if (char == 45) {\n continue;\n }\n\n // invalid if one char doesn't work with the rules above\n return false;\n }\n return true;\n}\n" + }, + "@aragon/osx/plugins/utils/Addresslist.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity ^0.8.8;\n\nimport {CheckpointsUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/CheckpointsUpgradeable.sol\";\n\nimport {_uncheckedAdd, _uncheckedSub} from \"../../utils/UncheckedMath.sol\";\n\n/// @title Addresslist\n/// @author Aragon Association - 2021-2023\n/// @notice The majority voting implementation using a list of member addresses.\n/// @dev This contract inherits from `MajorityVotingBase` and implements the `IMajorityVoting` interface.\nabstract contract Addresslist {\n using CheckpointsUpgradeable for CheckpointsUpgradeable.History;\n\n /// @notice The mapping containing the checkpointed history of the address list.\n mapping(address => CheckpointsUpgradeable.History) private _addresslistCheckpoints;\n\n /// @notice The checkpointed history of the length of the address list.\n CheckpointsUpgradeable.History private _addresslistLengthCheckpoints;\n\n /// @notice Thrown when the address list update is invalid, which can be caused by the addition of an existing member or removal of a non-existing member.\n /// @param member The array of member addresses to be added or removed.\n error InvalidAddresslistUpdate(address member);\n\n /// @notice Checks if an account is on the address list at a specific block number.\n /// @param _account The account address being checked.\n /// @param _blockNumber The block number.\n /// @return Whether the account is listed at the specified block number.\n function isListedAtBlock(\n address _account,\n uint256 _blockNumber\n ) public view virtual returns (bool) {\n return _addresslistCheckpoints[_account].getAtBlock(_blockNumber) == 1;\n }\n\n /// @notice Checks if an account is currently on the address list.\n /// @param _account The account address being checked.\n /// @return Whether the account is currently listed.\n function isListed(address _account) public view virtual returns (bool) {\n return _addresslistCheckpoints[_account].latest() == 1;\n }\n\n /// @notice Returns the length of the address list at a specific block number.\n /// @param _blockNumber The specific block to get the count from. If `0`, then the latest checkpoint value is returned.\n /// @return The address list length at the specified block number.\n function addresslistLengthAtBlock(uint256 _blockNumber) public view virtual returns (uint256) {\n return _addresslistLengthCheckpoints.getAtBlock(_blockNumber);\n }\n\n /// @notice Returns the current length of the address list.\n /// @return The current address list length.\n function addresslistLength() public view virtual returns (uint256) {\n return _addresslistLengthCheckpoints.latest();\n }\n\n /// @notice Internal function to add new addresses to the address list.\n /// @param _newAddresses The new addresses to be added.\n function _addAddresses(address[] calldata _newAddresses) internal virtual {\n for (uint256 i; i < _newAddresses.length; ) {\n if (isListed(_newAddresses[i])) {\n revert InvalidAddresslistUpdate(_newAddresses[i]);\n }\n\n // Mark the address as listed\n _addresslistCheckpoints[_newAddresses[i]].push(1);\n\n unchecked {\n ++i;\n }\n }\n _addresslistLengthCheckpoints.push(_uncheckedAdd, _newAddresses.length);\n }\n\n /// @notice Internal function to remove existing addresses from the address list.\n /// @param _exitingAddresses The existing addresses to be removed.\n function _removeAddresses(address[] calldata _exitingAddresses) internal virtual {\n for (uint256 i; i < _exitingAddresses.length; ) {\n if (!isListed(_exitingAddresses[i])) {\n revert InvalidAddresslistUpdate(_exitingAddresses[i]);\n }\n\n // Mark the address as not listed\n _addresslistCheckpoints[_exitingAddresses[i]].push(0);\n\n unchecked {\n ++i;\n }\n }\n _addresslistLengthCheckpoints.push(_uncheckedSub, _exitingAddresses.length);\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 /// https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n uint256[48] private __gap;\n}\n" + }, + "@aragon/osx/plugins/utils/Ratio.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity ^0.8.8;\n\n// The base value to encode real-valued ratios on the interval `[0,1]` as integers on the interval `[0, 10**6]`.\nuint256 constant RATIO_BASE = 10 ** 6;\n\n/// @notice Thrown if a ratio value exceeds the maximal value of `10**6`.\n/// @param limit The maximal value.\n/// @param actual The actual value.\nerror RatioOutOfBounds(uint256 limit, uint256 actual);\n\n/// @notice Applies a ratio to a value and ceils the remainder.\n/// @param _value The value to which the ratio is applied.\n/// @param _ratio The ratio that must be in the interval `[0, 10**6]`.\n/// @return result The resulting value.\nfunction _applyRatioCeiled(uint256 _value, uint256 _ratio) pure returns (uint256 result) {\n if (_ratio > RATIO_BASE) {\n revert RatioOutOfBounds({limit: RATIO_BASE, actual: _ratio});\n }\n\n _value = _value * _ratio;\n uint256 remainder = _value % RATIO_BASE;\n result = _value / RATIO_BASE;\n\n // Check if ceiling is needed\n if (remainder != 0) {\n ++result;\n }\n}\n" + }, + "@aragon/osx/token/ERC20/governance/GovernanceERC20.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity 0.8.17;\n\nimport {IERC20PermitUpgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol\";\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport {IERC20MetadataUpgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\";\nimport {ERC20VotesUpgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20VotesUpgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {ERC165Upgradeable} from \"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\";\nimport {IVotesUpgradeable} from \"@openzeppelin/contracts-upgradeable/governance/utils/IVotesUpgradeable.sol\";\n\nimport {DaoAuthorizableUpgradeable} from \"../../../core/plugin/dao-authorizable/DaoAuthorizableUpgradeable.sol\";\nimport {IDAO} from \"../../../core/dao/IDAO.sol\";\nimport {IERC20MintableUpgradeable} from \"../IERC20MintableUpgradeable.sol\";\n\n/// @title GovernanceERC20\n/// @author Aragon Association\n/// @notice An [OpenZeppelin `Votes`](https://docs.openzeppelin.com/contracts/4.x/api/governance#Votes) compatible [ERC-20](https://eips.ethereum.org/EIPS/eip-20) token that can be used for voting and is managed by a DAO.\ncontract GovernanceERC20 is\n IERC20MintableUpgradeable,\n Initializable,\n ERC165Upgradeable,\n ERC20VotesUpgradeable,\n DaoAuthorizableUpgradeable\n{\n /// @notice The permission identifier to mint new tokens\n bytes32 public constant MINT_PERMISSION_ID = keccak256(\"MINT_PERMISSION\");\n\n /// @notice The settings for the initial mint of the token.\n /// @param receivers The receivers of the tokens.\n /// @param amounts The amounts of tokens to be minted for each receiver.\n /// @dev The lengths of `receivers` and `amounts` must match.\n struct MintSettings {\n address[] receivers;\n uint256[] amounts;\n }\n\n /// @notice Thrown if the number of receivers and amounts specified in the mint settings do not match.\n /// @param receiversArrayLength The length of the `receivers` array.\n /// @param amountsArrayLength The length of the `amounts` array.\n error MintSettingsArrayLengthMismatch(uint256 receiversArrayLength, uint256 amountsArrayLength);\n\n /// @notice Calls the initialize function.\n /// @param _dao The managing DAO.\n /// @param _name The name of the [ERC-20](https://eips.ethereum.org/EIPS/eip-20) governance token.\n /// @param _symbol The symbol of the [ERC-20](https://eips.ethereum.org/EIPS/eip-20) governance token.\n /// @param _mintSettings The token mint settings struct containing the `receivers` and `amounts`.\n constructor(\n IDAO _dao,\n string memory _name,\n string memory _symbol,\n MintSettings memory _mintSettings\n ) {\n initialize(_dao, _name, _symbol, _mintSettings);\n }\n\n /// @notice Initializes the contract and mints tokens to a list of receivers.\n /// @param _dao The managing DAO.\n /// @param _name The name of the [ERC-20](https://eips.ethereum.org/EIPS/eip-20) governance token.\n /// @param _symbol The symbol of the [ERC-20](https://eips.ethereum.org/EIPS/eip-20) governance token.\n /// @param _mintSettings The token mint settings struct containing the `receivers` and `amounts`.\n function initialize(\n IDAO _dao,\n string memory _name,\n string memory _symbol,\n MintSettings memory _mintSettings\n ) public initializer {\n // Check mint settings\n if (_mintSettings.receivers.length != _mintSettings.amounts.length) {\n revert MintSettingsArrayLengthMismatch({\n receiversArrayLength: _mintSettings.receivers.length,\n amountsArrayLength: _mintSettings.amounts.length\n });\n }\n\n __ERC20_init(_name, _symbol);\n __ERC20Permit_init(_name);\n __DaoAuthorizableUpgradeable_init(_dao);\n\n for (uint256 i; i < _mintSettings.receivers.length; ) {\n _mint(_mintSettings.receivers[i], _mintSettings.amounts[i]);\n\n unchecked {\n ++i;\n }\n }\n }\n\n /// @notice Checks if this or the parent contract supports an interface by its ID.\n /// @param _interfaceId The ID of the interface.\n /// @return Returns `true` if the interface is supported.\n function supportsInterface(bytes4 _interfaceId) public view virtual override returns (bool) {\n return\n _interfaceId == type(IERC20Upgradeable).interfaceId ||\n _interfaceId == type(IERC20PermitUpgradeable).interfaceId ||\n _interfaceId == type(IERC20MetadataUpgradeable).interfaceId ||\n _interfaceId == type(IVotesUpgradeable).interfaceId ||\n _interfaceId == type(IERC20MintableUpgradeable).interfaceId ||\n super.supportsInterface(_interfaceId);\n }\n\n /// @notice Mints tokens to an address.\n /// @param to The address receiving the tokens.\n /// @param amount The amount of tokens to be minted.\n function mint(address to, uint256 amount) external override auth(MINT_PERMISSION_ID) {\n _mint(to, amount);\n }\n\n // https://forum.openzeppelin.com/t/self-delegation-in-erc20votes/17501/12?u=novaknole\n /// @inheritdoc ERC20VotesUpgradeable\n function _afterTokenTransfer(address from, address to, uint256 amount) internal override {\n super._afterTokenTransfer(from, to, amount);\n\n // Automatically turn on delegation on mint/transfer but only for the first time.\n if (to != address(0) && numCheckpoints(to) == 0 && delegates(to) == address(0)) {\n _delegate(to, to);\n }\n }\n}\n" + }, + "@aragon/osx/token/ERC20/governance/GovernanceWrappedERC20.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity 0.8.17;\n\nimport {ERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol\";\nimport {ERC20WrapperUpgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20WrapperUpgradeable.sol\";\nimport {IVotesUpgradeable} from \"@openzeppelin/contracts-upgradeable/governance/utils/IVotesUpgradeable.sol\";\nimport {IERC20PermitUpgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol\";\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport {IERC20MetadataUpgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\";\nimport {ERC20VotesUpgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20VotesUpgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {ERC165Upgradeable} from \"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\";\n\nimport {DaoAuthorizableUpgradeable} from \"../../../core/plugin/dao-authorizable/DaoAuthorizableUpgradeable.sol\";\nimport {IDAO} from \"../../../core/dao/IDAO.sol\";\nimport {IGovernanceWrappedERC20} from \"./IGovernanceWrappedERC20.sol\";\n\n/// @title GovernanceWrappedERC20\n/// @author Aragon Association\n/// @notice Wraps an existing [ERC-20](https://eips.ethereum.org/EIPS/eip-20) token by inheriting from `ERC20WrapperUpgradeable` and allows to use it for voting by inheriting from `ERC20VotesUpgradeable`. The latter is compatible with [OpenZeppelin's `Votes`](https://docs.openzeppelin.com/contracts/4.x/api/governance#Votes) interface.\n/// The contract also supports meta transactions. To use an `amount` of underlying tokens for voting, the token owner has to\n/// 1. call `approve` for the tokens to be used by this contract\n/// 2. call `depositFor` to wrap them, which safely transfers the underlying [ERC-20](https://eips.ethereum.org/EIPS/eip-20) tokens to the contract and mints wrapped [ERC-20](https://eips.ethereum.org/EIPS/eip-20) tokens.\n/// To get the [ERC-20](https://eips.ethereum.org/EIPS/eip-20) tokens back, the owner of the wrapped tokens can call `withdrawFor`, which burns the wrapped [ERC-20](https://eips.ethereum.org/EIPS/eip-20) tokens and safely transfers the underlying tokens back to the owner.\n/// @dev This contract intentionally has no public mint functionality because this is the responsibility of the underlying [ERC-20](https://eips.ethereum.org/EIPS/eip-20) token contract.\ncontract GovernanceWrappedERC20 is\n IGovernanceWrappedERC20,\n Initializable,\n ERC165Upgradeable,\n ERC20VotesUpgradeable,\n ERC20WrapperUpgradeable\n{\n /// @notice Calls the initialize function.\n /// @param _token The underlying [ERC-20](https://eips.ethereum.org/EIPS/eip-20) token.\n /// @param _name The name of the wrapped token.\n /// @param _symbol The symbol of the wrapped token.\n constructor(IERC20Upgradeable _token, string memory _name, string memory _symbol) {\n initialize(_token, _name, _symbol);\n }\n\n /// @notice Initializes the contract.\n /// @param _token The underlying [ERC-20](https://eips.ethereum.org/EIPS/eip-20) token.\n /// @param _name The name of the wrapped token.\n /// @param _symbol The symbol of the wrapped token.\n function initialize(\n IERC20Upgradeable _token,\n string memory _name,\n string memory _symbol\n ) public initializer {\n __ERC20_init(_name, _symbol);\n __ERC20Permit_init(_name);\n __ERC20Wrapper_init(_token);\n }\n\n /// @notice Checks if this or the parent contract supports an interface by its ID.\n /// @param _interfaceId The ID of the interface.\n /// @return Returns `true` if the interface is supported.\n function supportsInterface(bytes4 _interfaceId) public view virtual override returns (bool) {\n return\n _interfaceId == type(IGovernanceWrappedERC20).interfaceId ||\n _interfaceId == type(IERC20Upgradeable).interfaceId ||\n _interfaceId == type(IERC20PermitUpgradeable).interfaceId ||\n _interfaceId == type(IERC20MetadataUpgradeable).interfaceId ||\n _interfaceId == type(IVotesUpgradeable).interfaceId ||\n super.supportsInterface(_interfaceId);\n }\n\n /// @inheritdoc ERC20WrapperUpgradeable\n /// @dev Uses the `decimals` of the underlying [ERC-20](https://eips.ethereum.org/EIPS/eip-20) token.\n function decimals()\n public\n view\n override(ERC20Upgradeable, ERC20WrapperUpgradeable)\n returns (uint8)\n {\n return ERC20WrapperUpgradeable.decimals();\n }\n\n /// @inheritdoc IGovernanceWrappedERC20\n function depositFor(\n address account,\n uint256 amount\n ) public override(IGovernanceWrappedERC20, ERC20WrapperUpgradeable) returns (bool) {\n return ERC20WrapperUpgradeable.depositFor(account, amount);\n }\n\n /// @inheritdoc IGovernanceWrappedERC20\n function withdrawTo(\n address account,\n uint256 amount\n ) public override(IGovernanceWrappedERC20, ERC20WrapperUpgradeable) returns (bool) {\n return ERC20WrapperUpgradeable.withdrawTo(account, amount);\n }\n\n // https://forum.openzeppelin.com/t/self-delegation-in-erc20votes/17501/12?u=novaknole\n /// @inheritdoc ERC20VotesUpgradeable\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal override(ERC20VotesUpgradeable, ERC20Upgradeable) {\n super._afterTokenTransfer(from, to, amount);\n\n // Automatically turn on delegation on mint/transfer but only for the first time.\n if (to != address(0) && numCheckpoints(to) == 0 && delegates(to) == address(0)) {\n _delegate(to, to);\n }\n }\n\n /// @inheritdoc ERC20VotesUpgradeable\n function _mint(\n address to,\n uint256 amount\n ) internal override(ERC20VotesUpgradeable, ERC20Upgradeable) {\n super._mint(to, amount);\n }\n\n /// @inheritdoc ERC20VotesUpgradeable\n function _burn(\n address account,\n uint256 amount\n ) internal override(ERC20VotesUpgradeable, ERC20Upgradeable) {\n super._burn(account, amount);\n }\n}\n" + }, + "@aragon/osx/token/ERC20/governance/IGovernanceWrappedERC20.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity 0.8.17;\n\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport {ERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol\";\nimport {ERC20WrapperUpgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20WrapperUpgradeable.sol\";\n\ninterface IGovernanceWrappedERC20 {\n /// @notice Deposits an amount of underlying token and mints the corresponding number of wrapped tokens for a receiving address.\n /// @param account The address receiving the minted, wrapped tokens.\n /// @param amount The amount of tokens to deposit.\n function depositFor(address account, uint256 amount) external returns (bool);\n\n /// @notice Withdraws an amount of underlying tokens to a receiving address and burns the corresponding number of wrapped tokens.\n /// @param account The address receiving the withdrawn, underlying tokens.\n /// @param amount The amount of underlying tokens to withdraw.\n function withdrawTo(address account, uint256 amount) external returns (bool);\n}\n" + }, + "@aragon/osx/token/ERC20/IERC20MintableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity 0.8.17;\n\n/// @title IERC20MintableUpgradeable\n/// @notice Interface to allow minting of [ERC-20](https://eips.ethereum.org/EIPS/eip-20) tokens.\ninterface IERC20MintableUpgradeable {\n /// @notice Mints [ERC-20](https://eips.ethereum.org/EIPS/eip-20) tokens for a receiving address.\n /// @param _to The receiving address.\n /// @param _amount The amount of tokens.\n function mint(address _to, uint256 _amount) external;\n}\n" + }, + "@aragon/osx/utils/protocol/IProtocolVersion.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity ^0.8.8;\n\n/// @title IProtocolVersion\n/// @author Aragon Association - 2022-2023\n/// @notice An interface defining the semantic OSx protocol version.\ninterface IProtocolVersion {\n /// @notice Returns the protocol version at which the current contract was built. Use it to check for future upgrades that might be applicable.\n /// @return _version Returns the semantic OSx protocol version.\n function protocolVersion() external view returns (uint8[3] memory _version);\n}\n" + }, + "@aragon/osx/utils/protocol/ProtocolVersion.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity 0.8.17;\n\nimport {IProtocolVersion} from \"./IProtocolVersion.sol\";\n\n/// @title ProtocolVersion\n/// @author Aragon Association - 2023\n/// @notice An abstract, stateless, non-upgradeable contract serves as a base for other contracts requiring awareness of the OSx protocol version.\n/// @dev Do not add any new variables to this contract that would shift down storage in the inheritance chain.\nabstract contract ProtocolVersion is IProtocolVersion {\n // IMPORTANT: Do not add any storage variable, see the above notice.\n\n /// @inheritdoc IProtocolVersion\n function protocolVersion() public pure returns (uint8[3] memory) {\n return [1, 3, 0];\n }\n}\n" + }, + "@aragon/osx/utils/Proxy.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity ^0.8.8;\n\nimport \"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\";\n\n/// @notice Free function to create a [ERC-1967](https://eips.ethereum.org/EIPS/eip-1967) proxy contract based on the passed base contract address.\n/// @param _logic The base contract address.\n/// @param _data The constructor arguments for this contract.\n/// @return The address of the proxy contract created.\n/// @dev Initializes the upgradeable proxy with an initial implementation specified by _logic. If _data is non-empty, it’s used as data in a delegate call to _logic. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor (see [OpenZeppelin ERC1967Proxy-constructor](https://docs.openzeppelin.com/contracts/4.x/api/proxy#ERC1967Proxy-constructor-address-bytes-)).\nfunction createERC1967Proxy(address _logic, bytes memory _data) returns (address) {\n return address(new ERC1967Proxy(_logic, _data));\n}\n" + }, + "@aragon/osx/utils/UncheckedMath.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity ^0.8.8;\n\n/// @notice Increments an unsigned integer by one without checking the result for overflow errors (using safe math).\n/// @param i The number to be incremented.\n/// @return The number incremented by one.\nfunction _uncheckedIncrement(uint256 i) pure returns (uint256) {\n unchecked {\n ++i;\n }\n return i;\n}\n\n/// @notice Adds two unsigned integers without checking the result for overflow errors (using safe math).\n/// @param a The first summand.\n/// @param b The second summand.\n/// @return The sum.\nfunction _uncheckedAdd(uint256 a, uint256 b) pure returns (uint256) {\n unchecked {\n return a + b;\n }\n}\n\n/// @notice Subtracts two unsigned integers without checking the result for overflow errors (using safe math).\n/// @param a The minuend.\n/// @param b The subtrahend.\n/// @return The difference.\nfunction _uncheckedSub(uint256 a, uint256 b) pure returns (uint256) {\n unchecked {\n return a - b;\n }\n}\n" + }, + "@ensdomains/buffer/contracts/Buffer.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for writing to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n mstore(0x40, add(32, add(ptr, capacity)))\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n function max(uint a, uint b) private pure returns(uint) {\n if (a > b) {\n return a;\n }\n return b;\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Writes a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The start offset to write to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n if (off + len > buf.capacity) {\n resize(buf, max(buf.capacity, len + off) * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(add(len, off), buflen) {\n mstore(bufptr, add(len, off))\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, len);\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, data.length);\n }\n\n /**\n * @dev Writes a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write the byte at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeUint8(buffer memory buf, uint off, uint8 data) internal pure returns(buffer memory) {\n if (off >= buf.capacity) {\n resize(buf, buf.capacity * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if eq(off, buflen) {\n mstore(bufptr, add(buflen, 1))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n return writeUint8(buf, buf.buf.length, data);\n }\n\n /**\n * @dev Writes up to 32 bytes to the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes32 data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n unchecked {\n uint mask = (256 ** len) - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n }\n return buf;\n }\n\n /**\n * @dev Writes a bytes20 to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeBytes20(buffer memory buf, uint off, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, off, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, 32);\n }\n\n /**\n * @dev Writes an integer to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer, for chaining.\n */\n function writeInt(buffer memory buf, uint off, uint data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n uint mask = (256 ** len) - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + off + sizeof(buffer length) + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n return writeInt(buf, buf.buf.length, data, len);\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/dnssec-oracle/BytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary BytesUtils {\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\n\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal.\n * @param self The first bytes to compare.\n * @param other The second bytes to compare.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n return compare(self, 0, self.length, other, 0, other.length);\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal. Comparison is done per-rune,\n * on unicode codepoints.\n * @param self The first bytes to compare.\n * @param offset The offset of self.\n * @param len The length of self.\n * @param other The second bytes to compare.\n * @param otheroffset The offset of the other string.\n * @param otherlen The length of the other string.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n uint256 offset,\n uint256 len,\n bytes memory other,\n uint256 otheroffset,\n uint256 otherlen\n ) internal pure returns (int256) {\n if (offset + len > self.length) {\n revert OffsetOutOfBoundsError(offset + len, self.length);\n }\n if (otheroffset + otherlen > other.length) {\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\n }\n\n uint256 shortest = len;\n if (otherlen < len) shortest = otherlen;\n\n uint256 selfptr;\n uint256 otherptr;\n\n assembly {\n selfptr := add(self, add(offset, 32))\n otherptr := add(other, add(otheroffset, 32))\n }\n for (uint256 idx = 0; idx < shortest; idx += 32) {\n uint256 a;\n uint256 b;\n assembly {\n a := mload(selfptr)\n b := mload(otherptr)\n }\n if (a != b) {\n // Mask out irrelevant bytes and check again\n uint256 mask;\n if (shortest - idx >= 32) {\n mask = type(uint256).max;\n } else {\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\n }\n int256 diff = int256(a & mask) - int256(b & mask);\n if (diff != 0) return diff;\n }\n selfptr += 32;\n otherptr += 32;\n }\n\n return int256(len) - int256(otherlen);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @param len The number of bytes to compare\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset,\n uint256 len\n ) internal pure returns (bool) {\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal with offsets.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset\n ) internal pure returns (bool) {\n return\n keccak(self, offset, self.length - offset) ==\n keccak(other, otherOffset, other.length - otherOffset);\n }\n\n /*\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\n * they are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == offset + other.length &&\n equals(self, offset, other, 0, other.length);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == other.length &&\n equals(self, 0, other, 0, self.length);\n }\n\n /*\n * @dev Returns the 8-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 8 bits of the string, interpreted as an integer.\n */\n function readUint8(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint8 ret) {\n return uint8(self[idx]);\n }\n\n /*\n * @dev Returns the 16-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 16 bits of the string, interpreted as an integer.\n */\n function readUint16(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint16 ret) {\n require(idx + 2 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\n }\n }\n\n /*\n * @dev Returns the 32-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bits of the string, interpreted as an integer.\n */\n function readUint32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint32 ret) {\n require(idx + 4 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 ret) {\n require(idx + 32 <= self.length);\n assembly {\n ret := mload(add(add(self, 32), idx))\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes20(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes20 ret) {\n require(idx + 20 <= self.length);\n assembly {\n ret := and(\n mload(add(add(self, 32), idx)),\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\n )\n }\n }\n\n /*\n * @dev Returns the n byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes.\n * @param len The number of bytes.\n * @return The specified 32 bytes of the string.\n */\n function readBytesN(\n bytes memory self,\n uint256 idx,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(len <= 32);\n require(idx + len <= self.length);\n assembly {\n let mask := not(sub(exp(256, sub(32, len)), 1))\n ret := and(mload(add(add(self, 32), idx)), mask)\n }\n }\n\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint256 mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n }\n\n /*\n * @dev Copies a substring into a new byte string.\n * @param self The byte string to copy from.\n * @param offset The offset to start copying at.\n * @param len The number of bytes to copy.\n */\n function substring(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes memory) {\n require(offset + len <= self.length);\n\n bytes memory ret = new bytes(len);\n uint256 dest;\n uint256 src;\n\n assembly {\n dest := add(ret, 32)\n src := add(add(self, 32), offset)\n }\n memcpy(dest, src, len);\n\n return ret;\n }\n\n // Maps characters from 0x30 to 0x7A to their base32 values.\n // 0xFF represents invalid characters in that range.\n bytes constant base32HexTable =\n hex\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\";\n\n /**\n * @dev Decodes unpadded base32 data of up to one word in length.\n * @param self The data to decode.\n * @param off Offset into the string to start at.\n * @param len Number of characters to decode.\n * @return The decoded data, left aligned.\n */\n function base32HexDecodeWord(\n bytes memory self,\n uint256 off,\n uint256 len\n ) internal pure returns (bytes32) {\n require(len <= 52);\n\n uint256 ret = 0;\n uint8 decoded;\n for (uint256 i = 0; i < len; i++) {\n bytes1 char = self[off + i];\n require(char >= 0x30 && char <= 0x7A);\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\n require(decoded <= 0x20);\n if (i == len - 1) {\n break;\n }\n ret = (ret << 5) | decoded;\n }\n\n uint256 bitlen = len * 5;\n if (len % 8 == 0) {\n // Multiple of 8 characters, no padding\n ret = (ret << 5) | decoded;\n } else if (len % 8 == 2) {\n // Two extra characters - 1 byte\n ret = (ret << 3) | (decoded >> 2);\n bitlen -= 2;\n } else if (len % 8 == 4) {\n // Four extra characters - 2 bytes\n ret = (ret << 1) | (decoded >> 4);\n bitlen -= 4;\n } else if (len % 8 == 5) {\n // Five extra characters - 3 bytes\n ret = (ret << 4) | (decoded >> 1);\n bitlen -= 1;\n } else if (len % 8 == 7) {\n // Seven extra characters - 4 bytes\n ret = (ret << 2) | (decoded >> 3);\n bitlen -= 3;\n } else {\n revert();\n }\n\n return bytes32(ret << (256 - bitlen));\n }\n\n /**\n * @dev Finds the first occurrence of the byte `needle` in `self`.\n * @param self The string to search\n * @param off The offset to start searching at\n * @param len The number of bytes to search\n * @param needle The byte to search for\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\n */\n function find(\n bytes memory self,\n uint256 off,\n uint256 len,\n bytes1 needle\n ) internal pure returns (uint256) {\n for (uint256 idx = off; idx < off + len; idx++) {\n if (self[idx] == needle) {\n return idx;\n }\n }\n return type(uint256).max;\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/dnssec-oracle/RRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/**\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\n */\nlibrary RRUtils {\n using BytesUtils for *;\n using Buffer for *;\n\n /**\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The length of the DNS name at 'offset', in bytes.\n */\n function nameLength(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 idx = offset;\n while (true) {\n assert(idx < self.length);\n uint256 labelLen = self.readUint8(idx);\n idx += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n }\n return idx - offset;\n }\n\n /**\n * @dev Returns a DNS format name at the specified offset of self.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return ret The name.\n */\n function readName(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes memory ret) {\n uint256 len = nameLength(self, offset);\n return self.substring(offset, len);\n }\n\n /**\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The number of labels in the DNS name at 'offset', in bytes.\n */\n function labelCount(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 count = 0;\n while (true) {\n assert(offset < self.length);\n uint256 labelLen = self.readUint8(offset);\n offset += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n count += 1;\n }\n return count;\n }\n\n uint256 constant RRSIG_TYPE = 0;\n uint256 constant RRSIG_ALGORITHM = 2;\n uint256 constant RRSIG_LABELS = 3;\n uint256 constant RRSIG_TTL = 4;\n uint256 constant RRSIG_EXPIRATION = 8;\n uint256 constant RRSIG_INCEPTION = 12;\n uint256 constant RRSIG_KEY_TAG = 16;\n uint256 constant RRSIG_SIGNER_NAME = 18;\n\n struct SignedSet {\n uint16 typeCovered;\n uint8 algorithm;\n uint8 labels;\n uint32 ttl;\n uint32 expiration;\n uint32 inception;\n uint16 keytag;\n bytes signerName;\n bytes data;\n bytes name;\n }\n\n function readSignedSet(\n bytes memory data\n ) internal pure returns (SignedSet memory self) {\n self.typeCovered = data.readUint16(RRSIG_TYPE);\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\n self.labels = data.readUint8(RRSIG_LABELS);\n self.ttl = data.readUint32(RRSIG_TTL);\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\n self.inception = data.readUint32(RRSIG_INCEPTION);\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\n self.data = data.substring(\n RRSIG_SIGNER_NAME + self.signerName.length,\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\n );\n }\n\n function rrs(\n SignedSet memory rrset\n ) internal pure returns (RRIterator memory) {\n return iterateRRs(rrset.data, 0);\n }\n\n /**\n * @dev An iterator over resource records.\n */\n struct RRIterator {\n bytes data;\n uint256 offset;\n uint16 dnstype;\n uint16 class;\n uint32 ttl;\n uint256 rdataOffset;\n uint256 nextOffset;\n }\n\n /**\n * @dev Begins iterating over resource records.\n * @param self The byte string to read from.\n * @param offset The offset to start reading at.\n * @return ret An iterator object.\n */\n function iterateRRs(\n bytes memory self,\n uint256 offset\n ) internal pure returns (RRIterator memory ret) {\n ret.data = self;\n ret.nextOffset = offset;\n next(ret);\n }\n\n /**\n * @dev Returns true iff there are more RRs to iterate.\n * @param iter The iterator to check.\n * @return True iff the iterator has finished.\n */\n function done(RRIterator memory iter) internal pure returns (bool) {\n return iter.offset >= iter.data.length;\n }\n\n /**\n * @dev Moves the iterator to the next resource record.\n * @param iter The iterator to advance.\n */\n function next(RRIterator memory iter) internal pure {\n iter.offset = iter.nextOffset;\n if (iter.offset >= iter.data.length) {\n return;\n }\n\n // Skip the name\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\n\n // Read type, class, and ttl\n iter.dnstype = iter.data.readUint16(off);\n off += 2;\n iter.class = iter.data.readUint16(off);\n off += 2;\n iter.ttl = iter.data.readUint32(off);\n off += 4;\n\n // Read the rdata\n uint256 rdataLength = iter.data.readUint16(off);\n off += 2;\n iter.rdataOffset = off;\n iter.nextOffset = off + rdataLength;\n }\n\n /**\n * @dev Returns the name of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the owner name from the RR.\n */\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.offset,\n nameLength(iter.data, iter.offset)\n );\n }\n\n /**\n * @dev Returns the rdata portion of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the RR's RDATA.\n */\n function rdata(\n RRIterator memory iter\n ) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.rdataOffset,\n iter.nextOffset - iter.rdataOffset\n );\n }\n\n uint256 constant DNSKEY_FLAGS = 0;\n uint256 constant DNSKEY_PROTOCOL = 2;\n uint256 constant DNSKEY_ALGORITHM = 3;\n uint256 constant DNSKEY_PUBKEY = 4;\n\n struct DNSKEY {\n uint16 flags;\n uint8 protocol;\n uint8 algorithm;\n bytes publicKey;\n }\n\n function readDNSKEY(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DNSKEY memory self) {\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\n self.publicKey = data.substring(\n offset + DNSKEY_PUBKEY,\n length - DNSKEY_PUBKEY\n );\n }\n\n uint256 constant DS_KEY_TAG = 0;\n uint256 constant DS_ALGORITHM = 2;\n uint256 constant DS_DIGEST_TYPE = 3;\n uint256 constant DS_DIGEST = 4;\n\n struct DS {\n uint16 keytag;\n uint8 algorithm;\n uint8 digestType;\n bytes digest;\n }\n\n function readDS(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DS memory self) {\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\n }\n\n function isSubdomainOf(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n uint256 off = 0;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n while (counts > othercounts) {\n off = progress(self, off);\n counts--;\n }\n\n return self.equals(off, other, 0);\n }\n\n function compareNames(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n if (self.equals(other)) {\n return 0;\n }\n\n uint256 off;\n uint256 otheroff;\n uint256 prevoff;\n uint256 otherprevoff;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n // Keep removing labels from the front of the name until both names are equal length\n while (counts > othercounts) {\n prevoff = off;\n off = progress(self, off);\n counts--;\n }\n\n while (othercounts > counts) {\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n othercounts--;\n }\n\n // Compare the last nonequal labels to each other\n while (counts > 0 && !self.equals(off, other, otheroff)) {\n prevoff = off;\n off = progress(self, off);\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n counts -= 1;\n }\n\n if (off == 0) {\n return -1;\n }\n if (otheroff == 0) {\n return 1;\n }\n\n return\n self.compare(\n prevoff + 1,\n self.readUint8(prevoff),\n other,\n otherprevoff + 1,\n other.readUint8(otherprevoff)\n );\n }\n\n /**\n * @dev Compares two serial numbers using RFC1982 serial number math.\n */\n function serialNumberGte(\n uint32 i1,\n uint32 i2\n ) internal pure returns (bool) {\n unchecked {\n return int32(i1) - int32(i2) >= 0;\n }\n }\n\n function progress(\n bytes memory body,\n uint256 off\n ) internal pure returns (uint256) {\n return off + 1 + body.readUint8(off);\n }\n\n /**\n * @dev Computes the keytag for a chunk of data.\n * @param data The data to compute a keytag for.\n * @return The computed key tag.\n */\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\n /* This function probably deserves some explanation.\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\n *\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\n * uint ac;\n * for (uint i = 0; i < data.length; i++) {\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\n * }\n * return uint16(ac + (ac >> 16));\n * }\n *\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\n * large words work in our favour.\n *\n * The code below works by treating the input as a series of 256 bit words. It first masks out\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\n * effectively summing 16 different numbers with each EVM ADD opcode.\n *\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\n * and the remaining sums can be done just on ac1.\n */\n unchecked {\n require(data.length <= 8192, \"Long keys not permitted\");\n uint256 ac1;\n uint256 ac2;\n for (uint256 i = 0; i < data.length + 31; i += 32) {\n uint256 word;\n assembly {\n word := mload(add(add(data, 32), i))\n }\n if (i + 32 > data.length) {\n uint256 unused = 256 - (data.length - i) * 8;\n word = (word >> unused) << unused;\n }\n ac1 +=\n (word &\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\n 8;\n ac2 += (word &\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\n }\n ac1 =\n (ac1 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac1 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac2 =\n (ac2 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac2 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac1 = (ac1 << 8) + ac2;\n ac1 =\n (ac1 &\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\n 32);\n ac1 =\n (ac1 &\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\n 64);\n ac1 =\n (ac1 &\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\n (ac1 >> 128);\n ac1 += (ac1 >> 16) & 0xFFFF;\n return uint16(ac1);\n }\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "@ensdomains/ens-contracts/contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "@ensdomains/ens-contracts/contracts/registry/ENSRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistry is ENS {\n struct Record {\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n mapping(bytes32 => Record) records;\n mapping(address => mapping(address => bool)) operators;\n\n // Permits modifications only by the owner of the specified node.\n modifier authorised(bytes32 node) {\n address owner = records[node].owner;\n require(owner == msg.sender || operators[owner][msg.sender]);\n _;\n }\n\n /**\n * @dev Constructs a new ENS registry.\n */\n constructor() public {\n records[0x0].owner = msg.sender;\n }\n\n /**\n * @dev Sets the record for a node.\n * @param node The node to update.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n setOwner(node, owner);\n _setResolverAndTTL(node, resolver, ttl);\n }\n\n /**\n * @dev Sets the record for a subnode.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n bytes32 subnode = setSubnodeOwner(node, label, owner);\n _setResolverAndTTL(subnode, resolver, ttl);\n }\n\n /**\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\n * @param node The node to transfer ownership of.\n * @param owner The address of the new owner.\n */\n function setOwner(\n bytes32 node,\n address owner\n ) public virtual override authorised(node) {\n _setOwner(node, owner);\n emit Transfer(node, owner);\n }\n\n /**\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n */\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) public virtual override authorised(node) returns (bytes32) {\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\n _setOwner(subnode, owner);\n emit NewOwner(node, label, owner);\n return subnode;\n }\n\n /**\n * @dev Sets the resolver address for the specified node.\n * @param node The node to update.\n * @param resolver The address of the resolver.\n */\n function setResolver(\n bytes32 node,\n address resolver\n ) public virtual override authorised(node) {\n emit NewResolver(node, resolver);\n records[node].resolver = resolver;\n }\n\n /**\n * @dev Sets the TTL for the specified node.\n * @param node The node to update.\n * @param ttl The TTL in seconds.\n */\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public virtual override authorised(node) {\n emit NewTTL(node, ttl);\n records[node].ttl = ttl;\n }\n\n /**\n * @dev Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\n * @param operator Address to add to the set of authorized operators.\n * @param approved True if the operator is approved, false to revoke approval.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) external virtual override {\n operators[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(\n bytes32 node\n ) public view virtual override returns (address) {\n address addr = records[node].owner;\n if (addr == address(this)) {\n return address(0x0);\n }\n\n return addr;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(\n bytes32 node\n ) public view virtual override returns (address) {\n return records[node].resolver;\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view virtual override returns (uint64) {\n return records[node].ttl;\n }\n\n /**\n * @dev Returns whether a record has been imported to the registry.\n * @param node The specified node.\n * @return Bool if record exists\n */\n function recordExists(\n bytes32 node\n ) public view virtual override returns (bool) {\n return records[node].owner != address(0x0);\n }\n\n /**\n * @dev Query if an address is an authorized operator for another address.\n * @param owner The address that owns the records.\n * @param operator The address that acts on behalf of the owner.\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\n */\n function isApprovedForAll(\n address owner,\n address operator\n ) external view virtual override returns (bool) {\n return operators[owner][operator];\n }\n\n function _setOwner(bytes32 node, address owner) internal virtual {\n records[node].owner = owner;\n }\n\n function _setResolverAndTTL(\n bytes32 node,\n address resolver,\n uint64 ttl\n ) internal {\n if (resolver != records[node].resolver) {\n records[node].resolver = resolver;\n emit NewResolver(node, resolver);\n }\n\n if (ttl != records[node].ttl) {\n records[node].ttl = ttl;\n emit NewTTL(node, ttl);\n }\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/registry/FIFSRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them.\n */\ncontract FIFSRegistrar {\n ENS ens;\n bytes32 rootNode;\n\n modifier only_owner(bytes32 label) {\n address currentOwner = ens.owner(\n keccak256(abi.encodePacked(rootNode, label))\n );\n require(currentOwner == address(0x0) || currentOwner == msg.sender);\n _;\n }\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) public {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name, or change the owner of an existing registration.\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public only_owner(label) {\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/IMulticallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IMulticallable {\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/Multicallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"./IMulticallable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract Multicallable is IMulticallable, ERC165 {\n function _multicall(\n bytes32 nodehash,\n bytes[] calldata data\n ) internal returns (bytes[] memory results) {\n results = new bytes[](data.length);\n for (uint256 i = 0; i < data.length; i++) {\n if (nodehash != bytes32(0)) {\n bytes32 txNamehash = bytes32(data[i][4:36]);\n require(\n txNamehash == nodehash,\n \"multicall: All records must have a matching namehash\"\n );\n }\n (bool success, bytes memory result) = address(this).delegatecall(\n data[i]\n );\n require(success);\n results[i] = result;\n }\n return results;\n }\n\n // This function provides an extra security check when called\n // from priviledged contracts (such as EthRegistrarController)\n // that can set records on behalf of the node owners\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results) {\n return _multicall(nodehash, data);\n }\n\n function multicall(\n bytes[] calldata data\n ) public override returns (bytes[] memory results) {\n return _multicall(bytes32(0), data);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IMulticallable).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/ABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./IABIResolver.sol\";\nimport \"../ResolverBase.sol\";\n\nabstract contract ABIResolver is IABIResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis;\n\n /**\n * Sets the ABI associated with an ENS node.\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\n * the empty string.\n * @param node The node to update.\n * @param contentType The content type of the ABI\n * @param data The ABI data.\n */\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external virtual authorised(node) {\n // Content types must be powers of 2\n require(((contentType - 1) & contentType) == 0);\n\n versionable_abis[recordVersions[node]][node][contentType] = data;\n emit ABIChanged(node, contentType);\n }\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view virtual override returns (uint256, bytes memory) {\n mapping(uint256 => bytes) storage abiset = versionable_abis[\n recordVersions[node]\n ][node];\n\n for (\n uint256 contentType = 1;\n contentType <= contentTypes;\n contentType <<= 1\n ) {\n if (\n (contentType & contentTypes) != 0 &&\n abiset[contentType].length > 0\n ) {\n return (contentType, abiset[contentType]);\n }\n }\n\n return (0, bytes(\"\"));\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IABIResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/AddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IAddrResolver.sol\";\nimport \"./IAddressResolver.sol\";\n\nabstract contract AddrResolver is\n IAddrResolver,\n IAddressResolver,\n ResolverBase\n{\n uint256 private constant COIN_TYPE_ETH = 60;\n\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\n\n /**\n * Sets the address associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param a The address to set.\n */\n function setAddr(\n bytes32 node,\n address a\n ) external virtual authorised(node) {\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\n }\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(\n bytes32 node\n ) public view virtual override returns (address payable) {\n bytes memory a = addr(node, COIN_TYPE_ETH);\n if (a.length == 0) {\n return payable(0);\n }\n return bytesToAddress(a);\n }\n\n function setAddr(\n bytes32 node,\n uint256 coinType,\n bytes memory a\n ) public virtual authorised(node) {\n emit AddressChanged(node, coinType, a);\n if (coinType == COIN_TYPE_ETH) {\n emit AddrChanged(node, bytesToAddress(a));\n }\n versionable_addresses[recordVersions[node]][node][coinType] = a;\n }\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) public view virtual override returns (bytes memory) {\n return versionable_addresses[recordVersions[node]][node][coinType];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IAddrResolver).interfaceId ||\n interfaceID == type(IAddressResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function bytesToAddress(\n bytes memory b\n ) internal pure returns (address payable a) {\n require(b.length == 20);\n assembly {\n a := div(mload(add(b, 32)), exp(256, 12))\n }\n }\n\n function addressToBytes(address a) internal pure returns (bytes memory b) {\n b = new bytes(20);\n assembly {\n mstore(add(b, 32), mul(a, exp(256, 12)))\n }\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/ContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IContentHashResolver.sol\";\n\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes;\n\n /**\n * Sets the contenthash associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The contenthash to set\n */\n function setContenthash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n versionable_hashes[recordVersions[node]][node] = hash;\n emit ContenthashChanged(node, hash);\n }\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_hashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IContentHashResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/DNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"../../dnssec-oracle/RRUtils.sol\";\nimport \"./IDNSRecordResolver.sol\";\nimport \"./IDNSZoneResolver.sol\";\n\nabstract contract DNSResolver is\n IDNSRecordResolver,\n IDNSZoneResolver,\n ResolverBase\n{\n using RRUtils for *;\n using BytesUtils for bytes;\n\n // Zone hashes for the domains.\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\n // resource containing a single zonefile.\n // node => contenthash\n mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes;\n\n // The records themselves. Stored as binary RRSETs\n // node => version => name => resource => data\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))\n private versionable_records;\n\n // Count of number of entries for a given name. Required for DNS resolvers\n // when resolving wildcards.\n // node => version => name => number of records\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))\n private versionable_nameEntriesCount;\n\n /**\n * Set one or more DNS records. Records are supplied in wire-format.\n * Records with the same node/name/resource must be supplied one after the\n * other to ensure the data is updated correctly. For example, if the data\n * was supplied:\n * a.example.com IN A 1.2.3.4\n * a.example.com IN A 5.6.7.8\n * www.example.com IN CNAME a.example.com.\n * then this would store the two A records for a.example.com correctly as a\n * single RRSET, however if the data was supplied:\n * a.example.com IN A 1.2.3.4\n * www.example.com IN CNAME a.example.com.\n * a.example.com IN A 5.6.7.8\n * then this would store the first A record, the CNAME, then the second A\n * record which would overwrite the first.\n *\n * @param node the namehash of the node for which to set the records\n * @param data the DNS wire format records to set\n */\n function setDNSRecords(\n bytes32 node,\n bytes calldata data\n ) external virtual authorised(node) {\n uint16 resource = 0;\n uint256 offset = 0;\n bytes memory name;\n bytes memory value;\n bytes32 nameHash;\n uint64 version = recordVersions[node];\n // Iterate over the data to add the resource records\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (resource == 0) {\n resource = iter.dnstype;\n name = iter.name();\n nameHash = keccak256(abi.encodePacked(name));\n value = bytes(iter.rdata());\n } else {\n bytes memory newName = iter.name();\n if (resource != iter.dnstype || !name.equals(newName)) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n iter.offset - offset,\n value.length == 0,\n version\n );\n resource = iter.dnstype;\n offset = iter.offset;\n name = newName;\n nameHash = keccak256(name);\n value = bytes(iter.rdata());\n }\n }\n }\n if (name.length > 0) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n data.length - offset,\n value.length == 0,\n version\n );\n }\n }\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) public view virtual override returns (bytes memory) {\n return versionable_records[recordVersions[node]][node][name][resource];\n }\n\n /**\n * Check if a given node has records.\n * @param node the namehash of the node for which to check the records\n * @param name the namehash of the node for which to check the records\n */\n function hasDNSRecords(\n bytes32 node,\n bytes32 name\n ) public view virtual returns (bool) {\n return (versionable_nameEntriesCount[recordVersions[node]][node][\n name\n ] != 0);\n }\n\n /**\n * setZonehash sets the hash for the zone.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The zonehash to set\n */\n function setZonehash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n uint64 currentRecordVersion = recordVersions[node];\n bytes memory oldhash = versionable_zonehashes[currentRecordVersion][\n node\n ];\n versionable_zonehashes[currentRecordVersion][node] = hash;\n emit DNSZonehashChanged(node, oldhash, hash);\n }\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_zonehashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IDNSRecordResolver).interfaceId ||\n interfaceID == type(IDNSZoneResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function setDNSRRSet(\n bytes32 node,\n bytes memory name,\n uint16 resource,\n bytes memory data,\n uint256 offset,\n uint256 size,\n bool deleteRecord,\n uint64 version\n ) private {\n bytes32 nameHash = keccak256(name);\n bytes memory rrData = data.substring(offset, size);\n if (deleteRecord) {\n if (\n versionable_records[version][node][nameHash][resource].length !=\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]--;\n }\n delete (versionable_records[version][node][nameHash][resource]);\n emit DNSRecordDeleted(node, name, resource);\n } else {\n if (\n versionable_records[version][node][nameHash][resource].length ==\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]++;\n }\n versionable_records[version][node][nameHash][resource] = rrData;\n emit DNSRecordChanged(node, name, resource, rrData);\n }\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/ExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ncontract ExtendedResolver {\n function resolve(\n bytes memory /* name */,\n bytes memory data\n ) external view returns (bytes memory) {\n (bool success, bytes memory result) = address(this).staticcall(data);\n if (success) {\n return result;\n } else {\n // Revert with the reason provided by the call\n assembly {\n revert(add(result, 0x20), mload(result))\n }\n }\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/InterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../ResolverBase.sol\";\nimport \"./AddrResolver.sol\";\nimport \"./IInterfaceResolver.sol\";\n\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\n mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces;\n\n /**\n * Sets an interface associated with a name.\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\n * @param node The node to update.\n * @param interfaceID The EIP 165 interface ID.\n * @param implementer The address of a contract that implements this interface for this node.\n */\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external virtual authorised(node) {\n versionable_interfaces[recordVersions[node]][node][\n interfaceID\n ] = implementer;\n emit InterfaceChanged(node, interfaceID, implementer);\n }\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view virtual override returns (address) {\n address implementer = versionable_interfaces[recordVersions[node]][\n node\n ][interfaceID];\n if (implementer != address(0)) {\n return implementer;\n }\n\n address a = addr(node);\n if (a == address(0)) {\n return address(0);\n }\n\n (bool success, bytes memory returnData) = a.staticcall(\n abi.encodeWithSignature(\n \"supportsInterface(bytes4)\",\n type(IERC165).interfaceId\n )\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // EIP 165 not supported by target\n return address(0);\n }\n\n (success, returnData) = a.staticcall(\n abi.encodeWithSignature(\"supportsInterface(bytes4)\", interfaceID)\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // Specified interface not supported by target\n return address(0);\n }\n\n return a;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IInterfaceResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/IVersionableResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IVersionableResolver {\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\n\n function recordVersions(bytes32 node) external view returns (uint64);\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/NameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./INameResolver.sol\";\n\nabstract contract NameResolver is INameResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => string)) versionable_names;\n\n /**\n * Sets the name associated with an ENS node, for reverse records.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function setName(\n bytes32 node,\n string calldata newName\n ) external virtual authorised(node) {\n versionable_names[recordVersions[node]][node] = newName;\n emit NameChanged(node, newName);\n }\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(\n bytes32 node\n ) external view virtual override returns (string memory) {\n return versionable_names[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(INameResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/PubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IPubkeyResolver.sol\";\n\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\n struct PublicKey {\n bytes32 x;\n bytes32 y;\n }\n\n mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys;\n\n /**\n * Sets the SECP256k1 public key associated with an ENS node.\n * @param node The ENS node to query\n * @param x the X coordinate of the curve point for the public key.\n * @param y the Y coordinate of the curve point for the public key.\n */\n function setPubkey(\n bytes32 node,\n bytes32 x,\n bytes32 y\n ) external virtual authorised(node) {\n versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y);\n emit PubkeyChanged(node, x, y);\n }\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(\n bytes32 node\n ) external view virtual override returns (bytes32 x, bytes32 y) {\n uint64 currentRecordVersion = recordVersions[node];\n return (\n versionable_pubkeys[currentRecordVersion][node].x,\n versionable_pubkeys[currentRecordVersion][node].y\n );\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IPubkeyResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/TextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./ITextResolver.sol\";\n\nabstract contract TextResolver is ITextResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;\n\n /**\n * Sets the text data associated with an ENS node and key.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param key The key to set.\n * @param value The text data value to set.\n */\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external virtual authorised(node) {\n versionable_texts[recordVersions[node]][node][key] = value;\n emit TextChanged(node, key, key, value);\n }\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view virtual override returns (string memory) {\n return versionable_texts[recordVersions[node]][node][key];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(ITextResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/PublicResolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"../registry/ENS.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./profiles/ExtendedResolver.sol\";\nimport \"./Multicallable.sol\";\nimport \"../wrapper/INameWrapper.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract PublicResolver is\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ExtendedResolver\n{\n ENS immutable ens;\n INameWrapper immutable nameWrapper;\n address immutable trustedETHController;\n address immutable trustedReverseRegistrar;\n\n /**\n * A mapping of operators. An address that is authorised for an address\n * may make any changes to the name that the owner could, but may not update\n * the set of authorisations.\n * (owner, operator) => approved\n */\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * A mapping of delegates. A delegate that is authorised by an owner\n * for a name may make changes to the name's resolver, but may not update\n * the set of token approvals.\n * (owner, name, delegate) => approved\n */\n mapping(address => mapping(bytes32 => mapping(address => bool)))\n private _tokenApprovals;\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n // Logged when a delegate is approved or an approval is revoked.\n event Approved(\n address owner,\n bytes32 indexed node,\n address indexed delegate,\n bool indexed approved\n );\n\n constructor(\n ENS _ens,\n INameWrapper wrapperAddress,\n address _trustedETHController,\n address _trustedReverseRegistrar\n ) {\n ens = _ens;\n nameWrapper = wrapperAddress;\n trustedETHController = _trustedETHController;\n trustedReverseRegistrar = _trustedReverseRegistrar;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) external {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Approve a delegate to be able to updated records on a node.\n */\n function approve(bytes32 node, address delegate, bool approved) external {\n require(msg.sender != delegate, \"Setting delegate status for self\");\n\n _tokenApprovals[msg.sender][node][delegate] = approved;\n emit Approved(msg.sender, node, delegate, approved);\n }\n\n /**\n * @dev Check to see if the delegate has been approved by the owner for the node.\n */\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) public view returns (bool) {\n return _tokenApprovals[owner][node][delegate];\n }\n\n function isAuthorised(bytes32 node) internal view override returns (bool) {\n if (\n msg.sender == trustedETHController ||\n msg.sender == trustedReverseRegistrar\n ) {\n return true;\n }\n address owner = ens.owner(node);\n if (owner == address(nameWrapper)) {\n owner = nameWrapper.ownerOf(uint256(node));\n }\n return\n owner == msg.sender ||\n isApprovedForAll(owner, msg.sender) ||\n isApprovedFor(owner, node, msg.sender);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n override(\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/ResolverBase.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"./profiles/IVersionableResolver.sol\";\n\nabstract contract ResolverBase is ERC165, IVersionableResolver {\n mapping(bytes32 => uint64) public recordVersions;\n\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\n\n modifier authorised(bytes32 node) {\n require(isAuthorised(node));\n _;\n }\n\n /**\n * Increments the record version associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function clearRecords(bytes32 node) public virtual authorised(node) {\n recordVersions[node]++;\n emit VersionChanged(node, recordVersions[node]);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IVersionableResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "@ensdomains/ens-contracts/contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\nimport \"./INameWrapperUpgrade.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\nuint32 constant IS_DOT_ETH = 1 << 17;\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\nuint32 constant CAN_DO_EVERYTHING = 0;\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\n// all fuses apart from IS_DOT_ETH\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses);\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function name() external view returns (string memory);\n\n function upgradeContract() external view returns (INameWrapperUpgrade);\n\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) external;\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external returns (uint256 registrarExpiry);\n\n function renew(\n uint256 labelHash,\n uint256 duration\n ) external returns (uint256 expires);\n\n function unwrap(bytes32 node, bytes32 label, address owner) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function upgrade(bytes calldata name, bytes calldata extraData) external;\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n ) external returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function extendExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n ) external returns (uint64);\n\n function canModifyName(\n bytes32 node,\n address addr\n ) external view returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external view returns (address owner);\n\n function getData(\n uint256 id\n ) external view returns (address, uint32, uint64);\n\n function setMetadataService(IMetadataService _metadataService) external;\n\n function uri(uint256 tokenId) external view returns (string memory);\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) external view returns (bool);\n\n function isWrapped(bytes32) external view returns (bool);\n\n function isWrapped(bytes32, bytes32) external view returns (bool);\n}\n" + }, + "@ensdomains/ens-contracts/contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n bytes calldata extraData\n ) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/governance/utils/IVotesUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 a specific moment in the past. If the `clock()` is\n * configured to use block numbers, this will return the value at the end of the corresponding block.\n */\n function getPastVotes(address account, uint256 timepoint) external view returns (uint256);\n\n /**\n * @dev Returns the total supply of votes available at a specific moment in the past. If the `clock()` is\n * configured to use block numbers, this will return the value at the end of the corresponding block.\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 timepoint) 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(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822ProxiableUpgradeable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC1967Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\n *\n * _Available since v4.8.3._\n */\ninterface IERC1967Upgradeable {\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Emitted when the beacon is changed.\n */\n event BeaconUpgraded(address indexed beacon);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC5267Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)\n\npragma solidity ^0.8.0;\n\ninterface IERC5267Upgradeable {\n /**\n * @dev MAY be emitted to signal that the domain could have changed.\n */\n event EIP712DomainChanged();\n\n /**\n * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712\n * signature.\n */\n function eip712Domain()\n external\n view\n returns (\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt,\n uint256[] memory extensions\n );\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC5805Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5805.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../governance/utils/IVotesUpgradeable.sol\";\nimport \"./IERC6372Upgradeable.sol\";\n\ninterface IERC5805Upgradeable is IERC6372Upgradeable, IVotesUpgradeable {}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC6372Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC6372.sol)\n\npragma solidity ^0.8.0;\n\ninterface IERC6372Upgradeable {\n /**\n * @dev Clock used for flagging checkpoints. Can be overridden to implement timestamp based checkpoints (and voting).\n */\n function clock() external view returns (uint48);\n\n /**\n * @dev Description of the clock\n */\n // solhint-disable-next-line func-name-mixedcase\n function CLOCK_MODE() external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeaconUpgradeable {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeaconUpgradeable.sol\";\nimport \"../../interfaces/IERC1967Upgradeable.sol\";\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/StorageSlotUpgradeable.sol\";\nimport \"../utils/Initializable.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n */\nabstract contract ERC1967UpgradeUpgradeable is Initializable, IERC1967Upgradeable {\n function __ERC1967Upgrade_init() internal onlyInitializing {\n }\n\n function __ERC1967Upgrade_init_unchained() internal onlyInitializing {\n }\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(AddressUpgradeable.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n AddressUpgradeable.functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(AddressUpgradeable.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n AddressUpgradeable.functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);\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[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.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 * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!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 * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized != type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/UUPSUpgradeable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../ERC1967/ERC1967UpgradeUpgradeable.sol\";\nimport \"./Initializable.sol\";\n\n/**\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\n *\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\n * `UUPSUpgradeable` with a custom implementation of upgrades.\n *\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\n *\n * _Available since v4.1._\n */\nabstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {\n function __UUPSUpgradeable_init() internal onlyInitializing {\n }\n\n function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\n }\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\n address private immutable __self = address(this);\n\n /**\n * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\n * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\n * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\n * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\n * fail.\n */\n modifier onlyProxy() {\n require(address(this) != __self, \"Function must be called through delegatecall\");\n require(_getImplementation() == __self, \"Function must be called through active proxy\");\n _;\n }\n\n /**\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\n * callable on the implementing contract but not through proxies.\n */\n modifier notDelegated() {\n require(address(this) == __self, \"UUPSUpgradeable: must not be called through delegatecall\");\n _;\n }\n\n /**\n * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\n */\n function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\n return _IMPLEMENTATION_SLOT;\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n *\n * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\n */\n function upgradeTo(address newImplementation) public virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\n * encoded in `data`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n *\n * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\n */\n function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, data, true);\n }\n\n /**\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\n * {upgradeTo} and {upgradeToAndCall}.\n *\n * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\n *\n * ```solidity\n * function _authorizeUpgrade(address) internal override onlyOwner {}\n * ```\n */\n function _authorizeUpgrade(address newImplementation) 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[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155ReceiverUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155ReceiverUpgradeable is IERC165Upgradeable {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155Upgradeable is IERC165Upgradeable {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] calldata accounts,\n uint256[] calldata ids\n ) external view returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\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 * 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 default value returned by this function, unless\n * it's 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(address from, address to, uint256 amount) 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(address from, address to, uint256 amount) 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 // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\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 unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\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 // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\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(address owner, address spender, uint256 amount) 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(address owner, address spender, uint256 amount) 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(address from, address to, uint256 amount) 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(address from, address to, uint256 amount) 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-IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n// EIP-2612 is Final as of 2022-11-01. This file is deprecated.\n\nimport \"./IERC20PermitUpgradeable.sol\";\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/ERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20PermitUpgradeable.sol\";\nimport \"../ERC20Upgradeable.sol\";\nimport \"../../../utils/cryptography/ECDSAUpgradeable.sol\";\nimport \"../../../utils/cryptography/EIP712Upgradeable.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/ERC20VotesUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/ERC20Votes.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ERC20PermitUpgradeable.sol\";\nimport \"../../../interfaces/IERC5805Upgradeable.sol\";\nimport \"../../../utils/math/MathUpgradeable.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, ERC20PermitUpgradeable, IERC5805Upgradeable {\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 Clock used for flagging checkpoints. Can be overridden to implement timestamp based checkpoints (and voting).\n */\n function clock() public view virtual override returns (uint48) {\n return SafeCastUpgradeable.toUint48(block.number);\n }\n\n /**\n * @dev Description of the clock\n */\n // solhint-disable-next-line func-name-mixedcase\n function CLOCK_MODE() public view virtual override returns (string memory) {\n // Check that the clock was not modified\n require(clock() == block.number, \"ERC20Votes: broken clock mode\");\n return \"mode=blocknumber&from=default\";\n }\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 unchecked {\n return pos == 0 ? 0 : _checkpoints[account][pos - 1].votes;\n }\n }\n\n /**\n * @dev Retrieve the number of votes for `account` at the end of `timepoint`.\n *\n * Requirements:\n *\n * - `timepoint` must be in the past\n */\n function getPastVotes(address account, uint256 timepoint) public view virtual override returns (uint256) {\n require(timepoint < clock(), \"ERC20Votes: future lookup\");\n return _checkpointsLookup(_checkpoints[account], timepoint);\n }\n\n /**\n * @dev Retrieve the `totalSupply` at the end of `timepoint`. Note, this value is the sum of all balances.\n * It is NOT the sum of all the delegated votes!\n *\n * Requirements:\n *\n * - `timepoint` must be in the past\n */\n function getPastTotalSupply(uint256 timepoint) public view virtual override returns (uint256) {\n require(timepoint < clock(), \"ERC20Votes: future lookup\");\n return _checkpointsLookup(_totalSupplyCheckpoints, timepoint);\n }\n\n /**\n * @dev Lookup a value in a list of (sorted) checkpoints.\n */\n function _checkpointsLookup(Checkpoint[] storage ckpts, uint256 timepoint) private view returns (uint256) {\n // We run a binary search to look for the last (most recent) checkpoint taken before (or at) `timepoint`.\n //\n // Initially we check if the block is recent to narrow the search range.\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 `timepoint`, we look in [low, mid)\n // - If the middle checkpoint is before or equal to `timepoint`, 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 `timepoint`, we end up with an index that is\n // past the end of the array, so we technically don't find a checkpoint after `timepoint`, but it works out\n // the same.\n uint256 length = ckpts.length;\n\n uint256 low = 0;\n uint256 high = length;\n\n if (length > 5) {\n uint256 mid = length - MathUpgradeable.sqrt(length);\n if (_unsafeAccess(ckpts, mid).fromBlock > timepoint) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n\n while (low < high) {\n uint256 mid = MathUpgradeable.average(low, high);\n if (_unsafeAccess(ckpts, mid).fromBlock > timepoint) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n\n unchecked {\n return high == 0 ? 0 : _unsafeAccess(ckpts, high - 1).votes;\n }\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 {IVotes-DelegateVotesChanged} event.\n */\n function _afterTokenTransfer(address from, address to, uint256 amount) 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 {IVotes-DelegateChanged} and {IVotes-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(address src, address dst, uint256 amount) 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\n unchecked {\n Checkpoint memory oldCkpt = pos == 0 ? Checkpoint(0, 0) : _unsafeAccess(ckpts, pos - 1);\n\n oldWeight = oldCkpt.votes;\n newWeight = op(oldWeight, delta);\n\n if (pos > 0 && oldCkpt.fromBlock == clock()) {\n _unsafeAccess(ckpts, pos - 1).votes = SafeCastUpgradeable.toUint224(newWeight);\n } else {\n ckpts.push(Checkpoint({fromBlock: SafeCastUpgradeable.toUint32(clock()), votes: SafeCastUpgradeable.toUint224(newWeight)}));\n }\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 Access an element of the array without performing bounds check. The position is assumed to be within bounds.\n */\n function _unsafeAccess(Checkpoint[] storage ckpts, uint256 pos) private pure returns (Checkpoint storage result) {\n assembly {\n mstore(0, ckpts.slot)\n result.slot := add(keccak256(0, 0x20), pos)\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[47] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20WrapperUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 private _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 require(underlyingToken != this, \"ERC20Wrapper: cannot self wrap\");\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 Returns the address of the underlying ERC-20 token that is being wrapped.\n */\n function underlying() public view returns (IERC20Upgradeable) {\n return _underlying;\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 address sender = _msgSender();\n require(sender != address(this), \"ERC20Wrapper: wrapper can't deposit\");\n SafeERC20Upgradeable.safeTransferFrom(_underlying, sender, 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/extensions/IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/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/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/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 /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20Upgradeable token, address from, address to, uint256 value) 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(IERC20Upgradeable token, address spender, uint256 value) 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 /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to\n * 0 before setting it to a non-zero value.\n */\n function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\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 require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation 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 * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.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 IERC721ReceiverUpgradeable {\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-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/CheckpointsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Checkpoints.sol)\n// This file was procedurally generated from scripts/generate/templates/Checkpoints.js.\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\nimport \"./math/SafeCastUpgradeable.sol\";\n\n/**\n * @dev This library defines the `History` struct, for checkpointing values as they change at different points in\n * time, and later looking up past values by block number. See {Votes} as an example.\n *\n * To create a history of checkpoints define a variable type `Checkpoints.History` in your contract, and store a new\n * checkpoint for the current transaction block using the {push} function.\n *\n * _Available since v4.5._\n */\nlibrary CheckpointsUpgradeable {\n struct History {\n Checkpoint[] _checkpoints;\n }\n\n struct Checkpoint {\n uint32 _blockNumber;\n uint224 _value;\n }\n\n /**\n * @dev Returns the value at a given block number. If a checkpoint is not available at that block, the closest one\n * before it is returned, or zero otherwise. Because the number returned corresponds to that at the end of the\n * block, the requested block number must be in the past, excluding the current block.\n */\n function getAtBlock(History storage self, uint256 blockNumber) internal view returns (uint256) {\n require(blockNumber < block.number, \"Checkpoints: block not yet mined\");\n uint32 key = SafeCastUpgradeable.toUint32(blockNumber);\n\n uint256 len = self._checkpoints.length;\n uint256 pos = _upperBinaryLookup(self._checkpoints, key, 0, len);\n return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;\n }\n\n /**\n * @dev Returns the value at a given block number. If a checkpoint is not available at that block, the closest one\n * before it is returned, or zero otherwise. Similar to {upperLookup} but optimized for the case when the searched\n * checkpoint is probably \"recent\", defined as being among the last sqrt(N) checkpoints where N is the number of\n * checkpoints.\n */\n function getAtProbablyRecentBlock(History storage self, uint256 blockNumber) internal view returns (uint256) {\n require(blockNumber < block.number, \"Checkpoints: block not yet mined\");\n uint32 key = SafeCastUpgradeable.toUint32(blockNumber);\n\n uint256 len = self._checkpoints.length;\n\n uint256 low = 0;\n uint256 high = len;\n\n if (len > 5) {\n uint256 mid = len - MathUpgradeable.sqrt(len);\n if (key < _unsafeAccess(self._checkpoints, mid)._blockNumber) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n\n uint256 pos = _upperBinaryLookup(self._checkpoints, key, low, high);\n\n return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;\n }\n\n /**\n * @dev Pushes a value onto a History so that it is stored as the checkpoint for the current block.\n *\n * Returns previous value and new value.\n */\n function push(History storage self, uint256 value) internal returns (uint256, uint256) {\n return _insert(self._checkpoints, SafeCastUpgradeable.toUint32(block.number), SafeCastUpgradeable.toUint224(value));\n }\n\n /**\n * @dev Pushes a value onto a History, by updating the latest value using binary operation `op`. The new value will\n * be set to `op(latest, delta)`.\n *\n * Returns previous value and new value.\n */\n function push(\n History storage self,\n function(uint256, uint256) view returns (uint256) op,\n uint256 delta\n ) internal returns (uint256, uint256) {\n return push(self, op(latest(self), delta));\n }\n\n /**\n * @dev Returns the value in the most recent checkpoint, or zero if there are no checkpoints.\n */\n function latest(History storage self) internal view returns (uint224) {\n uint256 pos = self._checkpoints.length;\n return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;\n }\n\n /**\n * @dev Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value\n * in the most recent checkpoint.\n */\n function latestCheckpoint(\n History storage self\n ) internal view returns (bool exists, uint32 _blockNumber, uint224 _value) {\n uint256 pos = self._checkpoints.length;\n if (pos == 0) {\n return (false, 0, 0);\n } else {\n Checkpoint memory ckpt = _unsafeAccess(self._checkpoints, pos - 1);\n return (true, ckpt._blockNumber, ckpt._value);\n }\n }\n\n /**\n * @dev Returns the number of checkpoint.\n */\n function length(History storage self) internal view returns (uint256) {\n return self._checkpoints.length;\n }\n\n /**\n * @dev Pushes a (`key`, `value`) pair into an ordered list of checkpoints, either by inserting a new checkpoint,\n * or by updating the last one.\n */\n function _insert(Checkpoint[] storage self, uint32 key, uint224 value) private returns (uint224, uint224) {\n uint256 pos = self.length;\n\n if (pos > 0) {\n // Copying to memory is important here.\n Checkpoint memory last = _unsafeAccess(self, pos - 1);\n\n // Checkpoint keys must be non-decreasing.\n require(last._blockNumber <= key, \"Checkpoint: decreasing keys\");\n\n // Update or push new checkpoint\n if (last._blockNumber == key) {\n _unsafeAccess(self, pos - 1)._value = value;\n } else {\n self.push(Checkpoint({_blockNumber: key, _value: value}));\n }\n return (last._value, value);\n } else {\n self.push(Checkpoint({_blockNumber: key, _value: value}));\n return (0, value);\n }\n }\n\n /**\n * @dev Return the index of the last (most recent) checkpoint with key lower or equal than the search key, or `high` if there is none.\n * `low` and `high` define a section where to do the search, with inclusive `low` and exclusive `high`.\n *\n * WARNING: `high` should not be greater than the array's length.\n */\n function _upperBinaryLookup(\n Checkpoint[] storage self,\n uint32 key,\n uint256 low,\n uint256 high\n ) private view returns (uint256) {\n while (low < high) {\n uint256 mid = MathUpgradeable.average(low, high);\n if (_unsafeAccess(self, mid)._blockNumber > key) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n return high;\n }\n\n /**\n * @dev Return the index of the first (oldest) checkpoint with key is greater or equal than the search key, or `high` if there is none.\n * `low` and `high` define a section where to do the search, with inclusive `low` and exclusive `high`.\n *\n * WARNING: `high` should not be greater than the array's length.\n */\n function _lowerBinaryLookup(\n Checkpoint[] storage self,\n uint32 key,\n uint256 low,\n uint256 high\n ) private view returns (uint256) {\n while (low < high) {\n uint256 mid = MathUpgradeable.average(low, high);\n if (_unsafeAccess(self, mid)._blockNumber < key) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n return high;\n }\n\n /**\n * @dev Access an element of the array without performing bounds check. The position is assumed to be within bounds.\n */\n function _unsafeAccess(Checkpoint[] storage self, uint256 pos) private pure returns (Checkpoint storage result) {\n assembly {\n mstore(0, self.slot)\n result.slot := add(keccak256(0, 0x20), pos)\n }\n }\n\n struct Trace224 {\n Checkpoint224[] _checkpoints;\n }\n\n struct Checkpoint224 {\n uint32 _key;\n uint224 _value;\n }\n\n /**\n * @dev Pushes a (`key`, `value`) pair into a Trace224 so that it is stored as the checkpoint.\n *\n * Returns previous value and new value.\n */\n function push(Trace224 storage self, uint32 key, uint224 value) internal returns (uint224, uint224) {\n return _insert(self._checkpoints, key, value);\n }\n\n /**\n * @dev Returns the value in the first (oldest) checkpoint with key greater or equal than the search key, or zero if there is none.\n */\n function lowerLookup(Trace224 storage self, uint32 key) internal view returns (uint224) {\n uint256 len = self._checkpoints.length;\n uint256 pos = _lowerBinaryLookup(self._checkpoints, key, 0, len);\n return pos == len ? 0 : _unsafeAccess(self._checkpoints, pos)._value;\n }\n\n /**\n * @dev Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero if there is none.\n */\n function upperLookup(Trace224 storage self, uint32 key) internal view returns (uint224) {\n uint256 len = self._checkpoints.length;\n uint256 pos = _upperBinaryLookup(self._checkpoints, key, 0, len);\n return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;\n }\n\n /**\n * @dev Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero if there is none.\n *\n * NOTE: This is a variant of {upperLookup} that is optimised to find \"recent\" checkpoint (checkpoints with high keys).\n */\n function upperLookupRecent(Trace224 storage self, uint32 key) internal view returns (uint224) {\n uint256 len = self._checkpoints.length;\n\n uint256 low = 0;\n uint256 high = len;\n\n if (len > 5) {\n uint256 mid = len - MathUpgradeable.sqrt(len);\n if (key < _unsafeAccess(self._checkpoints, mid)._key) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n\n uint256 pos = _upperBinaryLookup(self._checkpoints, key, low, high);\n\n return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;\n }\n\n /**\n * @dev Returns the value in the most recent checkpoint, or zero if there are no checkpoints.\n */\n function latest(Trace224 storage self) internal view returns (uint224) {\n uint256 pos = self._checkpoints.length;\n return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;\n }\n\n /**\n * @dev Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value\n * in the most recent checkpoint.\n */\n function latestCheckpoint(Trace224 storage self) internal view returns (bool exists, uint32 _key, uint224 _value) {\n uint256 pos = self._checkpoints.length;\n if (pos == 0) {\n return (false, 0, 0);\n } else {\n Checkpoint224 memory ckpt = _unsafeAccess(self._checkpoints, pos - 1);\n return (true, ckpt._key, ckpt._value);\n }\n }\n\n /**\n * @dev Returns the number of checkpoint.\n */\n function length(Trace224 storage self) internal view returns (uint256) {\n return self._checkpoints.length;\n }\n\n /**\n * @dev Pushes a (`key`, `value`) pair into an ordered list of checkpoints, either by inserting a new checkpoint,\n * or by updating the last one.\n */\n function _insert(Checkpoint224[] storage self, uint32 key, uint224 value) private returns (uint224, uint224) {\n uint256 pos = self.length;\n\n if (pos > 0) {\n // Copying to memory is important here.\n Checkpoint224 memory last = _unsafeAccess(self, pos - 1);\n\n // Checkpoint keys must be non-decreasing.\n require(last._key <= key, \"Checkpoint: decreasing keys\");\n\n // Update or push new checkpoint\n if (last._key == key) {\n _unsafeAccess(self, pos - 1)._value = value;\n } else {\n self.push(Checkpoint224({_key: key, _value: value}));\n }\n return (last._value, value);\n } else {\n self.push(Checkpoint224({_key: key, _value: value}));\n return (0, value);\n }\n }\n\n /**\n * @dev Return the index of the last (most recent) checkpoint with key lower or equal than the search key, or `high` if there is none.\n * `low` and `high` define a section where to do the search, with inclusive `low` and exclusive `high`.\n *\n * WARNING: `high` should not be greater than the array's length.\n */\n function _upperBinaryLookup(\n Checkpoint224[] storage self,\n uint32 key,\n uint256 low,\n uint256 high\n ) private view returns (uint256) {\n while (low < high) {\n uint256 mid = MathUpgradeable.average(low, high);\n if (_unsafeAccess(self, mid)._key > key) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n return high;\n }\n\n /**\n * @dev Return the index of the first (oldest) checkpoint with key is greater or equal than the search key, or `high` if there is none.\n * `low` and `high` define a section where to do the search, with inclusive `low` and exclusive `high`.\n *\n * WARNING: `high` should not be greater than the array's length.\n */\n function _lowerBinaryLookup(\n Checkpoint224[] storage self,\n uint32 key,\n uint256 low,\n uint256 high\n ) private view returns (uint256) {\n while (low < high) {\n uint256 mid = MathUpgradeable.average(low, high);\n if (_unsafeAccess(self, mid)._key < key) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n return high;\n }\n\n /**\n * @dev Access an element of the array without performing bounds check. The position is assumed to be within bounds.\n */\n function _unsafeAccess(\n Checkpoint224[] storage self,\n uint256 pos\n ) private pure returns (Checkpoint224 storage result) {\n assembly {\n mstore(0, self.slot)\n result.slot := add(keccak256(0, 0x20), pos)\n }\n }\n\n struct Trace160 {\n Checkpoint160[] _checkpoints;\n }\n\n struct Checkpoint160 {\n uint96 _key;\n uint160 _value;\n }\n\n /**\n * @dev Pushes a (`key`, `value`) pair into a Trace160 so that it is stored as the checkpoint.\n *\n * Returns previous value and new value.\n */\n function push(Trace160 storage self, uint96 key, uint160 value) internal returns (uint160, uint160) {\n return _insert(self._checkpoints, key, value);\n }\n\n /**\n * @dev Returns the value in the first (oldest) checkpoint with key greater or equal than the search key, or zero if there is none.\n */\n function lowerLookup(Trace160 storage self, uint96 key) internal view returns (uint160) {\n uint256 len = self._checkpoints.length;\n uint256 pos = _lowerBinaryLookup(self._checkpoints, key, 0, len);\n return pos == len ? 0 : _unsafeAccess(self._checkpoints, pos)._value;\n }\n\n /**\n * @dev Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero if there is none.\n */\n function upperLookup(Trace160 storage self, uint96 key) internal view returns (uint160) {\n uint256 len = self._checkpoints.length;\n uint256 pos = _upperBinaryLookup(self._checkpoints, key, 0, len);\n return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;\n }\n\n /**\n * @dev Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero if there is none.\n *\n * NOTE: This is a variant of {upperLookup} that is optimised to find \"recent\" checkpoint (checkpoints with high keys).\n */\n function upperLookupRecent(Trace160 storage self, uint96 key) internal view returns (uint160) {\n uint256 len = self._checkpoints.length;\n\n uint256 low = 0;\n uint256 high = len;\n\n if (len > 5) {\n uint256 mid = len - MathUpgradeable.sqrt(len);\n if (key < _unsafeAccess(self._checkpoints, mid)._key) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n\n uint256 pos = _upperBinaryLookup(self._checkpoints, key, low, high);\n\n return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;\n }\n\n /**\n * @dev Returns the value in the most recent checkpoint, or zero if there are no checkpoints.\n */\n function latest(Trace160 storage self) internal view returns (uint160) {\n uint256 pos = self._checkpoints.length;\n return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;\n }\n\n /**\n * @dev Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value\n * in the most recent checkpoint.\n */\n function latestCheckpoint(Trace160 storage self) internal view returns (bool exists, uint96 _key, uint160 _value) {\n uint256 pos = self._checkpoints.length;\n if (pos == 0) {\n return (false, 0, 0);\n } else {\n Checkpoint160 memory ckpt = _unsafeAccess(self._checkpoints, pos - 1);\n return (true, ckpt._key, ckpt._value);\n }\n }\n\n /**\n * @dev Returns the number of checkpoint.\n */\n function length(Trace160 storage self) internal view returns (uint256) {\n return self._checkpoints.length;\n }\n\n /**\n * @dev Pushes a (`key`, `value`) pair into an ordered list of checkpoints, either by inserting a new checkpoint,\n * or by updating the last one.\n */\n function _insert(Checkpoint160[] storage self, uint96 key, uint160 value) private returns (uint160, uint160) {\n uint256 pos = self.length;\n\n if (pos > 0) {\n // Copying to memory is important here.\n Checkpoint160 memory last = _unsafeAccess(self, pos - 1);\n\n // Checkpoint keys must be non-decreasing.\n require(last._key <= key, \"Checkpoint: decreasing keys\");\n\n // Update or push new checkpoint\n if (last._key == key) {\n _unsafeAccess(self, pos - 1)._value = value;\n } else {\n self.push(Checkpoint160({_key: key, _value: value}));\n }\n return (last._value, value);\n } else {\n self.push(Checkpoint160({_key: key, _value: value}));\n return (0, value);\n }\n }\n\n /**\n * @dev Return the index of the last (most recent) checkpoint with key lower or equal than the search key, or `high` if there is none.\n * `low` and `high` define a section where to do the search, with inclusive `low` and exclusive `high`.\n *\n * WARNING: `high` should not be greater than the array's length.\n */\n function _upperBinaryLookup(\n Checkpoint160[] storage self,\n uint96 key,\n uint256 low,\n uint256 high\n ) private view returns (uint256) {\n while (low < high) {\n uint256 mid = MathUpgradeable.average(low, high);\n if (_unsafeAccess(self, mid)._key > key) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n return high;\n }\n\n /**\n * @dev Return the index of the first (oldest) checkpoint with key is greater or equal than the search key, or `high` if there is none.\n * `low` and `high` define a section where to do the search, with inclusive `low` and exclusive `high`.\n *\n * WARNING: `high` should not be greater than the array's length.\n */\n function _lowerBinaryLookup(\n Checkpoint160[] storage self,\n uint96 key,\n uint256 low,\n uint256 high\n ) private view returns (uint256) {\n while (low < high) {\n uint256 mid = MathUpgradeable.average(low, high);\n if (_unsafeAccess(self, mid)._key < key) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n return high;\n }\n\n /**\n * @dev Access an element of the array without performing bounds check. The position is assumed to be within bounds.\n */\n function _unsafeAccess(\n Checkpoint160[] storage self,\n uint256 pos\n ) private pure returns (Checkpoint160 storage result) {\n assembly {\n mstore(0, self.slot)\n result.slot := add(keccak256(0, 0x20), pos)\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/ECDSAUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (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 // Deprecated in v4.8\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 }\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(bytes32 hash, bytes32 r, bytes32 vs) 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(bytes32 hash, bytes32 r, bytes32 vs) 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(bytes32 hash, uint8 v, bytes32 r, bytes32 s) 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\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(bytes32 hash, uint8 v, bytes32 r, bytes32 s) 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 message) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, \"\\x19Ethereum Signed Message:\\n32\")\n mstore(0x1c, hash)\n message := keccak256(0x00, 0x3c)\n }\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 data) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(ptr, \"\\x19\\x01\")\n mstore(add(ptr, 0x02), domainSeparator)\n mstore(add(ptr, 0x22), structHash)\n data := keccak256(ptr, 0x42)\n }\n }\n\n /**\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\n * `validator` and `data` according to the version 0 of EIP-191.\n *\n * See {recover}.\n */\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x00\", validator, data));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol)\n\npragma solidity ^0.8.8;\n\nimport \"./ECDSAUpgradeable.sol\";\nimport \"../../interfaces/IERC5267Upgradeable.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 * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain\n * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the\n * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.\n *\n * _Available since v3.4._\n *\n * @custom:storage-size 52\n */\nabstract contract EIP712Upgradeable is Initializable, IERC5267Upgradeable {\n bytes32 private constant _TYPE_HASH =\n keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n /// @custom:oz-renamed-from _HASHED_NAME\n bytes32 private _hashedName;\n /// @custom:oz-renamed-from _HASHED_VERSION\n bytes32 private _hashedVersion;\n\n string private _name;\n string private _version;\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 _name = name;\n _version = version;\n\n // Reset prior values in storage if upgrading\n _hashedName = 0;\n _hashedVersion = 0;\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n return _buildDomainSeparator();\n }\n\n function _buildDomainSeparator() private view returns (bytes32) {\n return keccak256(abi.encode(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash(), 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 See {EIP-5267}.\n *\n * _Available since v4.9._\n */\n function eip712Domain()\n public\n view\n virtual\n override\n returns (\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt,\n uint256[] memory extensions\n )\n {\n // If the hashed name and version in storage are non-zero, the contract hasn't been properly initialized\n // and the EIP712 domain is not reliable, as it will be missing name and version.\n require(_hashedName == 0 && _hashedVersion == 0, \"EIP712: Uninitialized\");\n\n return (\n hex\"0f\", // 01111\n _EIP712Name(),\n _EIP712Version(),\n block.chainid,\n address(this),\n bytes32(0),\n new uint256[](0)\n );\n }\n\n /**\n * @dev 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 _EIP712Name() internal virtual view returns (string memory) {\n return _name;\n }\n\n /**\n * @dev 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 _EIP712Version() internal virtual view returns (string memory) {\n return _version;\n }\n\n /**\n * @dev The hash of the name parameter for the EIP712 domain.\n *\n * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Name` instead.\n */\n function _EIP712NameHash() internal view returns (bytes32) {\n string memory name = _EIP712Name();\n if (bytes(name).length > 0) {\n return keccak256(bytes(name));\n } else {\n // If the name is empty, the contract may have been upgraded without initializing the new storage.\n // We return the name hash in storage if non-zero, otherwise we assume the name is empty by design.\n bytes32 hashedName = _hashedName;\n if (hashedName != 0) {\n return hashedName;\n } else {\n return keccak256(\"\");\n }\n }\n }\n\n /**\n * @dev The hash of the version parameter for the EIP712 domain.\n *\n * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Version` instead.\n */\n function _EIP712VersionHash() internal view returns (bytes32) {\n string memory version = _EIP712Version();\n if (bytes(version).length > 0) {\n return keccak256(bytes(version));\n } else {\n // If the version is empty, the contract may have been upgraded without initializing the new storage.\n // We return the version hash in storage if non-zero, otherwise we assume the version is empty by design.\n bytes32 hashedVersion = _hashedVersion;\n if (hashedVersion != 0) {\n return hashedVersion;\n } else {\n return keccak256(\"\");\n }\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[48] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165CheckerUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/introspection/ERC165Checker.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\n\n/**\n * @dev Library used to query support of an interface declared via {IERC165}.\n *\n * Note that these functions return the actual result of the query: they do not\n * `revert` if an interface is not supported. It is up to the caller to decide\n * what to do in these cases.\n */\nlibrary ERC165CheckerUpgradeable {\n // As per the EIP-165 spec, no interface should ever match 0xffffffff\n bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;\n\n /**\n * @dev Returns true if `account` supports the {IERC165} interface.\n */\n function supportsERC165(address account) internal view returns (bool) {\n // Any contract that implements ERC165 must explicitly indicate support of\n // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid\n return\n supportsERC165InterfaceUnchecked(account, type(IERC165Upgradeable).interfaceId) &&\n !supportsERC165InterfaceUnchecked(account, _INTERFACE_ID_INVALID);\n }\n\n /**\n * @dev Returns true if `account` supports the interface defined by\n * `interfaceId`. Support for {IERC165} itself is queried automatically.\n *\n * See {IERC165-supportsInterface}.\n */\n function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {\n // query support of both ERC165 as per the spec and support of _interfaceId\n return supportsERC165(account) && supportsERC165InterfaceUnchecked(account, interfaceId);\n }\n\n /**\n * @dev Returns a boolean array where each value corresponds to the\n * interfaces passed in and whether they're supported or not. This allows\n * you to batch check interfaces for a contract where your expectation\n * is that some interfaces may not be supported.\n *\n * See {IERC165-supportsInterface}.\n *\n * _Available since v3.4._\n */\n function getSupportedInterfaces(\n address account,\n bytes4[] memory interfaceIds\n ) internal view returns (bool[] memory) {\n // an array of booleans corresponding to interfaceIds and whether they're supported or not\n bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);\n\n // query support of ERC165 itself\n if (supportsERC165(account)) {\n // query support of each interface in interfaceIds\n for (uint256 i = 0; i < interfaceIds.length; i++) {\n interfaceIdsSupported[i] = supportsERC165InterfaceUnchecked(account, interfaceIds[i]);\n }\n }\n\n return interfaceIdsSupported;\n }\n\n /**\n * @dev Returns true if `account` supports all the interfaces defined in\n * `interfaceIds`. Support for {IERC165} itself is queried automatically.\n *\n * Batch-querying can lead to gas savings by skipping repeated checks for\n * {IERC165} support.\n *\n * See {IERC165-supportsInterface}.\n */\n function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {\n // query support of ERC165 itself\n if (!supportsERC165(account)) {\n return false;\n }\n\n // query support of each interface in interfaceIds\n for (uint256 i = 0; i < interfaceIds.length; i++) {\n if (!supportsERC165InterfaceUnchecked(account, interfaceIds[i])) {\n return false;\n }\n }\n\n // all interfaces supported\n return true;\n }\n\n /**\n * @notice Query if a contract implements an interface, does not check ERC165 support\n * @param account The address of the contract to query for support of an interface\n * @param interfaceId The interface identifier, as specified in ERC-165\n * @return true if the contract at account indicates support of the interface with\n * identifier interfaceId, false otherwise\n * @dev Assumes that account contains a contract that supports ERC165, otherwise\n * the behavior of this method is undefined. This precondition can be checked\n * with {supportsERC165}.\n *\n * Some precompiled contracts will falsely indicate support for a given interface, so caution\n * should be exercised when using this function.\n *\n * Interface identification is specified in ERC-165.\n */\n function supportsERC165InterfaceUnchecked(address account, bytes4 interfaceId) internal view returns (bool) {\n // prepare call\n bytes memory encodedParams = abi.encodeWithSelector(IERC165Upgradeable.supportsInterface.selector, interfaceId);\n\n // perform static call\n bool success;\n uint256 returnSize;\n uint256 returnValue;\n assembly {\n success := staticcall(30000, account, add(encodedParams, 0x20), mload(encodedParams), 0x00, 0x20)\n returnSize := returndatasize()\n returnValue := mload(0x00)\n }\n\n return success && returnSize >= 0x20 && returnValue > 0;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165StorageUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165Storage.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.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 ERC165StorageUpgradeable is Initializable, ERC165Upgradeable {\n function __ERC165Storage_init() internal onlyInitializing {\n }\n\n function __ERC165Storage_init_unchained() internal onlyInitializing {\n }\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 /**\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/utils/introspection/ERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\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/introspection/IERC165Upgradeable.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 IERC165Upgradeable {\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-upgradeable/utils/math/MathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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. If 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 //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n *\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\n * all math on `uint256` and `int256` and then downcasting.\n */\nlibrary 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 downcasted) {\n downcasted = int248(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 248 bits\");\n }\n\n /**\n * @dev Returns the downcasted int240 from int256, reverting on\n * overflow (when the input is less than smallest int240 or\n * greater than largest int240).\n *\n * Counterpart to Solidity's `int240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n *\n * _Available since v4.7._\n */\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\n downcasted = int240(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 240 bits\");\n }\n\n /**\n * @dev Returns the downcasted int232 from int256, reverting on\n * overflow (when the input is less than smallest int232 or\n * greater than largest int232).\n *\n * Counterpart to Solidity's `int232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n *\n * _Available since v4.7._\n */\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\n downcasted = int232(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 232 bits\");\n }\n\n /**\n * @dev Returns the downcasted int224 from int256, reverting on\n * overflow (when the input is less than smallest int224 or\n * greater than largest int224).\n *\n * Counterpart to Solidity's `int224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n *\n * _Available since v4.7._\n */\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\n downcasted = int224(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 224 bits\");\n }\n\n /**\n * @dev Returns the downcasted int216 from int256, reverting on\n * overflow (when the input is less than smallest int216 or\n * greater than largest int216).\n *\n * Counterpart to Solidity's `int216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n *\n * _Available since v4.7._\n */\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\n downcasted = int216(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 216 bits\");\n }\n\n /**\n * @dev Returns the downcasted int208 from int256, reverting on\n * overflow (when the input is less than smallest int208 or\n * greater than largest int208).\n *\n * Counterpart to Solidity's `int208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n *\n * _Available since v4.7._\n */\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\n downcasted = int208(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 208 bits\");\n }\n\n /**\n * @dev Returns the downcasted int200 from int256, reverting on\n * overflow (when the input is less than smallest int200 or\n * greater than largest int200).\n *\n * Counterpart to Solidity's `int200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n *\n * _Available since v4.7._\n */\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\n downcasted = int200(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 200 bits\");\n }\n\n /**\n * @dev Returns the downcasted int192 from int256, reverting on\n * overflow (when the input is less than smallest int192 or\n * greater than largest int192).\n *\n * Counterpart to Solidity's `int192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n *\n * _Available since v4.7._\n */\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\n downcasted = int192(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 192 bits\");\n }\n\n /**\n * @dev Returns the downcasted int184 from int256, reverting on\n * overflow (when the input is less than smallest int184 or\n * greater than largest int184).\n *\n * Counterpart to Solidity's `int184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n *\n * _Available since v4.7._\n */\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\n downcasted = int184(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 184 bits\");\n }\n\n /**\n * @dev Returns the downcasted int176 from int256, reverting on\n * overflow (when the input is less than smallest int176 or\n * greater than largest int176).\n *\n * Counterpart to Solidity's `int176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n *\n * _Available since v4.7._\n */\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\n downcasted = int176(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 176 bits\");\n }\n\n /**\n * @dev Returns the downcasted int168 from int256, reverting on\n * overflow (when the input is less than smallest int168 or\n * greater than largest int168).\n *\n * Counterpart to Solidity's `int168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n *\n * _Available since v4.7._\n */\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\n downcasted = int168(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 168 bits\");\n }\n\n /**\n * @dev Returns the downcasted int160 from int256, reverting on\n * overflow (when the input is less than smallest int160 or\n * greater than largest int160).\n *\n * Counterpart to Solidity's `int160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n *\n * _Available since v4.7._\n */\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\n downcasted = int160(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 160 bits\");\n }\n\n /**\n * @dev Returns the downcasted int152 from int256, reverting on\n * overflow (when the input is less than smallest int152 or\n * greater than largest int152).\n *\n * Counterpart to Solidity's `int152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n *\n * _Available since v4.7._\n */\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\n downcasted = int152(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 152 bits\");\n }\n\n /**\n * @dev Returns the downcasted int144 from int256, reverting on\n * overflow (when the input is less than smallest int144 or\n * greater than largest int144).\n *\n * Counterpart to Solidity's `int144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n *\n * _Available since v4.7._\n */\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\n downcasted = int144(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 144 bits\");\n }\n\n /**\n * @dev Returns the downcasted int136 from int256, reverting on\n * overflow (when the input is less than smallest int136 or\n * greater than largest int136).\n *\n * Counterpart to Solidity's `int136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n *\n * _Available since v4.7._\n */\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\n downcasted = int136(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 136 bits\");\n }\n\n /**\n * @dev Returns the downcasted int128 from int256, reverting on\n * overflow (when the input is less than smallest int128 or\n * greater than largest int128).\n *\n * Counterpart to Solidity's `int128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v3.1._\n */\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\n downcasted = int128(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 128 bits\");\n }\n\n /**\n * @dev Returns the downcasted int120 from int256, reverting on\n * overflow (when the input is less than smallest int120 or\n * greater than largest int120).\n *\n * Counterpart to Solidity's `int120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n *\n * _Available since v4.7._\n */\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\n downcasted = int120(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 120 bits\");\n }\n\n /**\n * @dev Returns the downcasted int112 from int256, reverting on\n * overflow (when the input is less than smallest int112 or\n * greater than largest int112).\n *\n * Counterpart to Solidity's `int112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n *\n * _Available since v4.7._\n */\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\n downcasted = int112(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 112 bits\");\n }\n\n /**\n * @dev Returns the downcasted int104 from int256, reverting on\n * overflow (when the input is less than smallest int104 or\n * greater than largest int104).\n *\n * Counterpart to Solidity's `int104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n *\n * _Available since v4.7._\n */\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\n downcasted = int104(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 104 bits\");\n }\n\n /**\n * @dev Returns the downcasted int96 from int256, reverting on\n * overflow (when the input is less than smallest int96 or\n * greater than largest int96).\n *\n * Counterpart to Solidity's `int96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n *\n * _Available since v4.7._\n */\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\n downcasted = int96(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 96 bits\");\n }\n\n /**\n * @dev Returns the downcasted int88 from int256, reverting on\n * overflow (when the input is less than smallest int88 or\n * greater than largest int88).\n *\n * Counterpart to Solidity's `int88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n *\n * _Available since v4.7._\n */\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\n downcasted = int88(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 88 bits\");\n }\n\n /**\n * @dev Returns the downcasted int80 from int256, reverting on\n * overflow (when the input is less than smallest int80 or\n * greater than largest int80).\n *\n * Counterpart to Solidity's `int80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n *\n * _Available since v4.7._\n */\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\n downcasted = int80(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 80 bits\");\n }\n\n /**\n * @dev Returns the downcasted int72 from int256, reverting on\n * overflow (when the input is less than smallest int72 or\n * greater than largest int72).\n *\n * Counterpart to Solidity's `int72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n *\n * _Available since v4.7._\n */\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\n downcasted = int72(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 72 bits\");\n }\n\n /**\n * @dev Returns the downcasted int64 from int256, reverting on\n * overflow (when the input is less than smallest int64 or\n * greater than largest int64).\n *\n * Counterpart to Solidity's `int64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v3.1._\n */\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\n downcasted = int64(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 64 bits\");\n }\n\n /**\n * @dev Returns the downcasted int56 from int256, reverting on\n * overflow (when the input is less than smallest int56 or\n * greater than largest int56).\n *\n * Counterpart to Solidity's `int56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n *\n * _Available since v4.7._\n */\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\n downcasted = int56(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 56 bits\");\n }\n\n /**\n * @dev Returns the downcasted int48 from int256, reverting on\n * overflow (when the input is less than smallest int48 or\n * greater than largest int48).\n *\n * Counterpart to Solidity's `int48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n *\n * _Available since v4.7._\n */\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\n downcasted = int48(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 48 bits\");\n }\n\n /**\n * @dev Returns the downcasted int40 from int256, reverting on\n * overflow (when the input is less than smallest int40 or\n * greater than largest int40).\n *\n * Counterpart to Solidity's `int40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n *\n * _Available since v4.7._\n */\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\n downcasted = int40(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 40 bits\");\n }\n\n /**\n * @dev Returns the downcasted int32 from int256, reverting on\n * overflow (when the input is less than smallest int32 or\n * greater than largest int32).\n *\n * Counterpart to Solidity's `int32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v3.1._\n */\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\n downcasted = int32(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 32 bits\");\n }\n\n /**\n * @dev Returns the downcasted int24 from int256, reverting on\n * overflow (when the input is less than smallest int24 or\n * greater than largest int24).\n *\n * Counterpart to Solidity's `int24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n *\n * _Available since v4.7._\n */\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\n downcasted = int24(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 24 bits\");\n }\n\n /**\n * @dev Returns the downcasted int16 from int256, reverting on\n * overflow (when the input is less than smallest int16 or\n * greater than largest int16).\n *\n * Counterpart to Solidity's `int16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v3.1._\n */\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\n downcasted = int16(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 16 bits\");\n }\n\n /**\n * @dev Returns the downcasted int8 from int256, reverting on\n * overflow (when the input is less than smallest int8 or\n * greater than largest int8).\n *\n * Counterpart to Solidity's `int8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n *\n * _Available since v3.1._\n */\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\n downcasted = int8(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 8 bits\");\n }\n\n /**\n * @dev Converts an unsigned uint256 into a signed int256.\n *\n * Requirements:\n *\n * - input must be less than or equal to maxInt256.\n *\n * _Available since v3.0._\n */\n function toInt256(uint256 value) internal pure returns (int256) {\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\n require(value <= uint256(type(int256).max), \"SafeCast: value doesn't fit in an int256\");\n return int256(value);\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMathUpgradeable {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._\n * _Available since v4.9 for `string`, `bytes`._\n */\nlibrary StorageSlotUpgradeable {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n struct StringSlot {\n string value;\n }\n\n struct BytesSlot {\n bytes value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\n */\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n */\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\n */\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n */\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\nimport \"./math/SignedMathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _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 unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMathUpgradeable.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n 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] = _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 /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/draft-IERC1822.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822Proxiable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC1271.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC1271 standard signature validation method for\n * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].\n *\n * _Available since v4.1._\n */\ninterface IERC1271 {\n /**\n * @dev Should return whether the signature provided is valid for the provided data\n * @param hash Hash of the data to be signed\n * @param signature Signature byte array associated with _data\n */\n function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC1967.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\n *\n * _Available since v4.8.3._\n */\ninterface IERC1967 {\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Emitted when the beacon is changed.\n */\n event BeaconUpgraded(address indexed beacon);\n}\n" + }, + "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts/proxy/Clones.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/Clones.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for\n * deploying minimal proxy contracts, also known as \"clones\".\n *\n * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies\n * > a minimal bytecode implementation that delegates all calls to a known, fixed address.\n *\n * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`\n * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the\n * deterministic method.\n *\n * _Available since v3.4._\n */\nlibrary Clones {\n /**\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n *\n * This function uses the create opcode, which should never revert.\n */\n function clone(address implementation) internal returns (address instance) {\n /// @solidity memory-safe-assembly\n assembly {\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n // of the `implementation` address with the bytecode before the address.\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n instance := create(0, 0x09, 0x37)\n }\n require(instance != address(0), \"ERC1167: create failed\");\n }\n\n /**\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n *\n * This function uses the create2 opcode and a `salt` to deterministically deploy\n * the clone. Using the same `implementation` and `salt` multiple time will revert, since\n * the clones cannot be deployed twice at the same address.\n */\n function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {\n /// @solidity memory-safe-assembly\n assembly {\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n // of the `implementation` address with the bytecode before the address.\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n instance := create2(0, 0x09, 0x37, salt)\n }\n require(instance != address(0), \"ERC1167: create2 failed\");\n }\n\n /**\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n */\n function predictDeterministicAddress(\n address implementation,\n bytes32 salt,\n address deployer\n ) internal pure returns (address predicted) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(add(ptr, 0x38), deployer)\n mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)\n mstore(add(ptr, 0x14), implementation)\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)\n mstore(add(ptr, 0x58), salt)\n mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))\n predicted := keccak256(add(ptr, 0x43), 0x55)\n }\n }\n\n /**\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n */\n function predictDeterministicAddress(\n address implementation,\n bytes32 salt\n ) internal view returns (address predicted) {\n return predictDeterministicAddress(implementation, salt, address(this));\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Proxy.sol\";\nimport \"./ERC1967Upgrade.sol\";\n\n/**\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\n * implementation address that can be changed. This address is stored in storage in the location specified by\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\n * implementation behind the proxy.\n */\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\n *\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\n */\n constructor(address _logic, bytes memory _data) payable {\n _upgradeToAndCall(_logic, _data, false);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function _implementation() internal view virtual override returns (address impl) {\n return ERC1967Upgrade._getImplementation();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeacon.sol\";\nimport \"../../interfaces/IERC1967.sol\";\nimport \"../../interfaces/draft-IERC1822.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/StorageSlot.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n */\nabstract contract ERC1967Upgrade is IERC1967 {\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(Address.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n Address.isContract(IBeacon(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n /**\n * @dev Delegates the current call to `implementation`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\n * and {_fallback} should delegate.\n */\n function _implementation() internal view virtual returns (address);\n\n /**\n * @dev Delegates the current call to the address returned by `_implementation()`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\n _beforeFallback();\n _delegate(_implementation());\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\n * is empty.\n */\n receive() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\n * call, or as part of the Solidity `fallback` or `receive` functions.\n *\n * If overridden should call `super._beforeFallback()`.\n */\n function _beforeFallback() internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] calldata accounts,\n uint256[] calldata ids\n ) external view returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\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 * 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 default value returned by this function, unless\n * it's 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(address from, address to, uint256 amount) 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(address from, address to, uint256 amount) 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 // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\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 unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\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 // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\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(address owner, address spender, uint256 amount) 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(address owner, address spender, uint256 amount) 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(address from, address to, uint256 amount) 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(address from, address to, uint256 amount) internal virtual {}\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.9.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(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {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(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the 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/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@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/ERC165Checker.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/introspection/ERC165Checker.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Library used to query support of an interface declared via {IERC165}.\n *\n * Note that these functions return the actual result of the query: they do not\n * `revert` if an interface is not supported. It is up to the caller to decide\n * what to do in these cases.\n */\nlibrary ERC165Checker {\n // As per the EIP-165 spec, no interface should ever match 0xffffffff\n bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;\n\n /**\n * @dev Returns true if `account` supports the {IERC165} interface.\n */\n function supportsERC165(address account) internal view returns (bool) {\n // Any contract that implements ERC165 must explicitly indicate support of\n // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid\n return\n supportsERC165InterfaceUnchecked(account, type(IERC165).interfaceId) &&\n !supportsERC165InterfaceUnchecked(account, _INTERFACE_ID_INVALID);\n }\n\n /**\n * @dev Returns true if `account` supports the interface defined by\n * `interfaceId`. Support for {IERC165} itself is queried automatically.\n *\n * See {IERC165-supportsInterface}.\n */\n function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {\n // query support of both ERC165 as per the spec and support of _interfaceId\n return supportsERC165(account) && supportsERC165InterfaceUnchecked(account, interfaceId);\n }\n\n /**\n * @dev Returns a boolean array where each value corresponds to the\n * interfaces passed in and whether they're supported or not. This allows\n * you to batch check interfaces for a contract where your expectation\n * is that some interfaces may not be supported.\n *\n * See {IERC165-supportsInterface}.\n *\n * _Available since v3.4._\n */\n function getSupportedInterfaces(\n address account,\n bytes4[] memory interfaceIds\n ) internal view returns (bool[] memory) {\n // an array of booleans corresponding to interfaceIds and whether they're supported or not\n bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);\n\n // query support of ERC165 itself\n if (supportsERC165(account)) {\n // query support of each interface in interfaceIds\n for (uint256 i = 0; i < interfaceIds.length; i++) {\n interfaceIdsSupported[i] = supportsERC165InterfaceUnchecked(account, interfaceIds[i]);\n }\n }\n\n return interfaceIdsSupported;\n }\n\n /**\n * @dev Returns true if `account` supports all the interfaces defined in\n * `interfaceIds`. Support for {IERC165} itself is queried automatically.\n *\n * Batch-querying can lead to gas savings by skipping repeated checks for\n * {IERC165} support.\n *\n * See {IERC165-supportsInterface}.\n */\n function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {\n // query support of ERC165 itself\n if (!supportsERC165(account)) {\n return false;\n }\n\n // query support of each interface in interfaceIds\n for (uint256 i = 0; i < interfaceIds.length; i++) {\n if (!supportsERC165InterfaceUnchecked(account, interfaceIds[i])) {\n return false;\n }\n }\n\n // all interfaces supported\n return true;\n }\n\n /**\n * @notice Query if a contract implements an interface, does not check ERC165 support\n * @param account The address of the contract to query for support of an interface\n * @param interfaceId The interface identifier, as specified in ERC-165\n * @return true if the contract at account indicates support of the interface with\n * identifier interfaceId, false otherwise\n * @dev Assumes that account contains a contract that supports ERC165, otherwise\n * the behavior of this method is undefined. This precondition can be checked\n * with {supportsERC165}.\n *\n * Some precompiled contracts will falsely indicate support for a given interface, so caution\n * should be exercised when using this function.\n *\n * Interface identification is specified in ERC-165.\n */\n function supportsERC165InterfaceUnchecked(address account, bytes4 interfaceId) internal view returns (bool) {\n // prepare call\n bytes memory encodedParams = abi.encodeWithSelector(IERC165.supportsInterface.selector, interfaceId);\n\n // perform static call\n bool success;\n uint256 returnSize;\n uint256 returnValue;\n assembly {\n success := staticcall(30000, account, add(encodedParams, 0x20), mload(encodedParams), 0x00, 0x20)\n returnSize := returndatasize()\n returnValue := mload(0x00)\n }\n\n return success && returnSize >= 0x20 && returnValue > 0;\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/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._\n * _Available since v4.9 for `string`, `bytes`._\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n struct StringSlot {\n string value;\n }\n\n struct BytesSlot {\n bytes value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\n */\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n */\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\n */\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n */\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n}\n" + }, + "src/dependencies/dependencies.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\npragma solidity ^0.8.17;\n\nimport { IDAO } from \"@aragon/osx/core/dao/IDAO.sol\";\nimport { DAO } from \"@aragon/osx/core/dao/DAO.sol\";\nimport { DAOFactory } from \"@aragon/osx/framework/dao/DAOFactory.sol\";\nimport { DAORegistry } from \"@aragon/osx/framework/dao/DAORegistry.sol\";\n\nimport { PluginRepoFactory } from \"@aragon/osx/framework/plugin/repo/PluginRepoFactory.sol\";\nimport { PluginRepoRegistry } from \"@aragon/osx/framework/plugin/repo/PluginRepoRegistry.sol\";\nimport { PluginSetupProcessor } from \"@aragon/osx/framework/plugin/setup/PluginSetupProcessor.sol\";\nimport { InterfaceBasedRegistry } from \"@aragon/osx/framework/utils/InterfaceBasedRegistry.sol\";\nimport { PluginUUPSUpgradeable } from \"@aragon/osx/core/plugin/PluginUUPSUpgradeable.sol\";\n\nimport {GovernanceERC20} from \"@aragon/osx/token/ERC20/governance/GovernanceERC20.sol\";\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport {IVotesUpgradeable} from \"@openzeppelin/contracts-upgradeable/governance/utils/IVotesUpgradeable.sol\";\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\nimport { ENSSubdomainRegistrar } from \"@aragon/osx/framework/utils/ens/ENSSubdomainRegistrar.sol\";\nimport { ENSRegistry } from \"@ensdomains/ens-contracts/contracts/registry/ENSRegistry.sol\";\nimport { FIFSRegistrar } from \"@ensdomains/ens-contracts/contracts/registry/FIFSRegistrar.sol\";\nimport { PublicResolver } from \"@ensdomains/ens-contracts/contracts/resolvers/PublicResolver.sol\";\n\n\ncontract InterfaceBasedRegistryMock is InterfaceBasedRegistry {\n bytes32 public constant REGISTER_PERMISSION_ID = keccak256(\"REGISTER_PERMISSION\");\n\n event Registered(address);\n\n function initialize(IDAO _dao, bytes4 targetInterface) external initializer {\n __InterfaceBasedRegistry_init(_dao, targetInterface);\n }\n\n function register(address registrant) external auth(REGISTER_PERMISSION_ID) {\n _register(registrant);\n\n emit Registered(registrant);\n }\n}\n\ncontract PluginUUPSUpgradeableV1Mock is PluginUUPSUpgradeable {\n uint256 public state1;\n\n function initialize(IDAO _dao) external initializer {\n __PluginUUPSUpgradeable_init(_dao);\n state1 = 1;\n }\n}\n\ncontract PluginUUPSUpgradeableV2Mock is PluginUUPSUpgradeable {\n uint256 public state1;\n uint256 public state2;\n\n function initialize(IDAO _dao) external reinitializer(2) {\n __PluginUUPSUpgradeable_init(_dao);\n state1 = 1;\n state2 = 2;\n }\n\n function initializeV1toV2() external reinitializer(2) {\n state2 = 2;\n }\n}\n\ncontract PluginUUPSUpgradeableV3Mock is PluginUUPSUpgradeable {\n uint256 public state1;\n uint256 public state2;\n uint256 public state3;\n\n function initialize(IDAO _dao) external reinitializer(3) {\n __PluginUUPSUpgradeable_init(_dao);\n state1 = 1;\n state2 = 2;\n state3 = 3;\n }\n\n function initializeV1toV3() external reinitializer(3) {\n state2 = 2;\n state3 = 3;\n }\n\n function initializeV2toV3() external reinitializer(3) {\n state3 = 3;\n }\n}\n\n\ncontract GovernanceERC20Mock is GovernanceERC20 {\n constructor(\n IDAO _dao,\n string memory _name,\n string memory _symbol,\n MintSettings memory _mintSettings\n )\n GovernanceERC20(\n _dao,\n _name,\n _symbol,\n _mintSettings //MintSettings({amounts: new uint256[](0), receivers: new address[](0)})\n )\n {}\n\n // sets the balance of the address\n // this mints/burns the amount depending on the current balance\n function setBalance(address to, uint256 amount) public {\n uint256 old = balanceOf(to);\n if (old < amount) {\n _mint(to, amount - old);\n } else if (old > amount) {\n _burn(to, old - amount);\n }\n }\n}" + }, + "src/IVocdoniProposal.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity ^0.8.17;\n\nimport {IDAO} from \"@aragon/osx/core/dao/IDAO.sol\";\n\n/// @title IVocdoniProposal\n/// @notice An interface to be implemented by DAO plugins that create and execute off-chain proposals.\n/// @dev Slighly modified from the original Aragon OSx IProposal interface.\ninterface IVocdoniProposal {\n /// @notice Emitted when a proposal is created.\n /// @param proposalId The ID of the proposal.\n /// @param vochainProposalId The ID of the proposal in the Vochain.\n /// @param creator The creator of the proposal.\n /// @param startDate The start date of the proposal in seconds.\n /// @param endDate The end date of the proposal in seconds.\n /// @param expirationDate The expiration date of the proposal in seconds.\n /// @param actions The actions that will be executed if the proposal passes.\n /// @param allowFailureMap A bitmap allowing the proposal to succeed, even if individual actions might revert. If the bit at index `i` is 1, the proposal succeeds even if the `i`th action reverts. A failure map value of 0 requires every action to not revert.\n event ProposalCreated(\n uint256 indexed proposalId,\n bytes32 indexed vochainProposalId,\n address indexed creator,\n uint64 startDate,\n uint64 endDate,\n uint64 expirationDate,\n IDAO.Action[] actions,\n uint256 allowFailureMap\n );\n\n /// @notice Emitted when a proposal is executed.\n /// @param proposalId The ID of the proposal.\n event ProposalExecuted(uint256 indexed proposalId);\n\n /// @notice Returns the proposal count determining the next proposal ID.\n /// @return The proposal count.\n function proposalCount() external view returns (uint256);\n}" + }, + "src/IVocdoniVoting.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\npragma solidity ^0.8.17;\n\nimport {IDAO} from \"@aragon/osx/core/dao/IDAO.sol\";\n\n/// @title IVocdoniVoting\n/// @author Vocdoni\n/// @notice The Vocdoni off-chain voting contract interface for the OSX plugin.\n/// @notice The voting Proposal is managed off-chain on the Vocdoni blockchain.\ninterface IVocdoniVoting {\n /// @notice Adds new committee members.\n /// @param _members The addresses of the new committee members.\n function addCommitteeMembers(address[] calldata _members) external;\n\n /// @notice Removes committee members.\n /// @param _members The addresses of the committee members to remove.\n function removeCommitteeMembers(address[] calldata _members) external;\n\n /// @notice Returns whether an address is a committee member.\n /// @param _member The address to check.\n /// @return Whether the address is a committee member.\n function isCommitteeMember(address _member) external view returns (bool);\n\n /// @notice Sets the tally of a given proposal.\n /// @param _proposalId The ID of the proposal to set the tally of.\n /// @param _tally The tally to set.\n function setTally(uint256 _proposalId, uint256[][] memory _tally) external;\n\n /// @notice Approves a proposal tally.\n /// @param _proposalId The ID of the proposal to approve.\n function approveTally(uint256 _proposalId, bool _tryExecution) external;\n\n /// @notice Executes a proposal.\n /// @param _proposalId The ID of the proposal to execute.\n function executeProposal(uint256 _proposalId) external;\n}" + }, + "src/VocdoniProposalUpgradeable.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity ^0.8.17;\n\nimport {CountersUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol\";\nimport {ERC165Upgradeable} from \"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\";\nimport {IVocdoniProposal} from \"./IVocdoniProposal.sol\";\nimport {IDAO} from \"@aragon/osx/core/dao/IDAO.sol\";\n\n/// @title VocdoniProposalUpgradeable\n/// @notice An abstract contract containing the traits and internal functionality to create and execute off-chain proposals that can be inherited by upgradeable DAO plugins.\n/// @dev Slighly modified from the original Aragon OSx ProposalUpgradeable contract.\nabstract contract VocdoniProposalUpgradeable is IVocdoniProposal, ERC165Upgradeable {\n using CountersUpgradeable for CountersUpgradeable.Counter;\n\n /// @notice The incremental ID for proposals and executions.\n CountersUpgradeable.Counter private proposalCounter;\n\n /// @inheritdoc IVocdoniProposal\n function proposalCount() public view override returns (uint256) {\n return proposalCounter.current();\n }\n\n /// @notice Checks if this or the parent contract supports an interface by its ID.\n /// @param _interfaceId The ID of the interface.\n /// @return Returns `true` if the interface is supported.\n function supportsInterface(bytes4 _interfaceId) public view virtual override returns (bool) {\n return _interfaceId == type(IVocdoniProposal).interfaceId || super.supportsInterface(_interfaceId);\n }\n\n /// @notice Creates a proposal ID.\n /// @return proposalId The proposal ID.\n function _createProposalId() internal returns (uint256 proposalId) {\n proposalId = proposalCount();\n proposalCounter.increment();\n }\n\n /// @notice Internal function to execute a proposal.\n /// @param _proposalId The ID of the proposal to be executed.\n /// @param _actions The array of actions to be executed.\n /// @param _allowFailureMap A bitmap allowing the proposal to succeed, even if individual actions might revert. If the bit at index `i` is 1, the proposal succeeds even if the `i`th action reverts. A failure map value of 0 requires every action to not revert.\n /// @return execResults The array with the results of the executed actions.\n /// @return failureMap The failure map encoding which actions have failed.\n function _executeProposal(\n IDAO _dao,\n uint256 _proposalId,\n IDAO.Action[] memory _actions,\n uint256 _allowFailureMap\n ) internal virtual returns (bytes[] memory execResults, uint256 failureMap) {\n (execResults, failureMap) = _dao.execute(bytes32(_proposalId), _actions, _allowFailureMap);\n emit ProposalExecuted({proposalId: _proposalId});\n }\n\n /// @notice This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain (see [OpenZeppelin's guide about storage gaps](https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps)).\n uint256[49] private __gap;\n}" + }, + "src/VocdoniVoting.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\npragma solidity ^0.8.17;\n\n\nimport {SafeCastUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol\";\nimport {IVotesUpgradeable} from \"@openzeppelin/contracts-upgradeable/governance/utils/IVotesUpgradeable.sol\";\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\nimport {IDAO} from \"@aragon/osx/core/dao/IDAO.sol\";\nimport {PluginUUPSUpgradeable} from \"@aragon/osx/core/plugin/PluginUUPSUpgradeable.sol\";\nimport {RATIO_BASE, RatioOutOfBounds} from \"@aragon/osx/plugins/utils/Ratio.sol\";\nimport {Addresslist} from \"@aragon/osx/plugins/utils/Addresslist.sol\";\n\nimport {VocdoniProposalUpgradeable} from \"./VocdoniProposalUpgradeable.sol\";\nimport {IVocdoniVoting} from \"./IVocdoniVoting.sol\";\n\n/// @title VocdoniVoting\n/// @author Vocdoni\n/// @notice The Vocdoni off-chain voting data contract for the OSX plugin.\n/// @notice The voting Proposal is managed off-chain on the Vocdoni blockchain.\ncontract VocdoniVoting is IVocdoniVoting, PluginUUPSUpgradeable, VocdoniProposalUpgradeable, Addresslist {\n\n using SafeCastUpgradeable for uint256;\n\n /// @notice The [ERC-165](https://eips.ethereum.org/EIPS/eip-165) interface ID of the contract.\n bytes4 internal constant VOCDONI_INTERFACE_ID =\n this.initialize.selector ^\n this.addCommitteeMembers.selector ^\n this.removeCommitteeMembers.selector ^\n this.isCommitteeMember.selector ^\n this.setTally.selector ^\n this.approveTally.selector ^\n this.executeProposal.selector;\n\n /// @notice The ID of the permission required to update the plugin settings.\n bytes32 public constant UPDATE_PLUGIN_SETTINGS_PERMISSION_ID =\n keccak256(\"UPDATE_PLUGIN_SETTINGS_PERMISSION\");\n\n /// @notice The ID of the permission required to add/remove committee members.\n bytes32 public constant UPDATE_PLUGIN_COMMITTEE_PERMISSION_ID =\n keccak256(\"UPDATE_PLUGIN_COMMITTEE_PERMISSION\");\n\n /// @notice Emitted when the plugin settings are updated.\n /// @param onlyCommitteeProposalCreation If true, only committee members can create proposals.\n /// @param minTallyApprovals The minimum number of approvals required for a tally to be considered accepted.\n /// @param minDuration The minimum duration of a propsal.\n /// @param minParticipation The minimum participation value. Its value has to be in the interval [0, 10^6] defined by `RATIO_BASE = 10**6`.\n /// @param supportThreshold The support threshold value. Its value has to be in the interval [0, 10^6] defined by `RATIO_BASE = 10**6`.\n /// @param daoTokenAddress The address of the DAO token.\n /// @param censusStrategy The predicate of the census strategy to be used in the proposals. See: https://github.com/vocdoni/census3 \n /// @param minProposerVotingPower The minimum voting power required to create a proposal. Voting power is extracted from the DAO token\n event PluginSettingsUpdated(\n bool onlyCommitteeProposalCreation,\n uint16 minTallyApprovals,\n uint64 minDuration,\n uint32 minParticipation,\n uint32 supportThreshold,\n address daoTokenAddress,\n string censusStrategy,\n uint256 minProposerVotingPower\n );\n\n /// @notice Emitted when one or more committee members are added.\n /// @param newMembers The addresses of the new committee members.\n event CommitteeMembersAdded(address[] indexed newMembers);\n\n /// @notice Emitted when one or more committee member are removed.\n /// @param removedMembers The addresses of the removed committee members.\n event CommitteeMembersRemoved(address[] indexed removedMembers);\n\n /// @notice Emitted when the tally of a proposal is set.\n /// @param proposalId The ID of the proposal.\n /// @param tally The tally.\n event TallySet(uint256 indexed proposalId, uint256[][] tally);\n\n /// @notice Emitted when the tally of a proposal is approved.\n /// @param proposalId The ID of the proposal.\n event TallyApproved(uint256 indexed proposalId);\n\n /// @notice Thrown if the address list length is out of bounds.\n /// @param limit The limit value.\n /// @param actual The actual value.\n error AddresslistLengthOutOfBounds(uint16 limit, uint256 actual);\n\n /// @notice Thrown if the minimal approvals value is out of bounds (less than 1 or greater than the number of members in the address list).\n /// @param limit The maximal value.\n /// @param actual The actual value.\n error MinApprovalsOutOfBounds(uint16 limit, uint16 actual);\n\n /// @notice Thrown if the minimal duration value is out of bounds (less than one hour or greater than 1 year).\n /// @param limit The limit value.\n /// @param actual The actual value.\n error MinDurationOutOfBounds(uint64 limit, uint64 actual);\n\n /// @notice Thrown if the start date is invalid.\n /// @param limit The limit value.\n /// @param actual The actual value.\n error InvalidStartDate(uint64 limit, uint64 actual);\n\n /// @notice Thrown if the end date is invalid.\n /// @param limit The limit value.\n /// @param actual The actual value.\n error InvalidEndDate(uint64 limit, uint64 actual);\n\n /// @notice Thrown if the expiration date is invalid.\n /// @param limit The expiration date.\n /// @param actual The actual value.\n error InvalidExpirationDate(uint64 limit, uint64 actual);\n\n /// @notice Thrown if the plugin settings are updated too recently.\n /// @param lastUpdate The block number of the last update.\n error PluginSettingsUpdatedTooRecently(uint64 lastUpdate, uint64 securityBlock);\n\n /// @notice Thrown if the proposal is already executed.\n /// @param proposalId The ID of the proposal.\n error ProposalAlreadyExecuted(uint256 proposalId);\n\n /// @notice Thrown if the proposal tally is invalid.\n /// @param tally The tally of the proposal.\n error InvalidTally(uint256[][] tally);\n\n /// @notice Thrown if the proposal tally is already set and approved.\n /// @param approvals The number of approvals.\n /// @param minApprovals The minimum number of approvals required.\n error TallyAlreadyApproved(uint256 approvals, uint16 minApprovals);\n\n /// @notice Thrown if the proposal tally is not approved by enough committee members.\n /// @param minApprovals The minimum number of approvals required.\n /// @param actualApprovals The actual number of approvals.\n error NotEnoughApprovals(uint16 minApprovals, uint16 actualApprovals);\n\n /// @notice Thrown if an address is not valid or not supported\n /// @param addr The address\n error InvalidAddress(address addr);\n\n /// @notice Thrown if the prosal is not in the tally phase\n /// @param startDate The start date of the proposal\n /// @param endDate The end date of the proposal\n /// @param expirationDate The expiration date of the proposal\n /// @param currentTimestamp The current timestamp\n error ProposalNotInTallyPhase(uint64 startDate, uint64 endDate, uint64 expirationDate, uint256 currentTimestamp);\n\n /// @notice Thrown if the msg.sender does not have enough voting power\n /// @param required The required voting power\n error NotEnoughVotingPower(uint256 required);\n\n /// @notice Thrown if the msg.sender is not a committee member\n /// @param sender The sender\n error OnlyCommittee(address sender);\n\n /// @notice Thrown if the support threshold is not reached\n /// @param currentSupport The current support\n /// @param supportThreshold The support threshold\n error SupportThresholdNotReached(uint256 currentSupport, uint32 supportThreshold);\n\n /// @notice Thrown if the minimum participation is not reached\n /// @param currentParticipation The current participation\n /// @param minParticipation The minimum participation\n error MinParticipationNotReached(uint256 currentParticipation,uint32 minParticipation);\n\n /// @notice A container for the Vocdoni voting plugin settings\n /// @param onlyCommitteeProposalCreation If true, only committee members can create proposals.\n /// @param minTallyApprovals The minimum number of approvals required for the tally to be considered valid.\n /// @param minParticipation The minimum participation value. Its value has to be in the interval [0, 10^6] defined by `RATIO_BASE = 10**6`.\n /// @param supportThreshold The support threshold value. Its value has to be in the interval [0, 10^6] defined by `RATIO_BASE = 10**6`.\n /// @param minDuration The minimum duration of a proposal.\n /// @param daoTokenAddress The address of the DAO token.\n /// @param minProposerVotingPower The minimum voting power required to create a proposal. Voting power is extracted from the DAO token\n /// @param censusStrategy The predicate of the census strategy to be used in the proposals. See: https://github.com/vocdoni/census3\n struct PluginSettings {\n bool onlyCommitteeProposalCreation;\n uint16 minTallyApprovals;\n uint32 minParticipation;\n uint32 supportThreshold;\n uint64 minDuration;\n address daoTokenAddress;\n uint256 minProposerVotingPower;\n string censusStrategy;\n }\n\n /// @notice A container for the proposal parameters.\n /// @param censusBlock The block number used to generate the census of the proposal\n /// @param securityBlock Block number used for limiting contract usage when plugin settings are updated\n /// @param startDate The timestamp when the proposal starts.\n /// @param endDate The timestamp when the proposal ends. At this point the tally can be set.\n /// @param expirationDate The timestamp when the proposal expires. Proposal can't be executed after.\n struct ProposalParameters {\n uint64 censusBlock;\n uint64 securityBlock;\n uint64 startDate;\n uint64 endDate;\n uint64 expirationDate;\n }\n\n /// @notice A container for proposal-related information.\n /// @param executed Whether the proposal is executed or not.\n /// @param vochainProposalId The ID of the proposal in the Vochain.\n /// @param allowFailureMap A bitmap allowing the proposal to succeed, even if individual actions might revert. If the bit at index `i` is 1,\n // the proposal succeeds even if the `i`th action reverts. A failure map value of 0 requires every action to not revert.\n /// @param parameters The parameters of the proposal.\n /// @param tally The tally of the proposal.\n /// @dev tally only supports [[Yes, No, Abstain]] schema in this order. i.e [[10, 5, 2]] means 10 Yes, 5 No, 2 Abstain.\n /// @param approvers The approvers of the tally.\n /// @param actions The actions to be executed when the proposal passes.\n struct Proposal {\n bool executed;\n bytes32 vochainProposalId;\n uint256 allowFailureMap;\n ProposalParameters parameters;\n uint256[][] tally;\n address[] approvers;\n IDAO.Action[] actions;\n }\n\n /// @notice A mapping between proposal IDs and proposal information.\n mapping(uint256 => Proposal) private proposals;\n\n /// @notice The current plugin settings.\n PluginSettings private pluginSettings;\n\n /// @notice Keeps track at which block number the plugin settings have been changed the last time.\n /// @dev This variable prevents executing a proposal if plugin settings have been changed.\n uint64 private lastPluginSettingsChange;\n\n \n /// @notice Initializes the plugin.\n /// @param _dao The DAO address.\n /// @param _committeeAddresses The addresses of the committee.\n /// @param _pluginSettings The initial plugin settings.\n function initialize(IDAO _dao, address[] calldata _committeeAddresses, PluginSettings memory _pluginSettings) external initializer {\n __PluginUUPSUpgradeable_init(_dao);\n \n if (_committeeAddresses.length > type(uint16).max) {\n revert AddresslistLengthOutOfBounds({limit: type(uint16).max, actual: _committeeAddresses.length});\n }\n \n _addAddresses(_committeeAddresses);\n \n emit CommitteeMembersAdded({newMembers: _committeeAddresses});\n \n _updatePluginSettings(_pluginSettings);\n }\n\n /// @notice Checks if this or the parent contract supports an interface by its ID.\n /// @param _interfaceId The ID of the interface.\n /// @return Returns `true` if the interface is supported.\n function supportsInterface(\n bytes4 _interfaceId\n )\n public\n view\n virtual\n override(PluginUUPSUpgradeable, VocdoniProposalUpgradeable)\n returns (bool)\n {\n return\n _interfaceId == VOCDONI_INTERFACE_ID ||\n _interfaceId == type(IVocdoniVoting).interfaceId ||\n _interfaceId == type(Addresslist).interfaceId ||\n super.supportsInterface(_interfaceId);\n }\n\n /// @inheritdoc IVocdoniVoting\n function addCommitteeMembers(\n address[] calldata _members\n ) external override auth(UPDATE_PLUGIN_COMMITTEE_PERMISSION_ID) {\n uint256 newAddresslistLength = addresslistLength() + _members.length;\n\n // Check if the new address list length would be greater than `type(uint16).max`, the maximal number of approvals.\n if (newAddresslistLength > type(uint16).max) {\n revert AddresslistLengthOutOfBounds({\n limit: type(uint16).max,\n actual: newAddresslistLength\n });\n }\n\n _addAddresses(_members);\n\n emit CommitteeMembersAdded({newMembers: _members});\n }\n\n /// @inheritdoc IVocdoniVoting\n function removeCommitteeMembers(\n address[] calldata _members\n ) external override auth(UPDATE_PLUGIN_COMMITTEE_PERMISSION_ID) {\n uint16 newAddresslistLength = uint16(addresslistLength() - _members.length);\n\n // Check if the new address list length would become less than the current minimum number of approvals required.\n if (newAddresslistLength < pluginSettings.minTallyApprovals) {\n revert MinApprovalsOutOfBounds({\n limit: newAddresslistLength,\n actual: pluginSettings.minTallyApprovals\n });\n }\n\n _removeAddresses(_members);\n\n emit CommitteeMembersRemoved({removedMembers: _members});\n }\n\n /// @inheritdoc IVocdoniVoting\n function isCommitteeMember(address _member) public view override returns (bool) {\n return _isCommitteeMember(_member);\n }\n\n /// @notice Internal function for checking whether an address is a committee member.\n /// @param _member The address to check.\n /// @return Whether the address is a committee member.\n function _isCommitteeMember(address _member) internal view returns (bool) {\n return isListed(_member);\n }\n\n /// @notice Updates the plugin settings.\n /// @param _pluginSettings The new plugin settings.\n /// @dev The called must have the UPDATE_PLUGIN_SETTINGS_PERMISSION_ID permission.\n function updatePluginSettings(PluginSettings memory _pluginSettings) public auth(UPDATE_PLUGIN_SETTINGS_PERMISSION_ID) {\n _updatePluginSettings(_pluginSettings);\n }\n\n /// @notice Internal function for updating the plugin settings.\n /// @param _pluginSettings The new plugin settings.\n function _updatePluginSettings(PluginSettings memory _pluginSettings) private {\n if (pluginSettings.supportThreshold > RATIO_BASE - 1) {\n revert RatioOutOfBounds({\n limit: RATIO_BASE - 1,\n actual: pluginSettings.supportThreshold\n });\n }\n \n // Require the minimum participation value to be in the interval [0, 10^6], because `>=` comparision is used in the participation criterion.\n if (pluginSettings.minParticipation > RATIO_BASE) {\n revert RatioOutOfBounds({limit: RATIO_BASE, actual: pluginSettings.minParticipation});\n }\n\n if (pluginSettings.minDuration > 365 days) {\n revert MinDurationOutOfBounds({limit: 365 days, actual: pluginSettings.minDuration});\n }\n \n // update plugin settings\n pluginSettings = _pluginSettings;\n lastPluginSettingsChange = uint64(block.number);\n\n emit PluginSettingsUpdated({\n onlyCommitteeProposalCreation: _pluginSettings.onlyCommitteeProposalCreation,\n minTallyApprovals: _pluginSettings.minTallyApprovals,\n minDuration: _pluginSettings.minDuration,\n minParticipation: _pluginSettings.minParticipation,\n supportThreshold: _pluginSettings.supportThreshold,\n daoTokenAddress: _pluginSettings.daoTokenAddress,\n censusStrategy: _pluginSettings.censusStrategy,\n minProposerVotingPower: _pluginSettings.minProposerVotingPower\n });\n }\n\n /// @notice Returns a proposal.\n /// @param _proposalId The ID of the proposal to return.\n /// @return executed Whether the proposal is executed or not.\n /// @return approvers The approvers of the tally.\n /// @return vochainProposalId The ID of the proposal in the Vochain.\n /// @return parameters The parameters of the proposal.\n /// @return allowFailureMap The allow failure map of the proposal.\n /// @return tally The tally of the proposal.\n /// @return actions The actions of the proposal.\n function getProposal(uint256 _proposalId) public view returns (\n bool executed,\n address[] memory approvers,\n bytes32 vochainProposalId,\n ProposalParameters memory parameters,\n uint256 allowFailureMap,\n uint256[][] memory tally,\n IDAO.Action[] memory actions\n \n ) {\n Proposal storage proposal = proposals[_proposalId];\n executed = proposal.executed;\n approvers = proposal.approvers;\n vochainProposalId = proposal.vochainProposalId;\n parameters = proposal.parameters;\n allowFailureMap = proposal.allowFailureMap;\n tally = proposal.tally;\n actions = proposal.actions;\n }\n\n /// @notice Internal function for creating a proposal.\n /// @param _vochainProposalId The Vocdoni proposal ID.\n /// @param _allowFailureMap The allow failure map of the proposal.\n /// @param _parameters The parameters of the proposal.\n /// @param _actions The actions of the proposal.\n /// @return The ID of the created proposal.\n function createProposal(\n bytes32 _vochainProposalId,\n uint256 _allowFailureMap,\n ProposalParameters memory _parameters,\n IDAO.Action[] memory _actions\n ) external returns (uint256) {\n if (pluginSettings.onlyCommitteeProposalCreation &&\n !_isCommitteeMember(_msgSender())\n ) {\n revert OnlyCommittee({\n sender: _msgSender()\n });\n }\n \n if (pluginSettings.minProposerVotingPower != 0 &&\n // Because of the checks in `VocdoniVotingSetup`, we can assume that `votingToken` is an [ERC-20](https://eips.ethereum.org/EIPS/eip-20) token.\n IVotesUpgradeable(pluginSettings.daoTokenAddress).getVotes(_msgSender()) < pluginSettings.minProposerVotingPower &&\n IERC20Upgradeable(pluginSettings.daoTokenAddress).balanceOf(_msgSender()) < pluginSettings.minProposerVotingPower\n ) {\n revert NotEnoughVotingPower({\n required: pluginSettings.minProposerVotingPower\n });\n }\n\n\n (_parameters.startDate,\n _parameters.endDate,\n _parameters.expirationDate) = _validateProposalDates(\n _parameters.startDate,\n _parameters.endDate,\n _parameters.expirationDate\n );\n\n uint256 _proposalId = _createProposalId();\n \n Proposal storage proposal = proposals[_proposalId];\n \n proposal.vochainProposalId = _vochainProposalId;\n proposal.parameters.startDate = _parameters.startDate;\n proposal.parameters.endDate = _parameters.endDate;\n proposal.parameters.expirationDate = _parameters.expirationDate;\n proposal.parameters.censusBlock = _parameters.censusBlock;\n proposal.allowFailureMap = _allowFailureMap;\n proposal.parameters.securityBlock = block.number.toUint64() - 1;\n for (uint16 i = 0; i < _actions.length; i++) {\n proposal.actions.push(_actions[i]);\n }\n\n emit ProposalCreated(\n _proposalId,\n _vochainProposalId,\n _msgSender(),\n _parameters.startDate,\n _parameters.endDate,\n _parameters.expirationDate,\n _actions,\n _allowFailureMap\n );\n\n return _proposalId;\n }\n\n /// @inheritdoc IVocdoniVoting\n function setTally(uint256 _proposalId, uint256[][] memory _tally) public override {\n _setTally(_proposalId, _tally);\n } \n\n /// @notice Internal function for setting the tally of a given proposal.\n /// @param _proposalId The ID of the proposal to set the tally of.\n /// @param _tally The tally to set.\n /// @dev The caller must be a committee member if the ONLY_COMMITTEE_SET_TALLY flag is set.\n function _setTally(uint256 _proposalId, uint256[][] memory _tally) internal {\n if (!_isCommitteeMember(_msgSender())) {\n revert OnlyCommittee({\n sender: _msgSender()\n });\n }\n\n Proposal storage proposal = proposals[_proposalId];\n // if plugin settings changed since proposal creation, the proposal is no longer valid and the tally cannot be set\n if (lastPluginSettingsChange >= proposal.parameters.securityBlock) {\n revert PluginSettingsUpdatedTooRecently({\n lastUpdate: lastPluginSettingsChange,\n securityBlock: proposal.parameters.securityBlock\n });\n }\n\n if (!_isProposalOnTallyPhase(proposal)) {\n revert ProposalNotInTallyPhase({\n startDate: proposal.parameters.startDate,\n endDate: proposal.parameters.endDate,\n expirationDate: proposal.parameters.expirationDate,\n currentTimestamp: block.timestamp\n });\n }\n \n if (_tally.length != 1) {\n revert InvalidTally({tally: _tally});\n }\n\n if (_tally[0].length != 3) {\n revert InvalidTally({tally: _tally});\n }\n \n // tally already set\n if (proposal.tally.length != 0) {\n // check proposal not already approved\n if (proposal.approvers.length >= pluginSettings.minTallyApprovals) {\n revert TallyAlreadyApproved({\n approvals: proposal.approvers.length,\n minApprovals: pluginSettings.minTallyApprovals\n });\n }\n // check if the new tally is different\n if (_tally[0][0] == proposal.tally[0][0] &&\n _tally[0][1] == proposal.tally[0][1] &&\n _tally[0][2] == proposal.tally[0][2]\n ) {\n revert InvalidTally({tally: _tally});\n }\n // reset approvers\n proposal.approvers = new address[](0);\n }\n \n proposal.tally = _tally;\n proposal.approvers.push(_msgSender());\n\n emit TallySet({proposalId: _proposalId, tally: _tally});\n emit TallyApproved({proposalId: _proposalId});\n }\n\n /// @inheritdoc IVocdoniVoting\n function approveTally(uint256 _proposalId, bool _tryExecution) public override {\n return _approveTally(_proposalId, _tryExecution);\n }\n\n /// @notice Internal function for approving a proposal tally.\n /// @param _proposalId The ID of the proposal to approve.\n /// @dev The caller must be a committee member if the ONLY_COMMITTEE_APPROVE_TALLY flag is set.\n function _approveTally(uint256 _proposalId, bool _tryExecution) internal {\n if (!_isCommitteeMember(_msgSender())) {\n revert OnlyCommittee({\n sender: _msgSender()\n });\n }\n\n Proposal storage proposal = proposals[_proposalId];\n \n if (proposal.tally.length == 0) {\n revert InvalidTally(proposal.tally);\n }\n\n if (hasApprovedTally(_proposalId)) {\n revert TallyAlreadyApproved({\n approvals: proposal.approvers.length,\n minApprovals: pluginSettings.minTallyApprovals\n });\n }\n \n proposal.approvers.push(_msgSender());\n \n emit TallyApproved({proposalId: _proposalId});\n \n if (_tryExecution) {\n _checkTallyAndExecute(_proposalId);\n }\n }\n\n /// @inheritdoc IVocdoniVoting\n function executeProposal(uint256 _proposalId) public override {\n _executeProposal(_proposalId);\n }\n\n /// @notice Internal function for executing a proposal.\n /// @param _proposalId The ID of the proposal to execute.\n /// @dev The caller must be a committee member if the ONLY_COMMITTEE_EXECUTE flag is set.\n function _executeProposal(uint256 _proposalId) internal {\n Proposal storage proposal = proposals[_proposalId];\n\n if (!_isProposalOnTallyPhase(proposal)) {\n revert ProposalNotInTallyPhase(\n proposal.parameters.startDate,\n proposal.parameters.endDate,\n proposal.parameters.expirationDate,\n block.timestamp\n );\n }\n \n _checkTallyAndExecute(_proposalId);\n }\n\n /// @notice Internal function to check if a proposal is on the tally phase.\n /// @param _proposal The proposal to check\n function _isProposalOnTallyPhase(Proposal storage _proposal) internal view returns (bool) {\n uint64 currentBlockTimestamp = uint64(block.timestamp);\n /// [... startDate ............ endDate ............ expirationDate ...]\n /// [............. Voting phase ....... Tally phase ...................]\n if (_proposal.parameters.startDate < currentBlockTimestamp &&\n _proposal.parameters.endDate <= currentBlockTimestamp &&\n _proposal.parameters.expirationDate > currentBlockTimestamp &&\n !_proposal.executed) {\n return true;\n }\n return false;\n }\n\n /// @notice Internal function to check the tally and execute a proposal if the tally\n /// number of YES votes is greater than the tally number of NO votes.\n function _checkTallyAndExecute(uint256 _proposalId) internal {\n Proposal storage proposal = proposals[_proposalId];\n\n if(proposal.tally.length == 0) {\n revert InvalidTally({\n tally: proposal.tally\n });\n }\n \n if (proposal.approvers.length < pluginSettings.minTallyApprovals) {\n revert NotEnoughApprovals({\n minApprovals: pluginSettings.minTallyApprovals,\n actualApprovals: proposal.approvers.length.toUint16()\n });\n }\n \n uint256 _currentParticipation = proposal.tally[0][0] + proposal.tally[0][1] + proposal.tally[0][2];\n if (_currentParticipation < pluginSettings.minParticipation) {\n revert MinParticipationNotReached({\n currentParticipation: _currentParticipation,\n minParticipation: pluginSettings.minParticipation\n });\n }\n \n uint256 _currentSupport = (RATIO_BASE - pluginSettings.supportThreshold) * proposal.tally[0][0];\n if (_currentSupport <= pluginSettings.supportThreshold * proposal.tally[0][1]) {\n revert SupportThresholdNotReached({\n currentSupport: _currentSupport,\n supportThreshold: pluginSettings.supportThreshold\n });\n }\n \n proposal.executed = true;\n _executeProposal(\n dao(),\n _proposalId,\n proposal.actions,\n proposal.allowFailureMap\n );\n }\n\n\n function _validateProposalDates(uint64 _startDate, uint64 _endDate, uint64 _expirationDate)\n internal\n view\n virtual\n returns(\n uint64 startDate,\n uint64 endDate,\n uint64 expirationDate\n ) {\n uint64 currentBlockTimestamp = block.timestamp.toUint64();\n // check proposal start date and set it to the current block timestamp if it is 0\n if (_startDate == 0) {\n startDate = currentBlockTimestamp;\n } else {\n startDate = _startDate;\n if (startDate < currentBlockTimestamp) {\n revert InvalidStartDate({\n limit: currentBlockTimestamp,\n actual: startDate\n });\n }\n }\n // check proposal end date and set it to the start date + min duration if it is 0\n uint64 earliestEndDate = startDate + pluginSettings.minDuration; \n // Since `minDuration` is limited to 1 year, `startDate + minDuration`\n // can only overflow if the `startDate` is after `type(uint64).max - minDuration`. \n // In this case, the proposal creation will revert and another date can be picked.\n if (_endDate == 0) {\n endDate = earliestEndDate;\n } else {\n endDate = _endDate;\n if (endDate < earliestEndDate) {\n revert InvalidEndDate({\n limit: earliestEndDate,\n actual: endDate\n });\n }\n }\n // check proposal expiration date and set it to the (endDate + min duration) if it is 0\n uint64 earliestExpirationDate = endDate + pluginSettings.minDuration;\n if (_expirationDate == 0) {\n expirationDate = earliestExpirationDate;\n } else {\n expirationDate = _expirationDate;\n if (expirationDate < earliestExpirationDate) {\n revert InvalidExpirationDate({\n limit: earliestExpirationDate,\n actual: expirationDate\n });\n }\n }\n }\n\n /// @notice Gets the plugin settings.\n /// @return The plugin settings.\n function getPluginSettings() public view returns (PluginSettings memory) {\n return pluginSettings;\n }\n\n /// @notice Returns true if msg.sender has approved the given proposal tally\n /// @param _proposalId The ID of the proposal.\n /// @return Whether the msg.sender has approved the proposal tally.\n function hasApprovedTally(uint256 _proposalId) public view returns (bool) {\n Proposal storage proposal = proposals[_proposalId];\n for (uint16 i = 0; i < proposal.approvers.length; i++) {\n if (proposal.approvers[i] == _msgSender()) {\n return true;\n }\n }\n return false;\n }\n\n /// @notice This empty reserved space is put in place to allow future versions to add new variables\n /// without shifting down storage in the inheritance chain (see [OpenZeppelin's guide about storage gaps]\n /// (https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps)).\n uint256[49] private __gap;\n}\n" + }, + "src/VocdoniVotingSetup.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\npragma solidity ^0.8.17;\n\nimport {IDAO} from \"@aragon/osx/core/dao/IDAO.sol\";\nimport {DAO} from \"@aragon/osx/core/dao/DAO.sol\";\nimport {PermissionLib} from \"@aragon/osx/core/permission/PermissionLib.sol\";\nimport {PluginSetup, IPluginSetup} from \"@aragon/osx/framework/plugin/setup/PluginSetup.sol\";\nimport {VocdoniVoting} from \"./VocdoniVoting.sol\";\n\nimport {Clones} from \"@openzeppelin/contracts/proxy/Clones.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {ERC165Checker} from \"@openzeppelin/contracts/utils/introspection/ERC165Checker.sol\";\nimport {IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport {IVotesUpgradeable} from \"@openzeppelin/contracts-upgradeable/governance/utils/IVotesUpgradeable.sol\";\n\nimport {GovernanceERC20} from \"@aragon/osx/token/ERC20/governance/GovernanceERC20.sol\";\nimport {GovernanceWrappedERC20} from \"@aragon/osx/token/ERC20/governance/GovernanceWrappedERC20.sol\";\nimport {IGovernanceWrappedERC20} from \"@aragon/osx/token/ERC20/governance/IGovernanceWrappedERC20.sol\";\n\n/// @title VocdoniVotingSetup\n/// @author Vocdoni\n/// @notice The setup contract of the `VocdoniVoting` plugin.\ncontract VocdoniVotingSetup is PluginSetup {\n using Address for address;\n using Clones for address;\n using ERC165Checker for address;\n\n /// @notice The address of `VocdoniVoting` plugin logic contract to be used in creating proxy contracts.\n VocdoniVoting private immutable vocdoniVoting;\n\n /// @notice The address of the `GovernanceERC20` base contract.\n address public immutable governanceERC20Base;\n\n /// @notice The address of the `GovernanceWrappedERC20` base contract.\n address public immutable governanceWrappedERC20Base;\n\n /// @notice The token settings struct.\n /// @param addr The token address. If this is `address(0)`, a new `GovernanceERC20` token is deployed. If not, the existing token is wrapped as an `GovernanceWrappedERC20`.\n /// @param name The token name. This parameter is only relevant if the token address is `address(0)`.\n /// @param symbol The token symbol. This parameter is only relevant if the token address is `address(0)`.\n struct TokenSettings {\n address addr;\n string name;\n string symbol;\n }\n\n /// @notice Thrown if token address is passed which is not a token.\n /// @param token The token address\n error TokenNotContract(address token);\n\n /// @notice Thrown if token address is not ERC20.\n /// @param token The token address\n error TokenNotERC20(address token);\n\n /// @notice Thrown if passed helpers array is of wrong length.\n /// @param length The array length of passed helpers.\n error WrongHelpersArrayLength(uint256 length);\n\n /// @notice The contract constructor, that deploys the `VocdoniVoting` plugin logic contract.\n constructor(\n GovernanceERC20 _governanceERC20Base,\n GovernanceWrappedERC20 _governanceWrappedERC20Base\n ) { \n governanceERC20Base = address(_governanceERC20Base);\n governanceWrappedERC20Base = address(_governanceWrappedERC20Base);\n vocdoniVoting = new VocdoniVoting();\n }\n\n /// @inheritdoc IPluginSetup\n function prepareInstallation(address _dao, bytes calldata _data)\n external\n returns (address plugin, PreparedSetupData memory preparedSetupData)\n {\n // Decode `_data` to extract the params needed for deploying and initializing `VocdoniVoting` plugin.\n (\n address[] memory committee,\n VocdoniVoting.PluginSettings memory pluginSettings,\n TokenSettings memory tokenSettings,\n // only used for GovernanceERC20(token is not passed)\n GovernanceERC20.MintSettings memory mintSettings\n ) =\n abi.decode(\n _data,\n (\n address[],\n VocdoniVoting.PluginSettings,\n TokenSettings,\n GovernanceERC20.MintSettings\n )\n );\n\n address token = tokenSettings.addr;\n\n // Prepare helpers.\n address[] memory helpers = new address[](1);\n\n if (token != address(0)) {\n if (!token.isContract()) {\n revert TokenNotContract(token);\n }\n\n if (!_isERC20(token)) {\n revert TokenNotERC20(token);\n }\n\n // [0] = IERC20Upgradeable, [1] = IVotesUpgradeable, [2] = IGovernanceWrappedERC20\n bool[] memory supportedIds = _getTokenInterfaceIds(token);\n\n if (\n // If token supports none of them\n // it's simply ERC20 which gets checked by _isERC20\n // Currently, not a satisfiable check.\n (!supportedIds[0] && !supportedIds[1] && !supportedIds[2]) ||\n // If token supports IERC20, but neither\n // IVotes nor IGovernanceWrappedERC20, it needs wrapping.\n (supportedIds[0] && !supportedIds[1] && !supportedIds[2])\n ) {\n token = governanceWrappedERC20Base.clone();\n // User already has a token. We need to wrap it in\n // GovernanceWrappedERC20 in order to make the token\n // include governance functionality.\n GovernanceWrappedERC20(token).initialize(\n IERC20Upgradeable(tokenSettings.addr),\n tokenSettings.name,\n tokenSettings.symbol\n );\n }\n } else {\n // Clone a `GovernanceERC20`.\n token = governanceERC20Base.clone();\n GovernanceERC20(token).initialize(\n IDAO(_dao),\n tokenSettings.name,\n tokenSettings.symbol,\n mintSettings\n );\n }\n\n helpers[0] = token;\n\n // Prepare and Deploy the plugin proxy.\n plugin = createERC1967Proxy(\n address(vocdoniVoting),\n abi.encodeWithSelector(VocdoniVoting.initialize.selector, _dao, committee, pluginSettings)\n );\n\n // Prepare permissions\n PermissionLib.MultiTargetPermission[]\n memory permissions = new PermissionLib.MultiTargetPermission[](\n tokenSettings.addr != address(0) ? 4 : 5\n );\n\n // Set permissions to be granted.\n // Grant the list of permissions of the plugin to the DAO.\n permissions[0] = PermissionLib.MultiTargetPermission(\n PermissionLib.Operation.Grant,\n plugin,\n _dao,\n PermissionLib.NO_CONDITION,\n vocdoniVoting.UPDATE_PLUGIN_SETTINGS_PERMISSION_ID()\n );\n\n permissions[1] = PermissionLib.MultiTargetPermission(\n PermissionLib.Operation.Grant,\n plugin,\n _dao,\n PermissionLib.NO_CONDITION,\n vocdoniVoting.UPDATE_PLUGIN_COMMITTEE_PERMISSION_ID()\n );\n\n permissions[2] = PermissionLib.MultiTargetPermission(\n PermissionLib.Operation.Grant,\n plugin,\n _dao,\n PermissionLib.NO_CONDITION,\n vocdoniVoting.UPGRADE_PLUGIN_PERMISSION_ID()\n );\n\n // Grant `EXECUTE_PERMISSION` of the DAO to the plugin.\n permissions[3] = PermissionLib.MultiTargetPermission(\n PermissionLib.Operation.Grant,\n _dao,\n plugin,\n PermissionLib.NO_CONDITION,\n DAO(payable(_dao)).EXECUTE_PERMISSION_ID()\n );\n\n if (tokenSettings.addr == address(0)) {\n bytes32 tokenMintPermission = GovernanceERC20(token).MINT_PERMISSION_ID();\n\n permissions[4] = PermissionLib.MultiTargetPermission(\n PermissionLib.Operation.Grant,\n token,\n _dao,\n PermissionLib.NO_CONDITION,\n tokenMintPermission\n );\n }\n\n preparedSetupData.helpers = helpers;\n preparedSetupData.permissions = permissions;\n }\n\n /// @inheritdoc IPluginSetup\n function prepareUninstallation(address _dao, SetupPayload calldata _payload)\n external\n view\n returns (PermissionLib.MultiTargetPermission[] memory permissions)\n {\n // Prepare permissions.\n uint256 helperLength = _payload.currentHelpers.length;\n if (helperLength != 1) {\n revert WrongHelpersArrayLength({length: helperLength});\n }\n\n // token can be either GovernanceERC20, GovernanceWrappedERC20, or IVotesUpgradeable, which\n // does not follow the GovernanceERC20 and GovernanceWrappedERC20 standard.\n address token = _payload.currentHelpers[0];\n\n bool[] memory supportedIds = _getTokenInterfaceIds(token);\n\n bool isGovernanceERC20 = supportedIds[0] && supportedIds[1] && !supportedIds[2];\n\n permissions = new PermissionLib.MultiTargetPermission[](isGovernanceERC20 ? 5 : 4);\n\n // Set permissions to be Revoked.\n permissions[0] = PermissionLib.MultiTargetPermission(\n PermissionLib.Operation.Revoke,\n _payload.plugin,\n _dao,\n PermissionLib.NO_CONDITION,\n vocdoniVoting.UPDATE_PLUGIN_SETTINGS_PERMISSION_ID()\n );\n\n permissions[1] = PermissionLib.MultiTargetPermission(\n PermissionLib.Operation.Revoke,\n _payload.plugin,\n _dao,\n PermissionLib.NO_CONDITION,\n vocdoniVoting.UPDATE_PLUGIN_COMMITTEE_PERMISSION_ID()\n );\n\n permissions[2] = PermissionLib.MultiTargetPermission(\n PermissionLib.Operation.Revoke,\n _payload.plugin,\n _dao,\n PermissionLib.NO_CONDITION,\n vocdoniVoting.UPGRADE_PLUGIN_PERMISSION_ID()\n );\n\n permissions[3] = PermissionLib.MultiTargetPermission(\n PermissionLib.Operation.Revoke,\n _dao,\n _payload.plugin,\n PermissionLib.NO_CONDITION,\n DAO(payable(_dao)).EXECUTE_PERMISSION_ID()\n );\n\n // Revocation of permission is necessary only if the deployed token is GovernanceERC20,\n // as GovernanceWrapped does not possess this permission. Only return the following\n // if it's type of GovernanceERC20, otherwise revoking this permission wouldn't have any effect.\n if (isGovernanceERC20) {\n permissions[4] = PermissionLib.MultiTargetPermission(\n PermissionLib.Operation.Revoke,\n token,\n _dao,\n PermissionLib.NO_CONDITION,\n GovernanceERC20(token).MINT_PERMISSION_ID()\n );\n }\n }\n\n /// @inheritdoc IPluginSetup\n function implementation() external view virtual override returns (address) {\n return address(vocdoniVoting);\n }\n\n /// @notice Retrieves the interface identifiers supported by the token contract.\n /// @dev It is crucial to verify if the provided token address represents a valid contract before using the below.\n /// @param token The token address\n function _getTokenInterfaceIds(address token) private view returns (bool[] memory) {\n bytes4[] memory interfaceIds = new bytes4[](3);\n interfaceIds[0] = type(IERC20Upgradeable).interfaceId;\n interfaceIds[1] = type(IVotesUpgradeable).interfaceId;\n interfaceIds[2] = type(IGovernanceWrappedERC20).interfaceId;\n return token.getSupportedInterfaces(interfaceIds);\n }\n\n /// @notice Unsatisfiably determines if the contract is an ERC20 token.\n /// @dev It's important to first check whether token is a contract prior to this call.\n /// @param token The token address\n function _isERC20(address token) private view returns (bool) {\n (bool success, bytes memory data) = token.staticcall(\n abi.encodeWithSelector(IERC20Upgradeable.balanceOf.selector, address(this))\n );\n return success && data.length == 0x20;\n }\n}\n" + } + }, + "settings": { + "metadata": { + "bytecodeHash": "none", + "useLiteralContent": true + }, + "optimizer": { + "enabled": true, + "runs": 1000000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "storageLayout", + "devdoc", + "userdoc", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/plugin-info-testing.json b/packages/contracts/plugin-info-testing.json new file mode 100644 index 00000000..fc8a5bfe --- /dev/null +++ b/packages/contracts/plugin-info-testing.json @@ -0,0 +1,32 @@ +{ + "hardhat": { + "repo": "vocdoni-offchain-voting", + "address": "0xA4d97d64BCe2ab128Be10F5604D1f82C6D2781F5", + "args": [], + "blockNumberOfDeployment": 9652922, + "releases": { + "1": { + "builds": { + "1": { + "setup": { + "name": "VocdoniVotingSetup", + "address": "0x9dDd7eb20ff6B2E4bF2af2D7576abA89d9b01c4A", + "args": [], + "blockNumberOfDeployment": 9652923 + }, + "implementation": { + "name": "VocdoniVoting", + "address": "0x0A47eDa6cce35601F75b3132FEbcB010D6c1C9ac", + "args": [], + "blockNumberOfDeployment": 9652923 + }, + "helpers": [], + "buildMetadataURI": "ipfs://QmTf7LAs3g7S5Hf4jYjQYUkd8j9fk2JoWU6z4SQ3EjHt5Z", + "blockNumberOfPublication": 9652924 + } + }, + "releaseMetadataURI": "ipfs://QmR9r1GLfsPoET8Mya1rr6AXjwpAvrCGZJ13oMEFFTYCsE" + } + } + } +} diff --git a/packages/contracts/plugin-info.json b/packages/contracts/plugin-info.json index 80e512fa..9d6bbbfd 100644 --- a/packages/contracts/plugin-info.json +++ b/packages/contracts/plugin-info.json @@ -1,61 +1,31 @@ { "goerli": { - "repo": "test-2", - "address": "0xE56a8AfAE1F31013E41B08ce71d43f3008E50fd2", + "repo": "vocdoni-offchain-voting", + "address": "0xA4d97d64BCe2ab128Be10F5604D1f82C6D2781F5", "args": [], - "blockNumberOfDeployment": 9418499, + "blockNumberOfDeployment": 9652931, "releases": { "1": { "builds": { "1": { "setup": { - "name": "MyPluginSetup", - "address": "0x5F186fDFc79f890A3C01acFc1EE5c8e8c2977881", + "name": "VocdoniVotingSetup", + "address": "0x8dCb538Bf27CCED7A3498c45e9D51CBfa479bacF", "args": [], - "blockNumberOfDeployment": 9418501 + "blockNumberOfDeployment": 9652932 }, "implementation": { - "name": "MyPlugin", - "address": "0x5BF9D9CB63741C76d58765659a9Ce9405e5322cB", + "name": "VocdoniVoting", + "address": "0xd741c7eE3fc1766897d94d62FB1cf483f08680a4", "args": [], - "blockNumberOfDeployment": 9418501 + "blockNumberOfDeployment": 9652932 }, "helpers": [], - "buildMetadataURI": "ipfs://QmY919VZ9gkeF6L169qQo89ucsUB9ScTaJVbGn8vMGGHxr", - "blockNumberOfPublication": 9418503 + "buildMetadataURI": "ipfs://QmTf7LAs3g7S5Hf4jYjQYUkd8j9fk2JoWU6z4SQ3EjHt5Z", + "blockNumberOfPublication": 9652933 } }, - "releaseMetadataURI": "ipfs://QmVD1gtE5PdjhLuuRcjhiUqmnFXScVZbZ2oXEvXcKnd3b4" - } - } - }, - "baseGoerli": { - "repo": "test-2", - "address": "0xE3Bb449856e0A2A60f16e6bB7E59cEfB073DdAa1", - "args": [], - "blockNumberOfDeployment": 7850354, - "releases": { - "1": { - "builds": { - "1": { - "setup": { - "name": "MyPluginSetup", - "address": "0x604570fA0f83785ea925575d165725170eC316Cc", - "args": [], - "blockNumberOfDeployment": 7850358 - }, - "implementation": { - "name": "MyPlugin", - "address": "0x634a771777b306ba1B5F4ec85853b997d2Bf6827", - "args": [], - "blockNumberOfDeployment": 7850358 - }, - "helpers": [], - "buildMetadataURI": "ipfs://QmY919VZ9gkeF6L169qQo89ucsUB9ScTaJVbGn8vMGGHxr", - "blockNumberOfPublication": 7850362 - } - }, - "releaseMetadataURI": "ipfs://QmVD1gtE5PdjhLuuRcjhiUqmnFXScVZbZ2oXEvXcKnd3b4" + "releaseMetadataURI": "ipfs://QmR9r1GLfsPoET8Mya1rr6AXjwpAvrCGZJ13oMEFFTYCsE" } } } diff --git a/packages/contracts/plugin-settings.ts b/packages/contracts/plugin-settings.ts index 8cbe1867..dac809eb 100644 --- a/packages/contracts/plugin-settings.ts +++ b/packages/contracts/plugin-settings.ts @@ -1,15 +1,16 @@ import buildMetadata from './src/build-metadata.json'; import releaseMetadata from './src/release-metadata.json'; -export const PLUGIN_REPO_ENS_NAME = 'test-2'; -export const PLUGIN_CONTRACT_NAME = 'MyPlugin'; -export const PLUGIN_SETUP_CONTRACT_NAME = 'MyPluginSetup'; +export const PLUGIN_REPO_ENS_NAME = 'vocdoni-offchain-voting'; +export const PLUGIN_CONTRACT_NAME = 'VocdoniVoting'; +export const PLUGIN_SETUP_CONTRACT_NAME = 'VocdoniVotingSetup'; export const VERSION = { release: 1, // Increment this number ONLY if breaking/incompatible changes were made. Updates between releases are NOT possible. build: 1, // Increment this number if non-breaking/compatible changes were made. Updates to newer builds are possible. }; +// TODO: update the build metadata for decoding.... export const METADATA = { build: buildMetadata, release: releaseMetadata, diff --git a/packages/contracts/src/release-metadata.json b/packages/contracts/src/release-metadata.json index a47dc61a..8a3951d6 100644 --- a/packages/contracts/src/release-metadata.json +++ b/packages/contracts/src/release-metadata.json @@ -1,5 +1,5 @@ { - "name": "VocdoniVoting", - "description": "", - "images": {} + "name": "VocdoniOffchainVoting", + "description": "Tthis a really amazing plugin.... trust me....", + "images": {} } diff --git a/packages/subgraph/manifest/data/goerli.json b/packages/subgraph/manifest/data/goerli.json index 5f82e606..16cfdde5 100644 --- a/packages/subgraph/manifest/data/goerli.json +++ b/packages/subgraph/manifest/data/goerli.json @@ -6,7 +6,7 @@ { "name": "PluginSetupProcessor", "address": "0xE8B5d8D66a02CD1b9Bd32a4064D7ABa45F51305e", - "startBlock": 8548226 + "startBlock": 9418103 } ] } diff --git a/packages/subgraph/manifest/data/mumbai.json b/packages/subgraph/manifest/data/mumbai.json index 9b1a7847..0dfa29d5 100644 --- a/packages/subgraph/manifest/data/mumbai.json +++ b/packages/subgraph/manifest/data/mumbai.json @@ -6,7 +6,7 @@ { "name": "PluginSetupProcessor", "address": "0x9227b311C5cecB416707F1C8B7Ca1b52649AabEc", - "startBlock": 33514164 + "startBlock": 33633157 } ] } diff --git a/packages/subgraph/manifest/subgraph.placeholder.yaml b/packages/subgraph/manifest/subgraph.placeholder.yaml index f78df82b..11fedb16 100644 --- a/packages/subgraph/manifest/subgraph.placeholder.yaml +++ b/packages/subgraph/manifest/subgraph.placeholder.yaml @@ -49,18 +49,18 @@ templates: kind: ethereum/contract network: {{network}} source: - abi: Plugin + abi: VocdoniVoting mapping: kind: ethereum/events apiVersion: 0.0.5 language: wasm/assemblyscript entities: - - Dao + - Plugin abis: - - name: Plugin - file: $PLUGIN_MODULE/artifacts/src/MyPlugin.sol/MyPlugin.json + - name: VocdoniVoting + file: $PLUGIN_MODULE/artifacts/src/VocdoniVoting.sol/VocdoniVoting.json eventHandlers: - - event: NumberStored(uint256) - handler: handleNumberStored + - event: ProposalCreated(indexed uint256,indexed bytes32,indexed address,uint64,uint64,uint64,(address,uint256,bytes)[],uint256) + handler: handleProposalCreated file: ./src/plugin/plugin.ts diff --git a/packages/subgraph/schema.graphql b/packages/subgraph/schema.graphql index b19f5673..c018aec1 100644 --- a/packages/subgraph/schema.graphql +++ b/packages/subgraph/schema.graphql @@ -46,7 +46,6 @@ type Plugin implements PluginInstallation @entity { dao: Dao! "Set plugin specific related data below:" - number: BigInt! proposals: [PluginProposal!]! @derivedFrom(field: "plugin") members: [PluginMember!]! @derivedFrom(field: "plugin") } diff --git a/packages/subgraph/scripts/deploy-subgraph.sh b/packages/subgraph/scripts/deploy-subgraph.sh index 0c99609c..2fe68d37 100755 --- a/packages/subgraph/scripts/deploy-subgraph.sh +++ b/packages/subgraph/scripts/deploy-subgraph.sh @@ -5,7 +5,7 @@ then export $(cat .env | sed 's/#.*//g' | xargs) fi -if [ -z "$NETWORK_NAME" ] || [ -z "$SUBGRAPH_NAME" ] || [ -z "$GRAPH_KEY" ] || [ -z "$SUBGRAPH_VERSION" ] +if [ -z "$SUBGRAPH_NETWORK_NAME" ] || [ -z "$SUBGRAPH_NAME" ] || [ -z "$GRAPH_KEY" ] || [ -z "$SUBGRAPH_VERSION" ] then echo "env variables are not set properly, exiting..." exit -1 diff --git a/packages/subgraph/src/osx/pluginSetupProcessor.ts b/packages/subgraph/src/osx/pluginSetupProcessor.ts index 6edd4ee7..a48d227f 100644 --- a/packages/subgraph/src/osx/pluginSetupProcessor.ts +++ b/packages/subgraph/src/osx/pluginSetupProcessor.ts @@ -30,6 +30,13 @@ import {DataSourceContext, log} from '@graphprotocol/graph-ts'; export function handleInstallationPrepared(event: InstallationPrepared): void { const pluginRepo = event.params.pluginSetupRepo.toHexString(); + if (pluginRepo === PLUGIN_REPO_ADDRESS) { + log.warning( + '========== FOUND Comparing pluginRepo {} == PLUGIN_REPO_ADDRESS {}', + [pluginRepo, PLUGIN_REPO_ADDRESS] + ); + } + // Check if the prepared plugin is our plugin. const isThisPlugin = pluginRepo === PLUGIN_REPO_ADDRESS; @@ -37,14 +44,20 @@ export function handleInstallationPrepared(event: InstallationPrepared): void { return; } + log.warning('==========handleInstallationPrepared passed the repo check', []); + ////////////////////////////////////////////////////////////// // Index DAO ////////////////////////////////////////////////////////////// const dao = event.params.dao; const daoId = getDaoId(dao); + + log.warning('==========found a dao {}', [daoId]); + let doaEntity = Dao.load(daoId); if (!doaEntity) { doaEntity = new Dao(daoId); + doaEntity.save(); } diff --git a/packages/subgraph/src/plugin/plugin.ts b/packages/subgraph/src/plugin/plugin.ts index 6611334d..634496d0 100644 --- a/packages/subgraph/src/plugin/plugin.ts +++ b/packages/subgraph/src/plugin/plugin.ts @@ -1,9 +1,9 @@ import {getPluginInstallationId} from '../../commons/ids'; import {Plugin} from '../../generated/schema'; -import {NumberStored} from '../../generated/templates/Plugin/Plugin'; +import {ProposalCreated} from '../../generated/templates/Plugin/VocdoniVoting'; import {Address, dataSource} from '@graphprotocol/graph-ts'; -export function handleNumberStored(event: NumberStored): void { +export function handleProposalCreated(event: ProposalCreated): void { const pluginAddress = event.address; const context = dataSource.context(); @@ -15,9 +15,10 @@ export function handleNumberStored(event: NumberStored): void { ); if (installationId) { - const pluginEntity = Plugin.load(installationId.toHexString()); - if (pluginEntity) { - pluginEntity.number = event.params.number; + let pluginEntity = Plugin.load(installationId.toHexString()); + if (!pluginEntity) { + pluginEntity = new Plugin(installationId.toHexString()); + pluginEntity.dao = daoId; pluginEntity.save(); } } diff --git a/packages/subgraph/utils/constants.ts b/packages/subgraph/utils/constants.ts index aad52aa4..5a7b1e17 100644 --- a/packages/subgraph/utils/constants.ts +++ b/packages/subgraph/utils/constants.ts @@ -1,4 +1,4 @@ export const ADDRESS_ZERO = '0x0000000000000000000000000000000000000000'; export const PLUGIN_INTERFACE = '0x11223344'; -export const PLUGIN_REPO_ADDRESS = '0xEF30A43458d846bb754DBEE17958Dbc7a7b98618'; +export const PLUGIN_REPO_ADDRESS = '0xaca70d8c462940b839de386bcdd4cacf745632ca'; // make sure address are lowercased