From ad41645e942b892aaea9588c7bd97590d691bd5d Mon Sep 17 00:00:00 2001 From: John Carlo San Pedro Date: Mon, 19 Feb 2024 19:05:38 +1300 Subject: [PATCH] deploy new contracts to porcini --- deployments/genesis.config.ts | 8 +- deployments/porcini-dev/.chainId | 1 + .../porcini-dev/AuthorizedAccounts.json | 624 ++++++ .../AuthorizedAccounts_Implementation.json | 702 +++++++ .../porcini-dev/AuthorizedAccounts_Proxy.json | 235 +++ .../porcini-dev/DefaultProxyAdmin.json | 259 +++ deployments/porcini-dev/Directory.json | 701 +++++++ .../porcini-dev/Directory_Implementation.json | 849 ++++++++ deployments/porcini-dev/Directory_Proxy.json | 235 +++ deployments/porcini-dev/EpochsManager.json | 945 +++++++++ .../EpochsManager_Implementation.json | 1137 +++++++++++ .../porcini-dev/EpochsManager_Proxy.json | 235 +++ deployments/porcini-dev/Registries.json | 758 +++++++ .../Registries_Implementation.json | 893 ++++++++ deployments/porcini-dev/Registries_Proxy.json | 235 +++ deployments/porcini-dev/RewardsManager.json | 1048 ++++++++++ .../RewardsManager_Implementation.json | 1393 +++++++++++++ .../porcini-dev/RewardsManager_Proxy.json | 235 +++ .../porcini-dev/SeekerPowerOracle.json | 540 +++++ .../SeekerPowerOracle_Implementation.json | 553 +++++ .../porcini-dev/SeekerPowerOracle_Proxy.json | 235 +++ deployments/porcini-dev/StakingManager.json | 991 +++++++++ .../StakingManager_Implementation.json | 1280 ++++++++++++ .../porcini-dev/StakingManager_Proxy.json | 235 +++ deployments/porcini-dev/SyloTicketing.json | 1525 ++++++++++++++ .../SyloTicketing_Implementation.json | 1794 +++++++++++++++++ .../porcini-dev/SyloTicketing_Proxy.json | 235 +++ .../porcini-dev/TicketingParameters.json | 630 ++++++ .../TicketingParameters_Implementation.json | 668 ++++++ .../TicketingParameters_Proxy.json | 235 +++ .../028a55b8eaa1999d8f382c93dbafe26d.json | 179 ++ .../0e89febeebc7444140de8e67c9067d2c.json | 80 + .../4e3bc77852cb55aaa633eb254b5b5cf7.json | 161 ++ .../61c534572f64110305c1d307d9b45348.json | 161 ++ .../76c1e1f3445d6d518cb33f614f9922c9.json | 161 ++ .../porcini-dev_deployment_phase_two.json | 15 + hardhat.config.ts | 24 - 37 files changed, 20167 insertions(+), 28 deletions(-) create mode 100644 deployments/porcini-dev/.chainId create mode 100644 deployments/porcini-dev/AuthorizedAccounts.json create mode 100644 deployments/porcini-dev/AuthorizedAccounts_Implementation.json create mode 100644 deployments/porcini-dev/AuthorizedAccounts_Proxy.json create mode 100644 deployments/porcini-dev/DefaultProxyAdmin.json create mode 100644 deployments/porcini-dev/Directory.json create mode 100644 deployments/porcini-dev/Directory_Implementation.json create mode 100644 deployments/porcini-dev/Directory_Proxy.json create mode 100644 deployments/porcini-dev/EpochsManager.json create mode 100644 deployments/porcini-dev/EpochsManager_Implementation.json create mode 100644 deployments/porcini-dev/EpochsManager_Proxy.json create mode 100644 deployments/porcini-dev/Registries.json create mode 100644 deployments/porcini-dev/Registries_Implementation.json create mode 100644 deployments/porcini-dev/Registries_Proxy.json create mode 100644 deployments/porcini-dev/RewardsManager.json create mode 100644 deployments/porcini-dev/RewardsManager_Implementation.json create mode 100644 deployments/porcini-dev/RewardsManager_Proxy.json create mode 100644 deployments/porcini-dev/SeekerPowerOracle.json create mode 100644 deployments/porcini-dev/SeekerPowerOracle_Implementation.json create mode 100644 deployments/porcini-dev/SeekerPowerOracle_Proxy.json create mode 100644 deployments/porcini-dev/StakingManager.json create mode 100644 deployments/porcini-dev/StakingManager_Implementation.json create mode 100644 deployments/porcini-dev/StakingManager_Proxy.json create mode 100644 deployments/porcini-dev/SyloTicketing.json create mode 100644 deployments/porcini-dev/SyloTicketing_Implementation.json create mode 100644 deployments/porcini-dev/SyloTicketing_Proxy.json create mode 100644 deployments/porcini-dev/TicketingParameters.json create mode 100644 deployments/porcini-dev/TicketingParameters_Implementation.json create mode 100644 deployments/porcini-dev/TicketingParameters_Proxy.json create mode 100644 deployments/porcini-dev/solcInputs/028a55b8eaa1999d8f382c93dbafe26d.json create mode 100644 deployments/porcini-dev/solcInputs/0e89febeebc7444140de8e67c9067d2c.json create mode 100644 deployments/porcini-dev/solcInputs/4e3bc77852cb55aaa633eb254b5b5cf7.json create mode 100644 deployments/porcini-dev/solcInputs/61c534572f64110305c1d307d9b45348.json create mode 100644 deployments/porcini-dev/solcInputs/76c1e1f3445d6d518cb33f614f9922c9.json create mode 100644 deployments/porcini-dev_deployment_phase_two.json diff --git a/deployments/genesis.config.ts b/deployments/genesis.config.ts index 87410965..cc9ca2c1 100644 --- a/deployments/genesis.config.ts +++ b/deployments/genesis.config.ts @@ -140,7 +140,7 @@ const PorciniDevParameters: ContractParameters = { EpochsManager: { initialEpoch: 0, - epochDuration: 17280, // 1 day + epochDuration: 720, // 1 hour }, Registries: { @@ -148,10 +148,10 @@ const PorciniDevParameters: ContractParameters = { }, TicketingParameters: { - faceValue: hre.ethers.parseEther('1000'), - baseLiveWinProb: 2n ** 128n - 1n / 10n, + faceValue: hre.ethers.parseEther('100'), + baseLiveWinProb: (2n ** 128n - 1n) / 10n, // 10% expiredWinProb: 2n ** 128n - 1n, - ticketDuration: 17280, + ticketDuration: 17280, // 1 day decayRate: 80000, }, diff --git a/deployments/porcini-dev/.chainId b/deployments/porcini-dev/.chainId new file mode 100644 index 00000000..f98aa328 --- /dev/null +++ b/deployments/porcini-dev/.chainId @@ -0,0 +1 @@ +7672 \ No newline at end of file diff --git a/deployments/porcini-dev/AuthorizedAccounts.json b/deployments/porcini-dev/AuthorizedAccounts.json new file mode 100644 index 00000000..10e946fe --- /dev/null +++ b/deployments/porcini-dev/AuthorizedAccounts.json @@ -0,0 +1,624 @@ +{ + "address": "0x68eCb081F49690b3453F9a4fFa65c054d74DCFE0", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "inputs": [], + "name": "AccountAlreadyAuthorized", + "type": "error" + }, + { + "inputs": [], + "name": "AccountDoesNotExist", + "type": "error" + }, + { + "inputs": [], + "name": "AtBlockNumberCannotBeZero", + "type": "error" + }, + { + "inputs": [], + "name": "AuthorizedAccountCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "MainAccountCannotBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "main", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "authorized", + "type": "address" + }, + { + "indexed": false, + "internalType": "enum IAuthorizedAccounts.Permission[]", + "name": "permissions", + "type": "uint8[]" + } + ], + "name": "PermissionsAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "main", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "authorized", + "type": "address" + }, + { + "indexed": false, + "internalType": "enum IAuthorizedAccounts.Permission[]", + "name": "permissions", + "type": "uint8[]" + } + ], + "name": "PermissionsRemoved", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "authorized", + "type": "address" + }, + { + "internalType": "enum IAuthorizedAccounts.Permission[]", + "name": "permissions", + "type": "uint8[]" + } + ], + "name": "addPermissions", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "authorized", + "type": "address" + }, + { + "internalType": "enum IAuthorizedAccounts.Permission[]", + "name": "permissions", + "type": "uint8[]" + } + ], + "name": "authorizeAccount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "authorizedAccounts", + "outputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "authorizedAt", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "main", + "type": "address" + } + ], + "name": "getAuthorizedAccounts", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "authorizedAt", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "enum IAuthorizedAccounts.Permission", + "name": "permission", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "authorizedAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "unauthorizedAt", + "type": "uint256" + } + ], + "internalType": "struct IAuthorizedAccounts.AuthorizedPermission[]", + "name": "permissions", + "type": "tuple[]" + } + ], + "internalType": "struct IAuthorizedAccounts.AuthorizedAccount[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "authorized", + "type": "address" + }, + { + "internalType": "enum IAuthorizedAccounts.Permission[]", + "name": "permissions", + "type": "uint8[]" + } + ], + "name": "removePermissions", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "authorized", + "type": "address" + } + ], + "name": "unauthorizeAccount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "main", + "type": "address" + }, + { + "internalType": "address", + "name": "authorized", + "type": "address" + }, + { + "internalType": "enum IAuthorizedAccounts.Permission", + "name": "permission", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "atBlock", + "type": "uint256" + } + ], + "name": "validatePermission", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0x79ad082f9485190159c0ef79a7769cd3a87fcfc7369f10bb4a97d0b30fe9cd49", + "receipt": { + "to": null, + "from": "0x448c8e9e1816300Dd052e77D2A44c990A2807D15", + "contractAddress": "0x68eCb081F49690b3453F9a4fFa65c054d74DCFE0", + "transactionIndex": 0, + "gasUsed": "720430", + "logsBloom": "0x00000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000040000000200000000000000000000000000000000000000000000000000000800000000000000000000002000000000000000000000000000000000000000000000000000000000000800002000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000404000000100000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x59f9bc2d6a4521569136a86a31c2091a341dab04228d6e4f3d0daffd22faea9b", + "transactionHash": "0x79ad082f9485190159c0ef79a7769cd3a87fcfc7369f10bb4a97d0b30fe9cd49", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 10978364, + "transactionHash": "0x79ad082f9485190159c0ef79a7769cd3a87fcfc7369f10bb4a97d0b30fe9cd49", + "address": "0x68eCb081F49690b3453F9a4fFa65c054d74DCFE0", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x00000000000000000000000043c04bf00bc19d91561e2146597a7fb23642fa25" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0x59f9bc2d6a4521569136a86a31c2091a341dab04228d6e4f3d0daffd22faea9b" + }, + { + "transactionIndex": 0, + "blockNumber": 10978364, + "transactionHash": "0x79ad082f9485190159c0ef79a7769cd3a87fcfc7369f10bb4a97d0b30fe9cd49", + "address": "0x68eCb081F49690b3453F9a4fFa65c054d74DCFE0", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f06d5edb04f4995fff2c362a14826107f7cccbcc", + "logIndex": 1, + "blockHash": "0x59f9bc2d6a4521569136a86a31c2091a341dab04228d6e4f3d0daffd22faea9b" + } + ], + "blockNumber": 10978364, + "cumulativeGasUsed": "720430", + "status": 1, + "byzantium": true + }, + "args": [ + "0x43c04BF00bc19d91561e2146597a7Fb23642fa25", + "0xf06d5Edb04F4995FFF2c362a14826107F7CCCBCc", + "0x" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\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\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.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 *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\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 Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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 Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual 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 Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\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(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\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(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) 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\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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 overriden 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 internall 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 overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/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\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\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 * ```\\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`, and `uint256`._\\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 /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\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 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 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 assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "implementation": "0x43c04BF00bc19d91561e2146597a7Fb23642fa25", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/porcini-dev/AuthorizedAccounts_Implementation.json b/deployments/porcini-dev/AuthorizedAccounts_Implementation.json new file mode 100644 index 00000000..0d8316ad --- /dev/null +++ b/deployments/porcini-dev/AuthorizedAccounts_Implementation.json @@ -0,0 +1,702 @@ +{ + "address": "0x43c04BF00bc19d91561e2146597a7Fb23642fa25", + "abi": [ + { + "inputs": [], + "name": "AccountAlreadyAuthorized", + "type": "error" + }, + { + "inputs": [], + "name": "AccountDoesNotExist", + "type": "error" + }, + { + "inputs": [], + "name": "AtBlockNumberCannotBeZero", + "type": "error" + }, + { + "inputs": [], + "name": "AuthorizedAccountCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "MainAccountCannotBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "main", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "authorized", + "type": "address" + }, + { + "indexed": false, + "internalType": "enum IAuthorizedAccounts.Permission[]", + "name": "permissions", + "type": "uint8[]" + } + ], + "name": "PermissionsAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "main", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "authorized", + "type": "address" + }, + { + "indexed": false, + "internalType": "enum IAuthorizedAccounts.Permission[]", + "name": "permissions", + "type": "uint8[]" + } + ], + "name": "PermissionsRemoved", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "authorized", + "type": "address" + }, + { + "internalType": "enum IAuthorizedAccounts.Permission[]", + "name": "permissions", + "type": "uint8[]" + } + ], + "name": "addPermissions", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "authorized", + "type": "address" + }, + { + "internalType": "enum IAuthorizedAccounts.Permission[]", + "name": "permissions", + "type": "uint8[]" + } + ], + "name": "authorizeAccount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "authorizedAccounts", + "outputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "authorizedAt", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "main", + "type": "address" + } + ], + "name": "getAuthorizedAccounts", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "authorizedAt", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "enum IAuthorizedAccounts.Permission", + "name": "permission", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "authorizedAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "unauthorizedAt", + "type": "uint256" + } + ], + "internalType": "struct IAuthorizedAccounts.AuthorizedPermission[]", + "name": "permissions", + "type": "tuple[]" + } + ], + "internalType": "struct IAuthorizedAccounts.AuthorizedAccount[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "authorized", + "type": "address" + }, + { + "internalType": "enum IAuthorizedAccounts.Permission[]", + "name": "permissions", + "type": "uint8[]" + } + ], + "name": "removePermissions", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "authorized", + "type": "address" + } + ], + "name": "unauthorizeAccount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "main", + "type": "address" + }, + { + "internalType": "address", + "name": "authorized", + "type": "address" + }, + { + "internalType": "enum IAuthorizedAccounts.Permission", + "name": "permission", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "atBlock", + "type": "uint256" + } + ], + "name": "validatePermission", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x50609135b191d56020d3fb63afd2c9930fd46c28290720b4daeb8b7ba2aaf46d", + "receipt": { + "to": null, + "from": "0x448c8e9e1816300Dd052e77D2A44c990A2807D15", + "contractAddress": "0x43c04BF00bc19d91561e2146597a7Fb23642fa25", + "transactionIndex": 0, + "gasUsed": "1234582", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x756bff33b27c2d50db5723c7a87f5a384628a232cb1d7096e5bb43be118d3d9c", + "transactionHash": "0x50609135b191d56020d3fb63afd2c9930fd46c28290720b4daeb8b7ba2aaf46d", + "logs": [], + "blockNumber": 10978363, + "cumulativeGasUsed": "1234582", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "028a55b8eaa1999d8f382c93dbafe26d", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"AccountAlreadyAuthorized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AccountDoesNotExist\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AtBlockNumberCannotBeZero\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AuthorizedAccountCannotBeZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MainAccountCannotBeZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"main\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"authorized\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"enum IAuthorizedAccounts.Permission[]\",\"name\":\"permissions\",\"type\":\"uint8[]\"}],\"name\":\"PermissionsAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"main\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"authorized\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"enum IAuthorizedAccounts.Permission[]\",\"name\":\"permissions\",\"type\":\"uint8[]\"}],\"name\":\"PermissionsRemoved\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"authorized\",\"type\":\"address\"},{\"internalType\":\"enum IAuthorizedAccounts.Permission[]\",\"name\":\"permissions\",\"type\":\"uint8[]\"}],\"name\":\"addPermissions\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"authorized\",\"type\":\"address\"},{\"internalType\":\"enum IAuthorizedAccounts.Permission[]\",\"name\":\"permissions\",\"type\":\"uint8[]\"}],\"name\":\"authorizeAccount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"authorizedAccounts\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"authorizedAt\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"main\",\"type\":\"address\"}],\"name\":\"getAuthorizedAccounts\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"authorizedAt\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"enum IAuthorizedAccounts.Permission\",\"name\":\"permission\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"authorizedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unauthorizedAt\",\"type\":\"uint256\"}],\"internalType\":\"struct IAuthorizedAccounts.AuthorizedPermission[]\",\"name\":\"permissions\",\"type\":\"tuple[]\"}],\"internalType\":\"struct IAuthorizedAccounts.AuthorizedAccount[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"authorized\",\"type\":\"address\"},{\"internalType\":\"enum IAuthorizedAccounts.Permission[]\",\"name\":\"permissions\",\"type\":\"uint8[]\"}],\"name\":\"removePermissions\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"authorized\",\"type\":\"address\"}],\"name\":\"unauthorizeAccount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"main\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"authorized\",\"type\":\"address\"},{\"internalType\":\"enum IAuthorizedAccounts.Permission\",\"name\":\"permission\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"atBlock\",\"type\":\"uint256\"}],\"name\":\"validatePermission\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"addPermissions(address,uint8[])\":{\"params\":{\"authorized\":\"The authorized account address\",\"permissions\":\"The new permissions will be added to the authorized account\"}},\"authorizeAccount(address,uint8[])\":{\"params\":{\"authorized\":\"The address that the main account wants to authorize\",\"permissions\":\"The list of permissions that the authorized account can perform within the Sylo network.\"}},\"getAuthorizedAccounts(address)\":{\"params\":{\"main\":\"The address of main account\"},\"returns\":{\"_0\":\"An array of authorized accounts\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"removePermissions(address,uint8[])\":{\"params\":{\"authorized\":\"The address of authorized account\",\"permissions\":\"The list of permissions will be removed\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"},\"unauthorizeAccount(address)\":{\"params\":{\"authorized\":\"The address of the authorized account\"}},\"validatePermission(address,address,uint8,uint256)\":{\"params\":{\"atBlock\":\"The block number to check if the permission is valid between the permission's authorizedAt and unauthorizedAt period. It is added later to prevent the timing attack. E.g. If the main account authorizes the PersonalSign permission at block 1, creates a ticket at block 2, then unauthorizes the permission at block 3, the ticket will be invalid and cannot be redeemed. To avoid this, the `atBlock` param is needed to check if the permission is authorized between its authorizedAt and unauthorizedAt duration.\",\"authorized\":\"The address of authorized account\",\"main\":\"The address of main account\",\"permission\":\"The permission needs to be verified with the authorized account\"},\"returns\":{\"_0\":\"boolean value\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"addPermissions(address,uint8[])\":{\"notice\":\"Adds new permissions to a specific authorized account. - Adding permissions that don't exist in the Permission enum will return with panic code 0x21 (convert a value that is too big or negative into an enum type). - Adding duplicate permissions will update the permissions' authorizedAt value. - Adding permissions that were previously unauthorized will update the authorizedAt and unauthorizedAt values (refer to the comment in IAuthorizedAccount -> AuthorizedPermission struct). This will revert if the account does not exist.\"},\"authorizeAccount(address,uint8[])\":{\"notice\":\"Adds new authorized accounts with certain permissions. This will revert if the account has already existed.\"},\"authorizedAccounts(address,uint256)\":{\"notice\":\"Tracks authorized accounts for every main account\"},\"getAuthorizedAccounts(address)\":{\"notice\":\"Get all authorized accounts associated with a given account\"},\"removePermissions(address,uint8[])\":{\"notice\":\"Removes permissions of specific authorized account. - Removing permissions that don't exist in the Permission enum will return with panic code 0x21 (convert a value that is too big or negative into an enum type). - Removing duplicate/authorized permissions will update the permissions' unauthorizedAt value. This will revert if the account does not exist.\"},\"supportsInterface(bytes4)\":{\"notice\":\"Returns true if the contract implements the interface defined by `interfaceId` from ERC165.\"},\"unauthorizeAccount(address)\":{\"notice\":\"Removes all permissions of a specific authorized account associated with the msg.sender, and sets the account's authorizedAt to 0. Note: It does not remove the authorized account from the list. This will revert if the account does not exist.\"},\"validatePermission(address,address,uint8,uint256)\":{\"notice\":\"Validates permission of an authorized account associated with the main account.\"}},\"notice\":\"Manages authorized accounts with limited permissions on behalf of main account these authorized accounts are allowed to perform some certain actions in the Sylo network in order to reduce the works for main account\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/AuthorizedAccounts.sol\":\"AuthorizedAccounts\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./OwnableUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership} and {acceptOwnership}.\\n *\\n * This module is used through inheritance. It will make available all functions\\n * from parent (Ownable).\\n */\\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\\n function __Ownable2Step_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable2Step_init_unchained() internal onlyInitializing {\\n }\\n address private _pendingOwner;\\n\\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Returns the address of the pending owner.\\n */\\n function pendingOwner() public view virtual returns (address) {\\n return _pendingOwner;\\n }\\n\\n /**\\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual override onlyOwner {\\n _pendingOwner = newOwner;\\n emit OwnershipTransferStarted(owner(), newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual override {\\n delete _pendingOwner;\\n super._transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev The new owner accepts the ownership transfer.\\n */\\n function acceptOwnership() public virtual {\\n address sender = _msgSender();\\n require(pendingOwner() == sender, \\\"Ownable2Step: caller is not the new owner\\\");\\n _transferOwnership(sender);\\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\":\"0x84efb8889801b0ac817324aff6acc691d07bbee816b671817132911d287a8c63\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n\\n /**\\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\":\"0x4075622496acc77fd6d4de4cc30a8577a744d5c75afad33fdeacf1704d6eda98\",\"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/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/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/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/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\"},\"contracts/AuthorizedAccounts.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\n\\nimport \\\"./interfaces/IAuthorizedAccounts.sol\\\";\\n\\n/**\\n * @notice Manages authorized accounts with limited permissions on behalf of main account\\n * these authorized accounts are allowed to perform some certain actions in the Sylo network\\n * in order to reduce the works for main account\\n */\\ncontract AuthorizedAccounts is\\n IAuthorizedAccounts,\\n Initializable,\\n Ownable2StepUpgradeable,\\n ERC165\\n{\\n /**\\n * @notice Tracks authorized accounts for every main account\\n */\\n mapping(address => AuthorizedAccount[]) public authorizedAccounts;\\n\\n event PermissionsAdded(\\n address indexed main,\\n address indexed authorized,\\n Permission[] permissions\\n );\\n\\n event PermissionsRemoved(\\n address indexed main,\\n address indexed authorized,\\n Permission[] permissions\\n );\\n\\n error AuthorizedAccountCannotBeZeroAddress();\\n error MainAccountCannotBeZeroAddress();\\n error AtBlockNumberCannotBeZero();\\n error AccountAlreadyAuthorized();\\n error AccountDoesNotExist();\\n\\n function initialize() external initializer {\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAuthorizedAccounts).interfaceId;\\n }\\n\\n /**\\n * @notice Adds new authorized accounts with certain permissions.\\n * This will revert if the account has already existed.\\n * @param authorized The address that the main account wants to authorize\\n * @param permissions The list of permissions that the authorized account\\n * can perform within the Sylo network.\\n */\\n function authorizeAccount(address authorized, Permission[] calldata permissions) external {\\n if (authorized == address(0)) {\\n revert AuthorizedAccountCannotBeZeroAddress();\\n }\\n\\n // check if account has already been authorized\\n AuthorizedAccount[] storage authAccounts = authorizedAccounts[msg.sender];\\n for (uint i; i < authAccounts.length; ++i) {\\n if (authAccounts[i].account == authorized) {\\n if (authAccounts[i].authorizedAt != 0) {\\n revert AccountAlreadyAuthorized();\\n }\\n\\n authAccounts[i].authorizedAt = block.number;\\n return _addPermissions(authorized, authAccounts[i], permissions);\\n }\\n }\\n\\n // add new authorized account to the list\\n authAccounts.push();\\n AuthorizedAccount storage newAccount = authAccounts[authAccounts.length - 1];\\n newAccount.account = authorized;\\n newAccount.authorizedAt = block.number;\\n\\n _addPermissions(authorized, newAccount, permissions);\\n }\\n\\n /**\\n * @notice Removes all permissions of a specific authorized account\\n * associated with the msg.sender, and sets the account's authorizedAt to 0.\\n * Note: It does not remove the authorized account from the list.\\n * This will revert if the account does not exist.\\n * @param authorized The address of the authorized account\\n */\\n function unauthorizeAccount(address authorized) external {\\n if (authorized == address(0)) {\\n revert AuthorizedAccountCannotBeZeroAddress();\\n }\\n\\n AuthorizedAccount[] storage authAccounts = authorizedAccounts[msg.sender];\\n for (uint i; i < authAccounts.length; ++i) {\\n if (authAccounts[i].account == authorized) {\\n delete authAccounts[i].authorizedAt;\\n return _removePermissions(authorized, authAccounts[i], getAllPermissions());\\n }\\n }\\n\\n revert AccountDoesNotExist();\\n }\\n\\n /**\\n * @notice Adds new permissions to a specific authorized account.\\n * - Adding permissions that don't exist in the Permission enum will return\\n * with panic code 0x21 (convert a value that is too big or negative into an enum type).\\n * - Adding duplicate permissions will update the permissions' authorizedAt value.\\n * - Adding permissions that were previously unauthorized will update\\n * the authorizedAt and unauthorizedAt values (refer to the comment in\\n * IAuthorizedAccount -> AuthorizedPermission struct).\\n * This will revert if the account does not exist.\\n * @param authorized The authorized account address\\n * @param permissions The new permissions will be added to the authorized account\\n */\\n function addPermissions(address authorized, Permission[] calldata permissions) external {\\n if (authorized == address(0)) {\\n revert AuthorizedAccountCannotBeZeroAddress();\\n }\\n\\n AuthorizedAccount[] storage authAccounts = authorizedAccounts[msg.sender];\\n for (uint i; i < authAccounts.length; ++i) {\\n if (authAccounts[i].account == authorized) {\\n return _addPermissions(authorized, authAccounts[i], permissions);\\n }\\n }\\n\\n revert AccountDoesNotExist();\\n }\\n\\n function _addPermissions(\\n address authorized,\\n AuthorizedAccount storage authAccount,\\n Permission[] memory permissions\\n ) private {\\n for (uint i; i < permissions.length; ++i) {\\n bool exists;\\n for (uint j; j < authAccount.permissions.length; ++j) {\\n AuthorizedPermission storage authPermission = authAccount.permissions[j];\\n if (permissions[i] == authPermission.permission) {\\n exists = true;\\n authPermission.authorizedAt = block.number;\\n\\n // make sure unauthorizedAt is not greater than authorizedAt\\n // (refer to the comment in IAuthorizedAccount -> AuthorizedPermission struct)\\n if (authPermission.unauthorizedAt > authPermission.authorizedAt) {\\n authPermission.unauthorizedAt = authPermission.authorizedAt;\\n }\\n break;\\n }\\n }\\n if (!exists) {\\n authAccount.permissions.push(\\n AuthorizedPermission({\\n permission: permissions[i],\\n authorizedAt: block.number,\\n unauthorizedAt: 0\\n })\\n );\\n }\\n }\\n\\n emit PermissionsAdded(msg.sender, authorized, permissions);\\n }\\n\\n /**\\n * @notice Removes permissions of specific authorized account.\\n * - Removing permissions that don't exist in the Permission enum will return\\n * with panic code 0x21 (convert a value that is too big or negative into an enum type).\\n * - Removing duplicate/authorized permissions will update the permissions'\\n * unauthorizedAt value.\\n * This will revert if the account does not exist.\\n * @param authorized The address of authorized account\\n * @param permissions The list of permissions will be removed\\n */\\n function removePermissions(address authorized, Permission[] calldata permissions) external {\\n if (authorized == address(0)) {\\n revert AuthorizedAccountCannotBeZeroAddress();\\n }\\n\\n AuthorizedAccount[] storage authAccounts = authorizedAccounts[msg.sender];\\n for (uint i; i < authAccounts.length; ++i) {\\n if (authAccounts[i].account == authorized) {\\n return _removePermissions(authorized, authAccounts[i], permissions);\\n }\\n }\\n\\n revert AccountDoesNotExist();\\n }\\n\\n function _removePermissions(\\n address authorized,\\n AuthorizedAccount storage authAccount,\\n Permission[] memory permissions\\n ) private {\\n for (uint i; i < permissions.length; ++i) {\\n for (uint j; j < authAccount.permissions.length; ++j) {\\n if (permissions[i] == authAccount.permissions[j].permission) {\\n // only update unauthorizedAt if the permission is authorized\\n if (\\n authAccount.permissions[j].authorizedAt >=\\n authAccount.permissions[j].unauthorizedAt\\n ) {\\n authAccount.permissions[j].unauthorizedAt = block.number + 1;\\n }\\n break;\\n }\\n }\\n }\\n\\n emit PermissionsRemoved(msg.sender, authorized, permissions);\\n }\\n\\n /**\\n * @notice Validates permission of an authorized account associated with the main account.\\n *\\n * @param main The address of main account\\n * @param authorized The address of authorized account\\n * @param permission The permission needs to be verified with the authorized account\\n * @param atBlock The block number to check if the permission is valid between\\n * the permission's authorizedAt and unauthorizedAt period. It is added later to prevent\\n * the timing attack. E.g. If the main account authorizes the PersonalSign permission at\\n * block 1, creates a ticket at block 2, then unauthorizes the permission at block 3, the\\n * ticket will be invalid and cannot be redeemed. To avoid this, the `atBlock` param is\\n * needed to check if the permission is authorized between its authorizedAt and unauthorizedAt\\n * duration.\\n *\\n * @return boolean value\\n */\\n function validatePermission(\\n address main,\\n address authorized,\\n Permission permission,\\n uint256 atBlock\\n ) external view returns (bool) {\\n if (main == address(0)) {\\n revert MainAccountCannotBeZeroAddress();\\n }\\n\\n if (authorized == address(0)) {\\n revert AuthorizedAccountCannotBeZeroAddress();\\n }\\n\\n if (atBlock == 0) {\\n revert AtBlockNumberCannotBeZero();\\n }\\n\\n AuthorizedAccount[] storage authAccounts = authorizedAccounts[main];\\n\\n for (uint i = 0; i < authAccounts.length; ++i) {\\n if (authAccounts[i].account == authorized) {\\n for (uint j = 0; j < authAccounts[i].permissions.length; ++j) {\\n if (authAccounts[i].permissions[j].permission == permission) {\\n uint256 authorizedAt = authAccounts[i].permissions[j].authorizedAt;\\n uint256 unauthorizedAt = authAccounts[i].permissions[j].unauthorizedAt;\\n\\n bool isPermissionUnauthorized = authorizedAt > 0 &&\\n authorizedAt < unauthorizedAt;\\n if (isPermissionUnauthorized) {\\n // the permission was previously valid, so we check that\\n // the `atBlock` is referencing a time when the permission was valid\\n return authorizedAt <= atBlock && atBlock < unauthorizedAt;\\n }\\n\\n // otherwise just check if the permission was authorized before the\\n // atBlock\\n return authorizedAt > 0 && authorizedAt <= atBlock;\\n }\\n }\\n }\\n }\\n\\n return false;\\n }\\n\\n /**\\n * @notice Get all authorized accounts associated with a given account\\n * @param main The address of main account\\n * @return An array of authorized accounts\\n */\\n function getAuthorizedAccounts(\\n address main\\n ) external view returns (AuthorizedAccount[] memory) {\\n if (main == address(0)) {\\n revert MainAccountCannotBeZeroAddress();\\n }\\n\\n return authorizedAccounts[main];\\n }\\n\\n function getAllPermissions() internal pure returns (Permission[] memory) {\\n Permission[] memory permissions = new Permission[](1);\\n permissions[0] = Permission.PersonalSign;\\n return permissions;\\n }\\n}\\n\",\"keccak256\":\"0x9e248094e7c8256f520ffa7eee09af4715fafa6fe94de35a8532752932fa0bdd\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/IAuthorizedAccounts.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface IAuthorizedAccounts {\\n enum Permission {\\n // PersonalSign permission allows the authorized account to\\n // sign on behalf of the sending account.\\n PersonalSign\\n }\\n\\n /**\\n * @dev This type will hold the permission type and the block number from\\n * which the permission was set to be authorized and unauthorized.\\n * The permission is authorized when authorizedAt >= unauthorizedAt.\\n *\\n * Note: authorizedAt and unauthorizedAt won't be set to 0 when the permission\\n * is updated, because they are both needed when validating the permission.\\n */\\n struct AuthorizedPermission {\\n // Permission type\\n Permission permission;\\n // Block number from which the permission was set to be authorized.\\n // If the transaction is called in block 1, the permission is\\n // authorized from block 1 (authorizedAt = block.number).\\n uint256 authorizedAt;\\n // Block number from which the permission was set to be unauthorized.\\n // If the transaction is called in block 1, the permission is\\n // unauthorized from block 2 (unauthorizedAt = block.number + 1)\\n // unauthorizedAt is set that way to avoid the case where the\\n // permission is authorized and unauthorized in the same block:\\n // E.g. addPermission is called => authorizedAt = 1\\n // removePermission is called => unauthorizedAt = 1\\n // => We cannot tell if the permission is authorized or not.\\n // E.g. addPermission is called => authorizedAt = 1\\n // removePermission is called => unauthorizedAt = 2\\n // addPermission is called => authorizedAt = 1 AND update unauthorizedAt = authorizedAt = 1\\n // => The permission is authorized when authorizedAt >= unauthorizedAt\\n uint256 unauthorizedAt;\\n }\\n\\n struct AuthorizedAccount {\\n // The authorized account\\n address account;\\n // Block number at which the account was authorized.\\n // If the transaction is called in block 1, the account is\\n // authorized at block 1 (authorizedAt = block.number).\\n // If the account is unauthorized, authorizedAt will be set to 0.\\n uint256 authorizedAt;\\n // Permission list\\n AuthorizedPermission[] permissions;\\n }\\n\\n function authorizeAccount(address authorized, Permission[] calldata permissions) external;\\n\\n function unauthorizeAccount(address authorized) external;\\n\\n function addPermissions(address authorized, Permission[] calldata permissions) external;\\n\\n function removePermissions(\\n address authorized,\\n Permission[] calldata permissionsToRemove\\n ) external;\\n\\n function validatePermission(\\n address main,\\n address authorized,\\n Permission permission,\\n uint256 atBlock\\n ) external returns (bool);\\n\\n function getAuthorizedAccounts(\\n address main\\n ) external view returns (AuthorizedAccount[] memory);\\n}\\n\",\"keccak256\":\"0xebc98a4d5ed21face8bf0ef8ba07693b82ca89c81d52eb4f2adc5e99c94d7b30\",\"license\":\"Apache-2.0\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061155f806100206000396000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c80638129fc1c1161008c578063b0b2a57511610066578063b0b2a575146101f2578063c346893b14610205578063e30c397814610218578063f2fde38b1461022957600080fd5b80638129fc1c146101b25780638da5cb5b146101ba57806395c4300b146101df57600080fd5b80636f3201c9116100c85780636f3201c91461016f578063715018a6146101825780637408d09c1461018a57806379ba5097146101aa57600080fd5b806301ffc9a7146100ef578063229c86d4146101285780633a8565151461013d575b600080fd5b6101136100fd3660046111b5565b6001600160e01b0319166337e592f160e21b1490565b60405190151581526020015b60405180910390f35b61013b610136366004611202565b61023c565b005b61015061014b366004611288565b610346565b604080516001600160a01b03909316835260208301919091520161011f565b61013b61017d366004611202565b61038c565b61013b610475565b61019d6101983660046112b2565b610489565b60405161011f9190611305565b61013b6105d1565b61013b610650565b6033546001600160a01b03165b6040516001600160a01b03909116815260200161011f565b61013b6101ed366004611202565b610760565b61013b6102003660046112b2565b61090d565b6101136102133660046113d1565b6109f6565b6065546001600160a01b03166101c7565b61013b6102373660046112b2565b610c75565b6001600160a01b0383166102635760405163055a500d60e51b815260040160405180910390fd5b336000908152609760205260408120905b815481101561032c57846001600160a01b031682828154811061029957610299611422565b60009182526020909120600390910201546001600160a01b03160361031c57610315858383815481106102ce576102ce611422565b9060005260206000209060030201868680806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250610ce692505050565b5050505050565b6103258161144e565b9050610274565b5060405163e76ea87f60e01b815260040160405180910390fd5b6097602052816000526040600020818154811061036257600080fd5b6000918252602090912060039091020180546001909101546001600160a01b039091169250905082565b6001600160a01b0383166103b35760405163055a500d60e51b815260040160405180910390fd5b336000908152609760205260408120905b815481101561032c57846001600160a01b03168282815481106103e9576103e9611422565b60009182526020909120600390910201546001600160a01b031603610465576103158583838154811061041e5761041e611422565b9060005260206000209060030201868680806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250610eb092505050565b61046e8161144e565b90506103c4565b61047d611025565b610487600061107f565b565b60606001600160a01b0382166104b2576040516359d55b9160e11b815260040160405180910390fd5b6001600160a01b038216600090815260976020908152604080832080548251818502810185019093528083529193909284015b828210156105c65760008481526020808220604080516060810182526003870290920180546001600160a01b0316835260018101548385015260028101805483518187028101870185528181529496929593870194939192909184015b828210156105af576000848152602090206040805160608101909152600384029091018054829060ff16801561057a5761057a6112cd565b8015610588576105886112cd565b81526020016001820154815260200160028201548152505081526020019060010190610542565b5050505081525050815260200190600101906104e5565b505050509050919050565b60655433906001600160a01b031681146106445760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b61064d8161107f565b50565b600054610100900460ff16158080156106705750600054600160ff909116105b8061068a5750303b15801561068a575060005460ff166001145b6106ed5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161063b565b6000805460ff191660011790558015610710576000805461ff0019166101001790555b610718611098565b801561064d576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b6001600160a01b0383166107875760405163055a500d60e51b815260040160405180910390fd5b336000908152609760205260408120905b815481101561086e57846001600160a01b03168282815481106107bd576107bd611422565b60009182526020909120600390910201546001600160a01b03160361085e578181815481106107ee576107ee611422565b9060005260206000209060030201600101546000146108205760405163174191c160e11b815260040160405180910390fd5b4382828154811061083357610833611422565b906000526020600020906003020160010181905550610315858383815481106102ce576102ce611422565b6108678161144e565b9050610798565b5080546001908101808355600083815291839161088b9190611467565b8154811061089b5761089b611422565b60009182526020918290206003919091020180546001600160a01b0319166001600160a01b0388161781554360018201556040805186840280820185019092528681529193506103159288928592909189918991829190850190849080828437600092019190915250610ce692505050565b6001600160a01b0381166109345760405163055a500d60e51b815260040160405180910390fd5b336000908152609760205260408120905b815481101561032c57826001600160a01b031682828154811061096a5761096a611422565b60009182526020909120600390910201546001600160a01b0316036109e65781818154811061099b5761099b611422565b9060005260206000209060030201600101600090556109e1838383815481106109c6576109c6611422565b90600052602060002090600302016109dc6110c7565b610eb0565b505050565b6109ef8161144e565b9050610945565b60006001600160a01b038516610a1f576040516359d55b9160e11b815260040160405180910390fd5b6001600160a01b038416610a465760405163055a500d60e51b815260040160405180910390fd5b81600003610a675760405163a5d0c24760e01b815260040160405180910390fd5b6001600160a01b0385166000908152609760205260408120905b8154811015610c6657856001600160a01b0316828281548110610aa657610aa6611422565b60009182526020909120600390910201546001600160a01b031603610c565760005b828281548110610ada57610ada611422565b906000526020600020906003020160020180549050811015610c5457858015610b0557610b056112cd565b838381548110610b1757610b17611422565b90600052602060002090600302016002018281548110610b3957610b39611422565b600091825260209091206003909102015460ff168015610b5b57610b5b6112cd565b03610c44576000838381548110610b7457610b74611422565b90600052602060002090600302016002018281548110610b9657610b96611422565b90600052602060002090600302016001015490506000848481548110610bbe57610bbe611422565b90600052602060002090600302016002018381548110610be057610be0611422565b906000526020600020906003020160020154905060008083118015610c0457508183105b90508015610c2857878311158015610c1b57508188105b9650505050505050610c6d565b600083118015610c1b5750878311159650505050505050610c6d565b610c4d8161144e565b9050610ac8565b505b610c5f8161144e565b9050610a81565b5060009150505b949350505050565b610c7d611025565b606580546001600160a01b0383166001600160a01b03199091168117909155610cae6033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b60005b8151811015610e5f576000805b6002850154811015610da8576000856002018281548110610d1957610d19611422565b60009182526020909120600390910201805490915060ff168015610d3f57610d3f6112cd565b858581518110610d5157610d51611422565b60200260200101516000811115610d6a57610d6a6112cd565b03610d975743600182810182905560028301549094501115610d9157600181015460028201555b50610da8565b50610da18161144e565b9050610cf6565b5080610e4e57836002016040518060600160405280858581518110610dcf57610dcf611422565b60200260200101516000811115610de857610de86112cd565b8152436020808301919091526000604090920182905283546001818101865594835291208251600390920201805492939092839160ff1990911690838015610e3257610e326112cd565b0217905550602082015181600101556040820151816002015550505b50610e588161144e565b9050610ce9565b50826001600160a01b0316336001600160a01b03167f1a8c453bd4f4c60416befb32fbbae6c3feb80694214263b26e60888e4bbb58c883604051610ea39190611480565b60405180910390a3505050565b60005b8151811015610fe15760005b6002840154811015610fd057836002018181548110610ee057610ee0611422565b600091825260209091206003909102015460ff168015610f0257610f026112cd565b838381518110610f1457610f14611422565b60200260200101516000811115610f2d57610f2d6112cd565b03610fc057836002018181548110610f4757610f47611422565b906000526020600020906003020160020154846002018281548110610f6e57610f6e611422565b90600052602060002090600302016001015410610fbb57610f904360016114cb565b846002018281548110610fa557610fa5611422565b9060005260206000209060030201600201819055505b610fd0565b610fc98161144e565b9050610ebf565b50610fda8161144e565b9050610eb3565b50826001600160a01b0316336001600160a01b03167f91a6ec4bca1e3b215c3597813fbbd8a0b7348750ffc7e57e0891754c8338f69083604051610ea39190611480565b6033546001600160a01b031633146104875760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161063b565b606580546001600160a01b031916905561064d81611133565b600054610100900460ff166110bf5760405162461bcd60e51b815260040161063b906114de565b610487611185565b604080516001808252818301909252606091600091906020808301908036833701905050905060008160008151811061110257611102611422565b6020026020010190600081111561111b5761111b6112cd565b9081801561112b5761112b6112cd565b905250919050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166111ac5760405162461bcd60e51b815260040161063b906114de565b6104873361107f565b6000602082840312156111c757600080fd5b81356001600160e01b0319811681146111df57600080fd5b9392505050565b80356001600160a01b03811681146111fd57600080fd5b919050565b60008060006040848603121561121757600080fd5b611220846111e6565b9250602084013567ffffffffffffffff8082111561123d57600080fd5b818601915086601f83011261125157600080fd5b81358181111561126057600080fd5b8760208260051b850101111561127557600080fd5b6020830194508093505050509250925092565b6000806040838503121561129b57600080fd5b6112a4836111e6565b946020939093013593505050565b6000602082840312156112c457600080fd5b6111df826111e6565b634e487b7160e01b600052602160045260246000fd5b6001811061130157634e487b7160e01b600052602160045260246000fd5b9052565b60006020808301818452808551808352604092508286019150828160051b8701018488016000805b848110156113c257898403603f19018652825180516001600160a01b03168552888101518986015287015160608886018190528151818701819052918a0191849060808801905b808310156113ac5784516113898382516112e3565b808e0151838f01528c01518c830152938c01936001929092019190830190611374565b50988b019896505050928801925060010161132d565b50919998505050505050505050565b600080600080608085870312156113e757600080fd5b6113f0856111e6565b93506113fe602086016111e6565b925060408501356001811061141257600080fd5b9396929550929360600135925050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820161146057611460611438565b5060010190565b8181038181111561147a5761147a611438565b92915050565b6020808252825182820181905260009190848201906040850190845b818110156114bf576114af8385516112e3565b928401929184019160010161149c565b50909695505050505050565b8082018082111561147a5761147a611438565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea26469706673582212208bf2d5355edd479e2abfd98be000006952063cf35e87b64b985488c8e98dd84764736f6c63430008120033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c80638129fc1c1161008c578063b0b2a57511610066578063b0b2a575146101f2578063c346893b14610205578063e30c397814610218578063f2fde38b1461022957600080fd5b80638129fc1c146101b25780638da5cb5b146101ba57806395c4300b146101df57600080fd5b80636f3201c9116100c85780636f3201c91461016f578063715018a6146101825780637408d09c1461018a57806379ba5097146101aa57600080fd5b806301ffc9a7146100ef578063229c86d4146101285780633a8565151461013d575b600080fd5b6101136100fd3660046111b5565b6001600160e01b0319166337e592f160e21b1490565b60405190151581526020015b60405180910390f35b61013b610136366004611202565b61023c565b005b61015061014b366004611288565b610346565b604080516001600160a01b03909316835260208301919091520161011f565b61013b61017d366004611202565b61038c565b61013b610475565b61019d6101983660046112b2565b610489565b60405161011f9190611305565b61013b6105d1565b61013b610650565b6033546001600160a01b03165b6040516001600160a01b03909116815260200161011f565b61013b6101ed366004611202565b610760565b61013b6102003660046112b2565b61090d565b6101136102133660046113d1565b6109f6565b6065546001600160a01b03166101c7565b61013b6102373660046112b2565b610c75565b6001600160a01b0383166102635760405163055a500d60e51b815260040160405180910390fd5b336000908152609760205260408120905b815481101561032c57846001600160a01b031682828154811061029957610299611422565b60009182526020909120600390910201546001600160a01b03160361031c57610315858383815481106102ce576102ce611422565b9060005260206000209060030201868680806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250610ce692505050565b5050505050565b6103258161144e565b9050610274565b5060405163e76ea87f60e01b815260040160405180910390fd5b6097602052816000526040600020818154811061036257600080fd5b6000918252602090912060039091020180546001909101546001600160a01b039091169250905082565b6001600160a01b0383166103b35760405163055a500d60e51b815260040160405180910390fd5b336000908152609760205260408120905b815481101561032c57846001600160a01b03168282815481106103e9576103e9611422565b60009182526020909120600390910201546001600160a01b031603610465576103158583838154811061041e5761041e611422565b9060005260206000209060030201868680806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250610eb092505050565b61046e8161144e565b90506103c4565b61047d611025565b610487600061107f565b565b60606001600160a01b0382166104b2576040516359d55b9160e11b815260040160405180910390fd5b6001600160a01b038216600090815260976020908152604080832080548251818502810185019093528083529193909284015b828210156105c65760008481526020808220604080516060810182526003870290920180546001600160a01b0316835260018101548385015260028101805483518187028101870185528181529496929593870194939192909184015b828210156105af576000848152602090206040805160608101909152600384029091018054829060ff16801561057a5761057a6112cd565b8015610588576105886112cd565b81526020016001820154815260200160028201548152505081526020019060010190610542565b5050505081525050815260200190600101906104e5565b505050509050919050565b60655433906001600160a01b031681146106445760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b61064d8161107f565b50565b600054610100900460ff16158080156106705750600054600160ff909116105b8061068a5750303b15801561068a575060005460ff166001145b6106ed5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161063b565b6000805460ff191660011790558015610710576000805461ff0019166101001790555b610718611098565b801561064d576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b6001600160a01b0383166107875760405163055a500d60e51b815260040160405180910390fd5b336000908152609760205260408120905b815481101561086e57846001600160a01b03168282815481106107bd576107bd611422565b60009182526020909120600390910201546001600160a01b03160361085e578181815481106107ee576107ee611422565b9060005260206000209060030201600101546000146108205760405163174191c160e11b815260040160405180910390fd5b4382828154811061083357610833611422565b906000526020600020906003020160010181905550610315858383815481106102ce576102ce611422565b6108678161144e565b9050610798565b5080546001908101808355600083815291839161088b9190611467565b8154811061089b5761089b611422565b60009182526020918290206003919091020180546001600160a01b0319166001600160a01b0388161781554360018201556040805186840280820185019092528681529193506103159288928592909189918991829190850190849080828437600092019190915250610ce692505050565b6001600160a01b0381166109345760405163055a500d60e51b815260040160405180910390fd5b336000908152609760205260408120905b815481101561032c57826001600160a01b031682828154811061096a5761096a611422565b60009182526020909120600390910201546001600160a01b0316036109e65781818154811061099b5761099b611422565b9060005260206000209060030201600101600090556109e1838383815481106109c6576109c6611422565b90600052602060002090600302016109dc6110c7565b610eb0565b505050565b6109ef8161144e565b9050610945565b60006001600160a01b038516610a1f576040516359d55b9160e11b815260040160405180910390fd5b6001600160a01b038416610a465760405163055a500d60e51b815260040160405180910390fd5b81600003610a675760405163a5d0c24760e01b815260040160405180910390fd5b6001600160a01b0385166000908152609760205260408120905b8154811015610c6657856001600160a01b0316828281548110610aa657610aa6611422565b60009182526020909120600390910201546001600160a01b031603610c565760005b828281548110610ada57610ada611422565b906000526020600020906003020160020180549050811015610c5457858015610b0557610b056112cd565b838381548110610b1757610b17611422565b90600052602060002090600302016002018281548110610b3957610b39611422565b600091825260209091206003909102015460ff168015610b5b57610b5b6112cd565b03610c44576000838381548110610b7457610b74611422565b90600052602060002090600302016002018281548110610b9657610b96611422565b90600052602060002090600302016001015490506000848481548110610bbe57610bbe611422565b90600052602060002090600302016002018381548110610be057610be0611422565b906000526020600020906003020160020154905060008083118015610c0457508183105b90508015610c2857878311158015610c1b57508188105b9650505050505050610c6d565b600083118015610c1b5750878311159650505050505050610c6d565b610c4d8161144e565b9050610ac8565b505b610c5f8161144e565b9050610a81565b5060009150505b949350505050565b610c7d611025565b606580546001600160a01b0383166001600160a01b03199091168117909155610cae6033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b60005b8151811015610e5f576000805b6002850154811015610da8576000856002018281548110610d1957610d19611422565b60009182526020909120600390910201805490915060ff168015610d3f57610d3f6112cd565b858581518110610d5157610d51611422565b60200260200101516000811115610d6a57610d6a6112cd565b03610d975743600182810182905560028301549094501115610d9157600181015460028201555b50610da8565b50610da18161144e565b9050610cf6565b5080610e4e57836002016040518060600160405280858581518110610dcf57610dcf611422565b60200260200101516000811115610de857610de86112cd565b8152436020808301919091526000604090920182905283546001818101865594835291208251600390920201805492939092839160ff1990911690838015610e3257610e326112cd565b0217905550602082015181600101556040820151816002015550505b50610e588161144e565b9050610ce9565b50826001600160a01b0316336001600160a01b03167f1a8c453bd4f4c60416befb32fbbae6c3feb80694214263b26e60888e4bbb58c883604051610ea39190611480565b60405180910390a3505050565b60005b8151811015610fe15760005b6002840154811015610fd057836002018181548110610ee057610ee0611422565b600091825260209091206003909102015460ff168015610f0257610f026112cd565b838381518110610f1457610f14611422565b60200260200101516000811115610f2d57610f2d6112cd565b03610fc057836002018181548110610f4757610f47611422565b906000526020600020906003020160020154846002018281548110610f6e57610f6e611422565b90600052602060002090600302016001015410610fbb57610f904360016114cb565b846002018281548110610fa557610fa5611422565b9060005260206000209060030201600201819055505b610fd0565b610fc98161144e565b9050610ebf565b50610fda8161144e565b9050610eb3565b50826001600160a01b0316336001600160a01b03167f91a6ec4bca1e3b215c3597813fbbd8a0b7348750ffc7e57e0891754c8338f69083604051610ea39190611480565b6033546001600160a01b031633146104875760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161063b565b606580546001600160a01b031916905561064d81611133565b600054610100900460ff166110bf5760405162461bcd60e51b815260040161063b906114de565b610487611185565b604080516001808252818301909252606091600091906020808301908036833701905050905060008160008151811061110257611102611422565b6020026020010190600081111561111b5761111b6112cd565b9081801561112b5761112b6112cd565b905250919050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166111ac5760405162461bcd60e51b815260040161063b906114de565b6104873361107f565b6000602082840312156111c757600080fd5b81356001600160e01b0319811681146111df57600080fd5b9392505050565b80356001600160a01b03811681146111fd57600080fd5b919050565b60008060006040848603121561121757600080fd5b611220846111e6565b9250602084013567ffffffffffffffff8082111561123d57600080fd5b818601915086601f83011261125157600080fd5b81358181111561126057600080fd5b8760208260051b850101111561127557600080fd5b6020830194508093505050509250925092565b6000806040838503121561129b57600080fd5b6112a4836111e6565b946020939093013593505050565b6000602082840312156112c457600080fd5b6111df826111e6565b634e487b7160e01b600052602160045260246000fd5b6001811061130157634e487b7160e01b600052602160045260246000fd5b9052565b60006020808301818452808551808352604092508286019150828160051b8701018488016000805b848110156113c257898403603f19018652825180516001600160a01b03168552888101518986015287015160608886018190528151818701819052918a0191849060808801905b808310156113ac5784516113898382516112e3565b808e0151838f01528c01518c830152938c01936001929092019190830190611374565b50988b019896505050928801925060010161132d565b50919998505050505050505050565b600080600080608085870312156113e757600080fd5b6113f0856111e6565b93506113fe602086016111e6565b925060408501356001811061141257600080fd5b9396929550929360600135925050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820161146057611460611438565b5060010190565b8181038181111561147a5761147a611438565b92915050565b6020808252825182820181905260009190848201906040850190845b818110156114bf576114af8385516112e3565b928401929184019160010161149c565b50909695505050505050565b8082018082111561147a5761147a611438565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea26469706673582212208bf2d5355edd479e2abfd98be000006952063cf35e87b64b985488c8e98dd84764736f6c63430008120033", + "devdoc": { + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "acceptOwnership()": { + "details": "The new owner accepts the ownership transfer." + }, + "addPermissions(address,uint8[])": { + "params": { + "authorized": "The authorized account address", + "permissions": "The new permissions will be added to the authorized account" + } + }, + "authorizeAccount(address,uint8[])": { + "params": { + "authorized": "The address that the main account wants to authorize", + "permissions": "The list of permissions that the authorized account can perform within the Sylo network." + } + }, + "getAuthorizedAccounts(address)": { + "params": { + "main": "The address of main account" + }, + "returns": { + "_0": "An array of authorized accounts" + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pendingOwner()": { + "details": "Returns the address of the pending owner." + }, + "removePermissions(address,uint8[])": { + "params": { + "authorized": "The address of authorized account", + "permissions": "The list of permissions will be removed" + } + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner." + }, + "unauthorizeAccount(address)": { + "params": { + "authorized": "The address of the authorized account" + } + }, + "validatePermission(address,address,uint8,uint256)": { + "params": { + "atBlock": "The block number to check if the permission is valid between the permission's authorizedAt and unauthorizedAt period. It is added later to prevent the timing attack. E.g. If the main account authorizes the PersonalSign permission at block 1, creates a ticket at block 2, then unauthorizes the permission at block 3, the ticket will be invalid and cannot be redeemed. To avoid this, the `atBlock` param is needed to check if the permission is authorized between its authorizedAt and unauthorizedAt duration.", + "authorized": "The address of authorized account", + "main": "The address of main account", + "permission": "The permission needs to be verified with the authorized account" + }, + "returns": { + "_0": "boolean value" + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "addPermissions(address,uint8[])": { + "notice": "Adds new permissions to a specific authorized account. - Adding permissions that don't exist in the Permission enum will return with panic code 0x21 (convert a value that is too big or negative into an enum type). - Adding duplicate permissions will update the permissions' authorizedAt value. - Adding permissions that were previously unauthorized will update the authorizedAt and unauthorizedAt values (refer to the comment in IAuthorizedAccount -> AuthorizedPermission struct). This will revert if the account does not exist." + }, + "authorizeAccount(address,uint8[])": { + "notice": "Adds new authorized accounts with certain permissions. This will revert if the account has already existed." + }, + "authorizedAccounts(address,uint256)": { + "notice": "Tracks authorized accounts for every main account" + }, + "getAuthorizedAccounts(address)": { + "notice": "Get all authorized accounts associated with a given account" + }, + "removePermissions(address,uint8[])": { + "notice": "Removes permissions of specific authorized account. - Removing permissions that don't exist in the Permission enum will return with panic code 0x21 (convert a value that is too big or negative into an enum type). - Removing duplicate/authorized permissions will update the permissions' unauthorizedAt value. This will revert if the account does not exist." + }, + "supportsInterface(bytes4)": { + "notice": "Returns true if the contract implements the interface defined by `interfaceId` from ERC165." + }, + "unauthorizeAccount(address)": { + "notice": "Removes all permissions of a specific authorized account associated with the msg.sender, and sets the account's authorizedAt to 0. Note: It does not remove the authorized account from the list. This will revert if the account does not exist." + }, + "validatePermission(address,address,uint8,uint256)": { + "notice": "Validates permission of an authorized account associated with the main account." + } + }, + "notice": "Manages authorized accounts with limited permissions on behalf of main account these authorized accounts are allowed to perform some certain actions in the Sylo network in order to reduce the works for main account", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 244, + "contract": "contracts/AuthorizedAccounts.sol:AuthorizedAccounts", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 247, + "contract": "contracts/AuthorizedAccounts.sol:AuthorizedAccounts", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 777, + "contract": "contracts/AuthorizedAccounts.sol:AuthorizedAccounts", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 116, + "contract": "contracts/AuthorizedAccounts.sol:AuthorizedAccounts", + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address" + }, + { + "astId": 236, + "contract": "contracts/AuthorizedAccounts.sol:AuthorizedAccounts", + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 25, + "contract": "contracts/AuthorizedAccounts.sol:AuthorizedAccounts", + "label": "_pendingOwner", + "offset": 0, + "slot": "101", + "type": "t_address" + }, + { + "astId": 104, + "contract": "contracts/AuthorizedAccounts.sol:AuthorizedAccounts", + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 9298, + "contract": "contracts/AuthorizedAccounts.sol:AuthorizedAccounts", + "label": "authorizedAccounts", + "offset": 0, + "slot": "151", + "type": "t_mapping(t_address,t_array(t_struct(AuthorizedAccount)11401_storage)dyn_storage)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_struct(AuthorizedAccount)11401_storage)dyn_storage": { + "base": "t_struct(AuthorizedAccount)11401_storage", + "encoding": "dynamic_array", + "label": "struct IAuthorizedAccounts.AuthorizedAccount[]", + "numberOfBytes": "32" + }, + "t_array(t_struct(AuthorizedPermission)11392_storage)dyn_storage": { + "base": "t_struct(AuthorizedPermission)11392_storage", + "encoding": "dynamic_array", + "label": "struct IAuthorizedAccounts.AuthorizedPermission[]", + "numberOfBytes": "32" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_enum(Permission)11384": { + "encoding": "inplace", + "label": "enum IAuthorizedAccounts.Permission", + "numberOfBytes": "1" + }, + "t_mapping(t_address,t_array(t_struct(AuthorizedAccount)11401_storage)dyn_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct IAuthorizedAccounts.AuthorizedAccount[])", + "numberOfBytes": "32", + "value": "t_array(t_struct(AuthorizedAccount)11401_storage)dyn_storage" + }, + "t_struct(AuthorizedAccount)11401_storage": { + "encoding": "inplace", + "label": "struct IAuthorizedAccounts.AuthorizedAccount", + "members": [ + { + "astId": 11394, + "contract": "contracts/AuthorizedAccounts.sol:AuthorizedAccounts", + "label": "account", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 11396, + "contract": "contracts/AuthorizedAccounts.sol:AuthorizedAccounts", + "label": "authorizedAt", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 11400, + "contract": "contracts/AuthorizedAccounts.sol:AuthorizedAccounts", + "label": "permissions", + "offset": 0, + "slot": "2", + "type": "t_array(t_struct(AuthorizedPermission)11392_storage)dyn_storage" + } + ], + "numberOfBytes": "96" + }, + "t_struct(AuthorizedPermission)11392_storage": { + "encoding": "inplace", + "label": "struct IAuthorizedAccounts.AuthorizedPermission", + "members": [ + { + "astId": 11387, + "contract": "contracts/AuthorizedAccounts.sol:AuthorizedAccounts", + "label": "permission", + "offset": 0, + "slot": "0", + "type": "t_enum(Permission)11384" + }, + { + "astId": 11389, + "contract": "contracts/AuthorizedAccounts.sol:AuthorizedAccounts", + "label": "authorizedAt", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 11391, + "contract": "contracts/AuthorizedAccounts.sol:AuthorizedAccounts", + "label": "unauthorizedAt", + "offset": 0, + "slot": "2", + "type": "t_uint256" + } + ], + "numberOfBytes": "96" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/deployments/porcini-dev/AuthorizedAccounts_Proxy.json b/deployments/porcini-dev/AuthorizedAccounts_Proxy.json new file mode 100644 index 00000000..5d046a72 --- /dev/null +++ b/deployments/porcini-dev/AuthorizedAccounts_Proxy.json @@ -0,0 +1,235 @@ +{ + "address": "0x68eCb081F49690b3453F9a4fFa65c054d74DCFE0", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x79ad082f9485190159c0ef79a7769cd3a87fcfc7369f10bb4a97d0b30fe9cd49", + "receipt": { + "to": null, + "from": "0x448c8e9e1816300Dd052e77D2A44c990A2807D15", + "contractAddress": "0x68eCb081F49690b3453F9a4fFa65c054d74DCFE0", + "transactionIndex": 0, + "gasUsed": "720430", + "logsBloom": "0x00000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000040000000200000000000000000000000000000000000000000000000000000800000000000000000000002000000000000000000000000000000000000000000000000000000000000800002000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000404000000100000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x59f9bc2d6a4521569136a86a31c2091a341dab04228d6e4f3d0daffd22faea9b", + "transactionHash": "0x79ad082f9485190159c0ef79a7769cd3a87fcfc7369f10bb4a97d0b30fe9cd49", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 10978364, + "transactionHash": "0x79ad082f9485190159c0ef79a7769cd3a87fcfc7369f10bb4a97d0b30fe9cd49", + "address": "0x68eCb081F49690b3453F9a4fFa65c054d74DCFE0", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x00000000000000000000000043c04bf00bc19d91561e2146597a7fb23642fa25" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0x59f9bc2d6a4521569136a86a31c2091a341dab04228d6e4f3d0daffd22faea9b" + }, + { + "transactionIndex": 0, + "blockNumber": 10978364, + "transactionHash": "0x79ad082f9485190159c0ef79a7769cd3a87fcfc7369f10bb4a97d0b30fe9cd49", + "address": "0x68eCb081F49690b3453F9a4fFa65c054d74DCFE0", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f06d5edb04f4995fff2c362a14826107f7cccbcc", + "logIndex": 1, + "blockHash": "0x59f9bc2d6a4521569136a86a31c2091a341dab04228d6e4f3d0daffd22faea9b" + } + ], + "blockNumber": 10978364, + "cumulativeGasUsed": "720430", + "status": 1, + "byzantium": true + }, + "args": [ + "0x43c04BF00bc19d91561e2146597a7Fb23642fa25", + "0xf06d5Edb04F4995FFF2c362a14826107F7CCCBCc", + "0x" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\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\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.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 *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\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 Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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 Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual 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 Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\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(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\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(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) 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\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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 overriden 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 internall 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 overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/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\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\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 * ```\\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`, and `uint256`._\\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 /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\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 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 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 assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/porcini-dev/DefaultProxyAdmin.json b/deployments/porcini-dev/DefaultProxyAdmin.json new file mode 100644 index 00000000..82990398 --- /dev/null +++ b/deployments/porcini-dev/DefaultProxyAdmin.json @@ -0,0 +1,259 @@ +{ + "address": "0xf06d5Edb04F4995FFF2c362a14826107F7CCCBCc", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "initialOwner", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "contract TransparentUpgradeableProxy", + "name": "proxy", + "type": "address" + }, + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeProxyAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract TransparentUpgradeableProxy", + "name": "proxy", + "type": "address" + } + ], + "name": "getProxyAdmin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract TransparentUpgradeableProxy", + "name": "proxy", + "type": "address" + } + ], + "name": "getProxyImplementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract TransparentUpgradeableProxy", + "name": "proxy", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "upgrade", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract TransparentUpgradeableProxy", + "name": "proxy", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + } + ], + "transactionHash": "0x0ab4162a1965720764e335267da759b8213d06a196d019072913897e38b6b977", + "receipt": { + "to": null, + "from": "0x448c8e9e1816300Dd052e77D2A44c990A2807D15", + "contractAddress": "0xf06d5Edb04F4995FFF2c362a14826107F7CCCBCc", + "transactionIndex": 0, + "gasUsed": "643983", + "logsBloom": "0x00000000000000000000000000000000000000000000000000800000008000000400000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000400800000000000000000000000000000000400002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000020000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x15edab753854cad8db08f2806891fdc8781a22643a3ef7ea4215f3d391beb81f", + "transactionHash": "0x0ab4162a1965720764e335267da759b8213d06a196d019072913897e38b6b977", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 10978361, + "transactionHash": "0x0ab4162a1965720764e335267da759b8213d06a196d019072913897e38b6b977", + "address": "0xf06d5Edb04F4995FFF2c362a14826107F7CCCBCc", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000448c8e9e1816300dd052e77d2a44c990a2807d15" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0x15edab753854cad8db08f2806891fdc8781a22643a3ef7ea4215f3d391beb81f" + } + ], + "blockNumber": 10978361, + "cumulativeGasUsed": "643983", + "status": 1, + "byzantium": true + }, + "args": [ + "0x448c8e9e1816300Dd052e77D2A44c990A2807D15" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initialOwner\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"contract TransparentUpgradeableProxy\",\"name\":\"proxy\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeProxyAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract TransparentUpgradeableProxy\",\"name\":\"proxy\",\"type\":\"address\"}],\"name\":\"getProxyAdmin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract TransparentUpgradeableProxy\",\"name\":\"proxy\",\"type\":\"address\"}],\"name\":\"getProxyImplementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract TransparentUpgradeableProxy\",\"name\":\"proxy\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"upgrade\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract TransparentUpgradeableProxy\",\"name\":\"proxy\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For an explanation of why you would want to use this see the documentation for {TransparentUpgradeableProxy}.\",\"kind\":\"dev\",\"methods\":{\"changeProxyAdmin(address,address)\":{\"details\":\"Changes the admin of `proxy` to `newAdmin`. Requirements: - This contract must be the current admin of `proxy`.\"},\"getProxyAdmin(address)\":{\"details\":\"Returns the current admin of `proxy`. Requirements: - This contract must be the admin of `proxy`.\"},\"getProxyImplementation(address)\":{\"details\":\"Returns the current implementation of `proxy`. Requirements: - This contract must be the admin of `proxy`.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"},\"upgrade(address,address)\":{\"details\":\"Upgrades `proxy` to `implementation`. See {TransparentUpgradeableProxy-upgradeTo}. Requirements: - This contract must be the admin of `proxy`.\"},\"upgradeAndCall(address,address,bytes)\":{\"details\":\"Upgrades `proxy` to `implementation` and calls a function on the new implementation. See {TransparentUpgradeableProxy-upgradeToAndCall}. Requirements: - This contract must be the admin of `proxy`.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/ProxyAdmin.sol\":\"ProxyAdmin\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor (address initialOwner) {\\n _transferOwnership(initialOwner);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0x9b2bbba5bb04f53f277739c1cdff896ba8b3bf591cfc4eab2098c655e8ac251e\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\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\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.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 *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\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 Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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 Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual 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 Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\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(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\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(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) 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\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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 overriden 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 internall 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 overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/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\"},\"solc_0.8/openzeppelin/proxy/transparent/ProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/ProxyAdmin.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./TransparentUpgradeableProxy.sol\\\";\\nimport \\\"../../access/Ownable.sol\\\";\\n\\n/**\\n * @dev This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For an\\n * explanation of why you would want to use this see the documentation for {TransparentUpgradeableProxy}.\\n */\\ncontract ProxyAdmin is Ownable {\\n\\n constructor (address initialOwner) Ownable(initialOwner) {}\\n\\n /**\\n * @dev Returns the current implementation of `proxy`.\\n *\\n * Requirements:\\n *\\n * - This contract must be the admin of `proxy`.\\n */\\n function getProxyImplementation(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\\n // We need to manually run the static call since the getter cannot be flagged as view\\n // bytes4(keccak256(\\\"implementation()\\\")) == 0x5c60da1b\\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\\\"5c60da1b\\\");\\n require(success);\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * @dev Returns the current admin of `proxy`.\\n *\\n * Requirements:\\n *\\n * - This contract must be the admin of `proxy`.\\n */\\n function getProxyAdmin(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\\n // We need to manually run the static call since the getter cannot be flagged as view\\n // bytes4(keccak256(\\\"admin()\\\")) == 0xf851a440\\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\\\"f851a440\\\");\\n require(success);\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * @dev Changes the admin of `proxy` to `newAdmin`.\\n *\\n * Requirements:\\n *\\n * - This contract must be the current admin of `proxy`.\\n */\\n function changeProxyAdmin(TransparentUpgradeableProxy proxy, address newAdmin) public virtual onlyOwner {\\n proxy.changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrades `proxy` to `implementation`. See {TransparentUpgradeableProxy-upgradeTo}.\\n *\\n * Requirements:\\n *\\n * - This contract must be the admin of `proxy`.\\n */\\n function upgrade(TransparentUpgradeableProxy proxy, address implementation) public virtual onlyOwner {\\n proxy.upgradeTo(implementation);\\n }\\n\\n /**\\n * @dev Upgrades `proxy` to `implementation` and calls a function on the new implementation. See\\n * {TransparentUpgradeableProxy-upgradeToAndCall}.\\n *\\n * Requirements:\\n *\\n * - This contract must be the admin of `proxy`.\\n */\\n function upgradeAndCall(\\n TransparentUpgradeableProxy proxy,\\n address implementation,\\n bytes memory data\\n ) public payable virtual onlyOwner {\\n proxy.upgradeToAndCall{value: msg.value}(implementation, data);\\n }\\n}\\n\",\"keccak256\":\"0x754888b9c9ab5525343460b0a4fa2e2f4fca9b6a7e0e7ddea4154e2b1182a45d\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/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\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\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 * ```\\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`, and `uint256`._\\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 /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\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 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 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 assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50604051610b17380380610b1783398101604081905261002f91610090565b8061003981610040565b50506100c0565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156100a257600080fd5b81516001600160a01b03811681146100b957600080fd5b9392505050565b610a48806100cf6000396000f3fe60806040526004361061007b5760003560e01c80639623609d1161004e5780639623609d1461012b57806399a88ec41461013e578063f2fde38b1461015e578063f3b7dead1461017e57600080fd5b8063204e1c7a14610080578063715018a6146100c95780637eff275e146100e05780638da5cb5b14610100575b600080fd5b34801561008c57600080fd5b506100a061009b3660046107e4565b61019e565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100d557600080fd5b506100de610255565b005b3480156100ec57600080fd5b506100de6100fb366004610808565b6102e7565b34801561010c57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100a0565b6100de610139366004610870565b6103ee565b34801561014a57600080fd5b506100de610159366004610808565b6104fc565b34801561016a57600080fd5b506100de6101793660046107e4565b6105d1565b34801561018a57600080fd5b506100a06101993660046107e4565b610701565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907f5c60da1b00000000000000000000000000000000000000000000000000000000815260040190565b600060405180830381855afa9150503d8060008114610225576040519150601f19603f3d011682016040523d82523d6000602084013e61022a565b606091505b50915091508161023957600080fd5b8080602001905181019061024d9190610964565b949350505050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146102db576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6102e5600061074d565b565b60005473ffffffffffffffffffffffffffffffffffffffff163314610368576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102d2565b6040517f8f28397000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690638f283970906024015b600060405180830381600087803b1580156103d257600080fd5b505af11580156103e6573d6000803e3d6000fd5b505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461046f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102d2565b6040517f4f1ef28600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841690634f1ef2869034906104c59086908690600401610981565b6000604051808303818588803b1580156104de57600080fd5b505af11580156104f2573d6000803e3d6000fd5b5050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461057d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102d2565b6040517f3659cfe600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690633659cfe6906024016103b8565b60005473ffffffffffffffffffffffffffffffffffffffff163314610652576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102d2565b73ffffffffffffffffffffffffffffffffffffffff81166106f5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016102d2565b6106fe8161074d565b50565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907ff851a44000000000000000000000000000000000000000000000000000000000815260040190565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b73ffffffffffffffffffffffffffffffffffffffff811681146106fe57600080fd5b6000602082840312156107f657600080fd5b8135610801816107c2565b9392505050565b6000806040838503121561081b57600080fd5b8235610826816107c2565b91506020830135610836816107c2565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008060006060848603121561088557600080fd5b8335610890816107c2565b925060208401356108a0816107c2565b9150604084013567ffffffffffffffff808211156108bd57600080fd5b818601915086601f8301126108d157600080fd5b8135818111156108e3576108e3610841565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561092957610929610841565b8160405282815289602084870101111561094257600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b60006020828403121561097657600080fd5b8151610801816107c2565b73ffffffffffffffffffffffffffffffffffffffff8316815260006020604081840152835180604085015260005b818110156109cb578581018301518582016060015282016109af565b818111156109dd576000606083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160600194935050505056fea2646970667358221220bd6c09ab03bfaf9ec60a4bf8cd98903cecb891974e17e2d76a3b2002c97eeb8964736f6c634300080a0033", + "deployedBytecode": "0x60806040526004361061007b5760003560e01c80639623609d1161004e5780639623609d1461012b57806399a88ec41461013e578063f2fde38b1461015e578063f3b7dead1461017e57600080fd5b8063204e1c7a14610080578063715018a6146100c95780637eff275e146100e05780638da5cb5b14610100575b600080fd5b34801561008c57600080fd5b506100a061009b3660046107e4565b61019e565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100d557600080fd5b506100de610255565b005b3480156100ec57600080fd5b506100de6100fb366004610808565b6102e7565b34801561010c57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100a0565b6100de610139366004610870565b6103ee565b34801561014a57600080fd5b506100de610159366004610808565b6104fc565b34801561016a57600080fd5b506100de6101793660046107e4565b6105d1565b34801561018a57600080fd5b506100a06101993660046107e4565b610701565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907f5c60da1b00000000000000000000000000000000000000000000000000000000815260040190565b600060405180830381855afa9150503d8060008114610225576040519150601f19603f3d011682016040523d82523d6000602084013e61022a565b606091505b50915091508161023957600080fd5b8080602001905181019061024d9190610964565b949350505050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146102db576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6102e5600061074d565b565b60005473ffffffffffffffffffffffffffffffffffffffff163314610368576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102d2565b6040517f8f28397000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690638f283970906024015b600060405180830381600087803b1580156103d257600080fd5b505af11580156103e6573d6000803e3d6000fd5b505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461046f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102d2565b6040517f4f1ef28600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841690634f1ef2869034906104c59086908690600401610981565b6000604051808303818588803b1580156104de57600080fd5b505af11580156104f2573d6000803e3d6000fd5b5050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461057d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102d2565b6040517f3659cfe600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690633659cfe6906024016103b8565b60005473ffffffffffffffffffffffffffffffffffffffff163314610652576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102d2565b73ffffffffffffffffffffffffffffffffffffffff81166106f5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016102d2565b6106fe8161074d565b50565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907ff851a44000000000000000000000000000000000000000000000000000000000815260040190565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b73ffffffffffffffffffffffffffffffffffffffff811681146106fe57600080fd5b6000602082840312156107f657600080fd5b8135610801816107c2565b9392505050565b6000806040838503121561081b57600080fd5b8235610826816107c2565b91506020830135610836816107c2565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008060006060848603121561088557600080fd5b8335610890816107c2565b925060208401356108a0816107c2565b9150604084013567ffffffffffffffff808211156108bd57600080fd5b818601915086601f8301126108d157600080fd5b8135818111156108e3576108e3610841565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561092957610929610841565b8160405282815289602084870101111561094257600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b60006020828403121561097657600080fd5b8151610801816107c2565b73ffffffffffffffffffffffffffffffffffffffff8316815260006020604081840152835180604085015260005b818110156109cb578581018301518582016060015282016109af565b818111156109dd576000606083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160600194935050505056fea2646970667358221220bd6c09ab03bfaf9ec60a4bf8cd98903cecb891974e17e2d76a3b2002c97eeb8964736f6c634300080a0033", + "devdoc": { + "details": "This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For an explanation of why you would want to use this see the documentation for {TransparentUpgradeableProxy}.", + "kind": "dev", + "methods": { + "changeProxyAdmin(address,address)": { + "details": "Changes the admin of `proxy` to `newAdmin`. Requirements: - This contract must be the current admin of `proxy`." + }, + "getProxyAdmin(address)": { + "details": "Returns the current admin of `proxy`. Requirements: - This contract must be the admin of `proxy`." + }, + "getProxyImplementation(address)": { + "details": "Returns the current implementation of `proxy`. Requirements: - This contract must be the admin of `proxy`." + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + }, + "upgrade(address,address)": { + "details": "Upgrades `proxy` to `implementation`. See {TransparentUpgradeableProxy-upgradeTo}. Requirements: - This contract must be the admin of `proxy`." + }, + "upgradeAndCall(address,address,bytes)": { + "details": "Upgrades `proxy` to `implementation` and calls a function on the new implementation. See {TransparentUpgradeableProxy-upgradeToAndCall}. Requirements: - This contract must be the admin of `proxy`." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 7, + "contract": "solc_0.8/openzeppelin/proxy/transparent/ProxyAdmin.sol:ProxyAdmin", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + } + } + } +} \ No newline at end of file diff --git a/deployments/porcini-dev/Directory.json b/deployments/porcini-dev/Directory.json new file mode 100644 index 00000000..48178b4e --- /dev/null +++ b/deployments/porcini-dev/Directory.json @@ -0,0 +1,701 @@ +{ + "address": "0x75aBF214870415A94B0d38840Cd541E9a0f196FA", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "inputs": [], + "name": "ContractNameCannotBeEmpty", + "type": "error" + }, + { + "inputs": [], + "name": "InterfaceIdCannotBeZeroBytes", + "type": "error" + }, + { + "inputs": [], + "name": "ManagerCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "NoJoiningStakeToJoinEpoch", + "type": "error" + }, + { + "inputs": [], + "name": "NoStakeToJoinEpoch", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyManagers", + "type": "error" + }, + { + "inputs": [], + "name": "StakeeAlreadyJoinedEpoch", + "type": "error" + }, + { + "inputs": [], + "name": "StakeeCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "TargetContractCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "TargetNotSupportInterface", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "currentDirectory", + "type": "uint256" + } + ], + "name": "CurrentDirectoryUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "_rewardsManager", + "outputs": [ + { + "internalType": "contract RewardsManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_stakingManager", + "outputs": [ + { + "internalType": "contract StakingManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "manager", + "type": "address" + } + ], + "name": "addManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "currentDirectory", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "directories", + "outputs": [ + { + "internalType": "uint256", + "name": "totalStake", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + } + ], + "name": "getEntries", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + } + ], + "name": "getTotalStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "name": "getTotalStakeForStakee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract StakingManager", + "name": "stakingManager", + "type": "address" + }, + { + "internalType": "contract RewardsManager", + "name": "rewardsManager", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + }, + { + "internalType": "uint256", + "name": "seekerId", + "type": "uint256" + } + ], + "name": "joinNextDirectory", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "managers", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "manager", + "type": "address" + } + ], + "name": "removeManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint128", + "name": "point", + "type": "uint128" + } + ], + "name": "scan", + "outputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint128", + "name": "point", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + } + ], + "name": "scanWithEpochId", + "outputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + } + ], + "name": "setCurrentDirectory", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0xc578ea0fbd08844d18e1290581339f99cda4fec23c48a2def779541a34c1915f", + "receipt": { + "to": null, + "from": "0x448c8e9e1816300Dd052e77D2A44c990A2807D15", + "contractAddress": "0x75aBF214870415A94B0d38840Cd541E9a0f196FA", + "transactionIndex": 0, + "gasUsed": "720430", + "logsBloom": "0x00000000000000000000000000000000400002000000000000000400000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000008000800000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000400000000000000400000000000000000000000000000000000000010000000000000000000000000000000", + "blockHash": "0x8a88995d35d8d95dc37e8721c56daa5e7ef0d61ab3e1aa206dad47a4b74755a2", + "transactionHash": "0xc578ea0fbd08844d18e1290581339f99cda4fec23c48a2def779541a34c1915f", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 10978379, + "transactionHash": "0xc578ea0fbd08844d18e1290581339f99cda4fec23c48a2def779541a34c1915f", + "address": "0x75aBF214870415A94B0d38840Cd541E9a0f196FA", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x0000000000000000000000003fd2728882929be32f3f4909f8e5d4639c6975b8" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0x8a88995d35d8d95dc37e8721c56daa5e7ef0d61ab3e1aa206dad47a4b74755a2" + }, + { + "transactionIndex": 0, + "blockNumber": 10978379, + "transactionHash": "0xc578ea0fbd08844d18e1290581339f99cda4fec23c48a2def779541a34c1915f", + "address": "0x75aBF214870415A94B0d38840Cd541E9a0f196FA", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f06d5edb04f4995fff2c362a14826107f7cccbcc", + "logIndex": 1, + "blockHash": "0x8a88995d35d8d95dc37e8721c56daa5e7ef0d61ab3e1aa206dad47a4b74755a2" + } + ], + "blockNumber": 10978379, + "cumulativeGasUsed": "720430", + "status": 1, + "byzantium": true + }, + "args": [ + "0x3fD2728882929bE32f3F4909F8e5D4639c6975b8", + "0xf06d5Edb04F4995FFF2c362a14826107F7CCCBCc", + "0x" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\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\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.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 *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\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 Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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 Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual 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 Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\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(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\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(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) 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\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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 overriden 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 internall 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 overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/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\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\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 * ```\\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`, and `uint256`._\\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 /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\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 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 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 assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "implementation": "0x3fD2728882929bE32f3F4909F8e5D4639c6975b8", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/porcini-dev/Directory_Implementation.json b/deployments/porcini-dev/Directory_Implementation.json new file mode 100644 index 00000000..eea67e6d --- /dev/null +++ b/deployments/porcini-dev/Directory_Implementation.json @@ -0,0 +1,849 @@ +{ + "address": "0x3fD2728882929bE32f3F4909F8e5D4639c6975b8", + "abi": [ + { + "inputs": [], + "name": "ContractNameCannotBeEmpty", + "type": "error" + }, + { + "inputs": [], + "name": "InterfaceIdCannotBeZeroBytes", + "type": "error" + }, + { + "inputs": [], + "name": "ManagerCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "NoJoiningStakeToJoinEpoch", + "type": "error" + }, + { + "inputs": [], + "name": "NoStakeToJoinEpoch", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyManagers", + "type": "error" + }, + { + "inputs": [], + "name": "StakeeAlreadyJoinedEpoch", + "type": "error" + }, + { + "inputs": [], + "name": "StakeeCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "TargetContractCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "TargetNotSupportInterface", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "currentDirectory", + "type": "uint256" + } + ], + "name": "CurrentDirectoryUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "_rewardsManager", + "outputs": [ + { + "internalType": "contract RewardsManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_stakingManager", + "outputs": [ + { + "internalType": "contract StakingManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "manager", + "type": "address" + } + ], + "name": "addManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "currentDirectory", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "directories", + "outputs": [ + { + "internalType": "uint256", + "name": "totalStake", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + } + ], + "name": "getEntries", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + } + ], + "name": "getTotalStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "name": "getTotalStakeForStakee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract StakingManager", + "name": "stakingManager", + "type": "address" + }, + { + "internalType": "contract RewardsManager", + "name": "rewardsManager", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + }, + { + "internalType": "uint256", + "name": "seekerId", + "type": "uint256" + } + ], + "name": "joinNextDirectory", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "managers", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "manager", + "type": "address" + } + ], + "name": "removeManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint128", + "name": "point", + "type": "uint128" + } + ], + "name": "scan", + "outputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint128", + "name": "point", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + } + ], + "name": "scanWithEpochId", + "outputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + } + ], + "name": "setCurrentDirectory", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xe403238f8368d99c051c7caf83bfcdfb175eb449cb22d349fbd9ec1aabb577db", + "receipt": { + "to": null, + "from": "0x448c8e9e1816300Dd052e77D2A44c990A2807D15", + "contractAddress": "0x3fD2728882929bE32f3F4909F8e5D4639c6975b8", + "transactionIndex": 0, + "gasUsed": "1156149", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x2934e8fc378f82a2537a84bb1b280610a83b7b60f320e660ef1c1b437b328469", + "transactionHash": "0xe403238f8368d99c051c7caf83bfcdfb175eb449cb22d349fbd9ec1aabb577db", + "logs": [], + "blockNumber": 10978378, + "cumulativeGasUsed": "1156149", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "76c1e1f3445d6d518cb33f614f9922c9", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"ContractNameCannotBeEmpty\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InterfaceIdCannotBeZeroBytes\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ManagerCannotBeZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoJoiningStakeToJoinEpoch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoStakeToJoinEpoch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyManagers\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StakeeAlreadyJoinedEpoch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StakeeCannotBeZeroAddress\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"TargetContractCannotBeZeroAddress\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"TargetNotSupportInterface\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"currentDirectory\",\"type\":\"uint256\"}],\"name\":\"CurrentDirectoryUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"_rewardsManager\",\"outputs\":[{\"internalType\":\"contract RewardsManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_stakingManager\",\"outputs\":[{\"internalType\":\"contract StakingManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"manager\",\"type\":\"address\"}],\"name\":\"addManager\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentDirectory\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"directories\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"totalStake\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"}],\"name\":\"getEntries\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"}],\"name\":\"getTotalStake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"stakee\",\"type\":\"address\"}],\"name\":\"getTotalStakeForStakee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract StakingManager\",\"name\":\"stakingManager\",\"type\":\"address\"},{\"internalType\":\"contract RewardsManager\",\"name\":\"rewardsManager\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"stakee\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"seekerId\",\"type\":\"uint256\"}],\"name\":\"joinNextDirectory\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"managers\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"manager\",\"type\":\"address\"}],\"name\":\"removeManager\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint128\",\"name\":\"point\",\"type\":\"uint128\"}],\"name\":\"scan\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"stakee\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint128\",\"name\":\"point\",\"type\":\"uint128\"},{\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"}],\"name\":\"scanWithEpochId\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"stakee\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"}],\"name\":\"setCurrentDirectory\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"addManager(address)\":{\"params\":{\"manager\":\"The address of the manager contract.\"}},\"getEntries(uint256)\":{\"returns\":{\"_0\":\"An array of all the directory entries.\"}},\"getTotalStake(uint256)\":{\"params\":{\"epochId\":\"The ID of the epoch.\"},\"returns\":{\"_0\":\"The total amount of stake in SOLO.\"}},\"getTotalStakeForStakee(uint256,address)\":{\"params\":{\"epochId\":\"The ID of the epoch.\",\"stakee\":\"The address of the Node.\"},\"returns\":{\"_0\":\"The amount of stake the Node has for the given directory in SOLO.\"}},\"joinNextDirectory(address,uint256)\":{\"details\":\"This will construct the directory as nodes join. The directory is constructed by creating a boundary value which is a sum of the current directory's total stake, and the current stakee's total stake, and pushing the new boundary into the entries array. The previous boundary and the current boundary essentially create a range, where if a random point were to fall within that range, it would belong to the respective stakee. The boundary value grows in size as each stakee joins, thus the directory array always remains sorted. This allows us to perform a binary search on the directory. Example Stakes: [ Alice/20, Bob/10, Carl/40, Dave/25 ] TotalStake: 95 EpochDirectory: |-----------|------|----------------|--------| Alice/20 Bob/30 Carl/70 Dave/95 The amount of stake that a node will join a directory with is dependent on its different capacity values. There are two distinct capacity values, one calculated from the seeker power, and another from the minimum stake proportion. The final staking amount will not exceed either capacities, and in the case that the current total stake exceeds both, then the final will be the minimum of the two values.\",\"params\":{\"seekerId\":\"The seekerId of the Seeker that the node is registered with when joining the epoch. It is used to determine the nodes staking capacity based on its seeker power.\",\"stakee\":\"The address of the node.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"removeManager(address)\":{\"params\":{\"manager\":\"The address of the manager contract.\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"scan(uint128)\":{\"params\":{\"point\":\"The point, which will usually be a hash of a public key.\"}},\"scanWithEpochId(uint128,uint256)\":{\"params\":{\"epochId\":\"The epoch id associated with the directory to scan.\",\"point\":\"The point, which will usually be a hash of a public key.\"}},\"setCurrentDirectory(uint256)\":{\"details\":\"After deployment, the EpochsManager should immediately be set as the owner.\",\"params\":{\"epochId\":\"The ID of the specified epoch.\"}},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"_rewardsManager()\":{\"notice\":\"Sylo Rewards Manager contract \"},\"_stakingManager()\":{\"notice\":\"Sylo Staking Manager contract \"},\"addManager(address)\":{\"notice\":\"Adds a manager to this contract. Only callable by the owner.\"},\"currentDirectory()\":{\"notice\":\"The epoch ID of the current directory.\"},\"directories(uint256)\":{\"notice\":\"Tracks every directory, which will be indexed by an epoch ID\"},\"getEntries(uint256)\":{\"notice\":\"Retrieve all entries for a directory in a specified epoch.\"},\"getTotalStake(uint256)\":{\"notice\":\"Retrieve the total stake for a directory in the specified epoch, which will be the sum of the stakes for all Nodes participating in that epoch.\"},\"getTotalStakeForStakee(uint256,address)\":{\"notice\":\"Retrieve the total stake a Node has for the directory in the specified epoch.\"},\"joinNextDirectory(address,uint256)\":{\"notice\":\"This function is called by the epochs manager as a prerequisite to when the node joins the next epoch.\"},\"removeManager(address)\":{\"notice\":\"Removes a manager from this contract. Only callable by the owner.\"},\"scan(uint128)\":{\"notice\":\"Call this to perform a stake-weighted scan to find the Node assigned to the given point of the current directory.\"},\"scanWithEpochId(uint128,uint256)\":{\"notice\":\"Call this to perform a stake-weighted scan to find the Node assigned to the given point of the requested directory.\"},\"setCurrentDirectory(uint256)\":{\"notice\":\"This function should be called when a new epoch is initialized. This will set the current directory to the specified epoch. This is only callable by the owner of this contract, which should be the EpochsManager contract.\"},\"supportsInterface(bytes4)\":{\"notice\":\"Returns true if the contract implements the interface defined by `interfaceId` from ERC165.\"}},\"notice\":\"The Directory contract constructs and manages a structure holding the current stakes, which is queried against using the scan function. The scan function allows submitting random points which will return a staked node's address in proportion to the stake it has.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/staking/Directory.sol\":\"Directory\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./OwnableUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership} and {acceptOwnership}.\\n *\\n * This module is used through inheritance. It will make available all functions\\n * from parent (Ownable).\\n */\\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\\n function __Ownable2Step_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable2Step_init_unchained() internal onlyInitializing {\\n }\\n address private _pendingOwner;\\n\\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Returns the address of the pending owner.\\n */\\n function pendingOwner() public view virtual returns (address) {\\n return _pendingOwner;\\n }\\n\\n /**\\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual override onlyOwner {\\n _pendingOwner = newOwner;\\n emit OwnershipTransferStarted(owner(), newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual override {\\n delete _pendingOwner;\\n super._transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev The new owner accepts the ownership transfer.\\n */\\n function acceptOwnership() public virtual {\\n address sender = _msgSender();\\n require(pendingOwner() == sender, \\\"Ownable2Step: caller is not the new owner\\\");\\n _transferOwnership(sender);\\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\":\"0x84efb8889801b0ac817324aff6acc691d07bbee816b671817132911d287a8c63\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n\\n /**\\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\":\"0x4075622496acc77fd6d4de4cc30a8577a744d5c75afad33fdeacf1704d6eda98\",\"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/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/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/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\",\"keccak256\":\"0xa56ca923f70c1748830700250b19c61b70db9a683516dc5e216694a50445d99c\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.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 IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xec63854014a5b4f2b3290ab9103a21bdf902a508d0f41a8573fea49e98bf571a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.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 \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n /**\\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.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(IERC20 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(IERC20 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(IERC20 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(IERC20 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(IERC20 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 IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n 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(IERC20 token, bytes memory data) private returns (bool) {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\\n // and not revert is the subcall reverts.\\n\\n (bool success, bytes memory returndata) = address(token).call(data);\\n return\\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\\n }\\n}\\n\",\"keccak256\":\"0x909d608c2db6eb165ca178c81289a07ed2e118e444d0025b2a85c97d0b44a4fa\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"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/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\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.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/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\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 = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _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(SignedMath.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n 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\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.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 \\\"../Strings.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 ECDSA {\\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\\\", Strings.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\":\"0x809bc3edb4bcbef8263fa616c1b60ee0004b50a8a1bfa164d8f57fd31f520c58\",\"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/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\"},\"@openzeppelin/contracts/utils/math/Math.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 Math {\\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\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)\\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\\n * checks.\\n *\\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\\n * easily result in undesired exploitation or bugs, since developers usually\\n * assume that overflows raise errors. `SafeCast` restores this intuition by\\n * reverting the transaction when such an operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n *\\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\\n * all math on `uint256` and `int256` and then downcasting.\\n */\\nlibrary SafeCast {\\n /**\\n * @dev Returns the downcasted uint248 from uint256, reverting on\\n * overflow (when the input is greater than largest uint248).\\n *\\n * Counterpart to Solidity's `uint248` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 248 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint248(uint256 value) internal pure returns (uint248) {\\n require(value <= type(uint248).max, \\\"SafeCast: value doesn't fit in 248 bits\\\");\\n return uint248(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint240 from uint256, reverting on\\n * overflow (when the input is greater than largest uint240).\\n *\\n * Counterpart to Solidity's `uint240` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 240 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint240(uint256 value) internal pure returns (uint240) {\\n require(value <= type(uint240).max, \\\"SafeCast: value doesn't fit in 240 bits\\\");\\n return uint240(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint232 from uint256, reverting on\\n * overflow (when the input is greater than largest uint232).\\n *\\n * Counterpart to Solidity's `uint232` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 232 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint232(uint256 value) internal pure returns (uint232) {\\n require(value <= type(uint232).max, \\\"SafeCast: value doesn't fit in 232 bits\\\");\\n return uint232(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint224 from uint256, reverting on\\n * overflow (when the input is greater than largest uint224).\\n *\\n * Counterpart to Solidity's `uint224` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 224 bits\\n *\\n * _Available since v4.2._\\n */\\n function toUint224(uint256 value) internal pure returns (uint224) {\\n require(value <= type(uint224).max, \\\"SafeCast: value doesn't fit in 224 bits\\\");\\n return uint224(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint216 from uint256, reverting on\\n * overflow (when the input is greater than largest uint216).\\n *\\n * Counterpart to Solidity's `uint216` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 216 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint216(uint256 value) internal pure returns (uint216) {\\n require(value <= type(uint216).max, \\\"SafeCast: value doesn't fit in 216 bits\\\");\\n return uint216(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint208 from uint256, reverting on\\n * overflow (when the input is greater than largest uint208).\\n *\\n * Counterpart to Solidity's `uint208` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 208 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint208(uint256 value) internal pure returns (uint208) {\\n require(value <= type(uint208).max, \\\"SafeCast: value doesn't fit in 208 bits\\\");\\n return uint208(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint200 from uint256, reverting on\\n * overflow (when the input is greater than largest uint200).\\n *\\n * Counterpart to Solidity's `uint200` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 200 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint200(uint256 value) internal pure returns (uint200) {\\n require(value <= type(uint200).max, \\\"SafeCast: value doesn't fit in 200 bits\\\");\\n return uint200(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint192 from uint256, reverting on\\n * overflow (when the input is greater than largest uint192).\\n *\\n * Counterpart to Solidity's `uint192` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 192 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint192(uint256 value) internal pure returns (uint192) {\\n require(value <= type(uint192).max, \\\"SafeCast: value doesn't fit in 192 bits\\\");\\n return uint192(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint184 from uint256, reverting on\\n * overflow (when the input is greater than largest uint184).\\n *\\n * Counterpart to Solidity's `uint184` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 184 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint184(uint256 value) internal pure returns (uint184) {\\n require(value <= type(uint184).max, \\\"SafeCast: value doesn't fit in 184 bits\\\");\\n return uint184(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint176 from uint256, reverting on\\n * overflow (when the input is greater than largest uint176).\\n *\\n * Counterpart to Solidity's `uint176` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 176 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint176(uint256 value) internal pure returns (uint176) {\\n require(value <= type(uint176).max, \\\"SafeCast: value doesn't fit in 176 bits\\\");\\n return uint176(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint168 from uint256, reverting on\\n * overflow (when the input is greater than largest uint168).\\n *\\n * Counterpart to Solidity's `uint168` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 168 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint168(uint256 value) internal pure returns (uint168) {\\n require(value <= type(uint168).max, \\\"SafeCast: value doesn't fit in 168 bits\\\");\\n return uint168(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint160 from uint256, reverting on\\n * overflow (when the input is greater than largest uint160).\\n *\\n * Counterpart to Solidity's `uint160` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 160 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint160(uint256 value) internal pure returns (uint160) {\\n require(value <= type(uint160).max, \\\"SafeCast: value doesn't fit in 160 bits\\\");\\n return uint160(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint152 from uint256, reverting on\\n * overflow (when the input is greater than largest uint152).\\n *\\n * Counterpart to Solidity's `uint152` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 152 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint152(uint256 value) internal pure returns (uint152) {\\n require(value <= type(uint152).max, \\\"SafeCast: value doesn't fit in 152 bits\\\");\\n return uint152(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint144 from uint256, reverting on\\n * overflow (when the input is greater than largest uint144).\\n *\\n * Counterpart to Solidity's `uint144` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 144 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint144(uint256 value) internal pure returns (uint144) {\\n require(value <= type(uint144).max, \\\"SafeCast: value doesn't fit in 144 bits\\\");\\n return uint144(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint136 from uint256, reverting on\\n * overflow (when the input is greater than largest uint136).\\n *\\n * Counterpart to Solidity's `uint136` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 136 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint136(uint256 value) internal pure returns (uint136) {\\n require(value <= type(uint136).max, \\\"SafeCast: value doesn't fit in 136 bits\\\");\\n return uint136(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint128 from uint256, reverting on\\n * overflow (when the input is greater than largest uint128).\\n *\\n * Counterpart to Solidity's `uint128` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 128 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint128(uint256 value) internal pure returns (uint128) {\\n require(value <= type(uint128).max, \\\"SafeCast: value doesn't fit in 128 bits\\\");\\n return uint128(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint120 from uint256, reverting on\\n * overflow (when the input is greater than largest uint120).\\n *\\n * Counterpart to Solidity's `uint120` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 120 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint120(uint256 value) internal pure returns (uint120) {\\n require(value <= type(uint120).max, \\\"SafeCast: value doesn't fit in 120 bits\\\");\\n return uint120(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint112 from uint256, reverting on\\n * overflow (when the input is greater than largest uint112).\\n *\\n * Counterpart to Solidity's `uint112` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 112 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint112(uint256 value) internal pure returns (uint112) {\\n require(value <= type(uint112).max, \\\"SafeCast: value doesn't fit in 112 bits\\\");\\n return uint112(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint104 from uint256, reverting on\\n * overflow (when the input is greater than largest uint104).\\n *\\n * Counterpart to Solidity's `uint104` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 104 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint104(uint256 value) internal pure returns (uint104) {\\n require(value <= type(uint104).max, \\\"SafeCast: value doesn't fit in 104 bits\\\");\\n return uint104(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint96 from uint256, reverting on\\n * overflow (when the input is greater than largest uint96).\\n *\\n * Counterpart to Solidity's `uint96` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 96 bits\\n *\\n * _Available since v4.2._\\n */\\n function toUint96(uint256 value) internal pure returns (uint96) {\\n require(value <= type(uint96).max, \\\"SafeCast: value doesn't fit in 96 bits\\\");\\n return uint96(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint88 from uint256, reverting on\\n * overflow (when the input is greater than largest uint88).\\n *\\n * Counterpart to Solidity's `uint88` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 88 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint88(uint256 value) internal pure returns (uint88) {\\n require(value <= type(uint88).max, \\\"SafeCast: value doesn't fit in 88 bits\\\");\\n return uint88(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint80 from uint256, reverting on\\n * overflow (when the input is greater than largest uint80).\\n *\\n * Counterpart to Solidity's `uint80` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 80 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint80(uint256 value) internal pure returns (uint80) {\\n require(value <= type(uint80).max, \\\"SafeCast: value doesn't fit in 80 bits\\\");\\n return uint80(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint72 from uint256, reverting on\\n * overflow (when the input is greater than largest uint72).\\n *\\n * Counterpart to Solidity's `uint72` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 72 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint72(uint256 value) internal pure returns (uint72) {\\n require(value <= type(uint72).max, \\\"SafeCast: value doesn't fit in 72 bits\\\");\\n return uint72(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint64 from uint256, reverting on\\n * overflow (when the input is greater than largest uint64).\\n *\\n * Counterpart to Solidity's `uint64` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 64 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint64(uint256 value) internal pure returns (uint64) {\\n require(value <= type(uint64).max, \\\"SafeCast: value doesn't fit in 64 bits\\\");\\n return uint64(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint56 from uint256, reverting on\\n * overflow (when the input is greater than largest uint56).\\n *\\n * Counterpart to Solidity's `uint56` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 56 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint56(uint256 value) internal pure returns (uint56) {\\n require(value <= type(uint56).max, \\\"SafeCast: value doesn't fit in 56 bits\\\");\\n return uint56(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint48 from uint256, reverting on\\n * overflow (when the input is greater than largest uint48).\\n *\\n * Counterpart to Solidity's `uint48` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 48 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint48(uint256 value) internal pure returns (uint48) {\\n require(value <= type(uint48).max, \\\"SafeCast: value doesn't fit in 48 bits\\\");\\n return uint48(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint40 from uint256, reverting on\\n * overflow (when the input is greater than largest uint40).\\n *\\n * Counterpart to Solidity's `uint40` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 40 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint40(uint256 value) internal pure returns (uint40) {\\n require(value <= type(uint40).max, \\\"SafeCast: value doesn't fit in 40 bits\\\");\\n return uint40(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint32 from uint256, reverting on\\n * overflow (when the input is greater than largest uint32).\\n *\\n * Counterpart to Solidity's `uint32` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 32 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint32(uint256 value) internal pure returns (uint32) {\\n require(value <= type(uint32).max, \\\"SafeCast: value doesn't fit in 32 bits\\\");\\n return uint32(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint24 from uint256, reverting on\\n * overflow (when the input is greater than largest uint24).\\n *\\n * Counterpart to Solidity's `uint24` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 24 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint24(uint256 value) internal pure returns (uint24) {\\n require(value <= type(uint24).max, \\\"SafeCast: value doesn't fit in 24 bits\\\");\\n return uint24(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint16 from uint256, reverting on\\n * overflow (when the input is greater than largest uint16).\\n *\\n * Counterpart to Solidity's `uint16` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 16 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint16(uint256 value) internal pure returns (uint16) {\\n require(value <= type(uint16).max, \\\"SafeCast: value doesn't fit in 16 bits\\\");\\n return uint16(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint8 from uint256, reverting on\\n * overflow (when the input is greater than largest uint8).\\n *\\n * Counterpart to Solidity's `uint8` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 8 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint8(uint256 value) internal pure returns (uint8) {\\n require(value <= type(uint8).max, \\\"SafeCast: value doesn't fit in 8 bits\\\");\\n return uint8(value);\\n }\\n\\n /**\\n * @dev Converts a signed int256 into an unsigned uint256.\\n *\\n * Requirements:\\n *\\n * - input must be greater than or equal to 0.\\n *\\n * _Available since v3.0._\\n */\\n function toUint256(int256 value) internal pure returns (uint256) {\\n require(value >= 0, \\\"SafeCast: value must be positive\\\");\\n return uint256(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int248 from int256, reverting on\\n * overflow (when the input is less than smallest int248 or\\n * greater than largest int248).\\n *\\n * Counterpart to Solidity's `int248` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 248 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\\n downcasted = int248(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 248 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int240 from int256, reverting on\\n * overflow (when the input is less than smallest int240 or\\n * greater than largest int240).\\n *\\n * Counterpart to Solidity's `int240` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 240 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\\n downcasted = int240(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 240 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int232 from int256, reverting on\\n * overflow (when the input is less than smallest int232 or\\n * greater than largest int232).\\n *\\n * Counterpart to Solidity's `int232` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 232 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\\n downcasted = int232(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 232 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int224 from int256, reverting on\\n * overflow (when the input is less than smallest int224 or\\n * greater than largest int224).\\n *\\n * Counterpart to Solidity's `int224` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 224 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\\n downcasted = int224(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 224 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int216 from int256, reverting on\\n * overflow (when the input is less than smallest int216 or\\n * greater than largest int216).\\n *\\n * Counterpart to Solidity's `int216` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 216 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\\n downcasted = int216(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 216 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int208 from int256, reverting on\\n * overflow (when the input is less than smallest int208 or\\n * greater than largest int208).\\n *\\n * Counterpart to Solidity's `int208` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 208 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\\n downcasted = int208(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 208 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int200 from int256, reverting on\\n * overflow (when the input is less than smallest int200 or\\n * greater than largest int200).\\n *\\n * Counterpart to Solidity's `int200` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 200 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\\n downcasted = int200(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 200 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int192 from int256, reverting on\\n * overflow (when the input is less than smallest int192 or\\n * greater than largest int192).\\n *\\n * Counterpart to Solidity's `int192` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 192 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\\n downcasted = int192(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 192 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int184 from int256, reverting on\\n * overflow (when the input is less than smallest int184 or\\n * greater than largest int184).\\n *\\n * Counterpart to Solidity's `int184` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 184 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\\n downcasted = int184(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 184 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int176 from int256, reverting on\\n * overflow (when the input is less than smallest int176 or\\n * greater than largest int176).\\n *\\n * Counterpart to Solidity's `int176` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 176 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\\n downcasted = int176(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 176 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int168 from int256, reverting on\\n * overflow (when the input is less than smallest int168 or\\n * greater than largest int168).\\n *\\n * Counterpart to Solidity's `int168` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 168 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\\n downcasted = int168(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 168 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int160 from int256, reverting on\\n * overflow (when the input is less than smallest int160 or\\n * greater than largest int160).\\n *\\n * Counterpart to Solidity's `int160` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 160 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\\n downcasted = int160(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 160 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int152 from int256, reverting on\\n * overflow (when the input is less than smallest int152 or\\n * greater than largest int152).\\n *\\n * Counterpart to Solidity's `int152` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 152 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\\n downcasted = int152(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 152 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int144 from int256, reverting on\\n * overflow (when the input is less than smallest int144 or\\n * greater than largest int144).\\n *\\n * Counterpart to Solidity's `int144` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 144 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\\n downcasted = int144(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 144 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int136 from int256, reverting on\\n * overflow (when the input is less than smallest int136 or\\n * greater than largest int136).\\n *\\n * Counterpart to Solidity's `int136` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 136 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\\n downcasted = int136(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 136 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int128 from int256, reverting on\\n * overflow (when the input is less than smallest int128 or\\n * greater than largest int128).\\n *\\n * Counterpart to Solidity's `int128` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 128 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\\n downcasted = int128(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 128 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int120 from int256, reverting on\\n * overflow (when the input is less than smallest int120 or\\n * greater than largest int120).\\n *\\n * Counterpart to Solidity's `int120` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 120 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\\n downcasted = int120(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 120 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int112 from int256, reverting on\\n * overflow (when the input is less than smallest int112 or\\n * greater than largest int112).\\n *\\n * Counterpart to Solidity's `int112` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 112 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\\n downcasted = int112(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 112 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int104 from int256, reverting on\\n * overflow (when the input is less than smallest int104 or\\n * greater than largest int104).\\n *\\n * Counterpart to Solidity's `int104` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 104 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\\n downcasted = int104(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 104 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int96 from int256, reverting on\\n * overflow (when the input is less than smallest int96 or\\n * greater than largest int96).\\n *\\n * Counterpart to Solidity's `int96` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 96 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\\n downcasted = int96(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 96 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int88 from int256, reverting on\\n * overflow (when the input is less than smallest int88 or\\n * greater than largest int88).\\n *\\n * Counterpart to Solidity's `int88` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 88 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\\n downcasted = int88(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 88 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int80 from int256, reverting on\\n * overflow (when the input is less than smallest int80 or\\n * greater than largest int80).\\n *\\n * Counterpart to Solidity's `int80` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 80 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\\n downcasted = int80(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 80 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int72 from int256, reverting on\\n * overflow (when the input is less than smallest int72 or\\n * greater than largest int72).\\n *\\n * Counterpart to Solidity's `int72` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 72 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\\n downcasted = int72(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 72 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int64 from int256, reverting on\\n * overflow (when the input is less than smallest int64 or\\n * greater than largest int64).\\n *\\n * Counterpart to Solidity's `int64` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 64 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\\n downcasted = int64(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 64 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int56 from int256, reverting on\\n * overflow (when the input is less than smallest int56 or\\n * greater than largest int56).\\n *\\n * Counterpart to Solidity's `int56` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 56 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\\n downcasted = int56(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 56 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int48 from int256, reverting on\\n * overflow (when the input is less than smallest int48 or\\n * greater than largest int48).\\n *\\n * Counterpart to Solidity's `int48` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 48 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\\n downcasted = int48(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 48 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int40 from int256, reverting on\\n * overflow (when the input is less than smallest int40 or\\n * greater than largest int40).\\n *\\n * Counterpart to Solidity's `int40` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 40 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\\n downcasted = int40(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 40 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int32 from int256, reverting on\\n * overflow (when the input is less than smallest int32 or\\n * greater than largest int32).\\n *\\n * Counterpart to Solidity's `int32` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 32 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\\n downcasted = int32(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 32 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int24 from int256, reverting on\\n * overflow (when the input is less than smallest int24 or\\n * greater than largest int24).\\n *\\n * Counterpart to Solidity's `int24` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 24 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\\n downcasted = int24(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 24 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int16 from int256, reverting on\\n * overflow (when the input is less than smallest int16 or\\n * greater than largest int16).\\n *\\n * Counterpart to Solidity's `int16` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 16 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\\n downcasted = int16(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 16 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int8 from int256, reverting on\\n * overflow (when the input is less than smallest int8 or\\n * greater than largest int8).\\n *\\n * Counterpart to Solidity's `int8` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 8 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\\n downcasted = int8(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 8 bits\\\");\\n }\\n\\n /**\\n * @dev Converts an unsigned uint256 into a signed int256.\\n *\\n * Requirements:\\n *\\n * - input must be less than or equal to maxInt256.\\n *\\n * _Available since v3.0._\\n */\\n function toInt256(uint256 value) internal pure returns (int256) {\\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\\n require(value <= uint256(type(int256).max), \\\"SafeCast: value doesn't fit in an int256\\\");\\n return int256(value);\\n }\\n}\\n\",\"keccak256\":\"0x52a8cfb0f5239d11b457dcdd1b326992ef672714ca8da71a157255bddd13f3ad\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.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 SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"abdk-libraries-solidity/ABDKMath64x64.sol\":{\"content\":\"// SPDX-License-Identifier: BSD-4-Clause\\n/*\\n * ABDK Math 64.64 Smart Contract Library. Copyright \\u00a9 2019 by ABDK Consulting.\\n * Author: Mikhail Vladimirov \\n */\\npragma solidity ^0.8.0;\\n\\n/**\\n * Smart contract library of mathematical functions operating with signed\\n * 64.64-bit fixed point numbers. Signed 64.64-bit fixed point number is\\n * basically a simple fraction whose numerator is signed 128-bit integer and\\n * denominator is 2^64. As long as denominator is always the same, there is no\\n * need to store it, thus in Solidity signed 64.64-bit fixed point numbers are\\n * represented by int128 type holding only the numerator.\\n */\\nlibrary ABDKMath64x64 {\\n /*\\n * Minimum value signed 64.64-bit fixed point number may have. \\n */\\n int128 private constant MIN_64x64 = -0x80000000000000000000000000000000;\\n\\n /*\\n * Maximum value signed 64.64-bit fixed point number may have. \\n */\\n int128 private constant MAX_64x64 = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;\\n\\n /**\\n * Convert signed 256-bit integer number into signed 64.64-bit fixed point\\n * number. Revert on overflow.\\n *\\n * @param x signed 256-bit integer number\\n * @return signed 64.64-bit fixed point number\\n */\\n function fromInt (int256 x) internal pure returns (int128) {\\n unchecked {\\n require (x >= -0x8000000000000000 && x <= 0x7FFFFFFFFFFFFFFF);\\n return int128 (x << 64);\\n }\\n }\\n\\n /**\\n * Convert signed 64.64 fixed point number into signed 64-bit integer number\\n * rounding down.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64-bit integer number\\n */\\n function toInt (int128 x) internal pure returns (int64) {\\n unchecked {\\n return int64 (x >> 64);\\n }\\n }\\n\\n /**\\n * Convert unsigned 256-bit integer number into signed 64.64-bit fixed point\\n * number. Revert on overflow.\\n *\\n * @param x unsigned 256-bit integer number\\n * @return signed 64.64-bit fixed point number\\n */\\n function fromUInt (uint256 x) internal pure returns (int128) {\\n unchecked {\\n require (x <= 0x7FFFFFFFFFFFFFFF);\\n return int128 (int256 (x << 64));\\n }\\n }\\n\\n /**\\n * Convert signed 64.64 fixed point number into unsigned 64-bit integer\\n * number rounding down. Revert on underflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return unsigned 64-bit integer number\\n */\\n function toUInt (int128 x) internal pure returns (uint64) {\\n unchecked {\\n require (x >= 0);\\n return uint64 (uint128 (x >> 64));\\n }\\n }\\n\\n /**\\n * Convert signed 128.128 fixed point number into signed 64.64-bit fixed point\\n * number rounding down. Revert on overflow.\\n *\\n * @param x signed 128.128-bin fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function from128x128 (int256 x) internal pure returns (int128) {\\n unchecked {\\n int256 result = x >> 64;\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Convert signed 64.64 fixed point number into signed 128.128 fixed point\\n * number.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 128.128 fixed point number\\n */\\n function to128x128 (int128 x) internal pure returns (int256) {\\n unchecked {\\n return int256 (x) << 64;\\n }\\n }\\n\\n /**\\n * Calculate x + y. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function add (int128 x, int128 y) internal pure returns (int128) {\\n unchecked {\\n int256 result = int256(x) + y;\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate x - y. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function sub (int128 x, int128 y) internal pure returns (int128) {\\n unchecked {\\n int256 result = int256(x) - y;\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate x * y rounding down. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function mul (int128 x, int128 y) internal pure returns (int128) {\\n unchecked {\\n int256 result = int256(x) * y >> 64;\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate x * y rounding towards zero, where x is signed 64.64 fixed point\\n * number and y is signed 256-bit integer number. Revert on overflow.\\n *\\n * @param x signed 64.64 fixed point number\\n * @param y signed 256-bit integer number\\n * @return signed 256-bit integer number\\n */\\n function muli (int128 x, int256 y) internal pure returns (int256) {\\n unchecked {\\n if (x == MIN_64x64) {\\n require (y >= -0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF &&\\n y <= 0x1000000000000000000000000000000000000000000000000);\\n return -y << 63;\\n } else {\\n bool negativeResult = false;\\n if (x < 0) {\\n x = -x;\\n negativeResult = true;\\n }\\n if (y < 0) {\\n y = -y; // We rely on overflow behavior here\\n negativeResult = !negativeResult;\\n }\\n uint256 absoluteResult = mulu (x, uint256 (y));\\n if (negativeResult) {\\n require (absoluteResult <=\\n 0x8000000000000000000000000000000000000000000000000000000000000000);\\n return -int256 (absoluteResult); // We rely on overflow behavior here\\n } else {\\n require (absoluteResult <=\\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\\n return int256 (absoluteResult);\\n }\\n }\\n }\\n }\\n\\n /**\\n * Calculate x * y rounding down, where x is signed 64.64 fixed point number\\n * and y is unsigned 256-bit integer number. Revert on overflow.\\n *\\n * @param x signed 64.64 fixed point number\\n * @param y unsigned 256-bit integer number\\n * @return unsigned 256-bit integer number\\n */\\n function mulu (int128 x, uint256 y) internal pure returns (uint256) {\\n unchecked {\\n if (y == 0) return 0;\\n\\n require (x >= 0);\\n\\n uint256 lo = (uint256 (int256 (x)) * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) >> 64;\\n uint256 hi = uint256 (int256 (x)) * (y >> 128);\\n\\n require (hi <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\\n hi <<= 64;\\n\\n require (hi <=\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - lo);\\n return hi + lo;\\n }\\n }\\n\\n /**\\n * Calculate x / y rounding towards zero. Revert on overflow or when y is\\n * zero.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function div (int128 x, int128 y) internal pure returns (int128) {\\n unchecked {\\n require (y != 0);\\n int256 result = (int256 (x) << 64) / y;\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate x / y rounding towards zero, where x and y are signed 256-bit\\n * integer numbers. Revert on overflow or when y is zero.\\n *\\n * @param x signed 256-bit integer number\\n * @param y signed 256-bit integer number\\n * @return signed 64.64-bit fixed point number\\n */\\n function divi (int256 x, int256 y) internal pure returns (int128) {\\n unchecked {\\n require (y != 0);\\n\\n bool negativeResult = false;\\n if (x < 0) {\\n x = -x; // We rely on overflow behavior here\\n negativeResult = true;\\n }\\n if (y < 0) {\\n y = -y; // We rely on overflow behavior here\\n negativeResult = !negativeResult;\\n }\\n uint128 absoluteResult = divuu (uint256 (x), uint256 (y));\\n if (negativeResult) {\\n require (absoluteResult <= 0x80000000000000000000000000000000);\\n return -int128 (absoluteResult); // We rely on overflow behavior here\\n } else {\\n require (absoluteResult <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\\n return int128 (absoluteResult); // We rely on overflow behavior here\\n }\\n }\\n }\\n\\n /**\\n * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit\\n * integer numbers. Revert on overflow or when y is zero.\\n *\\n * @param x unsigned 256-bit integer number\\n * @param y unsigned 256-bit integer number\\n * @return signed 64.64-bit fixed point number\\n */\\n function divu (uint256 x, uint256 y) internal pure returns (int128) {\\n unchecked {\\n require (y != 0);\\n uint128 result = divuu (x, y);\\n require (result <= uint128 (MAX_64x64));\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate -x. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function neg (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x != MIN_64x64);\\n return -x;\\n }\\n }\\n\\n /**\\n * Calculate |x|. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function abs (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x != MIN_64x64);\\n return x < 0 ? -x : x;\\n }\\n }\\n\\n /**\\n * Calculate 1 / x rounding towards zero. Revert on overflow or when x is\\n * zero.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function inv (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x != 0);\\n int256 result = int256 (0x100000000000000000000000000000000) / x;\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate arithmetics average of x and y, i.e. (x + y) / 2 rounding down.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function avg (int128 x, int128 y) internal pure returns (int128) {\\n unchecked {\\n return int128 ((int256 (x) + int256 (y)) >> 1);\\n }\\n }\\n\\n /**\\n * Calculate geometric average of x and y, i.e. sqrt (x * y) rounding down.\\n * Revert on overflow or in case x * y is negative.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function gavg (int128 x, int128 y) internal pure returns (int128) {\\n unchecked {\\n int256 m = int256 (x) * int256 (y);\\n require (m >= 0);\\n require (m <\\n 0x4000000000000000000000000000000000000000000000000000000000000000);\\n return int128 (sqrtu (uint256 (m)));\\n }\\n }\\n\\n /**\\n * Calculate x^y assuming 0^0 is 1, where x is signed 64.64 fixed point number\\n * and y is unsigned 256-bit integer number. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y uint256 value\\n * @return signed 64.64-bit fixed point number\\n */\\n function pow (int128 x, uint256 y) internal pure returns (int128) {\\n unchecked {\\n bool negative = x < 0 && y & 1 == 1;\\n\\n uint256 absX = uint128 (x < 0 ? -x : x);\\n uint256 absResult;\\n absResult = 0x100000000000000000000000000000000;\\n\\n if (absX <= 0x10000000000000000) {\\n absX <<= 63;\\n while (y != 0) {\\n if (y & 0x1 != 0) {\\n absResult = absResult * absX >> 127;\\n }\\n absX = absX * absX >> 127;\\n\\n if (y & 0x2 != 0) {\\n absResult = absResult * absX >> 127;\\n }\\n absX = absX * absX >> 127;\\n\\n if (y & 0x4 != 0) {\\n absResult = absResult * absX >> 127;\\n }\\n absX = absX * absX >> 127;\\n\\n if (y & 0x8 != 0) {\\n absResult = absResult * absX >> 127;\\n }\\n absX = absX * absX >> 127;\\n\\n y >>= 4;\\n }\\n\\n absResult >>= 64;\\n } else {\\n uint256 absXShift = 63;\\n if (absX < 0x1000000000000000000000000) { absX <<= 32; absXShift -= 32; }\\n if (absX < 0x10000000000000000000000000000) { absX <<= 16; absXShift -= 16; }\\n if (absX < 0x1000000000000000000000000000000) { absX <<= 8; absXShift -= 8; }\\n if (absX < 0x10000000000000000000000000000000) { absX <<= 4; absXShift -= 4; }\\n if (absX < 0x40000000000000000000000000000000) { absX <<= 2; absXShift -= 2; }\\n if (absX < 0x80000000000000000000000000000000) { absX <<= 1; absXShift -= 1; }\\n\\n uint256 resultShift = 0;\\n while (y != 0) {\\n require (absXShift < 64);\\n\\n if (y & 0x1 != 0) {\\n absResult = absResult * absX >> 127;\\n resultShift += absXShift;\\n if (absResult > 0x100000000000000000000000000000000) {\\n absResult >>= 1;\\n resultShift += 1;\\n }\\n }\\n absX = absX * absX >> 127;\\n absXShift <<= 1;\\n if (absX >= 0x100000000000000000000000000000000) {\\n absX >>= 1;\\n absXShift += 1;\\n }\\n\\n y >>= 1;\\n }\\n\\n require (resultShift < 64);\\n absResult >>= 64 - resultShift;\\n }\\n int256 result = negative ? -int256 (absResult) : int256 (absResult);\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate sqrt (x) rounding down. Revert if x < 0.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function sqrt (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x >= 0);\\n return int128 (sqrtu (uint256 (int256 (x)) << 64));\\n }\\n }\\n\\n /**\\n * Calculate binary logarithm of x. Revert if x <= 0.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function log_2 (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x > 0);\\n\\n int256 msb = 0;\\n int256 xc = x;\\n if (xc >= 0x10000000000000000) { xc >>= 64; msb += 64; }\\n if (xc >= 0x100000000) { xc >>= 32; msb += 32; }\\n if (xc >= 0x10000) { xc >>= 16; msb += 16; }\\n if (xc >= 0x100) { xc >>= 8; msb += 8; }\\n if (xc >= 0x10) { xc >>= 4; msb += 4; }\\n if (xc >= 0x4) { xc >>= 2; msb += 2; }\\n if (xc >= 0x2) msb += 1; // No need to shift xc anymore\\n\\n int256 result = msb - 64 << 64;\\n uint256 ux = uint256 (int256 (x)) << uint256 (127 - msb);\\n for (int256 bit = 0x8000000000000000; bit > 0; bit >>= 1) {\\n ux *= ux;\\n uint256 b = ux >> 255;\\n ux >>= 127 + b;\\n result += bit * int256 (b);\\n }\\n\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate natural logarithm of x. Revert if x <= 0.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function ln (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x > 0);\\n\\n return int128 (int256 (\\n uint256 (int256 (log_2 (x))) * 0xB17217F7D1CF79ABC9E3B39803F2F6AF >> 128));\\n }\\n }\\n\\n /**\\n * Calculate binary exponent of x. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function exp_2 (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x < 0x400000000000000000); // Overflow\\n\\n if (x < -0x400000000000000000) return 0; // Underflow\\n\\n uint256 result = 0x80000000000000000000000000000000;\\n\\n if (x & 0x8000000000000000 > 0)\\n result = result * 0x16A09E667F3BCC908B2FB1366EA957D3E >> 128;\\n if (x & 0x4000000000000000 > 0)\\n result = result * 0x1306FE0A31B7152DE8D5A46305C85EDEC >> 128;\\n if (x & 0x2000000000000000 > 0)\\n result = result * 0x1172B83C7D517ADCDF7C8C50EB14A791F >> 128;\\n if (x & 0x1000000000000000 > 0)\\n result = result * 0x10B5586CF9890F6298B92B71842A98363 >> 128;\\n if (x & 0x800000000000000 > 0)\\n result = result * 0x1059B0D31585743AE7C548EB68CA417FD >> 128;\\n if (x & 0x400000000000000 > 0)\\n result = result * 0x102C9A3E778060EE6F7CACA4F7A29BDE8 >> 128;\\n if (x & 0x200000000000000 > 0)\\n result = result * 0x10163DA9FB33356D84A66AE336DCDFA3F >> 128;\\n if (x & 0x100000000000000 > 0)\\n result = result * 0x100B1AFA5ABCBED6129AB13EC11DC9543 >> 128;\\n if (x & 0x80000000000000 > 0)\\n result = result * 0x10058C86DA1C09EA1FF19D294CF2F679B >> 128;\\n if (x & 0x40000000000000 > 0)\\n result = result * 0x1002C605E2E8CEC506D21BFC89A23A00F >> 128;\\n if (x & 0x20000000000000 > 0)\\n result = result * 0x100162F3904051FA128BCA9C55C31E5DF >> 128;\\n if (x & 0x10000000000000 > 0)\\n result = result * 0x1000B175EFFDC76BA38E31671CA939725 >> 128;\\n if (x & 0x8000000000000 > 0)\\n result = result * 0x100058BA01FB9F96D6CACD4B180917C3D >> 128;\\n if (x & 0x4000000000000 > 0)\\n result = result * 0x10002C5CC37DA9491D0985C348C68E7B3 >> 128;\\n if (x & 0x2000000000000 > 0)\\n result = result * 0x1000162E525EE054754457D5995292026 >> 128;\\n if (x & 0x1000000000000 > 0)\\n result = result * 0x10000B17255775C040618BF4A4ADE83FC >> 128;\\n if (x & 0x800000000000 > 0)\\n result = result * 0x1000058B91B5BC9AE2EED81E9B7D4CFAB >> 128;\\n if (x & 0x400000000000 > 0)\\n result = result * 0x100002C5C89D5EC6CA4D7C8ACC017B7C9 >> 128;\\n if (x & 0x200000000000 > 0)\\n result = result * 0x10000162E43F4F831060E02D839A9D16D >> 128;\\n if (x & 0x100000000000 > 0)\\n result = result * 0x100000B1721BCFC99D9F890EA06911763 >> 128;\\n if (x & 0x80000000000 > 0)\\n result = result * 0x10000058B90CF1E6D97F9CA14DBCC1628 >> 128;\\n if (x & 0x40000000000 > 0)\\n result = result * 0x1000002C5C863B73F016468F6BAC5CA2B >> 128;\\n if (x & 0x20000000000 > 0)\\n result = result * 0x100000162E430E5A18F6119E3C02282A5 >> 128;\\n if (x & 0x10000000000 > 0)\\n result = result * 0x1000000B1721835514B86E6D96EFD1BFE >> 128;\\n if (x & 0x8000000000 > 0)\\n result = result * 0x100000058B90C0B48C6BE5DF846C5B2EF >> 128;\\n if (x & 0x4000000000 > 0)\\n result = result * 0x10000002C5C8601CC6B9E94213C72737A >> 128;\\n if (x & 0x2000000000 > 0)\\n result = result * 0x1000000162E42FFF037DF38AA2B219F06 >> 128;\\n if (x & 0x1000000000 > 0)\\n result = result * 0x10000000B17217FBA9C739AA5819F44F9 >> 128;\\n if (x & 0x800000000 > 0)\\n result = result * 0x1000000058B90BFCDEE5ACD3C1CEDC823 >> 128;\\n if (x & 0x400000000 > 0)\\n result = result * 0x100000002C5C85FE31F35A6A30DA1BE50 >> 128;\\n if (x & 0x200000000 > 0)\\n result = result * 0x10000000162E42FF0999CE3541B9FFFCF >> 128;\\n if (x & 0x100000000 > 0)\\n result = result * 0x100000000B17217F80F4EF5AADDA45554 >> 128;\\n if (x & 0x80000000 > 0)\\n result = result * 0x10000000058B90BFBF8479BD5A81B51AD >> 128;\\n if (x & 0x40000000 > 0)\\n result = result * 0x1000000002C5C85FDF84BD62AE30A74CC >> 128;\\n if (x & 0x20000000 > 0)\\n result = result * 0x100000000162E42FEFB2FED257559BDAA >> 128;\\n if (x & 0x10000000 > 0)\\n result = result * 0x1000000000B17217F7D5A7716BBA4A9AE >> 128;\\n if (x & 0x8000000 > 0)\\n result = result * 0x100000000058B90BFBE9DDBAC5E109CCE >> 128;\\n if (x & 0x4000000 > 0)\\n result = result * 0x10000000002C5C85FDF4B15DE6F17EB0D >> 128;\\n if (x & 0x2000000 > 0)\\n result = result * 0x1000000000162E42FEFA494F1478FDE05 >> 128;\\n if (x & 0x1000000 > 0)\\n result = result * 0x10000000000B17217F7D20CF927C8E94C >> 128;\\n if (x & 0x800000 > 0)\\n result = result * 0x1000000000058B90BFBE8F71CB4E4B33D >> 128;\\n if (x & 0x400000 > 0)\\n result = result * 0x100000000002C5C85FDF477B662B26945 >> 128;\\n if (x & 0x200000 > 0)\\n result = result * 0x10000000000162E42FEFA3AE53369388C >> 128;\\n if (x & 0x100000 > 0)\\n result = result * 0x100000000000B17217F7D1D351A389D40 >> 128;\\n if (x & 0x80000 > 0)\\n result = result * 0x10000000000058B90BFBE8E8B2D3D4EDE >> 128;\\n if (x & 0x40000 > 0)\\n result = result * 0x1000000000002C5C85FDF4741BEA6E77E >> 128;\\n if (x & 0x20000 > 0)\\n result = result * 0x100000000000162E42FEFA39FE95583C2 >> 128;\\n if (x & 0x10000 > 0)\\n result = result * 0x1000000000000B17217F7D1CFB72B45E1 >> 128;\\n if (x & 0x8000 > 0)\\n result = result * 0x100000000000058B90BFBE8E7CC35C3F0 >> 128;\\n if (x & 0x4000 > 0)\\n result = result * 0x10000000000002C5C85FDF473E242EA38 >> 128;\\n if (x & 0x2000 > 0)\\n result = result * 0x1000000000000162E42FEFA39F02B772C >> 128;\\n if (x & 0x1000 > 0)\\n result = result * 0x10000000000000B17217F7D1CF7D83C1A >> 128;\\n if (x & 0x800 > 0)\\n result = result * 0x1000000000000058B90BFBE8E7BDCBE2E >> 128;\\n if (x & 0x400 > 0)\\n result = result * 0x100000000000002C5C85FDF473DEA871F >> 128;\\n if (x & 0x200 > 0)\\n result = result * 0x10000000000000162E42FEFA39EF44D91 >> 128;\\n if (x & 0x100 > 0)\\n result = result * 0x100000000000000B17217F7D1CF79E949 >> 128;\\n if (x & 0x80 > 0)\\n result = result * 0x10000000000000058B90BFBE8E7BCE544 >> 128;\\n if (x & 0x40 > 0)\\n result = result * 0x1000000000000002C5C85FDF473DE6ECA >> 128;\\n if (x & 0x20 > 0)\\n result = result * 0x100000000000000162E42FEFA39EF366F >> 128;\\n if (x & 0x10 > 0)\\n result = result * 0x1000000000000000B17217F7D1CF79AFA >> 128;\\n if (x & 0x8 > 0)\\n result = result * 0x100000000000000058B90BFBE8E7BCD6D >> 128;\\n if (x & 0x4 > 0)\\n result = result * 0x10000000000000002C5C85FDF473DE6B2 >> 128;\\n if (x & 0x2 > 0)\\n result = result * 0x1000000000000000162E42FEFA39EF358 >> 128;\\n if (x & 0x1 > 0)\\n result = result * 0x10000000000000000B17217F7D1CF79AB >> 128;\\n\\n result >>= uint256 (int256 (63 - (x >> 64)));\\n require (result <= uint256 (int256 (MAX_64x64)));\\n\\n return int128 (int256 (result));\\n }\\n }\\n\\n /**\\n * Calculate natural exponent of x. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function exp (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x < 0x400000000000000000); // Overflow\\n\\n if (x < -0x400000000000000000) return 0; // Underflow\\n\\n return exp_2 (\\n int128 (int256 (x) * 0x171547652B82FE1777D0FFDA0D23A7D12 >> 128));\\n }\\n }\\n\\n /**\\n * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit\\n * integer numbers. Revert on overflow or when y is zero.\\n *\\n * @param x unsigned 256-bit integer number\\n * @param y unsigned 256-bit integer number\\n * @return unsigned 64.64-bit fixed point number\\n */\\n function divuu (uint256 x, uint256 y) private pure returns (uint128) {\\n unchecked {\\n require (y != 0);\\n\\n uint256 result;\\n\\n if (x <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)\\n result = (x << 64) / y;\\n else {\\n uint256 msb = 192;\\n uint256 xc = x >> 192;\\n if (xc >= 0x100000000) { xc >>= 32; msb += 32; }\\n if (xc >= 0x10000) { xc >>= 16; msb += 16; }\\n if (xc >= 0x100) { xc >>= 8; msb += 8; }\\n if (xc >= 0x10) { xc >>= 4; msb += 4; }\\n if (xc >= 0x4) { xc >>= 2; msb += 2; }\\n if (xc >= 0x2) msb += 1; // No need to shift xc anymore\\n\\n result = (x << 255 - msb) / ((y - 1 >> msb - 191) + 1);\\n require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\\n\\n uint256 hi = result * (y >> 128);\\n uint256 lo = result * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\\n\\n uint256 xh = x >> 192;\\n uint256 xl = x << 64;\\n\\n if (xl < lo) xh -= 1;\\n xl -= lo; // We rely on overflow behavior here\\n lo = hi << 128;\\n if (xl < lo) xh -= 1;\\n xl -= lo; // We rely on overflow behavior here\\n\\n result += xh == hi >> 128 ? xl / y : 1;\\n }\\n\\n require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\\n return uint128 (result);\\n }\\n }\\n\\n /**\\n * Calculate sqrt (x) rounding down, where x is unsigned 256-bit integer\\n * number.\\n *\\n * @param x unsigned 256-bit integer number\\n * @return unsigned 128-bit integer number\\n */\\n function sqrtu (uint256 x) private pure returns (uint128) {\\n unchecked {\\n if (x == 0) return 0;\\n else {\\n uint256 xx = x;\\n uint256 r = 1;\\n if (xx >= 0x100000000000000000000000000000000) { xx >>= 128; r <<= 64; }\\n if (xx >= 0x10000000000000000) { xx >>= 64; r <<= 32; }\\n if (xx >= 0x100000000) { xx >>= 32; r <<= 16; }\\n if (xx >= 0x10000) { xx >>= 16; r <<= 8; }\\n if (xx >= 0x100) { xx >>= 8; r <<= 4; }\\n if (xx >= 0x10) { xx >>= 4; r <<= 2; }\\n if (xx >= 0x4) { r <<= 1; }\\n r = (r + x / r) >> 1;\\n r = (r + x / r) >> 1;\\n r = (r + x / r) >> 1;\\n r = (r + x / r) >> 1;\\n r = (r + x / r) >> 1;\\n r = (r + x / r) >> 1;\\n r = (r + x / r) >> 1; // Seven iterations should be enough\\n uint256 r1 = x / r;\\n return uint128 (r < r1 ? r : r1);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x1364fdc24192b982f647c7fc68dcb2f6fc1b5e201843e773144bd23a76cb3b97\",\"license\":\"BSD-4-Clause\"},\"contracts/Registries.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\n\\nimport \\\"./libraries/SyloUtils.sol\\\";\\nimport \\\"./interfaces/IRegistries.sol\\\";\\n\\n/**\\n * @notice This contract manages Registries for Nodes. A Registry is a\\n * set of parameters configured by the Node itself. A Node is required\\n * to have a valid Registry to be able to participate in the network.\\n */\\ncontract Registries is IRegistries, Initializable, Ownable2StepUpgradeable, IERC165 {\\n using ECDSA for bytes32;\\n\\n /**\\n * @notice ERC721 contract for bridged Seekers. Used for verifying ownership\\n * of a seeker.\\n */\\n IERC721 public _rootSeekers;\\n\\n /**\\n * @notice Tracks each Node's registry.\\n */\\n mapping(address => IRegistries.Registry) public registries;\\n\\n /**\\n * @notice Tracks the node address that each seeker id is registered with\\n */\\n mapping(uint256 => address) public seekerRegistration;\\n\\n /**\\n * @notice Tracks the address of every registered node.\\n */\\n address[] public nodes;\\n\\n /**\\n * @notice Tracks nonces used when registering the seeker account\\n * to prevent signature re-use.\\n */\\n mapping(bytes32 => address) private signatureNonces;\\n\\n /**\\n * @notice Payout percentage refers to the portion of a tickets reward\\n * that will be allocated to the Node's stakers. This is global, and is\\n * currently set for all Nodes.\\n */\\n uint32 public defaultPayoutPercentage;\\n\\n event DefaultPayoutPercentageUpdated(uint32 defaultPayoutPercentage);\\n\\n error NonceCannotBeReused();\\n error EndMustBeGreaterThanStart();\\n error PercentageCannotExceed100000();\\n error PublicEndpointCannotBeEmpty();\\n error SeekerAccountMustOwnSeekerId();\\n error SeekerAccountMustBeMsgSender();\\n error ProofNotSignedBySeekerAccount();\\n error RootSeekersCannotBeZeroAddress();\\n error SeekerAccountCannotBeZeroAddress();\\n error EndCannotExceedNumberOfNodes(uint256 nodeLength);\\n\\n function initialize(\\n IERC721 rootSeekers,\\n uint32 _defaultPayoutPercentage\\n ) external initializer {\\n if (address(rootSeekers) == address(0)) {\\n revert RootSeekersCannotBeZeroAddress();\\n }\\n if (_defaultPayoutPercentage > 100000) {\\n revert PercentageCannotExceed100000();\\n }\\n\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n _rootSeekers = rootSeekers;\\n defaultPayoutPercentage = _defaultPayoutPercentage;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IRegistries).interfaceId;\\n }\\n\\n /**\\n * @notice Set the global default payout percentage value. Only callable\\n * by the owner.\\n * @param _defaultPayoutPercentage The payout percentage as a value where the\\n * denominator is 10000.\\n */\\n function setDefaultPayoutPercentage(uint32 _defaultPayoutPercentage) external onlyOwner {\\n if (_defaultPayoutPercentage > 100000) {\\n revert PercentageCannotExceed100000();\\n }\\n\\n defaultPayoutPercentage = _defaultPayoutPercentage;\\n emit DefaultPayoutPercentageUpdated(_defaultPayoutPercentage);\\n }\\n\\n /**\\n * @notice Call this as a Node to set or update your Registry entry.\\n * @param publicEndpoint The public endpoint of your Node. Essential for\\n * clients to be able to retrieve additional information, such as\\n * an address to establish a p2p connection.\\n */\\n function register(string calldata publicEndpoint) external {\\n if (bytes(publicEndpoint).length == 0) {\\n revert PublicEndpointCannotBeEmpty();\\n }\\n\\n // This is the nodes first registration\\n if (bytes(registries[msg.sender].publicEndpoint).length == 0) {\\n nodes.push(msg.sender);\\n }\\n\\n registries[msg.sender].publicEndpoint = publicEndpoint;\\n }\\n\\n function setSeekerAccount(\\n address seekerAccount,\\n uint256 seekerId,\\n bytes32 nonce,\\n bytes calldata signature\\n ) external {\\n if (seekerAccount == address(0)) {\\n revert SeekerAccountCannotBeZeroAddress();\\n }\\n if (signatureNonces[nonce] != address(0)) {\\n revert NonceCannotBeReused();\\n }\\n\\n bytes memory proofMessage = getProofMessage(seekerId, msg.sender, nonce);\\n bytes32 ethProof = ECDSA.toEthSignedMessageHash(proofMessage);\\n\\n if (ECDSA.recover(ethProof, signature) != seekerAccount) {\\n revert ProofNotSignedBySeekerAccount();\\n }\\n\\n // Now verify the seeker account actually owns the seeker\\n address owner = _rootSeekers.ownerOf(seekerId);\\n\\n if (seekerAccount != owner) {\\n revert SeekerAccountMustOwnSeekerId();\\n }\\n\\n delete registries[seekerRegistration[seekerId]].seekerId;\\n delete registries[seekerRegistration[seekerId]].seekerAccount;\\n\\n registries[msg.sender].seekerAccount = seekerAccount;\\n registries[msg.sender].seekerId = seekerId;\\n\\n seekerRegistration[seekerId] = msg.sender;\\n\\n signatureNonces[nonce] = seekerAccount;\\n }\\n\\n function revokeSeekerAccount(address node) external {\\n Registry storage registry = registries[node];\\n\\n if (registry.seekerAccount != msg.sender) {\\n revert SeekerAccountMustBeMsgSender();\\n }\\n\\n delete registry.seekerAccount;\\n delete seekerRegistration[registry.seekerId];\\n delete registry.seekerId;\\n }\\n\\n /**\\n * @notice Retrieve the registry associated with a Node.\\n * @param account The address of the Node.\\n * @return The Node's Registry.\\n */\\n function getRegistry(address account) external view returns (Registry memory) {\\n return registries[account];\\n }\\n\\n /**\\n * @notice Retrieve all registered nodes.\\n * @return An array of node addresses.\\n */\\n function getNodes() external view returns (address[] memory) {\\n return nodes;\\n }\\n\\n /**\\n * @notice Retrieves a list of registries. Takes in a\\n * a start and end indices to allow pagination.\\n * @param start The start index which is inclusive.\\n * @param end The end index which is exclusive.\\n * @return An array of Registries.\\n */\\n function getRegistries(\\n uint256 start,\\n uint256 end\\n ) external view returns (address[] memory, Registry[] memory) {\\n uint256 nodesLength = nodes.length;\\n\\n if (end <= start) {\\n revert EndMustBeGreaterThanStart();\\n }\\n if (end > nodesLength) {\\n revert EndCannotExceedNumberOfNodes(nodesLength);\\n }\\n\\n address[] memory _nodes = new address[](end - start);\\n Registry[] memory _registries = new Registry[](_nodes.length);\\n\\n for (uint256 i = start; i < end; ++i) {\\n _nodes[i - start] = nodes[i];\\n _registries[i - start] = registries[nodes[i]];\\n }\\n\\n return (_nodes, _registries);\\n }\\n\\n /**\\n * @notice Returns the total number of registered nodes.\\n * @return The number of registered nodes.\\n */\\n function getTotalNodes() external view returns (uint256) {\\n return nodes.length;\\n }\\n\\n /**\\n * @notice Helper function for deriving the proof message used to\\n * validate seeker ownership.\\n * @param seekerId The tokenId of the seeker used for operation.\\n * @param node The address of the node which that will be operated\\n * by the specified seeker.\\n * @param nonce The nonce used for this message.\\n */\\n function getProofMessage(\\n uint256 seekerId,\\n address node,\\n bytes32 nonce\\n ) public pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n unicode\\\"\\ud83e\\udd16 Hi frend! \\ud83e\\udd16\\\\n\\\\n\\ud83d\\udcdc Signing this message proves that you're the owner of this Seeker NFT and allows your Seeker to be used to operate your Seeker's Node. It's a simple but important step to ensure smooth operation.\\\\n\\\\nThis request will not trigger a blockchain transaction or cost any gas fees.\\\\n\\\\n\\ud83d\\udd25 Your node's address: \\\",\\n Strings.toHexString(uint256(uint160(node)), 20),\\n unicode\\\"\\\\n\\\\n\\ud83c\\udd94 Your seeker id: \\\",\\n Strings.toString(seekerId),\\n unicode\\\"\\\\n\\\\n\\ud83d\\udce6 A unique random value which secures this message: \\\",\\n Strings.toHexString(uint256(nonce), 32)\\n );\\n }\\n}\\n\",\"keccak256\":\"0x492be9b17a6624c5aa9de7b7d93f2ab1d7e6ee6443e60d4f036f7a7c670c343b\",\"license\":\"Apache-2.0\"},\"contracts/SeekerPowerOracle.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\n\\nimport \\\"./interfaces/ISeekerPowerOracle.sol\\\";\\n\\n/**\\n * @notice Acts as a source of information for Seeker Powers. Allows setting\\n * a Seeker's power level via a restricted oracle account call. Seeker Power can also\\n * be set by any account if the correct Oracle signature proof is provided.\\n */\\ncontract SeekerPowerOracle is ISeekerPowerOracle, Initializable, Ownable2StepUpgradeable, ERC165 {\\n /**\\n * @notice The oracle account. This contract accepts any attestations of\\n * Seeker power that have been signed by this account.\\n */\\n address public oracle;\\n\\n /**\\n * @notice Tracks nonce used when register the Seeker power to\\n * prevent signature re-use.\\n */\\n mapping(bytes32 => address) private proofNonces;\\n\\n /**\\n * @notice Tracks the set of Seeker Power levels.\\n */\\n mapping(uint256 => uint256) public seekerPowers;\\n\\n event SeekerPowerUpdated(uint256 indexed seekerId, uint256 indexed power);\\n\\n error UnauthorizedRegisterSeekerPowerCall();\\n error NonceCannotBeReused();\\n\\n function initialize(address _oracle) external initializer {\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n oracle = _oracle;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(ISeekerPowerOracle).interfaceId;\\n }\\n\\n /**\\n * @notice Sets the oracle account.\\n * @param _oracle The oracle account.\\n */\\n function setOracle(address _oracle) external onlyOwner {\\n oracle = _oracle;\\n }\\n\\n /**\\n * @notice Registers a Seeker's power level. Only callable by the\\n * owner or the oracle account.\\n * @param seekerId The id of the Seeker.\\n * @param power The power level of the Seeker.\\n */\\n function registerSeekerPowerRestricted(uint256 seekerId, uint256 power) external {\\n if (msg.sender != oracle) {\\n revert UnauthorizedRegisterSeekerPowerCall();\\n }\\n\\n seekerPowers[seekerId] = power;\\n emit SeekerPowerUpdated(seekerId, power);\\n }\\n\\n /**\\n * @notice Registers a Seeker's power level. Callable by any account\\n * but requires a proof signed by the oracle.\\n * @param seekerId The id of the Seeker.\\n * @param power The power level of the Seeker.\\n */\\n function registerSeekerPower(\\n uint256 seekerId,\\n uint256 power,\\n bytes32 nonce,\\n bytes calldata proof\\n ) external {\\n if (proofNonces[nonce] != address(0)) {\\n revert NonceCannotBeReused();\\n }\\n\\n bytes memory proofMessage = getProofMessage(seekerId, power, nonce);\\n bytes32 ecdsaHash = ECDSA.toEthSignedMessageHash(proofMessage);\\n\\n if (ECDSA.recover(ecdsaHash, proof) != oracle) {\\n revert UnauthorizedRegisterSeekerPowerCall();\\n }\\n\\n seekerPowers[seekerId] = power;\\n proofNonces[nonce] = oracle;\\n\\n emit SeekerPowerUpdated(seekerId, power);\\n }\\n\\n /**\\n * @notice Retrieves a Seeker's stored power level.\\n * @param seekerId The id of the Seeker.\\n */\\n function getSeekerPower(uint256 seekerId) external view returns (uint256) {\\n return seekerPowers[seekerId];\\n }\\n\\n /**\\n * @notice Constructs a proof message for the oracle to sign.\\n * @param seekerId The id of the Seeker.\\n * @param power The power level of the Seeker.\\n */\\n function getProofMessage(\\n uint256 seekerId,\\n uint256 power,\\n bytes32 nonce\\n ) public pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n Strings.toString(seekerId),\\n \\\":\\\",\\n Strings.toString(power),\\n \\\":\\\",\\n Strings.toHexString(uint256(nonce), 32)\\n );\\n }\\n}\\n\",\"keccak256\":\"0xbd652d364b9b0742083dc6dcce34b58aefddda5335afdcb3f8d42358cb89b18a\",\"license\":\"Apache-2.0\"},\"contracts/SyloToken.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/ERC20.sol\\\";\\n\\ncontract SyloToken is ERC20 {\\n constructor() ERC20(\\\"Sylo\\\", \\\"SYLO\\\") {\\n _mint(msg.sender, 10_000_000_000 ether);\\n }\\n}\\n\",\"keccak256\":\"0x75fda7d129e02669cd691691c14fccd1cdac23b833d7a25e899801865d58ef26\",\"license\":\"Apache-2.0\"},\"contracts/epochs/EpochsManager.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\n\\nimport \\\"../Registries.sol\\\";\\nimport \\\"../staking/Directory.sol\\\";\\nimport \\\"../interfaces/epochs/IEpochsManager.sol\\\";\\nimport \\\"../payments/ticketing/TicketingParameters.sol\\\";\\n\\ncontract EpochsManager is IEpochsManager, Initializable, Ownable2StepUpgradeable, ERC165 {\\n Directory public _directory;\\n\\n Registries public _registries;\\n\\n IERC721 public _rootSeekers;\\n\\n TicketingParameters public _ticketingParameters;\\n\\n /**\\n * @notice Track seekers that have joined for a specific epoch.\\n */\\n mapping(uint256 => mapping(uint256 => address)) public activeSeekers;\\n\\n // Define all Epoch specific parameters here.\\n // When initializing an epoch, these parameters are read,\\n // along with parameters from the other contracts to create the\\n // new epoch.\\n\\n /**\\n * @notice A mapping of all epochs that have been initialized.\\n */\\n mapping(uint256 => Epoch) public epochs;\\n\\n /**\\n * @notice The block number since the first epoch can be initialized.\\n */\\n uint256 public initialEpoch;\\n\\n /**\\n * @notice The duration in blocks an epoch will last for.\\n */\\n uint256 public epochDuration;\\n\\n /**\\n * @notice The value of the integer used as the current\\n * epoch's identifier. This value is incremented as each epoch\\n * is initialized.\\n */\\n uint256 public currentIteration;\\n\\n event NewEpoch(uint256 indexed epochId);\\n event EpochJoined(uint256 indexed epochId, address indexed node, uint256 indexed seekerId);\\n event InitialEpochUpdated(uint256 initialEpoch);\\n event EpochDurationUpdated(uint256 epochDuration);\\n\\n error SeekerOwnerMismatch();\\n error InitialEpochCannotBeZero();\\n error EpochDurationCannotBeZero();\\n error DirectoryCannotBeZeroAddress();\\n error RegistriesCannotBeZeroAddress();\\n error RootSeekerCannotBeZeroAddress();\\n error EpochHasNotEnded(uint256 epochId);\\n error SeekerAccountCannotBeZeroAddress();\\n error TicketingParametersCannotBeZeroAddress();\\n error SeekerAlreadyJoinedEpoch(uint256 epochId, uint256 seekerId);\\n error InitialEpochNotYetReady(uint256 expectedBlock, uint256 currentBlock);\\n\\n function initialize(\\n IERC721 rootSeekers,\\n Directory directory,\\n Registries registries,\\n TicketingParameters ticketingParameters,\\n uint256 _initialEpoch,\\n uint256 _epochDuration\\n ) external initializer {\\n if (address(rootSeekers) == address(0)) {\\n revert RootSeekerCannotBeZeroAddress();\\n }\\n\\n SyloUtils.validateContractInterface(\\n \\\"Directory\\\",\\n address(directory),\\n type(IDirectory).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"Registries\\\",\\n address(registries),\\n type(IRegistries).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"TicketingParameters\\\",\\n address(ticketingParameters),\\n type(ITicketingParameters).interfaceId\\n );\\n\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n _rootSeekers = rootSeekers;\\n _directory = directory;\\n _registries = registries;\\n _ticketingParameters = ticketingParameters;\\n\\n initialEpoch = _initialEpoch;\\n epochDuration = _epochDuration;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IEpochsManager).interfaceId;\\n }\\n\\n /**\\n * @notice Call this to initialize the next epoch. On success, a `NewEpoch` event\\n * will be emitted.\\n * @dev The function will read the current set of network parameters, and store\\n * the parameters in a new Epoch struct. The end block of the current epoch\\n * will also be set to a non-zero value.\\n */\\n function initializeEpoch() external returns (uint256) {\\n if (currentIteration == 0 && initialEpoch > block.number) {\\n revert InitialEpochNotYetReady(initialEpoch, block.number);\\n }\\n\\n Epoch storage current = epochs[currentIteration];\\n\\n uint256 end = current.startBlock + current.duration;\\n if (end > block.number) {\\n revert EpochHasNotEnded(currentIteration);\\n }\\n\\n (\\n uint256 faceValue,\\n uint128 baseLiveWinProb,\\n uint128 expiredWinProb,\\n uint256 ticketDuration,\\n uint32 decayRate\\n ) = _ticketingParameters.getTicketingParameters();\\n\\n uint256 nextEpochId = getNextEpochId();\\n\\n epochs[nextEpochId] = Epoch(\\n block.number,\\n epochDuration,\\n 0,\\n _registries.defaultPayoutPercentage(),\\n decayRate,\\n faceValue,\\n baseLiveWinProb,\\n expiredWinProb,\\n ticketDuration\\n );\\n\\n current.endBlock = block.number;\\n\\n currentIteration = nextEpochId;\\n\\n _directory.setCurrentDirectory(nextEpochId);\\n\\n emit NewEpoch(nextEpochId);\\n\\n return nextEpochId;\\n }\\n\\n /**\\n * @notice Set the first epoch starting block. Only callable by the owner.\\n * @param _initialEpoch The block number when the first epoch can be initialized.\\n */\\n function setInitialEpoch(uint256 _initialEpoch) external onlyOwner {\\n if (_initialEpoch == 0) {\\n revert InitialEpochCannotBeZero();\\n }\\n initialEpoch = _initialEpoch;\\n emit InitialEpochUpdated(_initialEpoch);\\n }\\n\\n /**\\n * @notice Set the epoch duration. Will take effect in the next epoch. Only\\n * callable by the owner.\\n * @param _epochDuration The epoch duration in number of blocks.\\n */\\n function setEpochDuration(uint256 _epochDuration) external onlyOwner {\\n if (_epochDuration == 0) {\\n revert EpochDurationCannotBeZero();\\n }\\n epochDuration = _epochDuration;\\n emit EpochDurationUpdated(epochDuration);\\n }\\n\\n /**\\n * @notice Retrieve the parameters for the current epoch.\\n * @return The current Epoch parameters.\\n */\\n function getCurrentActiveEpoch() external view returns (uint256, Epoch memory) {\\n return (currentIteration, epochs[currentIteration]);\\n }\\n\\n /**\\n * @notice Nodes should call this to join the next epoch. It will\\n * initialize the next reward pool and set the stake for the next directory.\\n * @dev This is a proxy function for `initalizeNextRewardPool` and\\n * `joinNextDirectory`.\\n */\\n function joinNextEpoch() external {\\n Registries.Registry memory registry = _registries.getRegistry(msg.sender);\\n\\n // validate the node's seeker ownership\\n if (registry.seekerAccount == address(0)) {\\n revert SeekerAccountCannotBeZeroAddress();\\n }\\n\\n uint256 seekerId = registry.seekerId;\\n\\n address owner = _rootSeekers.ownerOf(seekerId);\\n if (registry.seekerAccount != owner) {\\n revert SeekerOwnerMismatch();\\n }\\n\\n uint256 nextEpoch = getNextEpochId();\\n if (activeSeekers[nextEpoch][seekerId] != address(0)) {\\n revert SeekerAlreadyJoinedEpoch(nextEpoch, seekerId);\\n }\\n\\n activeSeekers[nextEpoch][seekerId] = msg.sender;\\n\\n _directory._rewardsManager().initializeNextRewardPool(msg.sender);\\n _directory.joinNextDirectory(msg.sender, seekerId);\\n\\n emit EpochJoined(nextEpoch, msg.sender, seekerId);\\n }\\n\\n /**\\n * @notice Retrieve the epoch parameter for the given id.\\n * @param epochId The id of the epoch to retrieve.\\n * @return The epoch parameters associated with the id.\\n */\\n function getEpoch(uint256 epochId) external view returns (Epoch memory) {\\n return epochs[epochId];\\n }\\n\\n /**\\n * @notice Retrieve the integer value that will be used for the\\n * next epoch id.\\n * @return The next epoch id identifier.\\n */\\n function getNextEpochId() public view returns (uint256) {\\n return currentIteration + 1;\\n }\\n}\\n\",\"keccak256\":\"0xc759afdc6022b1490447d2c3c3b4454c59cc86f59fe62cece92764b787a87030\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/IRegistries.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface IRegistries {\\n struct Registry {\\n // Percentage of a tickets value that will be rewarded to\\n // delegated stakers expressed as a fraction of 100000.\\n // This value is currently locked to the default payout percentage\\n // until epochs are implemented.\\n uint32 payoutPercentage;\\n // Public http/s endpoint to retrieve additional metadata\\n // about the node.\\n // The current metadata schema is as follows:\\n // { name: string, multiaddrs: string[] }\\n string publicEndpoint;\\n // The account which owns a seeker that will be used to\\n // operate the Node for this registry.\\n address seekerAccount;\\n // The id of the seeker used to operate the node. The owner\\n // of this id should be the seeker account.\\n uint256 seekerId;\\n }\\n\\n function register(string calldata publicEndpoint) external;\\n\\n function setDefaultPayoutPercentage(uint32 _defaultPayoutPercentage) external;\\n\\n function setSeekerAccount(\\n address seekerAccount,\\n uint256 seekerId,\\n bytes32 nonce,\\n bytes calldata signature\\n ) external;\\n\\n function revokeSeekerAccount(address node) external;\\n\\n function getRegistry(address account) external view returns (Registry memory);\\n\\n function getNodes() external view returns (address[] memory);\\n\\n function getRegistries(\\n uint256 start,\\n uint256 end\\n ) external view returns (address[] memory, Registry[] memory);\\n\\n function getTotalNodes() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x524252752fd14eb66b047848eaaffbc138c6b049f99f2c2f0a5c6a7a4d6e6e36\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/ISeekerPowerOracle.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface ISeekerPowerOracle {\\n function setOracle(address oracle) external;\\n\\n function registerSeekerPowerRestricted(uint256 seekerId, uint256 power) external;\\n\\n function registerSeekerPower(\\n uint256 seekerId,\\n uint256 power,\\n bytes32 nonce,\\n bytes calldata proof\\n ) external;\\n\\n function getSeekerPower(uint256 seekerId) external view returns (uint256);\\n\\n function getProofMessage(\\n uint256 seekerId,\\n uint256 power,\\n bytes32 nonce\\n ) external pure returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x26fb3e81dabde31b8730d4c601c51c881e018b540f19f7c599a8a7f9b8c05523\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/epochs/IEpochsManager.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface IEpochsManager {\\n /**\\n * @dev This struct will hold all network parameters that will be static\\n * for the entire epoch. This value will be stored in a mapping, where the\\n * key is the current epoch id.\\n */\\n struct Epoch {\\n // time related variables\\n uint256 startBlock; // Block the epoch was initialized\\n uint256 duration; // Minimum time epoch will be alive measured in number of blocks\\n uint256 endBlock; // Block the epoch ended (and when the next epoch was initialized)\\n // Zero here represents the epoch has not yet ended.\\n\\n // registry variables\\n uint32 defaultPayoutPercentage;\\n // ticketing variables\\n uint32 decayRate;\\n uint256 faceValue;\\n uint128 baseLiveWinProb;\\n uint128 expiredWinProb;\\n uint256 ticketDuration;\\n }\\n\\n function initializeEpoch() external returns (uint256);\\n\\n function setEpochDuration(uint256 _epochDuration) external;\\n\\n function getCurrentActiveEpoch() external view returns (uint256, Epoch memory);\\n\\n function joinNextEpoch() external;\\n\\n function getEpoch(uint256 epochId) external view returns (Epoch memory);\\n\\n function getNextEpochId() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xeef359833a448742f4eca45ac04eeea0c3e74eb21d3a36bfdae3a1bb7f81e0b5\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/payments/ticketing/IRewardsManager.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface IRewardsManager {\\n /**\\n * @dev This type will hold the necessary information for delegated stakers\\n * to make reward claims against their Node. Every Node will initialize\\n * and store a new Reward Pool for each epoch they participate in.\\n */\\n struct RewardPool {\\n // Tracks the balance of the reward pool owed to the stakers\\n uint256 stakersRewardTotal;\\n // Tracks the block number this reward pool was initialized\\n uint256 initializedAt;\\n // The total active stake for the node for will be the sum of the\\n // stakes owned by its delegators and the node's own stake.\\n uint256 totalActiveStake;\\n // track the cumulative reward factor as of the time the first ticket\\n // for this pool was redeemed\\n int128 initialCumulativeRewardFactor;\\n }\\n\\n struct LastClaim {\\n // The epoch the claim was made.\\n uint256 claimedAt;\\n // The stake at the time the claim was made. This is tracked as\\n // rewards can only be claimed after an epoch has ended, but the\\n // user's stake may have changed by then. This field tracks the\\n // staking value before the change so the reward for that epoch\\n // can be manually calculated.\\n uint256 stake;\\n }\\n\\n function getRewardPool(\\n uint256 epochId,\\n address stakee\\n ) external view returns (RewardPool memory);\\n\\n function getRewardPoolKey(uint256 epochId, address stakee) external pure returns (bytes32);\\n\\n function getRewardPoolStakersTotal(\\n uint256 epochId,\\n address stakee\\n ) external view returns (uint256);\\n\\n function getRewardPoolActiveStake(\\n uint256 epochId,\\n address stakee\\n ) external view returns (uint256);\\n\\n function getPendingRewards(address stakee) external view returns (uint256);\\n\\n function getLastClaim(address stakee, address staker) external view returns (LastClaim memory);\\n\\n function getTotalEpochRewards(uint256 epochId) external view returns (uint256);\\n\\n function getTotalEpochStakingRewards(uint256 epochId) external view returns (uint256);\\n\\n function initializeNextRewardPool(address stakee) external;\\n\\n function incrementRewardPool(address stakee, uint256 amount) external;\\n\\n function claimStakingRewards(address stakee) external returns (uint256);\\n\\n function updatePendingRewards(address stakee, address staker) external;\\n}\\n\",\"keccak256\":\"0x21b8d7f96073802ef4ec87fa15da5fcfd2c1d5e2bf9d6e17583406028e7b31d1\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/payments/ticketing/ITicketingParameters.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface ITicketingParameters {\\n function setFaceValue(uint256 _faceValue) external;\\n\\n function setBaseLiveWinProb(uint128 _baseLiveWinProb) external;\\n\\n function setExpiredWinProb(uint128 _expiredWinProb) external;\\n\\n function setDecayRate(uint32 _decayRate) external;\\n\\n function setTicketDuration(uint256 _ticketDuration) external;\\n\\n function getTicketingParameters()\\n external\\n view\\n returns (uint256, uint128, uint128, uint256, uint32);\\n}\\n\",\"keccak256\":\"0x6fa269d73176bd6543c190b070597fde50b91efdaa724b567bad29c9fbfa908a\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/staking/IDirectory.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface IDirectory {\\n /**\\n * @dev A DirectoryEntry will be stored for every node that joins the\\n * network in a specific epoch. The entry will contain the stakee's\\n * address, and a boundary value which is a sum of the current directory's\\n * total stake, and the current stakee's total stake.\\n */\\n struct DirectoryEntry {\\n address stakee;\\n uint256 boundary;\\n }\\n\\n /**\\n * @dev An EpochDirectory will be stored for every epoch. The\\n * directory will be constructed piece by piece as Nodes join,\\n * each adding their own directory entry based on their current\\n * stake value.\\n */\\n struct EpochDirectory {\\n DirectoryEntry[] entries;\\n mapping(address => uint256) stakes;\\n uint256 totalStake;\\n }\\n\\n function setCurrentDirectory(uint256 epochId) external;\\n\\n function joinNextDirectory(address stakee, uint256 seekerId) external;\\n\\n function scan(uint128 point) external view returns (address stakee);\\n\\n function scanWithEpochId(\\n uint128 point,\\n uint256 epochId\\n ) external view returns (address stakee);\\n\\n function getTotalStakeForStakee(\\n uint256 epochId,\\n address stakee\\n ) external view returns (uint256);\\n\\n function getTotalStake(uint256 epochId) external view returns (uint256);\\n\\n function getEntries(\\n uint256 epochId\\n ) external view returns (address[] memory, uint256[] memory);\\n}\\n\",\"keccak256\":\"0xfacfde1140082a99e6096222a0714bf9e532224a04c594096211c115ab4927f6\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/staking/IStakingManager.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface IStakingManager {\\n /**\\n * For every Node, there will be a mapping of the staker to a\\n * StakeEntry. The stake entry tracks the amount of stake in SOLO,\\n * and also when the stake was updated.\\n */\\n struct StakeEntry {\\n uint256 amount;\\n // Block number this entry was updated at\\n uint256 updatedAt;\\n // Epoch this entry was updated. The stake will become active\\n // in the following epoch\\n uint256 epochId;\\n }\\n\\n /**\\n * Every Node must have stake in order to participate in the Epoch.\\n * Stake can be provided by the Node itself or by other accounts in\\n * the network.\\n */\\n struct Stake {\\n // Track each stake entry associated to a node\\n mapping(address => StakeEntry) stakeEntries;\\n // The total stake held by this contract for a node,\\n // which will be the sum of all addStake and unlockStake calls\\n uint256 totalManagedStake;\\n }\\n\\n /**\\n * This struct will track stake that is in the process of unlocking.\\n */\\n struct Unlock {\\n uint256 amount; // Amount of stake unlocking\\n uint256 unlockAt; // Block number the stake becomes withdrawable\\n }\\n\\n function setUnlockDuration(uint256 _unlockDuration) external;\\n\\n function setMinimumStakeProportion(uint32 _minimumStakeProportion) external;\\n\\n function addStake(uint256 amount, address stakee) external;\\n\\n function unlockStake(uint256 amount, address stakee) external returns (uint256);\\n\\n function withdrawStake(address stakee) external;\\n\\n function cancelUnlocking(uint256 amount, address stakee) external;\\n\\n function calculateCapacityFromSeekerPower(uint256 seekerId) external view returns (uint256);\\n\\n function calculateMaxAdditionalDelegatedStake(address stakee) external view returns (uint256);\\n\\n function getTotalManagedStake() external view returns (uint256);\\n\\n function getStakeEntry(\\n address stakee,\\n address staker\\n ) external view returns (StakeEntry memory);\\n\\n function getStakeeTotalManagedStake(address stakee) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xb3c89c77822db30a1382ec7d11902db579cd48acc36aef965a92b47f8e1164a3\",\"license\":\"Apache-2.0\"},\"contracts/libraries/Manageable.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an list of public managers who may be added or removed.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyManager`, which can be applied to your functions to restrict their use to\\n * other contracts which have explicitly been added.\\n */\\nabstract contract Manageable is Ownable2StepUpgradeable {\\n /**\\n * @dev Tracks the managers added to this contract, where they key is the\\n * address of the managing contract, and the value is the block the manager was added in.\\n * We use this mapping to restrict access to those functions in a similar\\n * fashion to the onlyOwner construct.\\n */\\n mapping(address => uint256) public managers;\\n\\n error OnlyManagers();\\n error ManagerCannotBeZeroAddress();\\n\\n /**\\n * @notice Adds a manager to this contract. Only callable by the owner.\\n * @param manager The address of the manager contract.\\n */\\n function addManager(address manager) external onlyOwner {\\n if (manager == address(0)) {\\n revert ManagerCannotBeZeroAddress();\\n }\\n managers[manager] = block.number;\\n }\\n\\n /**\\n * @notice Removes a manager from this contract. Only callable by the owner.\\n * @param manager The address of the manager contract.\\n */\\n function removeManager(address manager) external onlyOwner {\\n delete managers[manager];\\n }\\n\\n /**\\n * @dev This modifier allows us to specify that certain contracts have\\n * special privileges to call restricted functions.\\n */\\n modifier onlyManager() {\\n if (managers[msg.sender] == 0) {\\n revert OnlyManagers();\\n }\\n _;\\n }\\n\\n // Reserve storage slots for future variables\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xeaf4d3bf238df7e61eaf6903ba7ed54af58a17090fe6197aae3f62d025027db2\",\"license\":\"Apache-2.0\"},\"contracts/libraries/SyloUtils.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/utils/math/SafeCast.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\n\\nerror ContractNameCannotBeEmpty();\\nerror InterfaceIdCannotBeZeroBytes();\\nerror TargetContractCannotBeZeroAddress(string name);\\nerror TargetNotSupportInterface(string name, bytes4 interfaceId);\\n\\nlibrary SyloUtils {\\n /**\\n * @dev The maximum possible SYLO that exists in the network.\\n */\\n uint256 public constant MAX_SYLO = 10_000_000_000 ether;\\n\\n /**\\n * @dev Percentages are expressed as a ratio where 100000 is the denominator.\\n * A large denominator allows for more precision, e.g representing 12.5%\\n * can be done as 12500 / 100000\\n */\\n uint32 public constant PERCENTAGE_DENOMINATOR = 100000;\\n\\n /**\\n * @dev Multiply a value by a given percentage. Converts the provided\\n * uint128 value to uint256 to avoid any reverts on overflow.\\n * @param value The value to multiply.\\n * @param percentage The percentage, as a ratio of 10000.\\n */\\n function percOf(uint128 value, uint32 percentage) internal pure returns (uint256) {\\n return (uint256(value) * percentage) / PERCENTAGE_DENOMINATOR;\\n }\\n\\n /**\\n * @dev Return a fraction as a percentage.\\n * @param numerator The numerator limited to a uint128 value to prevent\\n * phantom overflow.\\n * @param denominator The denominator.\\n * @return The percentage, as a ratio of 10000.\\n */\\n function asPerc(uint128 numerator, uint256 denominator) internal pure returns (uint32) {\\n return SafeCast.toUint32((uint256(numerator) * PERCENTAGE_DENOMINATOR) / denominator);\\n }\\n\\n /**\\n * @dev Validate that a contract implements a given interface.\\n * @param name The name of the contract, used in error messages.\\n * @param target The address of the contract.\\n * @param interfaceId The interface ID to check.\\n */\\n function validateContractInterface(\\n string memory name,\\n address target,\\n bytes4 interfaceId\\n ) internal view {\\n if (bytes(name).length == 0) {\\n revert ContractNameCannotBeEmpty();\\n }\\n if (target == address(0)) {\\n revert TargetContractCannotBeZeroAddress(name);\\n }\\n if (interfaceId == bytes4(0)) {\\n revert InterfaceIdCannotBeZeroBytes();\\n }\\n if (!ERC165(target).supportsInterface(interfaceId)) {\\n revert TargetNotSupportInterface(name, interfaceId);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa5bb1a5b9f8135b5fec1dfa183fab8f6685a4eb6d9daba23864a7d49d01dc8a3\",\"license\":\"Apache-2.0\"},\"contracts/payments/ticketing/RewardsManager.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"abdk-libraries-solidity/ABDKMath64x64.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/math/SafeCast.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\n\\nimport \\\"../../libraries/SyloUtils.sol\\\";\\nimport \\\"../../libraries/Manageable.sol\\\";\\nimport \\\"../../epochs/EpochsManager.sol\\\";\\nimport \\\"../../staking/StakingManager.sol\\\";\\nimport \\\"../../interfaces/epochs/IEpochsManager.sol\\\";\\nimport \\\"../../interfaces/staking/IStakingManager.sol\\\";\\nimport \\\"../../interfaces/payments/ticketing/IRewardsManager.sol\\\";\\n\\n/**\\n * @notice Handles epoch based reward pools that are incremented from redeeming tickets.\\n * Nodes use this contract to set up their reward pool for the next epoch,\\n * and stakers use this contract to track and claim staking rewards.\\n * @dev After deployment, the SyloTicketing contract should be\\n * set up as a manager to be able to call certain restricted functions.\\n */\\ncontract RewardsManager is IRewardsManager, Initializable, Manageable, ERC165 {\\n uint256 internal constant ONE_SYLO = 1 ether;\\n\\n // 64x64 Fixed point representation of 1 SYLO (10**18 >> 64)\\n int128 internal constant ONE_SYLO_FIXED = 18446744073709551616000000000000000000;\\n\\n uint256 internal constant MAX_INT64 = 9223372036854775807;\\n\\n /** ERC20 Sylo token contract. */\\n IERC20 public _token;\\n\\n /** Sylo Staking Manager contract. */\\n StakingManager public _stakingManager;\\n\\n /** Sylo Epochs Manager. */\\n EpochsManager public _epochsManager;\\n\\n /**\\n * @dev Each node will manage a cumulative reward factor (CRF) that is incremented\\n * whenever a ticket is redeemed. This factor acts as a single value\\n * that can be used to calculate any particular staker's reward share. This\\n * prevents the need to individually track each staker's proportion, and also allows\\n * a claim calculation to be performed without iterating through every epoch.\\n *\\n * The CRF is calculated as CRF = CRF + Reward / TotalStake.\\n */\\n mapping(address => int128) private cumulativeRewardFactors;\\n\\n /**\\n * @notice Tracks the last epoch a delegated staker made a reward claim in.\\n * The key to this mapping is a hash of the Node's address and the delegated\\n * stakers address.\\n */\\n mapping(bytes32 => LastClaim) public lastClaims;\\n\\n /**\\n * @notice Tracks each Nodes total pending rewards in SOLOs. This\\n * value is accumulated as Node's redeem tickets. Rewards are pending if the\\n * distribution amongst the stakers has not been accounted for yet. Pending rewards\\n * are transferred to unclaimed rewards once the the staker's share has been\\n * calculated.\\n */\\n mapping(address => uint256) public pendingRewards;\\n\\n /**\\n * @notice Tracks rewards for stakers after the stakers share has been calculated,\\n * but has not actually been claimed by the staker.\\n * The node fee reward is also added to the node's unclaimedStakingRewards.\\n */\\n mapping(bytes32 => uint256) public unclaimedStakingRewards;\\n\\n /**\\n * @notice Tracks each Node's most recently active reward pool\\n */\\n mapping(address => uint256) public latestActiveRewardPools;\\n\\n /**\\n * @notice Tracks total accumulated rewards in each epoch\\n */\\n mapping(uint256 => uint256) public totalEpochRewards;\\n\\n /**\\n * @notice Tracks total accumulated staking rewards in each epoch\\n */\\n mapping(uint256 => uint256) public totalEpochStakingRewards;\\n\\n /**\\n * @notice Tracks each reward pool initialized by a Node. The key to this map\\n * is derived from the epochId and the Node's address.\\n */\\n mapping(bytes32 => RewardPool) public rewardPools;\\n\\n error NoRewardToClaim();\\n error AmountCannotBeZero();\\n error RewardPoolNotExist();\\n error RewardPoolAlreadyExist();\\n error DoNotAllowZeroAddress();\\n error TokenCannotBeZeroAddress();\\n error NoStakeToCreateRewardPool();\\n error StakeeCannotBeZeroAddress();\\n error StakerCannotBeZeroAddress();\\n error StakerKeyCannotBeZeroBytes();\\n error InvalidFixedPointResult();\\n\\n function initialize(\\n IERC20 token,\\n StakingManager stakingManager,\\n EpochsManager epochsManager\\n ) external initializer {\\n if (address(token) == address(0)) {\\n revert TokenCannotBeZeroAddress();\\n }\\n\\n SyloUtils.validateContractInterface(\\n \\\"StakingManager\\\",\\n address(stakingManager),\\n type(IStakingManager).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"EpochsManager\\\",\\n address(epochsManager),\\n type(IEpochsManager).interfaceId\\n );\\n\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n _token = token;\\n _epochsManager = epochsManager;\\n _stakingManager = stakingManager;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IRewardsManager).interfaceId;\\n }\\n\\n /**\\n * @notice Returns the key used to index a reward pool. The key is a hash of\\n * the epochId and Node's address.\\n * @param epochId The epoch ID the reward pool was created in.\\n * @param stakee The address of the Node.\\n * @return A byte-array representing the reward pool key.\\n */\\n function getRewardPoolKey(uint256 epochId, address stakee) public pure returns (bytes32) {\\n return keccak256(abi.encodePacked(epochId, stakee));\\n }\\n\\n /**\\n * @notice Returns the key used to index staking claims. The key is a hash of\\n * the Node's address and the staker's address.\\n * @param stakee The address of the Node.\\n * @param staker The address of the stake.\\n * @return A byte-array representing the key.\\n */\\n function getStakerKey(address stakee, address staker) public pure returns (bytes32) {\\n return keccak256(abi.encodePacked(stakee, staker));\\n }\\n\\n /**\\n * @notice Retrieve the reward pool initialized by the given node, at the specified\\n * epoch.\\n * @param epochId The ID of the epoch the reward pool was initialized in.\\n * @param stakee The address of the Node.\\n * @return The reward pool.\\n */\\n function getRewardPool(\\n uint256 epochId,\\n address stakee\\n ) external view returns (RewardPool memory) {\\n return rewardPools[getRewardPoolKey(epochId, stakee)];\\n }\\n\\n /**\\n * @notice Retrieve the total accumulated reward that will be distributed to a Node's\\n * delegated stakers for a given epoch.\\n * @param epochId The ID of the epoch the reward pool was initialized in.\\n * @param stakee The address of the Node.\\n * @return The total accumulated staker reward in SOLO.\\n */\\n function getRewardPoolStakersTotal(\\n uint256 epochId,\\n address stakee\\n ) external view returns (uint256) {\\n return rewardPools[getRewardPoolKey(epochId, stakee)].stakersRewardTotal;\\n }\\n\\n /**\\n * @notice Retrieve the total active stake that will be used for a Node's reward\\n * pool in a given epoch.\\n * @param epochId The ID of the epoch the reward pool was initialized in.\\n * @param stakee The address of the Node.\\n * @return The total active stake for that reward pool in SOLO.\\n */\\n function getRewardPoolActiveStake(\\n uint256 epochId,\\n address stakee\\n ) external view returns (uint256) {\\n return rewardPools[getRewardPoolKey(epochId, stakee)].totalActiveStake;\\n }\\n\\n /**\\n * @notice Retrieve the total pending staking reward allocated to a Node's\\n * stakers.\\n * @param stakee The address of the Node.\\n * @return The total pending staking reward in SOLO.\\n */\\n function getPendingRewards(address stakee) external view returns (uint256) {\\n return pendingRewards[stakee];\\n }\\n\\n /**\\n * @notice Retrieves the ID of the epoch in which a staker last made their\\n * staking claim.\\n * @param stakee The address of the Node.\\n * @param staker The address of the staker.\\n * @return The ID of the epoch.\\n */\\n function getLastClaim(\\n address stakee,\\n address staker\\n ) external view returns (LastClaim memory) {\\n return lastClaims[getStakerKey(stakee, staker)];\\n }\\n\\n /**\\n * @notice Retrieves the total accumulated rewards for a specific epoch.\\n * @param epochId The epoch id.\\n * @return The total reward in that epoch, including staking rewards and fee\\n * reward.\\n */\\n function getTotalEpochRewards(uint256 epochId) external view returns (uint256) {\\n return totalEpochRewards[epochId];\\n }\\n\\n /**\\n * @notice Retrieves the total accumulated rewards for stakers in a specific epoch.\\n * @param epochId The epoch id.\\n * @return The total staking reward in that epoch.\\n */\\n function getTotalEpochStakingRewards(uint256 epochId) external view returns (uint256) {\\n return totalEpochStakingRewards[epochId];\\n }\\n\\n /**\\n * @notice This is used by Nodes to initialize their reward pool for\\n * the next epoch. This function will revert if the caller has no stake, or\\n * if the reward pool has already been initialized. The total active stake\\n * for the next reward pool is calculated by summing up the total managed\\n * stake held by the RewardsManager contract.\\n */\\n function initializeNextRewardPool(address stakee) external onlyManager {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n\\n uint256 nextEpochId = _epochsManager.getNextEpochId();\\n\\n RewardPool storage nextRewardPool = rewardPools[getRewardPoolKey(nextEpochId, stakee)];\\n if (nextRewardPool.initializedAt != 0) {\\n revert RewardPoolAlreadyExist();\\n }\\n\\n uint256 totalStake = _stakingManager.getStakeeTotalManagedStake(stakee);\\n if (totalStake == 0) {\\n revert NoStakeToCreateRewardPool();\\n }\\n\\n nextRewardPool.totalActiveStake = totalStake;\\n\\n nextRewardPool.initializedAt = block.number;\\n }\\n\\n /**\\n * @dev This function should be called by the Ticketing contract when a\\n * ticket is successfully redeemed. The face value of the ticket\\n * should be split between incrementing the node's reward balance,\\n * and the reward balance for the node's delegated stakers. The face value\\n * will be added to the current reward pool's balance. This function will\\n * fail if the Ticketing contract has not been set as a manager.\\n * @param stakee The address of the Node.\\n * @param amount The face value of the ticket in SOLO.\\n */\\n function incrementRewardPool(address stakee, uint256 amount) external onlyManager {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n if (amount == 0) {\\n revert AmountCannotBeZero();\\n }\\n\\n (uint256 epochId, IEpochsManager.Epoch memory currentEpoch) = _epochsManager\\n .getCurrentActiveEpoch();\\n\\n RewardPool storage rewardPool = rewardPools[getRewardPoolKey(epochId, stakee)];\\n if (rewardPool.initializedAt == 0) {\\n revert RewardPoolNotExist();\\n }\\n\\n // Update the latest active reward pool for the node to be this pool\\n if (latestActiveRewardPools[stakee] < epochId) {\\n latestActiveRewardPools[stakee] = epochId;\\n }\\n\\n uint256 stakersReward = SyloUtils.percOf(\\n SafeCast.toUint128(amount),\\n currentEpoch.defaultPayoutPercentage\\n );\\n\\n // transfer the node's fee reward to it's unclaimed reward value\\n unclaimedStakingRewards[getStakerKey(stakee, stakee)] =\\n unclaimedStakingRewards[getStakerKey(stakee, stakee)] +\\n (amount - stakersReward);\\n\\n // update the value of the reward owed to the stakers\\n pendingRewards[stakee] = pendingRewards[stakee] + stakersReward;\\n\\n // if this is the first ticket redeemed for this reward, set the initial\\n // CRF value for this pool\\n if (rewardPool.stakersRewardTotal == 0) {\\n rewardPool.initialCumulativeRewardFactor = cumulativeRewardFactors[stakee];\\n }\\n\\n rewardPool.stakersRewardTotal = rewardPool.stakersRewardTotal + stakersReward;\\n\\n // We preemptively prevent an overflow revert with the abdk library.\\n // Dividing the stakers reward with the pool's total active\\n // stake may produce a value that is greater than the maximum possible\\n // 64.64 fixed point value.\\n // This error is incredibly niche and unlikely to happen, so we just\\n // revert here as well (with a named error) and remediation involves\\n // just increasing the amount of stake a node has.\\n if (rewardPool.totalActiveStake * MAX_INT64 < stakersReward) {\\n revert InvalidFixedPointResult();\\n }\\n\\n cumulativeRewardFactors[stakee] = ABDKMath64x64.add(\\n cumulativeRewardFactors[stakee],\\n ABDKMath64x64.div(\\n toFixedPointSYLO(stakersReward),\\n toFixedPointSYLO(rewardPool.totalActiveStake)\\n )\\n );\\n\\n totalEpochRewards[epochId] = totalEpochRewards[epochId] + amount;\\n totalEpochStakingRewards[epochId] = totalEpochStakingRewards[epochId] + stakersReward;\\n }\\n\\n /**\\n * @dev This function utilizes the cumulative reward factors, and the staker's\\n * value in stake to calculate the staker's share of the pending reward.\\n */\\n function calculatePendingClaim(\\n bytes32 stakerKey,\\n address stakee,\\n address staker\\n ) internal view returns (uint256) {\\n uint256 claim = calculateInitialClaim(stakerKey, stakee);\\n\\n // find the first reward pool where their stake was active and had\\n // generated rewards\\n uint256 activeAt;\\n RewardPool memory initialActivePool;\\n\\n uint256 currentEpochId = _epochsManager.currentIteration();\\n\\n for (uint256 i = lastClaims[stakerKey].claimedAt + 1; i < currentEpochId; ++i) {\\n initialActivePool = rewardPools[getRewardPoolKey(i, stakee)];\\n // check if node initialized a reward pool for this epoch and\\n // gained rewards\\n if (initialActivePool.initializedAt > 0 && initialActivePool.stakersRewardTotal > 0) {\\n activeAt = i;\\n break;\\n }\\n }\\n\\n if (activeAt == 0) {\\n return claim;\\n }\\n\\n IStakingManager.StakeEntry memory stakeEntry = _stakingManager.getStakeEntry(\\n stakee,\\n staker\\n );\\n\\n // We convert the staker amount to SYLO as the maximum uint256 value that\\n // can be used for the fixed point representation is 2^64-1.\\n int128 initialStake = toFixedPointSYLO(stakeEntry.amount);\\n\\n int128 initialCumulativeRewardFactor = initialActivePool.initialCumulativeRewardFactor;\\n\\n int128 finalCumulativeRewardFactor = getFinalCumulativeRewardFactor(\\n stakee,\\n currentEpochId\\n );\\n\\n return\\n claim +\\n fromFixedPointSYLO(\\n ABDKMath64x64.mul(\\n initialStake,\\n ABDKMath64x64.sub(finalCumulativeRewardFactor, initialCumulativeRewardFactor)\\n )\\n );\\n }\\n\\n /**\\n * Manually calculates the reward claim for the first epoch the claim is being\\n * made for. This manual calculation is necessary as claims are only made up\\n * to the previous epoch.\\n */\\n function calculateInitialClaim(\\n bytes32 stakerKey,\\n address stakee\\n ) internal view returns (uint256) {\\n LastClaim memory lastClaim = lastClaims[stakerKey];\\n\\n // if we have already made a claim up to the previous epoch, then\\n // there is no need to calculate the initial claim\\n if (_epochsManager.currentIteration() == lastClaim.claimedAt) {\\n return 0;\\n }\\n\\n RewardPool memory firstRewardPool = rewardPools[\\n getRewardPoolKey(lastClaim.claimedAt, stakee)\\n ];\\n\\n // if there was no reward pool initialized for the first epoch,\\n // then there is no need to calculate the initial claim\\n if (firstRewardPool.totalActiveStake == 0) {\\n return 0;\\n }\\n\\n return\\n (firstRewardPool.stakersRewardTotal * lastClaim.stake) /\\n firstRewardPool.totalActiveStake;\\n }\\n\\n /**\\n * Determines the cumulative reward factor to use for claim calculations. The\\n * CRF will depend on when the Node last initialized a reward pool, and also when\\n * the staker last made their claim.\\n */\\n function getFinalCumulativeRewardFactor(\\n address stakee,\\n uint256 currentEpochId\\n ) internal view returns (int128) {\\n int128 finalCumulativeRewardFactor;\\n\\n // Get the cumulative reward factor for the Node\\n // for the start of this epoch, since we only perform\\n // calculations up to the end of the previous epoch.\\n if (latestActiveRewardPools[stakee] < currentEpochId) {\\n // If the Node has not been active, then the final\\n // cumulative reward factor will just be the current one.\\n finalCumulativeRewardFactor = cumulativeRewardFactors[stakee];\\n } else {\\n // We are calculating the claim for an active epoch, the\\n // final cumulative reward factor will be taken from the start of this\\n // epoch (end of previous epoch).\\n RewardPool storage latestRewardPool = rewardPools[\\n getRewardPoolKey(latestActiveRewardPools[stakee], stakee)\\n ];\\n finalCumulativeRewardFactor = latestRewardPool.initialCumulativeRewardFactor;\\n }\\n\\n return finalCumulativeRewardFactor;\\n }\\n\\n /**\\n * @notice Call this function to calculate the total reward owed to a staker.\\n * This value will include all epochs since the last claim was made up to\\n * the previous epoch. This will also add any pending rewards to the\\n * final value as well.\\n * @dev This function will utilize the cumulative reward factor to perform the\\n * calculation, keeping the gas cost scaling of this function to a constant value.\\n * @param stakee The address of the Node.\\n * @param staker The address of the staker.\\n * @return The value of the reward owed to the staker in SOLO.\\n */\\n function calculateStakerClaim(address stakee, address staker) public view returns (uint256) {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n if (staker == address(0)) {\\n revert StakerCannotBeZeroAddress();\\n }\\n\\n bytes32 stakerKey = getStakerKey(stakee, staker);\\n uint256 pendingClaim = calculatePendingClaim(stakerKey, stakee, staker);\\n\\n return pendingClaim + unclaimedStakingRewards[stakerKey];\\n }\\n\\n /**\\n * Helper function to convert a uint256 value in SOLOs to a 64.64 fixed point\\n * representation in SYLOs while avoiding any possibility of overflow.\\n * Any remainders from converting SOLO to SYLO is explicitly handled to mitigate\\n * precision loss. The error when using this function is [-1/2^64, 0].\\n */\\n function toFixedPointSYLO(uint256 amount) internal pure returns (int128) {\\n int128 fullSylos = ABDKMath64x64.fromUInt(amount / ONE_SYLO);\\n int128 fracSylos = ABDKMath64x64.fromUInt(amount % ONE_SYLO); // remainder\\n\\n return ABDKMath64x64.add(fullSylos, ABDKMath64x64.div(fracSylos, ONE_SYLO_FIXED));\\n }\\n\\n /**\\n * Helper function to convert a 64.64 fixed point value in SYLOs to a uint256\\n * representation in SOLOs while avoiding any possibility of overflow.\\n */\\n function fromFixedPointSYLO(int128 amount) internal pure returns (uint256) {\\n uint256 fullSylos = ABDKMath64x64.toUInt(amount);\\n uint256 fullSolos = fullSylos * ONE_SYLO;\\n\\n // calculate the value lost when converting the fixed point amount to a uint\\n int128 fracSylos = ABDKMath64x64.sub(amount, ABDKMath64x64.fromUInt(fullSylos));\\n uint256 fracSolos = ABDKMath64x64.toUInt(ABDKMath64x64.mul(fracSylos, ONE_SYLO_FIXED));\\n\\n return fullSolos + fracSolos;\\n }\\n\\n /**\\n * @notice Call this function to claim rewards as a staker. The\\n * SYLO tokens will be transferred to the caller's account. This function will\\n * fail if there exists no reward to claim. Note: Calling this will remove\\n * the current unclaimed reward from being used as stake in the next round.\\n * @param stakee The address of the Node to claim against.\\n */\\n function claimStakingRewards(address stakee) external returns (uint256) {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n\\n bytes32 stakerKey = getStakerKey(stakee, msg.sender);\\n uint256 pendingReward = calculatePendingClaim(stakerKey, stakee, msg.sender);\\n\\n uint256 totalClaim = pendingReward + unclaimedStakingRewards[stakerKey];\\n if (totalClaim == 0) {\\n revert NoRewardToClaim();\\n }\\n\\n delete unclaimedStakingRewards[stakerKey];\\n pendingRewards[stakee] = pendingRewards[stakee] - pendingReward;\\n\\n updateLastClaim(stakee, msg.sender);\\n\\n SafeERC20.safeTransfer(_token, msg.sender, totalClaim);\\n\\n return totalClaim;\\n }\\n\\n /**\\n * @notice This is called by the staking manager to transfer pending rewards\\n * to unclaimed rewards for a staker. This is required as the last used CRF\\n * needs to be updated whenever stake changes.\\n */\\n function updatePendingRewards(address stakee, address staker) external onlyManager {\\n bytes32 stakerKey = getStakerKey(stakee, staker);\\n uint256 pendingReward = calculatePendingClaim(stakerKey, stakee, staker);\\n\\n pendingRewards[stakee] = pendingRewards[stakee] - pendingReward;\\n\\n unclaimedStakingRewards[stakerKey] = unclaimedStakingRewards[stakerKey] + pendingReward;\\n\\n updateLastClaim(stakee, staker);\\n }\\n\\n function updateLastClaim(address stakee, address staker) internal {\\n IStakingManager.StakeEntry memory stakeEntry = _stakingManager.getStakeEntry(\\n stakee,\\n staker\\n );\\n lastClaims[getStakerKey(stakee, staker)] = LastClaim(\\n _epochsManager.currentIteration(),\\n stakeEntry.amount\\n );\\n }\\n}\\n\",\"keccak256\":\"0x906af015c975637b6a99d70795b0652f6e28aaa66e5c64a4bae34bff14c99551\",\"license\":\"Apache-2.0\"},\"contracts/payments/ticketing/TicketingParameters.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\n\\nimport \\\"../../libraries/SyloUtils.sol\\\";\\nimport \\\"../../interfaces/payments/ticketing/ITicketingParameters.sol\\\";\\n\\n/**\\n * @dev Persists the parameters for the ticketing mechanism. This contract is\\n * read by the EpochManager. Extracting the parameters into another\\n * contract is necessary to avoid a cyclic dependency between the ticketing\\n * and epoch contracts.\\n */\\ncontract TicketingParameters is\\n ITicketingParameters,\\n Initializable,\\n Ownable2StepUpgradeable,\\n ERC165\\n{\\n /** @notice The value of a winning ticket in SOLO. */\\n uint256 public faceValue;\\n\\n /**\\n * @notice The probability of a ticket winning during the start of its lifetime.\\n * This is a uint128 value representing the numerator in the probability\\n * ratio where 2^128 - 1 is the denominator.\\n */\\n uint128 public baseLiveWinProb;\\n\\n /**\\n * @notice The probability of a ticket winning after it has expired.\\n * This is a uint128 value representing the numerator in the probability\\n * ratio where 2^128 - 1 is the denominator. Note: Redeeming expired\\n * tickets is currently not supported.\\n */\\n uint128 public expiredWinProb;\\n\\n /**\\n * @notice The length in blocks before a ticket is considered expired.\\n * The default initialization value is 80,000. This equates\\n * to roughly two weeks (15s per block).\\n */\\n uint256 public ticketDuration;\\n\\n /**\\n * @notice A percentage value representing the proportion of the base win\\n * probability that will be decayed once a ticket has expired.\\n * Example: 80% decayRate indicates that a ticket will decay down to 20% of its\\n * base win probability upon reaching the block before its expiry.\\n * The value is expressed as a fraction of 100000.\\n */\\n uint32 public decayRate;\\n\\n event FaceValueUpdated(uint256 faceValue);\\n event BaseLiveWinProbUpdated(uint128 baseLiveWinprob);\\n event ExpiredWinProbUpdated(uint128 expiredWinProb);\\n event TicketDurationUpdated(uint256 ticketDuration);\\n event DecayRateUpdated(uint32 decayRate);\\n\\n error FaceValueCannotBeZero();\\n error TicketDurationCannotBeZero();\\n\\n function initialize(\\n uint256 _faceValue,\\n uint128 _baseLiveWinProb,\\n uint128 _expiredWinProb,\\n uint32 _decayRate,\\n uint256 _ticketDuration\\n ) external initializer {\\n if (_faceValue == 0) {\\n revert FaceValueCannotBeZero();\\n }\\n if (_ticketDuration == 0) {\\n revert TicketDurationCannotBeZero();\\n }\\n\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n faceValue = _faceValue;\\n baseLiveWinProb = _baseLiveWinProb;\\n expiredWinProb = _expiredWinProb;\\n decayRate = _decayRate;\\n ticketDuration = _ticketDuration;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(ITicketingParameters).interfaceId;\\n }\\n\\n /**\\n * @notice Set the face value for tickets in SOLO. Only callable by\\n * the contract owner.\\n * @param _faceValue The face value to set in SOLO.\\n */\\n function setFaceValue(uint256 _faceValue) external onlyOwner {\\n if (_faceValue == 0) {\\n revert FaceValueCannotBeZero();\\n }\\n\\n faceValue = _faceValue;\\n emit FaceValueUpdated(_faceValue);\\n }\\n\\n /**\\n * @notice Set the base live win probability of a ticket. Only callable by\\n * the contract owner.\\n * @param _baseLiveWinProb The probability represented as a value\\n * between 0 to 2**128 - 1.\\n */\\n function setBaseLiveWinProb(uint128 _baseLiveWinProb) external onlyOwner {\\n baseLiveWinProb = _baseLiveWinProb;\\n emit BaseLiveWinProbUpdated(_baseLiveWinProb);\\n }\\n\\n /**\\n * @notice Set the expired win probability of a ticket. Only callable by\\n * the contract owner.\\n * @param _expiredWinProb The probability represented as a value\\n * between 0 to 2**128 - 1.\\n */\\n function setExpiredWinProb(uint128 _expiredWinProb) external onlyOwner {\\n expiredWinProb = _expiredWinProb;\\n emit ExpiredWinProbUpdated(_expiredWinProb);\\n }\\n\\n /**\\n * @notice Set the decay rate of a ticket. Only callable by the\\n * the contract owner.\\n * @param _decayRate The decay rate as a percentage, where the\\n * denominator is 10000.\\n */\\n function setDecayRate(uint32 _decayRate) external onlyOwner {\\n decayRate = _decayRate;\\n emit DecayRateUpdated(_decayRate);\\n }\\n\\n /**\\n * @notice Set the ticket duration of a ticket. Only callable by the\\n * contract owner.\\n * @param _ticketDuration The duration of a ticket in number of blocks.\\n */\\n function setTicketDuration(uint256 _ticketDuration) external onlyOwner {\\n if (_ticketDuration == 0) {\\n revert TicketDurationCannotBeZero();\\n }\\n\\n ticketDuration = _ticketDuration;\\n emit TicketDurationUpdated(_ticketDuration);\\n }\\n\\n /**\\n * @notice Retrieve the current ticketing parameters.\\n * @return faceValue The face value of a ticket in SOLO.\\n * @return baseLiveWinProb The base live win probability of a ticket.\\n * @return expiredWinProb The expired win probability of a ticket.\\n * @return ticketDuration The duration of a ticket in number of blocks.\\n * @return decayRate The decay rate of a ticket.\\n */\\n function getTicketingParameters()\\n external\\n view\\n returns (uint256, uint128, uint128, uint256, uint32)\\n {\\n return (faceValue, baseLiveWinProb, expiredWinProb, ticketDuration, decayRate);\\n }\\n}\\n\",\"keccak256\":\"0x44b4c2eb70c0583f888ff8fca7ad21b084b6c58a453b7dd914275ccabed98ec0\",\"license\":\"Apache-2.0\"},\"contracts/staking/Directory.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/utils/math/Math.sol\\\";\\n\\nimport \\\"./StakingManager.sol\\\";\\nimport \\\"../libraries/SyloUtils.sol\\\";\\nimport \\\"../libraries/Manageable.sol\\\";\\nimport \\\"../interfaces/staking/IDirectory.sol\\\";\\nimport \\\"../payments/ticketing/RewardsManager.sol\\\";\\n\\n/**\\n * @notice The Directory contract constructs and manages a structure holding the current stakes,\\n * which is queried against using the scan function. The scan function allows submitting\\n * random points which will return a staked node's address in proportion to the stake it has.\\n */\\ncontract Directory is IDirectory, Initializable, Manageable, IERC165 {\\n /** Sylo Staking Manager contract */\\n StakingManager public _stakingManager;\\n\\n /** Sylo Rewards Manager contract */\\n RewardsManager public _rewardsManager;\\n\\n /**\\n * @notice The epoch ID of the current directory.\\n */\\n uint256 public currentDirectory;\\n\\n /**\\n * @notice Tracks every directory, which will be indexed by an epoch ID\\n */\\n mapping(uint256 => EpochDirectory) public directories;\\n\\n event CurrentDirectoryUpdated(uint256 indexed currentDirectory);\\n\\n error NoStakeToJoinEpoch();\\n error StakeeAlreadyJoinedEpoch();\\n error StakeeCannotBeZeroAddress();\\n error NoJoiningStakeToJoinEpoch();\\n\\n function initialize(\\n StakingManager stakingManager,\\n RewardsManager rewardsManager\\n ) external initializer {\\n SyloUtils.validateContractInterface(\\n \\\"StakingManager\\\",\\n address(stakingManager),\\n type(IStakingManager).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"RewardsManager\\\",\\n address(rewardsManager),\\n type(IRewardsManager).interfaceId\\n );\\n\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n _stakingManager = stakingManager;\\n _rewardsManager = rewardsManager;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IDirectory).interfaceId;\\n }\\n\\n /**\\n * @notice This function should be called when a new epoch is initialized.\\n * This will set the current directory to the specified epoch. This is only\\n * callable by the owner of this contract, which should be the EpochsManager\\n * contract.\\n * @dev After deployment, the EpochsManager should immediately be set as\\n * the owner.\\n * @param epochId The ID of the specified epoch.\\n */\\n function setCurrentDirectory(uint256 epochId) external onlyManager {\\n currentDirectory = epochId;\\n emit CurrentDirectoryUpdated(epochId);\\n }\\n\\n /**\\n * @notice This function is called by the epochs manager as a prerequisite to when the node joins the next epoch.\\n * @param stakee The address of the node.\\n * @param seekerId The seekerId of the Seeker that the node is\\n * registered with when joining the epoch. It is used to determine the nodes\\n * staking capacity based on its seeker power.\\n *\\n * @dev This will construct the directory as nodes join. The directory is constructed\\n * by creating a boundary value which is a sum of the current directory's total stake, and\\n * the current stakee's total stake, and pushing the new boundary into the entries array.\\n * The previous boundary and the current boundary essentially create a range, where if a\\n * random point were to fall within that range, it would belong to the respective stakee.\\n * The boundary value grows in size as each stakee joins, thus the directory array\\n * always remains sorted. This allows us to perform a binary search on the directory.\\n *\\n * Example\\n *\\n * Stakes: [ Alice/20, Bob/10, Carl/40, Dave/25 ]\\n * TotalStake: 95\\n *\\n * EpochDirectory:\\n *\\n * |-----------|------|----------------|--------|\\n * Alice/20 Bob/30 Carl/70 Dave/95\\n *\\n * The amount of stake that a node will join a directory with is dependent on its\\n * different capacity values. There are two distinct capacity values, one\\n * calculated from the seeker power, and another from the minimum stake\\n * proportion. The final staking amount will not exceed either capacities,\\n * and in the case that the current total stake exceeds both, then the final\\n * will be the minimum of the two values.\\n */\\n function joinNextDirectory(address stakee, uint256 seekerId) external onlyManager {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n\\n uint256 nextEpochId = currentDirectory + 1;\\n\\n uint256 totalStake = _stakingManager.getStakeeTotalManagedStake(stakee);\\n if (totalStake == 0) {\\n revert NoStakeToJoinEpoch();\\n }\\n\\n // staking capacity based on seeker power\\n uint256 seekerStakingCapacity = _stakingManager.calculateCapacityFromSeekerPower(seekerId);\\n\\n // staking capacity based on the min staking proportion constant\\n uint256 minProportionStakingCapacity = _stakingManager.calculateCapacityFromMinStakingProportion(stakee);\\n\\n uint256 joiningStake;\\n if (totalStake > seekerStakingCapacity && totalStake > minProportionStakingCapacity) {\\n joiningStake = Math.min(seekerStakingCapacity, minProportionStakingCapacity);\\n } else if (totalStake > seekerStakingCapacity) {\\n joiningStake = seekerStakingCapacity;\\n } else if (totalStake > minProportionStakingCapacity) {\\n joiningStake = minProportionStakingCapacity;\\n } else { // uncapped\\n joiningStake = totalStake;\\n }\\n\\n if (joiningStake == 0) {\\n revert NoJoiningStakeToJoinEpoch();\\n }\\n\\n if (directories[nextEpochId].stakes[stakee] > 0) {\\n revert StakeeAlreadyJoinedEpoch();\\n }\\n\\n uint256 nextBoundary = directories[nextEpochId].totalStake + joiningStake;\\n\\n directories[nextEpochId].entries.push(DirectoryEntry(stakee, nextBoundary));\\n directories[nextEpochId].stakes[stakee] = joiningStake;\\n directories[nextEpochId].totalStake = nextBoundary;\\n }\\n\\n /**\\n * @notice Call this to perform a stake-weighted scan to find the Node assigned\\n * to the given point of the current directory.\\n * @param point The point, which will usually be a hash of a public key.\\n */\\n function scan(uint128 point) external view returns (address stakee) {\\n return _scan(point, currentDirectory);\\n }\\n\\n /**\\n * @notice Call this to perform a stake-weighted scan to find the Node assigned\\n * to the given point of the requested directory.\\n * @param point The point, which will usually be a hash of a public key.\\n * @param epochId The epoch id associated with the directory to scan.\\n */\\n function scanWithEpochId(\\n uint128 point,\\n uint256 epochId\\n ) external view returns (address stakee) {\\n return _scan(point, epochId);\\n }\\n\\n /**\\n * @notice Call this to perform a stake-weighted scan to find the Node assigned\\n * to the given point of the requested directory (internal).\\n * @dev The current implementation will perform a binary search through\\n * the directory. This can allow gas costs to be low if this needs to be\\n * used in a transaction.\\n * @param point The point, which will usually be a hash of a public key.\\n * @param epochId The epoch id associated with the directory to scan.\\n */\\n function _scan(uint128 point, uint256 epochId) internal view returns (address stakee) {\\n uint256 entryLength = directories[epochId].entries.length;\\n\\n if (entryLength == 0) {\\n return address(0);\\n }\\n\\n // Staking all the Sylo would only be 94 bits, so multiplying this with\\n // a uint128 cannot overflow a uint256.\\n uint256 expectedVal = (directories[epochId].totalStake * uint256(point)) >> 128;\\n\\n uint256 left;\\n uint256 right = entryLength - 1;\\n\\n // perform a binary search through the directory\\n uint256 lower;\\n uint256 upper;\\n uint256 index;\\n\\n while (left <= right) {\\n index = (left + right) >> 1;\\n\\n lower = index == 0 ? 0 : directories[epochId].entries[index - 1].boundary;\\n upper = directories[epochId].entries[index].boundary;\\n\\n if (expectedVal >= lower && expectedVal < upper) {\\n return directories[epochId].entries[index].stakee;\\n } else if (expectedVal < lower) {\\n right = index - 1;\\n } else {\\n // expectedVal >= upper\\n left = index + 1;\\n }\\n }\\n }\\n\\n /**\\n * @notice Retrieve the total stake a Node has for the directory in the\\n * specified epoch.\\n * @param epochId The ID of the epoch.\\n * @param stakee The address of the Node.\\n * @return The amount of stake the Node has for the given directory in SOLO.\\n */\\n function getTotalStakeForStakee(\\n uint256 epochId,\\n address stakee\\n ) external view returns (uint256) {\\n return directories[epochId].stakes[stakee];\\n }\\n\\n /**\\n * @notice Retrieve the total stake for a directory in the specified epoch, which\\n * will be the sum of the stakes for all Nodes participating in that epoch.\\n * @param epochId The ID of the epoch.\\n * @return The total amount of stake in SOLO.\\n */\\n function getTotalStake(uint256 epochId) external view returns (uint256) {\\n return directories[epochId].totalStake;\\n }\\n\\n /**\\n * @notice Retrieve all entries for a directory in a specified epoch.\\n * @return An array of all the directory entries.\\n */\\n function getEntries(\\n uint256 epochId\\n ) external view returns (address[] memory, uint256[] memory) {\\n uint256 entryLength = directories[epochId].entries.length;\\n\\n address[] memory stakees = new address[](entryLength);\\n uint256[] memory boundaries = new uint256[](entryLength);\\n\\n DirectoryEntry memory entry;\\n DirectoryEntry[] memory entries = directories[epochId].entries;\\n\\n for (uint256 i; i < entryLength; ++i) {\\n entry = entries[i];\\n stakees[i] = entry.stakee;\\n boundaries[i] = entry.boundary;\\n }\\n return (stakees, boundaries);\\n }\\n}\\n\",\"keccak256\":\"0x98a344ba0403e7c5e92fe89a67799ec6583767bfa82a76e66c3b6e84ce519e59\",\"license\":\"Apache-2.0\"},\"contracts/staking/StakingManager.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\n\\nimport \\\"../SyloToken.sol\\\";\\nimport \\\"../libraries/SyloUtils.sol\\\";\\nimport \\\"../SeekerPowerOracle.sol\\\";\\nimport \\\"../epochs/EpochsManager.sol\\\";\\nimport \\\"../payments/ticketing/RewardsManager.sol\\\";\\nimport \\\"../interfaces/staking/IStakingManager.sol\\\";\\n\\n/**\\n * @notice Manages stakes and delegated stakes for Nodes. Holding\\n * staked Sylo is necessary for a Node to participate in the\\n * Sylo Network. The stake is used in stake-weighted scan function,\\n * and delegated stakers are rewarded on a pro-rata basis.\\n */\\ncontract StakingManager is IStakingManager, Initializable, Ownable2StepUpgradeable, ERC165 {\\n /** ERC 20 compatible token we are dealing with */\\n IERC20 public _token;\\n\\n /**\\n * @notice Rewards Manager contract. Any changes to stake will automatically\\n * trigger a claim to any outstanding rewards.\\n */\\n RewardsManager public _rewardsManager;\\n\\n EpochsManager public _epochsManager;\\n\\n SeekerPowerOracle public _seekerPowerOracle;\\n\\n /**\\n * @notice Tracks the managed stake for every Node.\\n */\\n mapping(address => Stake) public stakes;\\n\\n /** @notice Tracks overall total stake held by this contract */\\n uint256 public totalManagedStake;\\n\\n /**\\n * @notice Tracks funds that are in the process of being unlocked. This\\n * is indexed by a key that hashes both the address of the staked Node and\\n * the address of the staker.\\n */\\n mapping(bytes32 => Unlock) public unlockings;\\n\\n /**\\n * @notice The number of blocks a user must wait after calling \\\"unlock\\\"\\n * before they can withdraw their stake\\n */\\n uint256 public unlockDuration;\\n\\n /**\\n * @notice Minimum amount of stake that a Node needs to stake\\n * against itself in order to participate in the network. This is\\n * represented as a percentage of the Node's total stake, where\\n * the value is a ratio of 10000.\\n */\\n uint32 public minimumStakeProportion;\\n\\n /**\\n * @notice The multiplier used in determining a Seeker's staking\\n * capacity based on its power level.\\n */\\n uint256 public seekerPowerMultiplier;\\n\\n event UnlockDurationUpdated(uint256 unlockDuration);\\n event MinimumStakeProportionUpdated(uint256 minimumStakeProportion);\\n\\n error NoStakeToUnlock();\\n error StakeNotYetUnlocked();\\n error CannotStakeZeroAmount();\\n error CannotUnlockZeroAmount();\\n error TokenCannotBeZeroAddress();\\n error StakeeCannotBeZeroAddress();\\n error UnlockDurationCannotBeZero();\\n error CannotCancelUnlockZeroAmount();\\n error CannotUnlockMoreThanStaked(uint256 stakeAmount, uint256 unlockAmount);\\n error StakeCapacityReached(uint256 maxCapacity, uint256 currentCapacity);\\n error SeekerPowerNotRegistered(uint256 seekerId);\\n\\n function initialize(\\n IERC20 token,\\n RewardsManager rewardsManager,\\n EpochsManager epochsManager,\\n SeekerPowerOracle seekerPowerOracle,\\n uint256 _unlockDuration,\\n uint32 _minimumStakeProportion,\\n uint256 _seekerPowerMultiplier\\n ) external initializer {\\n if (address(token) == address(0)) {\\n revert TokenCannotBeZeroAddress();\\n }\\n\\n SyloUtils.validateContractInterface(\\n \\\"RewardsManager\\\",\\n address(rewardsManager),\\n type(IRewardsManager).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"EpochsManager\\\",\\n address(epochsManager),\\n type(IEpochsManager).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"SeekerPowerOracle\\\",\\n address(seekerPowerOracle),\\n type(ISeekerPowerOracle).interfaceId\\n );\\n\\n if (_unlockDuration == 0) {\\n revert UnlockDurationCannotBeZero();\\n }\\n\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n _token = token;\\n _rewardsManager = rewardsManager;\\n _epochsManager = epochsManager;\\n _seekerPowerOracle = seekerPowerOracle;\\n unlockDuration = _unlockDuration;\\n minimumStakeProportion = _minimumStakeProportion;\\n seekerPowerMultiplier = _seekerPowerMultiplier;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IStakingManager).interfaceId;\\n }\\n\\n /**\\n * @notice Sets the unlock duration for stakes. Only callable by\\n * the owner.\\n * @param _unlockDuration The unlock duration in number of blocks.\\n */\\n function setUnlockDuration(uint256 _unlockDuration) external onlyOwner {\\n if (_unlockDuration == 0) {\\n revert UnlockDurationCannotBeZero();\\n }\\n\\n unlockDuration = _unlockDuration;\\n emit UnlockDurationUpdated(_unlockDuration);\\n }\\n\\n /**\\n * @notice Sets the minimum stake proportion for Nodes. Only callable by\\n * the owner.\\n * @param _minimumStakeProportion The minimum stake proportion in SOLO.\\n */\\n function setMinimumStakeProportion(uint32 _minimumStakeProportion) external onlyOwner {\\n minimumStakeProportion = _minimumStakeProportion;\\n emit MinimumStakeProportionUpdated(_minimumStakeProportion);\\n }\\n\\n /**\\n * @notice Called by Nodes and delegated stakers to add stake.\\n * This function will fail under the following conditions:\\n * - If the Node address is invalid\\n * - If the specified stake value is zero\\n * - If the additional stake causes the Node to fail to meet the\\n * minimum stake proportion requirement.\\n * @param amount The amount of stake to add in SOLO.\\n * @param stakee The address of the staked Node.\\n */\\n function addStake(uint256 amount, address stakee) external {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n if (amount == 0) {\\n revert CannotStakeZeroAmount();\\n }\\n\\n _addStake(amount, stakee);\\n SafeERC20.safeTransferFrom(_token, msg.sender, address(this), amount);\\n }\\n\\n function _addStake(uint256 amount, address stakee) internal {\\n // automatically move any pending rewards generated by their existing stake\\n _rewardsManager.updatePendingRewards(stakee, msg.sender);\\n\\n uint256 currentEpochId = _epochsManager.currentIteration();\\n\\n Stake storage stake = stakes[stakee];\\n\\n uint256 currentStake = getCurrentStakerAmount(stakee, msg.sender);\\n\\n stake.stakeEntries[msg.sender] = StakeEntry(\\n currentStake + amount,\\n block.number,\\n currentEpochId\\n );\\n\\n stake.totalManagedStake = stake.totalManagedStake + amount;\\n totalManagedStake = totalManagedStake + amount;\\n }\\n\\n /**\\n * @notice Call this function to begin the unlocking process. Calling this\\n * will trigger an automatic claim of any outstanding staking rewards. Any\\n * stake that was already in the unlocking phase will have the specified\\n * amount added to it, and its duration refreshed. This function will fail\\n * under the following conditions:\\n * - If no stake exists for the caller\\n * - If the unlock amount is zero\\n * - If the unlock amount is more than what is staked\\n * Note: If calling as a Node, this function will *not* revert if it causes\\n * the Node to fail to meet the minimum stake proportion. However it will still\\n * prevent the Node from participating in the network until the minimum is met\\n * again.\\n * @param amount The amount of stake to unlock in SOLO.\\n * @param stakee The address of the staked Node.\\n */\\n function unlockStake(uint256 amount, address stakee) external returns (uint256) {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n if (amount == 0) {\\n revert CannotUnlockZeroAmount();\\n }\\n\\n uint256 currentStake = getCurrentStakerAmount(stakee, msg.sender);\\n\\n if (currentStake == 0) {\\n revert NoStakeToUnlock();\\n }\\n if (currentStake < amount) {\\n revert CannotUnlockMoreThanStaked(currentStake, amount);\\n }\\n\\n // automatically move any pending rewards generated by their existing stake\\n _rewardsManager.updatePendingRewards(stakee, msg.sender);\\n\\n uint256 currentEpochId = _epochsManager.currentIteration();\\n\\n Stake storage stake = stakes[stakee];\\n\\n stake.stakeEntries[msg.sender] = StakeEntry(\\n currentStake - amount,\\n block.number,\\n currentEpochId\\n );\\n\\n stake.totalManagedStake = stake.totalManagedStake - amount;\\n totalManagedStake = totalManagedStake - amount;\\n\\n bytes32 key = getKey(stakee, msg.sender);\\n\\n // Keep track of when the stake can be withdrawn\\n Unlock storage unlock = unlockings[key];\\n\\n uint256 unlockAt = block.number + unlockDuration;\\n if (unlock.unlockAt < unlockAt) {\\n unlock.unlockAt = unlockAt;\\n }\\n\\n unlock.amount = unlock.amount + amount;\\n\\n return unlockAt;\\n }\\n\\n /**\\n * @notice Call this function to withdraw stake that has finished unlocking.\\n * This will fail if the stake has not yet unlocked.\\n * @param stakee The address of the staked Node.\\n */\\n function withdrawStake(address stakee) external {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n\\n bytes32 key = getKey(stakee, msg.sender);\\n\\n Unlock storage unlock = unlockings[key];\\n\\n if (unlock.unlockAt >= block.number) {\\n revert StakeNotYetUnlocked();\\n }\\n\\n uint256 amount = unlock.amount;\\n\\n delete unlockings[key];\\n\\n SafeERC20.safeTransfer(_token, msg.sender, amount);\\n }\\n\\n /**\\n * @notice Call this function to cancel any stake that is in the process\\n * of unlocking. As this essentially adds back stake to the Node, this\\n * will trigger an automatic claim of any outstanding staking rewards.\\n * If the specified amount to cancel is greater than the stake that is\\n * currently being unlocked, it will cancel the maximum stake possible.\\n * @param amount The amount of unlocking stake to cancel in SOLO.\\n * @param stakee The address of the staked Node.\\n */\\n function cancelUnlocking(uint256 amount, address stakee) external {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n if (amount == 0) {\\n revert CannotCancelUnlockZeroAmount();\\n }\\n\\n bytes32 key = getKey(stakee, msg.sender);\\n\\n Unlock storage unlock = unlockings[key];\\n\\n if (amount >= unlock.amount) {\\n amount = unlock.amount;\\n delete unlockings[key];\\n } else {\\n unlock.amount = unlock.amount - amount;\\n }\\n\\n _addStake(amount, stakee);\\n }\\n\\n /**\\n * @notice This function determines the staking capacity of\\n * a Seeker based on its power level. The method will revert if\\n * the Seeker's power level has not been registered with the oracle.\\n *\\n * Currently the algorithm is as follows:\\n * staking_capacity = seeker_power * seeker_power_multiplier;\\n */\\n function calculateCapacityFromSeekerPower(uint256 seekerId) external view returns (uint256) {\\n uint256 seekerPower = _seekerPowerOracle.getSeekerPower(seekerId);\\n if (seekerPower == 0) {\\n revert SeekerPowerNotRegistered(seekerId);\\n }\\n\\n // If the Seeker Power is already\\n // at the maximum sylo, then we just return the max sylo value directly.\\n if (seekerPower >= SyloUtils.MAX_SYLO) {\\n return SyloUtils.MAX_SYLO;\\n }\\n\\n uint256 capacity = seekerPower * seekerPowerMultiplier;\\n\\n return capacity > SyloUtils.MAX_SYLO ? SyloUtils.MAX_SYLO : capacity;\\n }\\n\\n /**\\n * @notice This function can be used to a determine a Node's staking capacity,\\n * based on the minimum stake proportion constant.\\n * @param stakee The address of the staked Node.\\n */\\n function calculateCapacityFromMinStakingProportion(address stakee) public view returns (uint256) {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n\\n Stake storage stake = stakes[stakee];\\n\\n uint256 currentlyOwnedStake = stake.stakeEntries[stakee].amount;\\n return (currentlyOwnedStake * SyloUtils.PERCENTAGE_DENOMINATOR) /\\n minimumStakeProportion;\\n }\\n\\n /**\\n * @notice This function should be called by clients to determine how much\\n * additional delegated stake can be allocated to a Node via an addStake or\\n * cancelUnlocking call. This is useful to avoid a revert due to\\n * the minimum stake proportion requirement not being met from the additional stake.\\n * @param stakee The address of the staked Node.\\n */\\n function calculateMaxAdditionalDelegatedStake(address stakee) external view returns (uint256) {\\n uint256 totalMaxStake = calculateCapacityFromMinStakingProportion(stakee);\\n\\n Stake storage stake = stakes[stakee];\\n\\n if (totalMaxStake < stake.totalManagedStake) {\\n revert StakeCapacityReached(totalMaxStake, stake.totalManagedStake);\\n }\\n\\n return totalMaxStake - stake.totalManagedStake;\\n }\\n\\n /**\\n * @notice Retrieve the key used to index a stake entry. The key is a hash\\n * which takes both address of the Node and the staker as input.\\n * @param stakee The address of the staked Node.\\n * @param staker The address of the staker.\\n * @return A byte-array representing the key.\\n */\\n function getKey(address stakee, address staker) public pure returns (bytes32) {\\n return keccak256(abi.encodePacked(stakee, staker));\\n }\\n\\n /**\\n * @notice Retrieve the total stake being managed by this contract.\\n * @return The total amount of managed stake in SOLO.\\n */\\n function getTotalManagedStake() external view returns (uint256) {\\n return totalManagedStake;\\n }\\n\\n /**\\n * @notice Retrieve a stake entry.\\n * @param stakee The address of the staked Node.\\n * @param staker The address of the staker.\\n * @return The stake entry.\\n */\\n function getStakeEntry(\\n address stakee,\\n address staker\\n ) external view returns (StakeEntry memory) {\\n return stakes[stakee].stakeEntries[staker];\\n }\\n\\n /**\\n * @notice Retrieve the total amount of SOLO staked against a Node.\\n * @param stakee The address of the staked Node.\\n * @return The amount of staked SOLO.\\n */\\n function getStakeeTotalManagedStake(address stakee) external view returns (uint256) {\\n return stakes[stakee].totalManagedStake;\\n }\\n\\n /**\\n * @notice Check if a Node is meeting the minimum stake proportion requirement.\\n * @param stakee The address of the staked Node.\\n * @return True if the Node is meeting minimum stake proportion requirement.\\n */\\n function checkMinimumStakeProportion(address stakee) public view returns (bool) {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n\\n Stake storage stake = stakes[stakee];\\n\\n uint256 currentlyOwnedStake = stake.stakeEntries[stakee].amount;\\n uint32 ownedStakeProportion = SyloUtils.asPerc(\\n SafeCast.toUint128(currentlyOwnedStake),\\n stake.totalManagedStake\\n );\\n\\n return ownedStakeProportion >= minimumStakeProportion;\\n }\\n\\n /**\\n * @notice Retrieve the current amount of SOLO staked against a Node by\\n * a specified staker.\\n * @param stakee The address of the staked Node.\\n * @param staker The address of the staker.\\n * @return The amount of staked SOLO.\\n */\\n function getCurrentStakerAmount(address stakee, address staker) public view returns (uint256) {\\n return stakes[stakee].stakeEntries[staker].amount;\\n }\\n}\\n\",\"keccak256\":\"0x039e692a4a3a670977e78ef7145a43d0bc00e48387fafd4f527b60fbb6966628\",\"license\":\"Apache-2.0\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506113f4806100206000396000f3fe608060405234801561001057600080fd5b50600436106101375760003560e01c80638ce57496116100b8578063d3549ebd1161007c578063d3549ebd146102af578063e30c3978146102d0578063f2fde38b146102e1578063f7e99847146102f4578063fa42e7ea14610307578063fdff9b4d1461031057600080fd5b80638ce57496146102425780638da5cb5b14610255578063a004af7014610266578063ac18de4314610289578063c3b6f7261461029c57600080fd5b8063485cc955116100ff578063485cc955146101e15780634e680661146101f4578063715018a61461021f57806379ba5097146102275780637ddc62c11461022f57600080fd5b806301ffc9a71461013c5780631bdcc9ad146101755780632d06177a146101965780633287a64e146101ab57806345367f23146101be575b600080fd5b61016061014a366004611046565b6001600160e01b031916638a5d64cd60e01b1490565b60405190151581526020015b60405180910390f35b610188610183366004611085565b610330565b60405190815260200161016c565b6101a96101a43660046110b5565b61035d565b005b6101a96101b93660046110d2565b6103a8565b6101886101cc3660046110fe565b600090815260cc602052604090206002015490565b6101a96101ef366004611117565b61074d565b610207610202366004611161565b610905565b6040516001600160a01b03909116815260200161016c565b6101a9610913565b6101a9610927565b60ca54610207906001600160a01b031681565b6101a96102503660046110fe565b6109a1565b6033546001600160a01b0316610207565b6101886102743660046110fe565b60cc6020526000908152604090206002015481565b6101a96102973660046110b5565b610a02565b60c954610207906001600160a01b031681565b6102c26102bd3660046110fe565b610a24565b60405161016c92919061117c565b6065546001600160a01b0316610207565b6101a96102ef3660046110b5565b610bf3565b610207610302366004611200565b610c64565b61018860cb5481565b61018861031e3660046110b5565b60976020526000908152604090205481565b600082815260cc602090815260408083206001600160a01b03851684526001019091529020545b92915050565b610365610c77565b6001600160a01b03811661038c576040516309045a0360e41b815260040160405180910390fd5b6001600160a01b03166000908152609760205260409020439055565b3360009081526097602052604081205490036103d657604051620ab82160e31b815260040160405180910390fd5b6001600160a01b0382166103fd57604051630381bf9b60e01b815260040160405180910390fd5b600060cb54600161040e9190611232565b60c9546040516313cdd31b60e01b81526001600160a01b038681166004830152929350600092909116906313cdd31b90602401602060405180830381865afa15801561045e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104829190611245565b9050806000036104a55760405163d5a14ac760e01b815260040160405180910390fd5b60c9546040516332e97d9b60e01b8152600481018590526000916001600160a01b0316906332e97d9b90602401602060405180830381865afa1580156104ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105139190611245565b60c9546040516376ba1a5160e11b81526001600160a01b0388811660048301529293506000929091169063ed7434a290602401602060405180830381865afa158015610563573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105879190611245565b90506000828411801561059957508184115b156105af576105a88383610cd1565b90506105d0565b828411156105be5750816105d0565b818411156105cd5750806105d0565b50825b806000036105f15760405163c90c437560e01b815260040160405180910390fd5b600085815260cc602090815260408083206001600160a01b038b168452600101909152902054156106355760405163d3a8044d60e01b815260040160405180910390fd5b600085815260cc6020526040812060020154610652908390611232565b905060cc600087815260200190815260200160002060000160405180604001604052808a6001600160a01b0316815260200183815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506020820151816001015550508160cc600088815260200190815260200160002060010160008a6001600160a01b03166001600160a01b03168152602001908152602001600020819055508060cc6000888152602001908152602001600020600201819055505050505050505050565b600054610100900460ff161580801561076d5750600054600160ff909116105b806107875750303b158015610787575060005460ff166001145b6107ef5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff191660011790558015610812576000805461ff0019166101001790555b61084a6040518060400160405280600e81526020016d29ba30b5b4b733a6b0b730b3b2b960911b815250846303e0261b60e41b610ce7565b6108826040518060400160405280600e81526020016d2932bbb0b93239a6b0b730b3b2b960911b81525083631ed895ad60e11b610ce7565b61088a610deb565b60c980546001600160a01b038086166001600160a01b03199283161790925560ca8054928516929091169190911790558015610900576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b60006103578260cb54610e1a565b61091b610c77565b6109256000610fab565b565b60655433906001600160a01b031681146109955760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084016107e6565b61099e81610fab565b50565b3360009081526097602052604081205490036109cf57604051620ab82160e31b815260040160405180910390fd5b60cb81905560405181907f75f55585d4c8b5311183327778caa8bbec00e1537b9fe086a33013f5f62bfb2390600090a250565b610a0a610c77565b6001600160a01b0316600090815260976020526040812055565b600081815260cc60205260408120546060918291908167ffffffffffffffff811115610a5257610a5261125e565b604051908082528060200260200182016040528015610a7b578160200160208202803683370190505b50905060008267ffffffffffffffff811115610a9957610a9961125e565b604051908082528060200260200182016040528015610ac2578160200160208202803683370190505b506040805180820190915260008082526020820152909150600087815260cc6020908152604080832080548251818502810185019093528083529192909190849084015b82821015610b4e576000848152602090819020604080518082019091526002850290910180546001600160a01b03168252600190810154828401529083529092019101610b06565b50505050905060005b85811015610be457818181518110610b7157610b71611274565b602002602001015192508260000151858281518110610b9257610b92611274565b60200260200101906001600160a01b031690816001600160a01b0316815250508260200151848281518110610bc957610bc9611274565b6020908102919091010152610bdd8161128a565b9050610b57565b50929791965090945050505050565b610bfb610c77565b606580546001600160a01b0383166001600160a01b03199091168117909155610c2c6033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6000610c708383610e1a565b9392505050565b6033546001600160a01b031633146109255760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107e6565b6000818310610ce05781610c70565b5090919050565b8251600003610d095760405163d1fc12f760e01b815260040160405180910390fd5b6001600160a01b038216610d30578260405161f56160eb1b81526004016107e691906112e9565b6001600160e01b03198116610d585760405163308c995160e01b815260040160405180910390fd5b6040516301ffc9a760e01b81526001600160e01b0319821660048201526001600160a01b038316906301ffc9a790602401602060405180830381865afa158015610da6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dca91906112fc565b610900578281604051633f8ccd3b60e21b81526004016107e692919061131e565b600054610100900460ff16610e125760405162461bcd60e51b81526004016107e690611349565b610925610fc4565b600081815260cc6020526040812054808203610e3a576000915050610357565b600083815260cc6020526040812060020154608090610e63906001600160801b03881690611394565b901c9050600080610e756001856113ab565b905060008060005b838511610f9e576001610e908587611232565b901c90508015610eda57600089815260cc60205260409020610eb36001836113ab565b81548110610ec357610ec3611274565b906000526020600020906002020160010154610edd565b60005b60008a815260cc6020526040902080549194509082908110610f0157610f01611274565b9060005260206000209060020201600101549150828610158015610f2457508186105b15610f7257600089815260cc60205260409020805482908110610f4957610f49611274565b60009182526020909120600290910201546001600160a01b031697506103579650505050505050565b82861015610f8c57610f856001826113ab565b9350610e7d565b610f97816001611232565b9450610e7d565b5050505050505092915050565b606580546001600160a01b031916905561099e81610ff4565b600054610100900460ff16610feb5760405162461bcd60e51b81526004016107e690611349565b61092533610fab565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006020828403121561105857600080fd5b81356001600160e01b031981168114610c7057600080fd5b6001600160a01b038116811461099e57600080fd5b6000806040838503121561109857600080fd5b8235915060208301356110aa81611070565b809150509250929050565b6000602082840312156110c757600080fd5b8135610c7081611070565b600080604083850312156110e557600080fd5b82356110f081611070565b946020939093013593505050565b60006020828403121561111057600080fd5b5035919050565b6000806040838503121561112a57600080fd5b823561113581611070565b915060208301356110aa81611070565b80356001600160801b038116811461115c57600080fd5b919050565b60006020828403121561117357600080fd5b610c7082611145565b604080825283519082018190526000906020906060840190828701845b828110156111be5781516001600160a01b031684529284019290840190600101611199565b5050508381038285015284518082528583019183019060005b818110156111f3578351835292840192918401916001016111d7565b5090979650505050505050565b6000806040838503121561121357600080fd5b6110f083611145565b634e487b7160e01b600052601160045260246000fd5b808201808211156103575761035761121c565b60006020828403121561125757600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b60006001820161129c5761129c61121c565b5060010190565b6000815180845260005b818110156112c9576020818501810151868301820152016112ad565b506000602082860101526020601f19601f83011685010191505092915050565b602081526000610c7060208301846112a3565b60006020828403121561130e57600080fd5b81518015158114610c7057600080fd5b60408152600061133160408301856112a3565b905063ffffffff60e01b831660208301529392505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b80820281158282048414176103575761035761121c565b818103818111156103575761035761121c56fea264697066735822122098e531838206b255ec7eb2ffc16ccb2e8d317dd428aff300d88d0ea91910e39564736f6c63430008120033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101375760003560e01c80638ce57496116100b8578063d3549ebd1161007c578063d3549ebd146102af578063e30c3978146102d0578063f2fde38b146102e1578063f7e99847146102f4578063fa42e7ea14610307578063fdff9b4d1461031057600080fd5b80638ce57496146102425780638da5cb5b14610255578063a004af7014610266578063ac18de4314610289578063c3b6f7261461029c57600080fd5b8063485cc955116100ff578063485cc955146101e15780634e680661146101f4578063715018a61461021f57806379ba5097146102275780637ddc62c11461022f57600080fd5b806301ffc9a71461013c5780631bdcc9ad146101755780632d06177a146101965780633287a64e146101ab57806345367f23146101be575b600080fd5b61016061014a366004611046565b6001600160e01b031916638a5d64cd60e01b1490565b60405190151581526020015b60405180910390f35b610188610183366004611085565b610330565b60405190815260200161016c565b6101a96101a43660046110b5565b61035d565b005b6101a96101b93660046110d2565b6103a8565b6101886101cc3660046110fe565b600090815260cc602052604090206002015490565b6101a96101ef366004611117565b61074d565b610207610202366004611161565b610905565b6040516001600160a01b03909116815260200161016c565b6101a9610913565b6101a9610927565b60ca54610207906001600160a01b031681565b6101a96102503660046110fe565b6109a1565b6033546001600160a01b0316610207565b6101886102743660046110fe565b60cc6020526000908152604090206002015481565b6101a96102973660046110b5565b610a02565b60c954610207906001600160a01b031681565b6102c26102bd3660046110fe565b610a24565b60405161016c92919061117c565b6065546001600160a01b0316610207565b6101a96102ef3660046110b5565b610bf3565b610207610302366004611200565b610c64565b61018860cb5481565b61018861031e3660046110b5565b60976020526000908152604090205481565b600082815260cc602090815260408083206001600160a01b03851684526001019091529020545b92915050565b610365610c77565b6001600160a01b03811661038c576040516309045a0360e41b815260040160405180910390fd5b6001600160a01b03166000908152609760205260409020439055565b3360009081526097602052604081205490036103d657604051620ab82160e31b815260040160405180910390fd5b6001600160a01b0382166103fd57604051630381bf9b60e01b815260040160405180910390fd5b600060cb54600161040e9190611232565b60c9546040516313cdd31b60e01b81526001600160a01b038681166004830152929350600092909116906313cdd31b90602401602060405180830381865afa15801561045e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104829190611245565b9050806000036104a55760405163d5a14ac760e01b815260040160405180910390fd5b60c9546040516332e97d9b60e01b8152600481018590526000916001600160a01b0316906332e97d9b90602401602060405180830381865afa1580156104ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105139190611245565b60c9546040516376ba1a5160e11b81526001600160a01b0388811660048301529293506000929091169063ed7434a290602401602060405180830381865afa158015610563573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105879190611245565b90506000828411801561059957508184115b156105af576105a88383610cd1565b90506105d0565b828411156105be5750816105d0565b818411156105cd5750806105d0565b50825b806000036105f15760405163c90c437560e01b815260040160405180910390fd5b600085815260cc602090815260408083206001600160a01b038b168452600101909152902054156106355760405163d3a8044d60e01b815260040160405180910390fd5b600085815260cc6020526040812060020154610652908390611232565b905060cc600087815260200190815260200160002060000160405180604001604052808a6001600160a01b0316815260200183815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506020820151816001015550508160cc600088815260200190815260200160002060010160008a6001600160a01b03166001600160a01b03168152602001908152602001600020819055508060cc6000888152602001908152602001600020600201819055505050505050505050565b600054610100900460ff161580801561076d5750600054600160ff909116105b806107875750303b158015610787575060005460ff166001145b6107ef5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff191660011790558015610812576000805461ff0019166101001790555b61084a6040518060400160405280600e81526020016d29ba30b5b4b733a6b0b730b3b2b960911b815250846303e0261b60e41b610ce7565b6108826040518060400160405280600e81526020016d2932bbb0b93239a6b0b730b3b2b960911b81525083631ed895ad60e11b610ce7565b61088a610deb565b60c980546001600160a01b038086166001600160a01b03199283161790925560ca8054928516929091169190911790558015610900576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b60006103578260cb54610e1a565b61091b610c77565b6109256000610fab565b565b60655433906001600160a01b031681146109955760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084016107e6565b61099e81610fab565b50565b3360009081526097602052604081205490036109cf57604051620ab82160e31b815260040160405180910390fd5b60cb81905560405181907f75f55585d4c8b5311183327778caa8bbec00e1537b9fe086a33013f5f62bfb2390600090a250565b610a0a610c77565b6001600160a01b0316600090815260976020526040812055565b600081815260cc60205260408120546060918291908167ffffffffffffffff811115610a5257610a5261125e565b604051908082528060200260200182016040528015610a7b578160200160208202803683370190505b50905060008267ffffffffffffffff811115610a9957610a9961125e565b604051908082528060200260200182016040528015610ac2578160200160208202803683370190505b506040805180820190915260008082526020820152909150600087815260cc6020908152604080832080548251818502810185019093528083529192909190849084015b82821015610b4e576000848152602090819020604080518082019091526002850290910180546001600160a01b03168252600190810154828401529083529092019101610b06565b50505050905060005b85811015610be457818181518110610b7157610b71611274565b602002602001015192508260000151858281518110610b9257610b92611274565b60200260200101906001600160a01b031690816001600160a01b0316815250508260200151848281518110610bc957610bc9611274565b6020908102919091010152610bdd8161128a565b9050610b57565b50929791965090945050505050565b610bfb610c77565b606580546001600160a01b0383166001600160a01b03199091168117909155610c2c6033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6000610c708383610e1a565b9392505050565b6033546001600160a01b031633146109255760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107e6565b6000818310610ce05781610c70565b5090919050565b8251600003610d095760405163d1fc12f760e01b815260040160405180910390fd5b6001600160a01b038216610d30578260405161f56160eb1b81526004016107e691906112e9565b6001600160e01b03198116610d585760405163308c995160e01b815260040160405180910390fd5b6040516301ffc9a760e01b81526001600160e01b0319821660048201526001600160a01b038316906301ffc9a790602401602060405180830381865afa158015610da6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dca91906112fc565b610900578281604051633f8ccd3b60e21b81526004016107e692919061131e565b600054610100900460ff16610e125760405162461bcd60e51b81526004016107e690611349565b610925610fc4565b600081815260cc6020526040812054808203610e3a576000915050610357565b600083815260cc6020526040812060020154608090610e63906001600160801b03881690611394565b901c9050600080610e756001856113ab565b905060008060005b838511610f9e576001610e908587611232565b901c90508015610eda57600089815260cc60205260409020610eb36001836113ab565b81548110610ec357610ec3611274565b906000526020600020906002020160010154610edd565b60005b60008a815260cc6020526040902080549194509082908110610f0157610f01611274565b9060005260206000209060020201600101549150828610158015610f2457508186105b15610f7257600089815260cc60205260409020805482908110610f4957610f49611274565b60009182526020909120600290910201546001600160a01b031697506103579650505050505050565b82861015610f8c57610f856001826113ab565b9350610e7d565b610f97816001611232565b9450610e7d565b5050505050505092915050565b606580546001600160a01b031916905561099e81610ff4565b600054610100900460ff16610feb5760405162461bcd60e51b81526004016107e690611349565b61092533610fab565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006020828403121561105857600080fd5b81356001600160e01b031981168114610c7057600080fd5b6001600160a01b038116811461099e57600080fd5b6000806040838503121561109857600080fd5b8235915060208301356110aa81611070565b809150509250929050565b6000602082840312156110c757600080fd5b8135610c7081611070565b600080604083850312156110e557600080fd5b82356110f081611070565b946020939093013593505050565b60006020828403121561111057600080fd5b5035919050565b6000806040838503121561112a57600080fd5b823561113581611070565b915060208301356110aa81611070565b80356001600160801b038116811461115c57600080fd5b919050565b60006020828403121561117357600080fd5b610c7082611145565b604080825283519082018190526000906020906060840190828701845b828110156111be5781516001600160a01b031684529284019290840190600101611199565b5050508381038285015284518082528583019183019060005b818110156111f3578351835292840192918401916001016111d7565b5090979650505050505050565b6000806040838503121561121357600080fd5b6110f083611145565b634e487b7160e01b600052601160045260246000fd5b808201808211156103575761035761121c565b60006020828403121561125757600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b60006001820161129c5761129c61121c565b5060010190565b6000815180845260005b818110156112c9576020818501810151868301820152016112ad565b506000602082860101526020601f19601f83011685010191505092915050565b602081526000610c7060208301846112a3565b60006020828403121561130e57600080fd5b81518015158114610c7057600080fd5b60408152600061133160408301856112a3565b905063ffffffff60e01b831660208301529392505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b80820281158282048414176103575761035761121c565b818103818111156103575761035761121c56fea264697066735822122098e531838206b255ec7eb2ffc16ccb2e8d317dd428aff300d88d0ea91910e39564736f6c63430008120033", + "devdoc": { + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "acceptOwnership()": { + "details": "The new owner accepts the ownership transfer." + }, + "addManager(address)": { + "params": { + "manager": "The address of the manager contract." + } + }, + "getEntries(uint256)": { + "returns": { + "_0": "An array of all the directory entries." + } + }, + "getTotalStake(uint256)": { + "params": { + "epochId": "The ID of the epoch." + }, + "returns": { + "_0": "The total amount of stake in SOLO." + } + }, + "getTotalStakeForStakee(uint256,address)": { + "params": { + "epochId": "The ID of the epoch.", + "stakee": "The address of the Node." + }, + "returns": { + "_0": "The amount of stake the Node has for the given directory in SOLO." + } + }, + "joinNextDirectory(address,uint256)": { + "details": "This will construct the directory as nodes join. The directory is constructed by creating a boundary value which is a sum of the current directory's total stake, and the current stakee's total stake, and pushing the new boundary into the entries array. The previous boundary and the current boundary essentially create a range, where if a random point were to fall within that range, it would belong to the respective stakee. The boundary value grows in size as each stakee joins, thus the directory array always remains sorted. This allows us to perform a binary search on the directory. Example Stakes: [ Alice/20, Bob/10, Carl/40, Dave/25 ] TotalStake: 95 EpochDirectory: |-----------|------|----------------|--------| Alice/20 Bob/30 Carl/70 Dave/95 The amount of stake that a node will join a directory with is dependent on its different capacity values. There are two distinct capacity values, one calculated from the seeker power, and another from the minimum stake proportion. The final staking amount will not exceed either capacities, and in the case that the current total stake exceeds both, then the final will be the minimum of the two values.", + "params": { + "seekerId": "The seekerId of the Seeker that the node is registered with when joining the epoch. It is used to determine the nodes staking capacity based on its seeker power.", + "stakee": "The address of the node." + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pendingOwner()": { + "details": "Returns the address of the pending owner." + }, + "removeManager(address)": { + "params": { + "manager": "The address of the manager contract." + } + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "scan(uint128)": { + "params": { + "point": "The point, which will usually be a hash of a public key." + } + }, + "scanWithEpochId(uint128,uint256)": { + "params": { + "epochId": "The epoch id associated with the directory to scan.", + "point": "The point, which will usually be a hash of a public key." + } + }, + "setCurrentDirectory(uint256)": { + "details": "After deployment, the EpochsManager should immediately be set as the owner.", + "params": { + "epochId": "The ID of the specified epoch." + } + }, + "transferOwnership(address)": { + "details": "Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "_rewardsManager()": { + "notice": "Sylo Rewards Manager contract " + }, + "_stakingManager()": { + "notice": "Sylo Staking Manager contract " + }, + "addManager(address)": { + "notice": "Adds a manager to this contract. Only callable by the owner." + }, + "currentDirectory()": { + "notice": "The epoch ID of the current directory." + }, + "directories(uint256)": { + "notice": "Tracks every directory, which will be indexed by an epoch ID" + }, + "getEntries(uint256)": { + "notice": "Retrieve all entries for a directory in a specified epoch." + }, + "getTotalStake(uint256)": { + "notice": "Retrieve the total stake for a directory in the specified epoch, which will be the sum of the stakes for all Nodes participating in that epoch." + }, + "getTotalStakeForStakee(uint256,address)": { + "notice": "Retrieve the total stake a Node has for the directory in the specified epoch." + }, + "joinNextDirectory(address,uint256)": { + "notice": "This function is called by the epochs manager as a prerequisite to when the node joins the next epoch." + }, + "removeManager(address)": { + "notice": "Removes a manager from this contract. Only callable by the owner." + }, + "scan(uint128)": { + "notice": "Call this to perform a stake-weighted scan to find the Node assigned to the given point of the current directory." + }, + "scanWithEpochId(uint128,uint256)": { + "notice": "Call this to perform a stake-weighted scan to find the Node assigned to the given point of the requested directory." + }, + "setCurrentDirectory(uint256)": { + "notice": "This function should be called when a new epoch is initialized. This will set the current directory to the specified epoch. This is only callable by the owner of this contract, which should be the EpochsManager contract." + }, + "supportsInterface(bytes4)": { + "notice": "Returns true if the contract implements the interface defined by `interfaceId` from ERC165." + } + }, + "notice": "The Directory contract constructs and manages a structure holding the current stakes, which is queried against using the scan function. The scan function allows submitting random points which will return a staked node's address in proportion to the stake it has.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 244, + "contract": "contracts/staking/Directory.sol:Directory", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 247, + "contract": "contracts/staking/Directory.sol:Directory", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 777, + "contract": "contracts/staking/Directory.sol:Directory", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 116, + "contract": "contracts/staking/Directory.sol:Directory", + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address" + }, + { + "astId": 236, + "contract": "contracts/staking/Directory.sol:Directory", + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 25, + "contract": "contracts/staking/Directory.sol:Directory", + "label": "_pendingOwner", + "offset": 0, + "slot": "101", + "type": "t_address" + }, + { + "astId": 104, + "contract": "contracts/staking/Directory.sol:Directory", + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 11127, + "contract": "contracts/staking/Directory.sol:Directory", + "label": "managers", + "offset": 0, + "slot": "151", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 11192, + "contract": "contracts/staking/Directory.sol:Directory", + "label": "__gap", + "offset": 0, + "slot": "152", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 14416, + "contract": "contracts/staking/Directory.sol:Directory", + "label": "_stakingManager", + "offset": 0, + "slot": "201", + "type": "t_contract(StakingManager)15921" + }, + { + "astId": 14420, + "contract": "contracts/staking/Directory.sol:Directory", + "label": "_rewardsManager", + "offset": 0, + "slot": "202", + "type": "t_contract(RewardsManager)14142" + }, + { + "astId": 14423, + "contract": "contracts/staking/Directory.sol:Directory", + "label": "currentDirectory", + "offset": 0, + "slot": "203", + "type": "t_uint256" + }, + { + "astId": 14429, + "contract": "contracts/staking/Directory.sol:Directory", + "label": "directories", + "offset": 0, + "slot": "204", + "type": "t_mapping(t_uint256,t_struct(EpochDirectory)10963_storage)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_struct(DirectoryEntry)10952_storage)dyn_storage": { + "base": "t_struct(DirectoryEntry)10952_storage", + "encoding": "dynamic_array", + "label": "struct IDirectory.DirectoryEntry[]", + "numberOfBytes": "32" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(RewardsManager)14142": { + "encoding": "inplace", + "label": "contract RewardsManager", + "numberOfBytes": "20" + }, + "t_contract(StakingManager)15921": { + "encoding": "inplace", + "label": "contract StakingManager", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_uint256,t_struct(EpochDirectory)10963_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct IDirectory.EpochDirectory)", + "numberOfBytes": "32", + "value": "t_struct(EpochDirectory)10963_storage" + }, + "t_struct(DirectoryEntry)10952_storage": { + "encoding": "inplace", + "label": "struct IDirectory.DirectoryEntry", + "members": [ + { + "astId": 10949, + "contract": "contracts/staking/Directory.sol:Directory", + "label": "stakee", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 10951, + "contract": "contracts/staking/Directory.sol:Directory", + "label": "boundary", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_struct(EpochDirectory)10963_storage": { + "encoding": "inplace", + "label": "struct IDirectory.EpochDirectory", + "members": [ + { + "astId": 10956, + "contract": "contracts/staking/Directory.sol:Directory", + "label": "entries", + "offset": 0, + "slot": "0", + "type": "t_array(t_struct(DirectoryEntry)10952_storage)dyn_storage" + }, + { + "astId": 10960, + "contract": "contracts/staking/Directory.sol:Directory", + "label": "stakes", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 10962, + "contract": "contracts/staking/Directory.sol:Directory", + "label": "totalStake", + "offset": 0, + "slot": "2", + "type": "t_uint256" + } + ], + "numberOfBytes": "96" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/deployments/porcini-dev/Directory_Proxy.json b/deployments/porcini-dev/Directory_Proxy.json new file mode 100644 index 00000000..d0460470 --- /dev/null +++ b/deployments/porcini-dev/Directory_Proxy.json @@ -0,0 +1,235 @@ +{ + "address": "0x75aBF214870415A94B0d38840Cd541E9a0f196FA", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xc578ea0fbd08844d18e1290581339f99cda4fec23c48a2def779541a34c1915f", + "receipt": { + "to": null, + "from": "0x448c8e9e1816300Dd052e77D2A44c990A2807D15", + "contractAddress": "0x75aBF214870415A94B0d38840Cd541E9a0f196FA", + "transactionIndex": 0, + "gasUsed": "720430", + "logsBloom": "0x00000000000000000000000000000000400002000000000000000400000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000008000800000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000400000000000000400000000000000000000000000000000000000010000000000000000000000000000000", + "blockHash": "0x8a88995d35d8d95dc37e8721c56daa5e7ef0d61ab3e1aa206dad47a4b74755a2", + "transactionHash": "0xc578ea0fbd08844d18e1290581339f99cda4fec23c48a2def779541a34c1915f", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 10978379, + "transactionHash": "0xc578ea0fbd08844d18e1290581339f99cda4fec23c48a2def779541a34c1915f", + "address": "0x75aBF214870415A94B0d38840Cd541E9a0f196FA", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x0000000000000000000000003fd2728882929be32f3f4909f8e5d4639c6975b8" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0x8a88995d35d8d95dc37e8721c56daa5e7ef0d61ab3e1aa206dad47a4b74755a2" + }, + { + "transactionIndex": 0, + "blockNumber": 10978379, + "transactionHash": "0xc578ea0fbd08844d18e1290581339f99cda4fec23c48a2def779541a34c1915f", + "address": "0x75aBF214870415A94B0d38840Cd541E9a0f196FA", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f06d5edb04f4995fff2c362a14826107f7cccbcc", + "logIndex": 1, + "blockHash": "0x8a88995d35d8d95dc37e8721c56daa5e7ef0d61ab3e1aa206dad47a4b74755a2" + } + ], + "blockNumber": 10978379, + "cumulativeGasUsed": "720430", + "status": 1, + "byzantium": true + }, + "args": [ + "0x3fD2728882929bE32f3F4909F8e5D4639c6975b8", + "0xf06d5Edb04F4995FFF2c362a14826107F7CCCBCc", + "0x" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\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\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.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 *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\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 Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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 Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual 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 Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\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(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\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(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) 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\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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 overriden 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 internall 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 overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/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\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\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 * ```\\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`, and `uint256`._\\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 /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\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 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 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 assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/porcini-dev/EpochsManager.json b/deployments/porcini-dev/EpochsManager.json new file mode 100644 index 00000000..397f6903 --- /dev/null +++ b/deployments/porcini-dev/EpochsManager.json @@ -0,0 +1,945 @@ +{ + "address": "0x9591e2f0a64E39675c9C3C28D055974fa1b93774", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "inputs": [], + "name": "ContractNameCannotBeEmpty", + "type": "error" + }, + { + "inputs": [], + "name": "DirectoryCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "EpochDurationCannotBeZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + } + ], + "name": "EpochHasNotEnded", + "type": "error" + }, + { + "inputs": [], + "name": "InitialEpochCannotBeZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expectedBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "currentBlock", + "type": "uint256" + } + ], + "name": "InitialEpochNotYetReady", + "type": "error" + }, + { + "inputs": [], + "name": "InterfaceIdCannotBeZeroBytes", + "type": "error" + }, + { + "inputs": [], + "name": "RegistriesCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "RootSeekerCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "SeekerAccountCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "seekerId", + "type": "uint256" + } + ], + "name": "SeekerAlreadyJoinedEpoch", + "type": "error" + }, + { + "inputs": [], + "name": "SeekerOwnerMismatch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "TargetContractCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "TargetNotSupportInterface", + "type": "error" + }, + { + "inputs": [], + "name": "TicketingParametersCannotBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "epochDuration", + "type": "uint256" + } + ], + "name": "EpochDurationUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "node", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "seekerId", + "type": "uint256" + } + ], + "name": "EpochJoined", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "initialEpoch", + "type": "uint256" + } + ], + "name": "InitialEpochUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + } + ], + "name": "NewEpoch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "_directory", + "outputs": [ + { + "internalType": "contract Directory", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_registries", + "outputs": [ + { + "internalType": "contract Registries", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_rootSeekers", + "outputs": [ + { + "internalType": "contract IERC721", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_ticketingParameters", + "outputs": [ + { + "internalType": "contract TicketingParameters", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "activeSeekers", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "currentIteration", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "epochDuration", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "epochs", + "outputs": [ + { + "internalType": "uint256", + "name": "startBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "endBlock", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "defaultPayoutPercentage", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "decayRate", + "type": "uint32" + }, + { + "internalType": "uint256", + "name": "faceValue", + "type": "uint256" + }, + { + "internalType": "uint128", + "name": "baseLiveWinProb", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "expiredWinProb", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "ticketDuration", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getCurrentActiveEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "startBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "endBlock", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "defaultPayoutPercentage", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "decayRate", + "type": "uint32" + }, + { + "internalType": "uint256", + "name": "faceValue", + "type": "uint256" + }, + { + "internalType": "uint128", + "name": "baseLiveWinProb", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "expiredWinProb", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "ticketDuration", + "type": "uint256" + } + ], + "internalType": "struct IEpochsManager.Epoch", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + } + ], + "name": "getEpoch", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "startBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "endBlock", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "defaultPayoutPercentage", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "decayRate", + "type": "uint32" + }, + { + "internalType": "uint256", + "name": "faceValue", + "type": "uint256" + }, + { + "internalType": "uint128", + "name": "baseLiveWinProb", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "expiredWinProb", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "ticketDuration", + "type": "uint256" + } + ], + "internalType": "struct IEpochsManager.Epoch", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getNextEpochId", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC721", + "name": "rootSeekers", + "type": "address" + }, + { + "internalType": "contract Directory", + "name": "directory", + "type": "address" + }, + { + "internalType": "contract Registries", + "name": "registries", + "type": "address" + }, + { + "internalType": "contract TicketingParameters", + "name": "ticketingParameters", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_initialEpoch", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_epochDuration", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "initializeEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "joinNextEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_epochDuration", + "type": "uint256" + } + ], + "name": "setEpochDuration", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_initialEpoch", + "type": "uint256" + } + ], + "name": "setInitialEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0xa930afab651bf8c278a4e4f8ab96b9d65ddd2cb2ef99c76025b2819ce099466d", + "receipt": { + "to": null, + "from": "0x448c8e9e1816300Dd052e77D2A44c990A2807D15", + "contractAddress": "0x9591e2f0a64E39675c9C3C28D055974fa1b93774", + "transactionIndex": 0, + "gasUsed": "720430", + "logsBloom": "0x80000000000400000000000000000001400000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000008000000020000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x6d34a056f2e4eb7bae613ec24ea805421aaa5a5b2146c052f14913c755e88ad2", + "transactionHash": "0xa930afab651bf8c278a4e4f8ab96b9d65ddd2cb2ef99c76025b2819ce099466d", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 10978371, + "transactionHash": "0xa930afab651bf8c278a4e4f8ab96b9d65ddd2cb2ef99c76025b2819ce099466d", + "address": "0x9591e2f0a64E39675c9C3C28D055974fa1b93774", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000d6f61d3e7a9026c42810e74a05dd4be763adcb53" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0x6d34a056f2e4eb7bae613ec24ea805421aaa5a5b2146c052f14913c755e88ad2" + }, + { + "transactionIndex": 0, + "blockNumber": 10978371, + "transactionHash": "0xa930afab651bf8c278a4e4f8ab96b9d65ddd2cb2ef99c76025b2819ce099466d", + "address": "0x9591e2f0a64E39675c9C3C28D055974fa1b93774", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f06d5edb04f4995fff2c362a14826107f7cccbcc", + "logIndex": 1, + "blockHash": "0x6d34a056f2e4eb7bae613ec24ea805421aaa5a5b2146c052f14913c755e88ad2" + } + ], + "blockNumber": 10978371, + "cumulativeGasUsed": "720430", + "status": 1, + "byzantium": true + }, + "args": [ + "0xD6f61D3e7a9026C42810E74a05dD4bE763AdCB53", + "0xf06d5Edb04F4995FFF2c362a14826107F7CCCBCc", + "0x" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\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\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.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 *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\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 Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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 Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual 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 Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\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(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\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(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) 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\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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 overriden 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 internall 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 overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/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\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\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 * ```\\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`, and `uint256`._\\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 /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\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 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 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 assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "implementation": "0xD6f61D3e7a9026C42810E74a05dD4bE763AdCB53", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/porcini-dev/EpochsManager_Implementation.json b/deployments/porcini-dev/EpochsManager_Implementation.json new file mode 100644 index 00000000..34926e24 --- /dev/null +++ b/deployments/porcini-dev/EpochsManager_Implementation.json @@ -0,0 +1,1137 @@ +{ + "address": "0xD6f61D3e7a9026C42810E74a05dD4bE763AdCB53", + "abi": [ + { + "inputs": [], + "name": "ContractNameCannotBeEmpty", + "type": "error" + }, + { + "inputs": [], + "name": "DirectoryCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "EpochDurationCannotBeZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + } + ], + "name": "EpochHasNotEnded", + "type": "error" + }, + { + "inputs": [], + "name": "InitialEpochCannotBeZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expectedBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "currentBlock", + "type": "uint256" + } + ], + "name": "InitialEpochNotYetReady", + "type": "error" + }, + { + "inputs": [], + "name": "InterfaceIdCannotBeZeroBytes", + "type": "error" + }, + { + "inputs": [], + "name": "RegistriesCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "RootSeekerCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "SeekerAccountCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "seekerId", + "type": "uint256" + } + ], + "name": "SeekerAlreadyJoinedEpoch", + "type": "error" + }, + { + "inputs": [], + "name": "SeekerOwnerMismatch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "TargetContractCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "TargetNotSupportInterface", + "type": "error" + }, + { + "inputs": [], + "name": "TicketingParametersCannotBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "epochDuration", + "type": "uint256" + } + ], + "name": "EpochDurationUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "node", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "seekerId", + "type": "uint256" + } + ], + "name": "EpochJoined", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "initialEpoch", + "type": "uint256" + } + ], + "name": "InitialEpochUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + } + ], + "name": "NewEpoch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "_directory", + "outputs": [ + { + "internalType": "contract Directory", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_registries", + "outputs": [ + { + "internalType": "contract Registries", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_rootSeekers", + "outputs": [ + { + "internalType": "contract IERC721", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_ticketingParameters", + "outputs": [ + { + "internalType": "contract TicketingParameters", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "activeSeekers", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "currentIteration", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "epochDuration", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "epochs", + "outputs": [ + { + "internalType": "uint256", + "name": "startBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "endBlock", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "defaultPayoutPercentage", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "decayRate", + "type": "uint32" + }, + { + "internalType": "uint256", + "name": "faceValue", + "type": "uint256" + }, + { + "internalType": "uint128", + "name": "baseLiveWinProb", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "expiredWinProb", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "ticketDuration", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getCurrentActiveEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "startBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "endBlock", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "defaultPayoutPercentage", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "decayRate", + "type": "uint32" + }, + { + "internalType": "uint256", + "name": "faceValue", + "type": "uint256" + }, + { + "internalType": "uint128", + "name": "baseLiveWinProb", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "expiredWinProb", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "ticketDuration", + "type": "uint256" + } + ], + "internalType": "struct IEpochsManager.Epoch", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + } + ], + "name": "getEpoch", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "startBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "endBlock", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "defaultPayoutPercentage", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "decayRate", + "type": "uint32" + }, + { + "internalType": "uint256", + "name": "faceValue", + "type": "uint256" + }, + { + "internalType": "uint128", + "name": "baseLiveWinProb", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "expiredWinProb", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "ticketDuration", + "type": "uint256" + } + ], + "internalType": "struct IEpochsManager.Epoch", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getNextEpochId", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC721", + "name": "rootSeekers", + "type": "address" + }, + { + "internalType": "contract Directory", + "name": "directory", + "type": "address" + }, + { + "internalType": "contract Registries", + "name": "registries", + "type": "address" + }, + { + "internalType": "contract TicketingParameters", + "name": "ticketingParameters", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_initialEpoch", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_epochDuration", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "initializeEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "joinNextEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_epochDuration", + "type": "uint256" + } + ], + "name": "setEpochDuration", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_initialEpoch", + "type": "uint256" + } + ], + "name": "setInitialEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x6203d625a86272b772867734a56a99707928b5789b32e2b6bbde3ce7446d66da", + "receipt": { + "to": null, + "from": "0x448c8e9e1816300Dd052e77D2A44c990A2807D15", + "contractAddress": "0xD6f61D3e7a9026C42810E74a05dD4bE763AdCB53", + "transactionIndex": 0, + "gasUsed": "1340781", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xad5825cb272c2b76b84b77b39799df51624081523038b8748a756d5abffc0ec3", + "transactionHash": "0x6203d625a86272b772867734a56a99707928b5789b32e2b6bbde3ce7446d66da", + "logs": [], + "blockNumber": 10978370, + "cumulativeGasUsed": "1340781", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "76c1e1f3445d6d518cb33f614f9922c9", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"ContractNameCannotBeEmpty\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DirectoryCannotBeZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"EpochDurationCannotBeZero\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"}],\"name\":\"EpochHasNotEnded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InitialEpochCannotBeZero\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"expectedBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"currentBlock\",\"type\":\"uint256\"}],\"name\":\"InitialEpochNotYetReady\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InterfaceIdCannotBeZeroBytes\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RegistriesCannotBeZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RootSeekerCannotBeZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SeekerAccountCannotBeZeroAddress\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"seekerId\",\"type\":\"uint256\"}],\"name\":\"SeekerAlreadyJoinedEpoch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SeekerOwnerMismatch\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"TargetContractCannotBeZeroAddress\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"TargetNotSupportInterface\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TicketingParametersCannotBeZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"epochDuration\",\"type\":\"uint256\"}],\"name\":\"EpochDurationUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"node\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"seekerId\",\"type\":\"uint256\"}],\"name\":\"EpochJoined\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"initialEpoch\",\"type\":\"uint256\"}],\"name\":\"InitialEpochUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"}],\"name\":\"NewEpoch\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"_directory\",\"outputs\":[{\"internalType\":\"contract Directory\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_registries\",\"outputs\":[{\"internalType\":\"contract Registries\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_rootSeekers\",\"outputs\":[{\"internalType\":\"contract IERC721\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_ticketingParameters\",\"outputs\":[{\"internalType\":\"contract TicketingParameters\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"activeSeekers\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentIteration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"epochDuration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"epochs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"startBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"endBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint32\",\"name\":\"defaultPayoutPercentage\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"decayRate\",\"type\":\"uint32\"},{\"internalType\":\"uint256\",\"name\":\"faceValue\",\"type\":\"uint256\"},{\"internalType\":\"uint128\",\"name\":\"baseLiveWinProb\",\"type\":\"uint128\"},{\"internalType\":\"uint128\",\"name\":\"expiredWinProb\",\"type\":\"uint128\"},{\"internalType\":\"uint256\",\"name\":\"ticketDuration\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCurrentActiveEpoch\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"startBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"endBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint32\",\"name\":\"defaultPayoutPercentage\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"decayRate\",\"type\":\"uint32\"},{\"internalType\":\"uint256\",\"name\":\"faceValue\",\"type\":\"uint256\"},{\"internalType\":\"uint128\",\"name\":\"baseLiveWinProb\",\"type\":\"uint128\"},{\"internalType\":\"uint128\",\"name\":\"expiredWinProb\",\"type\":\"uint128\"},{\"internalType\":\"uint256\",\"name\":\"ticketDuration\",\"type\":\"uint256\"}],\"internalType\":\"struct IEpochsManager.Epoch\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"}],\"name\":\"getEpoch\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"startBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"endBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint32\",\"name\":\"defaultPayoutPercentage\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"decayRate\",\"type\":\"uint32\"},{\"internalType\":\"uint256\",\"name\":\"faceValue\",\"type\":\"uint256\"},{\"internalType\":\"uint128\",\"name\":\"baseLiveWinProb\",\"type\":\"uint128\"},{\"internalType\":\"uint128\",\"name\":\"expiredWinProb\",\"type\":\"uint128\"},{\"internalType\":\"uint256\",\"name\":\"ticketDuration\",\"type\":\"uint256\"}],\"internalType\":\"struct IEpochsManager.Epoch\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getNextEpochId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialEpoch\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC721\",\"name\":\"rootSeekers\",\"type\":\"address\"},{\"internalType\":\"contract Directory\",\"name\":\"directory\",\"type\":\"address\"},{\"internalType\":\"contract Registries\",\"name\":\"registries\",\"type\":\"address\"},{\"internalType\":\"contract TicketingParameters\",\"name\":\"ticketingParameters\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_initialEpoch\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_epochDuration\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initializeEpoch\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"joinNextEpoch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epochDuration\",\"type\":\"uint256\"}],\"name\":\"setEpochDuration\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_initialEpoch\",\"type\":\"uint256\"}],\"name\":\"setInitialEpoch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"getCurrentActiveEpoch()\":{\"returns\":{\"_0\":\"The current Epoch parameters.\"}},\"getEpoch(uint256)\":{\"params\":{\"epochId\":\"The id of the epoch to retrieve.\"},\"returns\":{\"_0\":\"The epoch parameters associated with the id.\"}},\"getNextEpochId()\":{\"returns\":{\"_0\":\"The next epoch id identifier.\"}},\"initializeEpoch()\":{\"details\":\"The function will read the current set of network parameters, and store the parameters in a new Epoch struct. The end block of the current epoch will also be set to a non-zero value.\"},\"joinNextEpoch()\":{\"details\":\"This is a proxy function for `initalizeNextRewardPool` and `joinNextDirectory`.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"setEpochDuration(uint256)\":{\"params\":{\"_epochDuration\":\"The epoch duration in number of blocks.\"}},\"setInitialEpoch(uint256)\":{\"params\":{\"_initialEpoch\":\"The block number when the first epoch can be initialized.\"}},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"activeSeekers(uint256,uint256)\":{\"notice\":\"Track seekers that have joined for a specific epoch.\"},\"currentIteration()\":{\"notice\":\"The value of the integer used as the current epoch's identifier. This value is incremented as each epoch is initialized.\"},\"epochDuration()\":{\"notice\":\"The duration in blocks an epoch will last for.\"},\"epochs(uint256)\":{\"notice\":\"A mapping of all epochs that have been initialized.\"},\"getCurrentActiveEpoch()\":{\"notice\":\"Retrieve the parameters for the current epoch.\"},\"getEpoch(uint256)\":{\"notice\":\"Retrieve the epoch parameter for the given id.\"},\"getNextEpochId()\":{\"notice\":\"Retrieve the integer value that will be used for the next epoch id.\"},\"initialEpoch()\":{\"notice\":\"The block number since the first epoch can be initialized.\"},\"initializeEpoch()\":{\"notice\":\"Call this to initialize the next epoch. On success, a `NewEpoch` event will be emitted.\"},\"joinNextEpoch()\":{\"notice\":\"Nodes should call this to join the next epoch. It will initialize the next reward pool and set the stake for the next directory.\"},\"setEpochDuration(uint256)\":{\"notice\":\"Set the epoch duration. Will take effect in the next epoch. Only callable by the owner.\"},\"setInitialEpoch(uint256)\":{\"notice\":\"Set the first epoch starting block. Only callable by the owner.\"},\"supportsInterface(bytes4)\":{\"notice\":\"Returns true if the contract implements the interface defined by `interfaceId` from ERC165.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/epochs/EpochsManager.sol\":\"EpochsManager\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./OwnableUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership} and {acceptOwnership}.\\n *\\n * This module is used through inheritance. It will make available all functions\\n * from parent (Ownable).\\n */\\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\\n function __Ownable2Step_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable2Step_init_unchained() internal onlyInitializing {\\n }\\n address private _pendingOwner;\\n\\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Returns the address of the pending owner.\\n */\\n function pendingOwner() public view virtual returns (address) {\\n return _pendingOwner;\\n }\\n\\n /**\\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual override onlyOwner {\\n _pendingOwner = newOwner;\\n emit OwnershipTransferStarted(owner(), newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual override {\\n delete _pendingOwner;\\n super._transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev The new owner accepts the ownership transfer.\\n */\\n function acceptOwnership() public virtual {\\n address sender = _msgSender();\\n require(pendingOwner() == sender, \\\"Ownable2Step: caller is not the new owner\\\");\\n _transferOwnership(sender);\\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\":\"0x84efb8889801b0ac817324aff6acc691d07bbee816b671817132911d287a8c63\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n\\n /**\\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\":\"0x4075622496acc77fd6d4de4cc30a8577a744d5c75afad33fdeacf1704d6eda98\",\"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/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/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/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\",\"keccak256\":\"0xa56ca923f70c1748830700250b19c61b70db9a683516dc5e216694a50445d99c\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.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 IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xec63854014a5b4f2b3290ab9103a21bdf902a508d0f41a8573fea49e98bf571a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.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 \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n /**\\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.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(IERC20 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(IERC20 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(IERC20 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(IERC20 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(IERC20 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 IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n 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(IERC20 token, bytes memory data) private returns (bool) {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\\n // and not revert is the subcall reverts.\\n\\n (bool success, bytes memory returndata) = address(token).call(data);\\n return\\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\\n }\\n}\\n\",\"keccak256\":\"0x909d608c2db6eb165ca178c81289a07ed2e118e444d0025b2a85c97d0b44a4fa\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"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/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\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.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/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\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 = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _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(SignedMath.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n 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\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.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 \\\"../Strings.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 ECDSA {\\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\\\", Strings.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\":\"0x809bc3edb4bcbef8263fa616c1b60ee0004b50a8a1bfa164d8f57fd31f520c58\",\"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/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\"},\"@openzeppelin/contracts/utils/math/Math.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 Math {\\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\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)\\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\\n * checks.\\n *\\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\\n * easily result in undesired exploitation or bugs, since developers usually\\n * assume that overflows raise errors. `SafeCast` restores this intuition by\\n * reverting the transaction when such an operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n *\\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\\n * all math on `uint256` and `int256` and then downcasting.\\n */\\nlibrary SafeCast {\\n /**\\n * @dev Returns the downcasted uint248 from uint256, reverting on\\n * overflow (when the input is greater than largest uint248).\\n *\\n * Counterpart to Solidity's `uint248` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 248 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint248(uint256 value) internal pure returns (uint248) {\\n require(value <= type(uint248).max, \\\"SafeCast: value doesn't fit in 248 bits\\\");\\n return uint248(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint240 from uint256, reverting on\\n * overflow (when the input is greater than largest uint240).\\n *\\n * Counterpart to Solidity's `uint240` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 240 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint240(uint256 value) internal pure returns (uint240) {\\n require(value <= type(uint240).max, \\\"SafeCast: value doesn't fit in 240 bits\\\");\\n return uint240(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint232 from uint256, reverting on\\n * overflow (when the input is greater than largest uint232).\\n *\\n * Counterpart to Solidity's `uint232` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 232 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint232(uint256 value) internal pure returns (uint232) {\\n require(value <= type(uint232).max, \\\"SafeCast: value doesn't fit in 232 bits\\\");\\n return uint232(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint224 from uint256, reverting on\\n * overflow (when the input is greater than largest uint224).\\n *\\n * Counterpart to Solidity's `uint224` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 224 bits\\n *\\n * _Available since v4.2._\\n */\\n function toUint224(uint256 value) internal pure returns (uint224) {\\n require(value <= type(uint224).max, \\\"SafeCast: value doesn't fit in 224 bits\\\");\\n return uint224(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint216 from uint256, reverting on\\n * overflow (when the input is greater than largest uint216).\\n *\\n * Counterpart to Solidity's `uint216` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 216 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint216(uint256 value) internal pure returns (uint216) {\\n require(value <= type(uint216).max, \\\"SafeCast: value doesn't fit in 216 bits\\\");\\n return uint216(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint208 from uint256, reverting on\\n * overflow (when the input is greater than largest uint208).\\n *\\n * Counterpart to Solidity's `uint208` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 208 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint208(uint256 value) internal pure returns (uint208) {\\n require(value <= type(uint208).max, \\\"SafeCast: value doesn't fit in 208 bits\\\");\\n return uint208(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint200 from uint256, reverting on\\n * overflow (when the input is greater than largest uint200).\\n *\\n * Counterpart to Solidity's `uint200` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 200 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint200(uint256 value) internal pure returns (uint200) {\\n require(value <= type(uint200).max, \\\"SafeCast: value doesn't fit in 200 bits\\\");\\n return uint200(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint192 from uint256, reverting on\\n * overflow (when the input is greater than largest uint192).\\n *\\n * Counterpart to Solidity's `uint192` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 192 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint192(uint256 value) internal pure returns (uint192) {\\n require(value <= type(uint192).max, \\\"SafeCast: value doesn't fit in 192 bits\\\");\\n return uint192(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint184 from uint256, reverting on\\n * overflow (when the input is greater than largest uint184).\\n *\\n * Counterpart to Solidity's `uint184` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 184 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint184(uint256 value) internal pure returns (uint184) {\\n require(value <= type(uint184).max, \\\"SafeCast: value doesn't fit in 184 bits\\\");\\n return uint184(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint176 from uint256, reverting on\\n * overflow (when the input is greater than largest uint176).\\n *\\n * Counterpart to Solidity's `uint176` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 176 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint176(uint256 value) internal pure returns (uint176) {\\n require(value <= type(uint176).max, \\\"SafeCast: value doesn't fit in 176 bits\\\");\\n return uint176(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint168 from uint256, reverting on\\n * overflow (when the input is greater than largest uint168).\\n *\\n * Counterpart to Solidity's `uint168` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 168 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint168(uint256 value) internal pure returns (uint168) {\\n require(value <= type(uint168).max, \\\"SafeCast: value doesn't fit in 168 bits\\\");\\n return uint168(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint160 from uint256, reverting on\\n * overflow (when the input is greater than largest uint160).\\n *\\n * Counterpart to Solidity's `uint160` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 160 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint160(uint256 value) internal pure returns (uint160) {\\n require(value <= type(uint160).max, \\\"SafeCast: value doesn't fit in 160 bits\\\");\\n return uint160(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint152 from uint256, reverting on\\n * overflow (when the input is greater than largest uint152).\\n *\\n * Counterpart to Solidity's `uint152` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 152 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint152(uint256 value) internal pure returns (uint152) {\\n require(value <= type(uint152).max, \\\"SafeCast: value doesn't fit in 152 bits\\\");\\n return uint152(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint144 from uint256, reverting on\\n * overflow (when the input is greater than largest uint144).\\n *\\n * Counterpart to Solidity's `uint144` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 144 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint144(uint256 value) internal pure returns (uint144) {\\n require(value <= type(uint144).max, \\\"SafeCast: value doesn't fit in 144 bits\\\");\\n return uint144(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint136 from uint256, reverting on\\n * overflow (when the input is greater than largest uint136).\\n *\\n * Counterpart to Solidity's `uint136` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 136 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint136(uint256 value) internal pure returns (uint136) {\\n require(value <= type(uint136).max, \\\"SafeCast: value doesn't fit in 136 bits\\\");\\n return uint136(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint128 from uint256, reverting on\\n * overflow (when the input is greater than largest uint128).\\n *\\n * Counterpart to Solidity's `uint128` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 128 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint128(uint256 value) internal pure returns (uint128) {\\n require(value <= type(uint128).max, \\\"SafeCast: value doesn't fit in 128 bits\\\");\\n return uint128(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint120 from uint256, reverting on\\n * overflow (when the input is greater than largest uint120).\\n *\\n * Counterpart to Solidity's `uint120` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 120 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint120(uint256 value) internal pure returns (uint120) {\\n require(value <= type(uint120).max, \\\"SafeCast: value doesn't fit in 120 bits\\\");\\n return uint120(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint112 from uint256, reverting on\\n * overflow (when the input is greater than largest uint112).\\n *\\n * Counterpart to Solidity's `uint112` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 112 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint112(uint256 value) internal pure returns (uint112) {\\n require(value <= type(uint112).max, \\\"SafeCast: value doesn't fit in 112 bits\\\");\\n return uint112(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint104 from uint256, reverting on\\n * overflow (when the input is greater than largest uint104).\\n *\\n * Counterpart to Solidity's `uint104` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 104 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint104(uint256 value) internal pure returns (uint104) {\\n require(value <= type(uint104).max, \\\"SafeCast: value doesn't fit in 104 bits\\\");\\n return uint104(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint96 from uint256, reverting on\\n * overflow (when the input is greater than largest uint96).\\n *\\n * Counterpart to Solidity's `uint96` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 96 bits\\n *\\n * _Available since v4.2._\\n */\\n function toUint96(uint256 value) internal pure returns (uint96) {\\n require(value <= type(uint96).max, \\\"SafeCast: value doesn't fit in 96 bits\\\");\\n return uint96(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint88 from uint256, reverting on\\n * overflow (when the input is greater than largest uint88).\\n *\\n * Counterpart to Solidity's `uint88` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 88 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint88(uint256 value) internal pure returns (uint88) {\\n require(value <= type(uint88).max, \\\"SafeCast: value doesn't fit in 88 bits\\\");\\n return uint88(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint80 from uint256, reverting on\\n * overflow (when the input is greater than largest uint80).\\n *\\n * Counterpart to Solidity's `uint80` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 80 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint80(uint256 value) internal pure returns (uint80) {\\n require(value <= type(uint80).max, \\\"SafeCast: value doesn't fit in 80 bits\\\");\\n return uint80(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint72 from uint256, reverting on\\n * overflow (when the input is greater than largest uint72).\\n *\\n * Counterpart to Solidity's `uint72` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 72 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint72(uint256 value) internal pure returns (uint72) {\\n require(value <= type(uint72).max, \\\"SafeCast: value doesn't fit in 72 bits\\\");\\n return uint72(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint64 from uint256, reverting on\\n * overflow (when the input is greater than largest uint64).\\n *\\n * Counterpart to Solidity's `uint64` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 64 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint64(uint256 value) internal pure returns (uint64) {\\n require(value <= type(uint64).max, \\\"SafeCast: value doesn't fit in 64 bits\\\");\\n return uint64(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint56 from uint256, reverting on\\n * overflow (when the input is greater than largest uint56).\\n *\\n * Counterpart to Solidity's `uint56` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 56 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint56(uint256 value) internal pure returns (uint56) {\\n require(value <= type(uint56).max, \\\"SafeCast: value doesn't fit in 56 bits\\\");\\n return uint56(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint48 from uint256, reverting on\\n * overflow (when the input is greater than largest uint48).\\n *\\n * Counterpart to Solidity's `uint48` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 48 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint48(uint256 value) internal pure returns (uint48) {\\n require(value <= type(uint48).max, \\\"SafeCast: value doesn't fit in 48 bits\\\");\\n return uint48(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint40 from uint256, reverting on\\n * overflow (when the input is greater than largest uint40).\\n *\\n * Counterpart to Solidity's `uint40` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 40 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint40(uint256 value) internal pure returns (uint40) {\\n require(value <= type(uint40).max, \\\"SafeCast: value doesn't fit in 40 bits\\\");\\n return uint40(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint32 from uint256, reverting on\\n * overflow (when the input is greater than largest uint32).\\n *\\n * Counterpart to Solidity's `uint32` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 32 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint32(uint256 value) internal pure returns (uint32) {\\n require(value <= type(uint32).max, \\\"SafeCast: value doesn't fit in 32 bits\\\");\\n return uint32(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint24 from uint256, reverting on\\n * overflow (when the input is greater than largest uint24).\\n *\\n * Counterpart to Solidity's `uint24` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 24 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint24(uint256 value) internal pure returns (uint24) {\\n require(value <= type(uint24).max, \\\"SafeCast: value doesn't fit in 24 bits\\\");\\n return uint24(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint16 from uint256, reverting on\\n * overflow (when the input is greater than largest uint16).\\n *\\n * Counterpart to Solidity's `uint16` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 16 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint16(uint256 value) internal pure returns (uint16) {\\n require(value <= type(uint16).max, \\\"SafeCast: value doesn't fit in 16 bits\\\");\\n return uint16(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint8 from uint256, reverting on\\n * overflow (when the input is greater than largest uint8).\\n *\\n * Counterpart to Solidity's `uint8` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 8 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint8(uint256 value) internal pure returns (uint8) {\\n require(value <= type(uint8).max, \\\"SafeCast: value doesn't fit in 8 bits\\\");\\n return uint8(value);\\n }\\n\\n /**\\n * @dev Converts a signed int256 into an unsigned uint256.\\n *\\n * Requirements:\\n *\\n * - input must be greater than or equal to 0.\\n *\\n * _Available since v3.0._\\n */\\n function toUint256(int256 value) internal pure returns (uint256) {\\n require(value >= 0, \\\"SafeCast: value must be positive\\\");\\n return uint256(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int248 from int256, reverting on\\n * overflow (when the input is less than smallest int248 or\\n * greater than largest int248).\\n *\\n * Counterpart to Solidity's `int248` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 248 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\\n downcasted = int248(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 248 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int240 from int256, reverting on\\n * overflow (when the input is less than smallest int240 or\\n * greater than largest int240).\\n *\\n * Counterpart to Solidity's `int240` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 240 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\\n downcasted = int240(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 240 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int232 from int256, reverting on\\n * overflow (when the input is less than smallest int232 or\\n * greater than largest int232).\\n *\\n * Counterpart to Solidity's `int232` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 232 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\\n downcasted = int232(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 232 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int224 from int256, reverting on\\n * overflow (when the input is less than smallest int224 or\\n * greater than largest int224).\\n *\\n * Counterpart to Solidity's `int224` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 224 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\\n downcasted = int224(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 224 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int216 from int256, reverting on\\n * overflow (when the input is less than smallest int216 or\\n * greater than largest int216).\\n *\\n * Counterpart to Solidity's `int216` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 216 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\\n downcasted = int216(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 216 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int208 from int256, reverting on\\n * overflow (when the input is less than smallest int208 or\\n * greater than largest int208).\\n *\\n * Counterpart to Solidity's `int208` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 208 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\\n downcasted = int208(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 208 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int200 from int256, reverting on\\n * overflow (when the input is less than smallest int200 or\\n * greater than largest int200).\\n *\\n * Counterpart to Solidity's `int200` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 200 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\\n downcasted = int200(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 200 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int192 from int256, reverting on\\n * overflow (when the input is less than smallest int192 or\\n * greater than largest int192).\\n *\\n * Counterpart to Solidity's `int192` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 192 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\\n downcasted = int192(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 192 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int184 from int256, reverting on\\n * overflow (when the input is less than smallest int184 or\\n * greater than largest int184).\\n *\\n * Counterpart to Solidity's `int184` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 184 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\\n downcasted = int184(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 184 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int176 from int256, reverting on\\n * overflow (when the input is less than smallest int176 or\\n * greater than largest int176).\\n *\\n * Counterpart to Solidity's `int176` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 176 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\\n downcasted = int176(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 176 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int168 from int256, reverting on\\n * overflow (when the input is less than smallest int168 or\\n * greater than largest int168).\\n *\\n * Counterpart to Solidity's `int168` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 168 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\\n downcasted = int168(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 168 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int160 from int256, reverting on\\n * overflow (when the input is less than smallest int160 or\\n * greater than largest int160).\\n *\\n * Counterpart to Solidity's `int160` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 160 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\\n downcasted = int160(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 160 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int152 from int256, reverting on\\n * overflow (when the input is less than smallest int152 or\\n * greater than largest int152).\\n *\\n * Counterpart to Solidity's `int152` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 152 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\\n downcasted = int152(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 152 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int144 from int256, reverting on\\n * overflow (when the input is less than smallest int144 or\\n * greater than largest int144).\\n *\\n * Counterpart to Solidity's `int144` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 144 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\\n downcasted = int144(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 144 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int136 from int256, reverting on\\n * overflow (when the input is less than smallest int136 or\\n * greater than largest int136).\\n *\\n * Counterpart to Solidity's `int136` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 136 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\\n downcasted = int136(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 136 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int128 from int256, reverting on\\n * overflow (when the input is less than smallest int128 or\\n * greater than largest int128).\\n *\\n * Counterpart to Solidity's `int128` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 128 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\\n downcasted = int128(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 128 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int120 from int256, reverting on\\n * overflow (when the input is less than smallest int120 or\\n * greater than largest int120).\\n *\\n * Counterpart to Solidity's `int120` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 120 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\\n downcasted = int120(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 120 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int112 from int256, reverting on\\n * overflow (when the input is less than smallest int112 or\\n * greater than largest int112).\\n *\\n * Counterpart to Solidity's `int112` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 112 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\\n downcasted = int112(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 112 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int104 from int256, reverting on\\n * overflow (when the input is less than smallest int104 or\\n * greater than largest int104).\\n *\\n * Counterpart to Solidity's `int104` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 104 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\\n downcasted = int104(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 104 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int96 from int256, reverting on\\n * overflow (when the input is less than smallest int96 or\\n * greater than largest int96).\\n *\\n * Counterpart to Solidity's `int96` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 96 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\\n downcasted = int96(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 96 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int88 from int256, reverting on\\n * overflow (when the input is less than smallest int88 or\\n * greater than largest int88).\\n *\\n * Counterpart to Solidity's `int88` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 88 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\\n downcasted = int88(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 88 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int80 from int256, reverting on\\n * overflow (when the input is less than smallest int80 or\\n * greater than largest int80).\\n *\\n * Counterpart to Solidity's `int80` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 80 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\\n downcasted = int80(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 80 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int72 from int256, reverting on\\n * overflow (when the input is less than smallest int72 or\\n * greater than largest int72).\\n *\\n * Counterpart to Solidity's `int72` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 72 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\\n downcasted = int72(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 72 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int64 from int256, reverting on\\n * overflow (when the input is less than smallest int64 or\\n * greater than largest int64).\\n *\\n * Counterpart to Solidity's `int64` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 64 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\\n downcasted = int64(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 64 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int56 from int256, reverting on\\n * overflow (when the input is less than smallest int56 or\\n * greater than largest int56).\\n *\\n * Counterpart to Solidity's `int56` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 56 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\\n downcasted = int56(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 56 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int48 from int256, reverting on\\n * overflow (when the input is less than smallest int48 or\\n * greater than largest int48).\\n *\\n * Counterpart to Solidity's `int48` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 48 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\\n downcasted = int48(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 48 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int40 from int256, reverting on\\n * overflow (when the input is less than smallest int40 or\\n * greater than largest int40).\\n *\\n * Counterpart to Solidity's `int40` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 40 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\\n downcasted = int40(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 40 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int32 from int256, reverting on\\n * overflow (when the input is less than smallest int32 or\\n * greater than largest int32).\\n *\\n * Counterpart to Solidity's `int32` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 32 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\\n downcasted = int32(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 32 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int24 from int256, reverting on\\n * overflow (when the input is less than smallest int24 or\\n * greater than largest int24).\\n *\\n * Counterpart to Solidity's `int24` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 24 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\\n downcasted = int24(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 24 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int16 from int256, reverting on\\n * overflow (when the input is less than smallest int16 or\\n * greater than largest int16).\\n *\\n * Counterpart to Solidity's `int16` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 16 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\\n downcasted = int16(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 16 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int8 from int256, reverting on\\n * overflow (when the input is less than smallest int8 or\\n * greater than largest int8).\\n *\\n * Counterpart to Solidity's `int8` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 8 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\\n downcasted = int8(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 8 bits\\\");\\n }\\n\\n /**\\n * @dev Converts an unsigned uint256 into a signed int256.\\n *\\n * Requirements:\\n *\\n * - input must be less than or equal to maxInt256.\\n *\\n * _Available since v3.0._\\n */\\n function toInt256(uint256 value) internal pure returns (int256) {\\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\\n require(value <= uint256(type(int256).max), \\\"SafeCast: value doesn't fit in an int256\\\");\\n return int256(value);\\n }\\n}\\n\",\"keccak256\":\"0x52a8cfb0f5239d11b457dcdd1b326992ef672714ca8da71a157255bddd13f3ad\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.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 SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"abdk-libraries-solidity/ABDKMath64x64.sol\":{\"content\":\"// SPDX-License-Identifier: BSD-4-Clause\\n/*\\n * ABDK Math 64.64 Smart Contract Library. Copyright \\u00a9 2019 by ABDK Consulting.\\n * Author: Mikhail Vladimirov \\n */\\npragma solidity ^0.8.0;\\n\\n/**\\n * Smart contract library of mathematical functions operating with signed\\n * 64.64-bit fixed point numbers. Signed 64.64-bit fixed point number is\\n * basically a simple fraction whose numerator is signed 128-bit integer and\\n * denominator is 2^64. As long as denominator is always the same, there is no\\n * need to store it, thus in Solidity signed 64.64-bit fixed point numbers are\\n * represented by int128 type holding only the numerator.\\n */\\nlibrary ABDKMath64x64 {\\n /*\\n * Minimum value signed 64.64-bit fixed point number may have. \\n */\\n int128 private constant MIN_64x64 = -0x80000000000000000000000000000000;\\n\\n /*\\n * Maximum value signed 64.64-bit fixed point number may have. \\n */\\n int128 private constant MAX_64x64 = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;\\n\\n /**\\n * Convert signed 256-bit integer number into signed 64.64-bit fixed point\\n * number. Revert on overflow.\\n *\\n * @param x signed 256-bit integer number\\n * @return signed 64.64-bit fixed point number\\n */\\n function fromInt (int256 x) internal pure returns (int128) {\\n unchecked {\\n require (x >= -0x8000000000000000 && x <= 0x7FFFFFFFFFFFFFFF);\\n return int128 (x << 64);\\n }\\n }\\n\\n /**\\n * Convert signed 64.64 fixed point number into signed 64-bit integer number\\n * rounding down.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64-bit integer number\\n */\\n function toInt (int128 x) internal pure returns (int64) {\\n unchecked {\\n return int64 (x >> 64);\\n }\\n }\\n\\n /**\\n * Convert unsigned 256-bit integer number into signed 64.64-bit fixed point\\n * number. Revert on overflow.\\n *\\n * @param x unsigned 256-bit integer number\\n * @return signed 64.64-bit fixed point number\\n */\\n function fromUInt (uint256 x) internal pure returns (int128) {\\n unchecked {\\n require (x <= 0x7FFFFFFFFFFFFFFF);\\n return int128 (int256 (x << 64));\\n }\\n }\\n\\n /**\\n * Convert signed 64.64 fixed point number into unsigned 64-bit integer\\n * number rounding down. Revert on underflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return unsigned 64-bit integer number\\n */\\n function toUInt (int128 x) internal pure returns (uint64) {\\n unchecked {\\n require (x >= 0);\\n return uint64 (uint128 (x >> 64));\\n }\\n }\\n\\n /**\\n * Convert signed 128.128 fixed point number into signed 64.64-bit fixed point\\n * number rounding down. Revert on overflow.\\n *\\n * @param x signed 128.128-bin fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function from128x128 (int256 x) internal pure returns (int128) {\\n unchecked {\\n int256 result = x >> 64;\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Convert signed 64.64 fixed point number into signed 128.128 fixed point\\n * number.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 128.128 fixed point number\\n */\\n function to128x128 (int128 x) internal pure returns (int256) {\\n unchecked {\\n return int256 (x) << 64;\\n }\\n }\\n\\n /**\\n * Calculate x + y. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function add (int128 x, int128 y) internal pure returns (int128) {\\n unchecked {\\n int256 result = int256(x) + y;\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate x - y. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function sub (int128 x, int128 y) internal pure returns (int128) {\\n unchecked {\\n int256 result = int256(x) - y;\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate x * y rounding down. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function mul (int128 x, int128 y) internal pure returns (int128) {\\n unchecked {\\n int256 result = int256(x) * y >> 64;\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate x * y rounding towards zero, where x is signed 64.64 fixed point\\n * number and y is signed 256-bit integer number. Revert on overflow.\\n *\\n * @param x signed 64.64 fixed point number\\n * @param y signed 256-bit integer number\\n * @return signed 256-bit integer number\\n */\\n function muli (int128 x, int256 y) internal pure returns (int256) {\\n unchecked {\\n if (x == MIN_64x64) {\\n require (y >= -0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF &&\\n y <= 0x1000000000000000000000000000000000000000000000000);\\n return -y << 63;\\n } else {\\n bool negativeResult = false;\\n if (x < 0) {\\n x = -x;\\n negativeResult = true;\\n }\\n if (y < 0) {\\n y = -y; // We rely on overflow behavior here\\n negativeResult = !negativeResult;\\n }\\n uint256 absoluteResult = mulu (x, uint256 (y));\\n if (negativeResult) {\\n require (absoluteResult <=\\n 0x8000000000000000000000000000000000000000000000000000000000000000);\\n return -int256 (absoluteResult); // We rely on overflow behavior here\\n } else {\\n require (absoluteResult <=\\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\\n return int256 (absoluteResult);\\n }\\n }\\n }\\n }\\n\\n /**\\n * Calculate x * y rounding down, where x is signed 64.64 fixed point number\\n * and y is unsigned 256-bit integer number. Revert on overflow.\\n *\\n * @param x signed 64.64 fixed point number\\n * @param y unsigned 256-bit integer number\\n * @return unsigned 256-bit integer number\\n */\\n function mulu (int128 x, uint256 y) internal pure returns (uint256) {\\n unchecked {\\n if (y == 0) return 0;\\n\\n require (x >= 0);\\n\\n uint256 lo = (uint256 (int256 (x)) * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) >> 64;\\n uint256 hi = uint256 (int256 (x)) * (y >> 128);\\n\\n require (hi <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\\n hi <<= 64;\\n\\n require (hi <=\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - lo);\\n return hi + lo;\\n }\\n }\\n\\n /**\\n * Calculate x / y rounding towards zero. Revert on overflow or when y is\\n * zero.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function div (int128 x, int128 y) internal pure returns (int128) {\\n unchecked {\\n require (y != 0);\\n int256 result = (int256 (x) << 64) / y;\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate x / y rounding towards zero, where x and y are signed 256-bit\\n * integer numbers. Revert on overflow or when y is zero.\\n *\\n * @param x signed 256-bit integer number\\n * @param y signed 256-bit integer number\\n * @return signed 64.64-bit fixed point number\\n */\\n function divi (int256 x, int256 y) internal pure returns (int128) {\\n unchecked {\\n require (y != 0);\\n\\n bool negativeResult = false;\\n if (x < 0) {\\n x = -x; // We rely on overflow behavior here\\n negativeResult = true;\\n }\\n if (y < 0) {\\n y = -y; // We rely on overflow behavior here\\n negativeResult = !negativeResult;\\n }\\n uint128 absoluteResult = divuu (uint256 (x), uint256 (y));\\n if (negativeResult) {\\n require (absoluteResult <= 0x80000000000000000000000000000000);\\n return -int128 (absoluteResult); // We rely on overflow behavior here\\n } else {\\n require (absoluteResult <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\\n return int128 (absoluteResult); // We rely on overflow behavior here\\n }\\n }\\n }\\n\\n /**\\n * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit\\n * integer numbers. Revert on overflow or when y is zero.\\n *\\n * @param x unsigned 256-bit integer number\\n * @param y unsigned 256-bit integer number\\n * @return signed 64.64-bit fixed point number\\n */\\n function divu (uint256 x, uint256 y) internal pure returns (int128) {\\n unchecked {\\n require (y != 0);\\n uint128 result = divuu (x, y);\\n require (result <= uint128 (MAX_64x64));\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate -x. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function neg (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x != MIN_64x64);\\n return -x;\\n }\\n }\\n\\n /**\\n * Calculate |x|. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function abs (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x != MIN_64x64);\\n return x < 0 ? -x : x;\\n }\\n }\\n\\n /**\\n * Calculate 1 / x rounding towards zero. Revert on overflow or when x is\\n * zero.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function inv (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x != 0);\\n int256 result = int256 (0x100000000000000000000000000000000) / x;\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate arithmetics average of x and y, i.e. (x + y) / 2 rounding down.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function avg (int128 x, int128 y) internal pure returns (int128) {\\n unchecked {\\n return int128 ((int256 (x) + int256 (y)) >> 1);\\n }\\n }\\n\\n /**\\n * Calculate geometric average of x and y, i.e. sqrt (x * y) rounding down.\\n * Revert on overflow or in case x * y is negative.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function gavg (int128 x, int128 y) internal pure returns (int128) {\\n unchecked {\\n int256 m = int256 (x) * int256 (y);\\n require (m >= 0);\\n require (m <\\n 0x4000000000000000000000000000000000000000000000000000000000000000);\\n return int128 (sqrtu (uint256 (m)));\\n }\\n }\\n\\n /**\\n * Calculate x^y assuming 0^0 is 1, where x is signed 64.64 fixed point number\\n * and y is unsigned 256-bit integer number. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y uint256 value\\n * @return signed 64.64-bit fixed point number\\n */\\n function pow (int128 x, uint256 y) internal pure returns (int128) {\\n unchecked {\\n bool negative = x < 0 && y & 1 == 1;\\n\\n uint256 absX = uint128 (x < 0 ? -x : x);\\n uint256 absResult;\\n absResult = 0x100000000000000000000000000000000;\\n\\n if (absX <= 0x10000000000000000) {\\n absX <<= 63;\\n while (y != 0) {\\n if (y & 0x1 != 0) {\\n absResult = absResult * absX >> 127;\\n }\\n absX = absX * absX >> 127;\\n\\n if (y & 0x2 != 0) {\\n absResult = absResult * absX >> 127;\\n }\\n absX = absX * absX >> 127;\\n\\n if (y & 0x4 != 0) {\\n absResult = absResult * absX >> 127;\\n }\\n absX = absX * absX >> 127;\\n\\n if (y & 0x8 != 0) {\\n absResult = absResult * absX >> 127;\\n }\\n absX = absX * absX >> 127;\\n\\n y >>= 4;\\n }\\n\\n absResult >>= 64;\\n } else {\\n uint256 absXShift = 63;\\n if (absX < 0x1000000000000000000000000) { absX <<= 32; absXShift -= 32; }\\n if (absX < 0x10000000000000000000000000000) { absX <<= 16; absXShift -= 16; }\\n if (absX < 0x1000000000000000000000000000000) { absX <<= 8; absXShift -= 8; }\\n if (absX < 0x10000000000000000000000000000000) { absX <<= 4; absXShift -= 4; }\\n if (absX < 0x40000000000000000000000000000000) { absX <<= 2; absXShift -= 2; }\\n if (absX < 0x80000000000000000000000000000000) { absX <<= 1; absXShift -= 1; }\\n\\n uint256 resultShift = 0;\\n while (y != 0) {\\n require (absXShift < 64);\\n\\n if (y & 0x1 != 0) {\\n absResult = absResult * absX >> 127;\\n resultShift += absXShift;\\n if (absResult > 0x100000000000000000000000000000000) {\\n absResult >>= 1;\\n resultShift += 1;\\n }\\n }\\n absX = absX * absX >> 127;\\n absXShift <<= 1;\\n if (absX >= 0x100000000000000000000000000000000) {\\n absX >>= 1;\\n absXShift += 1;\\n }\\n\\n y >>= 1;\\n }\\n\\n require (resultShift < 64);\\n absResult >>= 64 - resultShift;\\n }\\n int256 result = negative ? -int256 (absResult) : int256 (absResult);\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate sqrt (x) rounding down. Revert if x < 0.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function sqrt (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x >= 0);\\n return int128 (sqrtu (uint256 (int256 (x)) << 64));\\n }\\n }\\n\\n /**\\n * Calculate binary logarithm of x. Revert if x <= 0.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function log_2 (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x > 0);\\n\\n int256 msb = 0;\\n int256 xc = x;\\n if (xc >= 0x10000000000000000) { xc >>= 64; msb += 64; }\\n if (xc >= 0x100000000) { xc >>= 32; msb += 32; }\\n if (xc >= 0x10000) { xc >>= 16; msb += 16; }\\n if (xc >= 0x100) { xc >>= 8; msb += 8; }\\n if (xc >= 0x10) { xc >>= 4; msb += 4; }\\n if (xc >= 0x4) { xc >>= 2; msb += 2; }\\n if (xc >= 0x2) msb += 1; // No need to shift xc anymore\\n\\n int256 result = msb - 64 << 64;\\n uint256 ux = uint256 (int256 (x)) << uint256 (127 - msb);\\n for (int256 bit = 0x8000000000000000; bit > 0; bit >>= 1) {\\n ux *= ux;\\n uint256 b = ux >> 255;\\n ux >>= 127 + b;\\n result += bit * int256 (b);\\n }\\n\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate natural logarithm of x. Revert if x <= 0.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function ln (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x > 0);\\n\\n return int128 (int256 (\\n uint256 (int256 (log_2 (x))) * 0xB17217F7D1CF79ABC9E3B39803F2F6AF >> 128));\\n }\\n }\\n\\n /**\\n * Calculate binary exponent of x. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function exp_2 (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x < 0x400000000000000000); // Overflow\\n\\n if (x < -0x400000000000000000) return 0; // Underflow\\n\\n uint256 result = 0x80000000000000000000000000000000;\\n\\n if (x & 0x8000000000000000 > 0)\\n result = result * 0x16A09E667F3BCC908B2FB1366EA957D3E >> 128;\\n if (x & 0x4000000000000000 > 0)\\n result = result * 0x1306FE0A31B7152DE8D5A46305C85EDEC >> 128;\\n if (x & 0x2000000000000000 > 0)\\n result = result * 0x1172B83C7D517ADCDF7C8C50EB14A791F >> 128;\\n if (x & 0x1000000000000000 > 0)\\n result = result * 0x10B5586CF9890F6298B92B71842A98363 >> 128;\\n if (x & 0x800000000000000 > 0)\\n result = result * 0x1059B0D31585743AE7C548EB68CA417FD >> 128;\\n if (x & 0x400000000000000 > 0)\\n result = result * 0x102C9A3E778060EE6F7CACA4F7A29BDE8 >> 128;\\n if (x & 0x200000000000000 > 0)\\n result = result * 0x10163DA9FB33356D84A66AE336DCDFA3F >> 128;\\n if (x & 0x100000000000000 > 0)\\n result = result * 0x100B1AFA5ABCBED6129AB13EC11DC9543 >> 128;\\n if (x & 0x80000000000000 > 0)\\n result = result * 0x10058C86DA1C09EA1FF19D294CF2F679B >> 128;\\n if (x & 0x40000000000000 > 0)\\n result = result * 0x1002C605E2E8CEC506D21BFC89A23A00F >> 128;\\n if (x & 0x20000000000000 > 0)\\n result = result * 0x100162F3904051FA128BCA9C55C31E5DF >> 128;\\n if (x & 0x10000000000000 > 0)\\n result = result * 0x1000B175EFFDC76BA38E31671CA939725 >> 128;\\n if (x & 0x8000000000000 > 0)\\n result = result * 0x100058BA01FB9F96D6CACD4B180917C3D >> 128;\\n if (x & 0x4000000000000 > 0)\\n result = result * 0x10002C5CC37DA9491D0985C348C68E7B3 >> 128;\\n if (x & 0x2000000000000 > 0)\\n result = result * 0x1000162E525EE054754457D5995292026 >> 128;\\n if (x & 0x1000000000000 > 0)\\n result = result * 0x10000B17255775C040618BF4A4ADE83FC >> 128;\\n if (x & 0x800000000000 > 0)\\n result = result * 0x1000058B91B5BC9AE2EED81E9B7D4CFAB >> 128;\\n if (x & 0x400000000000 > 0)\\n result = result * 0x100002C5C89D5EC6CA4D7C8ACC017B7C9 >> 128;\\n if (x & 0x200000000000 > 0)\\n result = result * 0x10000162E43F4F831060E02D839A9D16D >> 128;\\n if (x & 0x100000000000 > 0)\\n result = result * 0x100000B1721BCFC99D9F890EA06911763 >> 128;\\n if (x & 0x80000000000 > 0)\\n result = result * 0x10000058B90CF1E6D97F9CA14DBCC1628 >> 128;\\n if (x & 0x40000000000 > 0)\\n result = result * 0x1000002C5C863B73F016468F6BAC5CA2B >> 128;\\n if (x & 0x20000000000 > 0)\\n result = result * 0x100000162E430E5A18F6119E3C02282A5 >> 128;\\n if (x & 0x10000000000 > 0)\\n result = result * 0x1000000B1721835514B86E6D96EFD1BFE >> 128;\\n if (x & 0x8000000000 > 0)\\n result = result * 0x100000058B90C0B48C6BE5DF846C5B2EF >> 128;\\n if (x & 0x4000000000 > 0)\\n result = result * 0x10000002C5C8601CC6B9E94213C72737A >> 128;\\n if (x & 0x2000000000 > 0)\\n result = result * 0x1000000162E42FFF037DF38AA2B219F06 >> 128;\\n if (x & 0x1000000000 > 0)\\n result = result * 0x10000000B17217FBA9C739AA5819F44F9 >> 128;\\n if (x & 0x800000000 > 0)\\n result = result * 0x1000000058B90BFCDEE5ACD3C1CEDC823 >> 128;\\n if (x & 0x400000000 > 0)\\n result = result * 0x100000002C5C85FE31F35A6A30DA1BE50 >> 128;\\n if (x & 0x200000000 > 0)\\n result = result * 0x10000000162E42FF0999CE3541B9FFFCF >> 128;\\n if (x & 0x100000000 > 0)\\n result = result * 0x100000000B17217F80F4EF5AADDA45554 >> 128;\\n if (x & 0x80000000 > 0)\\n result = result * 0x10000000058B90BFBF8479BD5A81B51AD >> 128;\\n if (x & 0x40000000 > 0)\\n result = result * 0x1000000002C5C85FDF84BD62AE30A74CC >> 128;\\n if (x & 0x20000000 > 0)\\n result = result * 0x100000000162E42FEFB2FED257559BDAA >> 128;\\n if (x & 0x10000000 > 0)\\n result = result * 0x1000000000B17217F7D5A7716BBA4A9AE >> 128;\\n if (x & 0x8000000 > 0)\\n result = result * 0x100000000058B90BFBE9DDBAC5E109CCE >> 128;\\n if (x & 0x4000000 > 0)\\n result = result * 0x10000000002C5C85FDF4B15DE6F17EB0D >> 128;\\n if (x & 0x2000000 > 0)\\n result = result * 0x1000000000162E42FEFA494F1478FDE05 >> 128;\\n if (x & 0x1000000 > 0)\\n result = result * 0x10000000000B17217F7D20CF927C8E94C >> 128;\\n if (x & 0x800000 > 0)\\n result = result * 0x1000000000058B90BFBE8F71CB4E4B33D >> 128;\\n if (x & 0x400000 > 0)\\n result = result * 0x100000000002C5C85FDF477B662B26945 >> 128;\\n if (x & 0x200000 > 0)\\n result = result * 0x10000000000162E42FEFA3AE53369388C >> 128;\\n if (x & 0x100000 > 0)\\n result = result * 0x100000000000B17217F7D1D351A389D40 >> 128;\\n if (x & 0x80000 > 0)\\n result = result * 0x10000000000058B90BFBE8E8B2D3D4EDE >> 128;\\n if (x & 0x40000 > 0)\\n result = result * 0x1000000000002C5C85FDF4741BEA6E77E >> 128;\\n if (x & 0x20000 > 0)\\n result = result * 0x100000000000162E42FEFA39FE95583C2 >> 128;\\n if (x & 0x10000 > 0)\\n result = result * 0x1000000000000B17217F7D1CFB72B45E1 >> 128;\\n if (x & 0x8000 > 0)\\n result = result * 0x100000000000058B90BFBE8E7CC35C3F0 >> 128;\\n if (x & 0x4000 > 0)\\n result = result * 0x10000000000002C5C85FDF473E242EA38 >> 128;\\n if (x & 0x2000 > 0)\\n result = result * 0x1000000000000162E42FEFA39F02B772C >> 128;\\n if (x & 0x1000 > 0)\\n result = result * 0x10000000000000B17217F7D1CF7D83C1A >> 128;\\n if (x & 0x800 > 0)\\n result = result * 0x1000000000000058B90BFBE8E7BDCBE2E >> 128;\\n if (x & 0x400 > 0)\\n result = result * 0x100000000000002C5C85FDF473DEA871F >> 128;\\n if (x & 0x200 > 0)\\n result = result * 0x10000000000000162E42FEFA39EF44D91 >> 128;\\n if (x & 0x100 > 0)\\n result = result * 0x100000000000000B17217F7D1CF79E949 >> 128;\\n if (x & 0x80 > 0)\\n result = result * 0x10000000000000058B90BFBE8E7BCE544 >> 128;\\n if (x & 0x40 > 0)\\n result = result * 0x1000000000000002C5C85FDF473DE6ECA >> 128;\\n if (x & 0x20 > 0)\\n result = result * 0x100000000000000162E42FEFA39EF366F >> 128;\\n if (x & 0x10 > 0)\\n result = result * 0x1000000000000000B17217F7D1CF79AFA >> 128;\\n if (x & 0x8 > 0)\\n result = result * 0x100000000000000058B90BFBE8E7BCD6D >> 128;\\n if (x & 0x4 > 0)\\n result = result * 0x10000000000000002C5C85FDF473DE6B2 >> 128;\\n if (x & 0x2 > 0)\\n result = result * 0x1000000000000000162E42FEFA39EF358 >> 128;\\n if (x & 0x1 > 0)\\n result = result * 0x10000000000000000B17217F7D1CF79AB >> 128;\\n\\n result >>= uint256 (int256 (63 - (x >> 64)));\\n require (result <= uint256 (int256 (MAX_64x64)));\\n\\n return int128 (int256 (result));\\n }\\n }\\n\\n /**\\n * Calculate natural exponent of x. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function exp (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x < 0x400000000000000000); // Overflow\\n\\n if (x < -0x400000000000000000) return 0; // Underflow\\n\\n return exp_2 (\\n int128 (int256 (x) * 0x171547652B82FE1777D0FFDA0D23A7D12 >> 128));\\n }\\n }\\n\\n /**\\n * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit\\n * integer numbers. Revert on overflow or when y is zero.\\n *\\n * @param x unsigned 256-bit integer number\\n * @param y unsigned 256-bit integer number\\n * @return unsigned 64.64-bit fixed point number\\n */\\n function divuu (uint256 x, uint256 y) private pure returns (uint128) {\\n unchecked {\\n require (y != 0);\\n\\n uint256 result;\\n\\n if (x <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)\\n result = (x << 64) / y;\\n else {\\n uint256 msb = 192;\\n uint256 xc = x >> 192;\\n if (xc >= 0x100000000) { xc >>= 32; msb += 32; }\\n if (xc >= 0x10000) { xc >>= 16; msb += 16; }\\n if (xc >= 0x100) { xc >>= 8; msb += 8; }\\n if (xc >= 0x10) { xc >>= 4; msb += 4; }\\n if (xc >= 0x4) { xc >>= 2; msb += 2; }\\n if (xc >= 0x2) msb += 1; // No need to shift xc anymore\\n\\n result = (x << 255 - msb) / ((y - 1 >> msb - 191) + 1);\\n require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\\n\\n uint256 hi = result * (y >> 128);\\n uint256 lo = result * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\\n\\n uint256 xh = x >> 192;\\n uint256 xl = x << 64;\\n\\n if (xl < lo) xh -= 1;\\n xl -= lo; // We rely on overflow behavior here\\n lo = hi << 128;\\n if (xl < lo) xh -= 1;\\n xl -= lo; // We rely on overflow behavior here\\n\\n result += xh == hi >> 128 ? xl / y : 1;\\n }\\n\\n require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\\n return uint128 (result);\\n }\\n }\\n\\n /**\\n * Calculate sqrt (x) rounding down, where x is unsigned 256-bit integer\\n * number.\\n *\\n * @param x unsigned 256-bit integer number\\n * @return unsigned 128-bit integer number\\n */\\n function sqrtu (uint256 x) private pure returns (uint128) {\\n unchecked {\\n if (x == 0) return 0;\\n else {\\n uint256 xx = x;\\n uint256 r = 1;\\n if (xx >= 0x100000000000000000000000000000000) { xx >>= 128; r <<= 64; }\\n if (xx >= 0x10000000000000000) { xx >>= 64; r <<= 32; }\\n if (xx >= 0x100000000) { xx >>= 32; r <<= 16; }\\n if (xx >= 0x10000) { xx >>= 16; r <<= 8; }\\n if (xx >= 0x100) { xx >>= 8; r <<= 4; }\\n if (xx >= 0x10) { xx >>= 4; r <<= 2; }\\n if (xx >= 0x4) { r <<= 1; }\\n r = (r + x / r) >> 1;\\n r = (r + x / r) >> 1;\\n r = (r + x / r) >> 1;\\n r = (r + x / r) >> 1;\\n r = (r + x / r) >> 1;\\n r = (r + x / r) >> 1;\\n r = (r + x / r) >> 1; // Seven iterations should be enough\\n uint256 r1 = x / r;\\n return uint128 (r < r1 ? r : r1);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x1364fdc24192b982f647c7fc68dcb2f6fc1b5e201843e773144bd23a76cb3b97\",\"license\":\"BSD-4-Clause\"},\"contracts/Registries.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\n\\nimport \\\"./libraries/SyloUtils.sol\\\";\\nimport \\\"./interfaces/IRegistries.sol\\\";\\n\\n/**\\n * @notice This contract manages Registries for Nodes. A Registry is a\\n * set of parameters configured by the Node itself. A Node is required\\n * to have a valid Registry to be able to participate in the network.\\n */\\ncontract Registries is IRegistries, Initializable, Ownable2StepUpgradeable, IERC165 {\\n using ECDSA for bytes32;\\n\\n /**\\n * @notice ERC721 contract for bridged Seekers. Used for verifying ownership\\n * of a seeker.\\n */\\n IERC721 public _rootSeekers;\\n\\n /**\\n * @notice Tracks each Node's registry.\\n */\\n mapping(address => IRegistries.Registry) public registries;\\n\\n /**\\n * @notice Tracks the node address that each seeker id is registered with\\n */\\n mapping(uint256 => address) public seekerRegistration;\\n\\n /**\\n * @notice Tracks the address of every registered node.\\n */\\n address[] public nodes;\\n\\n /**\\n * @notice Tracks nonces used when registering the seeker account\\n * to prevent signature re-use.\\n */\\n mapping(bytes32 => address) private signatureNonces;\\n\\n /**\\n * @notice Payout percentage refers to the portion of a tickets reward\\n * that will be allocated to the Node's stakers. This is global, and is\\n * currently set for all Nodes.\\n */\\n uint32 public defaultPayoutPercentage;\\n\\n event DefaultPayoutPercentageUpdated(uint32 defaultPayoutPercentage);\\n\\n error NonceCannotBeReused();\\n error EndMustBeGreaterThanStart();\\n error PercentageCannotExceed100000();\\n error PublicEndpointCannotBeEmpty();\\n error SeekerAccountMustOwnSeekerId();\\n error SeekerAccountMustBeMsgSender();\\n error ProofNotSignedBySeekerAccount();\\n error RootSeekersCannotBeZeroAddress();\\n error SeekerAccountCannotBeZeroAddress();\\n error EndCannotExceedNumberOfNodes(uint256 nodeLength);\\n\\n function initialize(\\n IERC721 rootSeekers,\\n uint32 _defaultPayoutPercentage\\n ) external initializer {\\n if (address(rootSeekers) == address(0)) {\\n revert RootSeekersCannotBeZeroAddress();\\n }\\n if (_defaultPayoutPercentage > 100000) {\\n revert PercentageCannotExceed100000();\\n }\\n\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n _rootSeekers = rootSeekers;\\n defaultPayoutPercentage = _defaultPayoutPercentage;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IRegistries).interfaceId;\\n }\\n\\n /**\\n * @notice Set the global default payout percentage value. Only callable\\n * by the owner.\\n * @param _defaultPayoutPercentage The payout percentage as a value where the\\n * denominator is 10000.\\n */\\n function setDefaultPayoutPercentage(uint32 _defaultPayoutPercentage) external onlyOwner {\\n if (_defaultPayoutPercentage > 100000) {\\n revert PercentageCannotExceed100000();\\n }\\n\\n defaultPayoutPercentage = _defaultPayoutPercentage;\\n emit DefaultPayoutPercentageUpdated(_defaultPayoutPercentage);\\n }\\n\\n /**\\n * @notice Call this as a Node to set or update your Registry entry.\\n * @param publicEndpoint The public endpoint of your Node. Essential for\\n * clients to be able to retrieve additional information, such as\\n * an address to establish a p2p connection.\\n */\\n function register(string calldata publicEndpoint) external {\\n if (bytes(publicEndpoint).length == 0) {\\n revert PublicEndpointCannotBeEmpty();\\n }\\n\\n // This is the nodes first registration\\n if (bytes(registries[msg.sender].publicEndpoint).length == 0) {\\n nodes.push(msg.sender);\\n }\\n\\n registries[msg.sender].publicEndpoint = publicEndpoint;\\n }\\n\\n function setSeekerAccount(\\n address seekerAccount,\\n uint256 seekerId,\\n bytes32 nonce,\\n bytes calldata signature\\n ) external {\\n if (seekerAccount == address(0)) {\\n revert SeekerAccountCannotBeZeroAddress();\\n }\\n if (signatureNonces[nonce] != address(0)) {\\n revert NonceCannotBeReused();\\n }\\n\\n bytes memory proofMessage = getProofMessage(seekerId, msg.sender, nonce);\\n bytes32 ethProof = ECDSA.toEthSignedMessageHash(proofMessage);\\n\\n if (ECDSA.recover(ethProof, signature) != seekerAccount) {\\n revert ProofNotSignedBySeekerAccount();\\n }\\n\\n // Now verify the seeker account actually owns the seeker\\n address owner = _rootSeekers.ownerOf(seekerId);\\n\\n if (seekerAccount != owner) {\\n revert SeekerAccountMustOwnSeekerId();\\n }\\n\\n delete registries[seekerRegistration[seekerId]].seekerId;\\n delete registries[seekerRegistration[seekerId]].seekerAccount;\\n\\n registries[msg.sender].seekerAccount = seekerAccount;\\n registries[msg.sender].seekerId = seekerId;\\n\\n seekerRegistration[seekerId] = msg.sender;\\n\\n signatureNonces[nonce] = seekerAccount;\\n }\\n\\n function revokeSeekerAccount(address node) external {\\n Registry storage registry = registries[node];\\n\\n if (registry.seekerAccount != msg.sender) {\\n revert SeekerAccountMustBeMsgSender();\\n }\\n\\n delete registry.seekerAccount;\\n delete seekerRegistration[registry.seekerId];\\n delete registry.seekerId;\\n }\\n\\n /**\\n * @notice Retrieve the registry associated with a Node.\\n * @param account The address of the Node.\\n * @return The Node's Registry.\\n */\\n function getRegistry(address account) external view returns (Registry memory) {\\n return registries[account];\\n }\\n\\n /**\\n * @notice Retrieve all registered nodes.\\n * @return An array of node addresses.\\n */\\n function getNodes() external view returns (address[] memory) {\\n return nodes;\\n }\\n\\n /**\\n * @notice Retrieves a list of registries. Takes in a\\n * a start and end indices to allow pagination.\\n * @param start The start index which is inclusive.\\n * @param end The end index which is exclusive.\\n * @return An array of Registries.\\n */\\n function getRegistries(\\n uint256 start,\\n uint256 end\\n ) external view returns (address[] memory, Registry[] memory) {\\n uint256 nodesLength = nodes.length;\\n\\n if (end <= start) {\\n revert EndMustBeGreaterThanStart();\\n }\\n if (end > nodesLength) {\\n revert EndCannotExceedNumberOfNodes(nodesLength);\\n }\\n\\n address[] memory _nodes = new address[](end - start);\\n Registry[] memory _registries = new Registry[](_nodes.length);\\n\\n for (uint256 i = start; i < end; ++i) {\\n _nodes[i - start] = nodes[i];\\n _registries[i - start] = registries[nodes[i]];\\n }\\n\\n return (_nodes, _registries);\\n }\\n\\n /**\\n * @notice Returns the total number of registered nodes.\\n * @return The number of registered nodes.\\n */\\n function getTotalNodes() external view returns (uint256) {\\n return nodes.length;\\n }\\n\\n /**\\n * @notice Helper function for deriving the proof message used to\\n * validate seeker ownership.\\n * @param seekerId The tokenId of the seeker used for operation.\\n * @param node The address of the node which that will be operated\\n * by the specified seeker.\\n * @param nonce The nonce used for this message.\\n */\\n function getProofMessage(\\n uint256 seekerId,\\n address node,\\n bytes32 nonce\\n ) public pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n unicode\\\"\\ud83e\\udd16 Hi frend! \\ud83e\\udd16\\\\n\\\\n\\ud83d\\udcdc Signing this message proves that you're the owner of this Seeker NFT and allows your Seeker to be used to operate your Seeker's Node. It's a simple but important step to ensure smooth operation.\\\\n\\\\nThis request will not trigger a blockchain transaction or cost any gas fees.\\\\n\\\\n\\ud83d\\udd25 Your node's address: \\\",\\n Strings.toHexString(uint256(uint160(node)), 20),\\n unicode\\\"\\\\n\\\\n\\ud83c\\udd94 Your seeker id: \\\",\\n Strings.toString(seekerId),\\n unicode\\\"\\\\n\\\\n\\ud83d\\udce6 A unique random value which secures this message: \\\",\\n Strings.toHexString(uint256(nonce), 32)\\n );\\n }\\n}\\n\",\"keccak256\":\"0x492be9b17a6624c5aa9de7b7d93f2ab1d7e6ee6443e60d4f036f7a7c670c343b\",\"license\":\"Apache-2.0\"},\"contracts/SeekerPowerOracle.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\n\\nimport \\\"./interfaces/ISeekerPowerOracle.sol\\\";\\n\\n/**\\n * @notice Acts as a source of information for Seeker Powers. Allows setting\\n * a Seeker's power level via a restricted oracle account call. Seeker Power can also\\n * be set by any account if the correct Oracle signature proof is provided.\\n */\\ncontract SeekerPowerOracle is ISeekerPowerOracle, Initializable, Ownable2StepUpgradeable, ERC165 {\\n /**\\n * @notice The oracle account. This contract accepts any attestations of\\n * Seeker power that have been signed by this account.\\n */\\n address public oracle;\\n\\n /**\\n * @notice Tracks nonce used when register the Seeker power to\\n * prevent signature re-use.\\n */\\n mapping(bytes32 => address) private proofNonces;\\n\\n /**\\n * @notice Tracks the set of Seeker Power levels.\\n */\\n mapping(uint256 => uint256) public seekerPowers;\\n\\n event SeekerPowerUpdated(uint256 indexed seekerId, uint256 indexed power);\\n\\n error UnauthorizedRegisterSeekerPowerCall();\\n error NonceCannotBeReused();\\n\\n function initialize(address _oracle) external initializer {\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n oracle = _oracle;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(ISeekerPowerOracle).interfaceId;\\n }\\n\\n /**\\n * @notice Sets the oracle account.\\n * @param _oracle The oracle account.\\n */\\n function setOracle(address _oracle) external onlyOwner {\\n oracle = _oracle;\\n }\\n\\n /**\\n * @notice Registers a Seeker's power level. Only callable by the\\n * owner or the oracle account.\\n * @param seekerId The id of the Seeker.\\n * @param power The power level of the Seeker.\\n */\\n function registerSeekerPowerRestricted(uint256 seekerId, uint256 power) external {\\n if (msg.sender != oracle) {\\n revert UnauthorizedRegisterSeekerPowerCall();\\n }\\n\\n seekerPowers[seekerId] = power;\\n emit SeekerPowerUpdated(seekerId, power);\\n }\\n\\n /**\\n * @notice Registers a Seeker's power level. Callable by any account\\n * but requires a proof signed by the oracle.\\n * @param seekerId The id of the Seeker.\\n * @param power The power level of the Seeker.\\n */\\n function registerSeekerPower(\\n uint256 seekerId,\\n uint256 power,\\n bytes32 nonce,\\n bytes calldata proof\\n ) external {\\n if (proofNonces[nonce] != address(0)) {\\n revert NonceCannotBeReused();\\n }\\n\\n bytes memory proofMessage = getProofMessage(seekerId, power, nonce);\\n bytes32 ecdsaHash = ECDSA.toEthSignedMessageHash(proofMessage);\\n\\n if (ECDSA.recover(ecdsaHash, proof) != oracle) {\\n revert UnauthorizedRegisterSeekerPowerCall();\\n }\\n\\n seekerPowers[seekerId] = power;\\n proofNonces[nonce] = oracle;\\n\\n emit SeekerPowerUpdated(seekerId, power);\\n }\\n\\n /**\\n * @notice Retrieves a Seeker's stored power level.\\n * @param seekerId The id of the Seeker.\\n */\\n function getSeekerPower(uint256 seekerId) external view returns (uint256) {\\n return seekerPowers[seekerId];\\n }\\n\\n /**\\n * @notice Constructs a proof message for the oracle to sign.\\n * @param seekerId The id of the Seeker.\\n * @param power The power level of the Seeker.\\n */\\n function getProofMessage(\\n uint256 seekerId,\\n uint256 power,\\n bytes32 nonce\\n ) public pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n Strings.toString(seekerId),\\n \\\":\\\",\\n Strings.toString(power),\\n \\\":\\\",\\n Strings.toHexString(uint256(nonce), 32)\\n );\\n }\\n}\\n\",\"keccak256\":\"0xbd652d364b9b0742083dc6dcce34b58aefddda5335afdcb3f8d42358cb89b18a\",\"license\":\"Apache-2.0\"},\"contracts/SyloToken.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/ERC20.sol\\\";\\n\\ncontract SyloToken is ERC20 {\\n constructor() ERC20(\\\"Sylo\\\", \\\"SYLO\\\") {\\n _mint(msg.sender, 10_000_000_000 ether);\\n }\\n}\\n\",\"keccak256\":\"0x75fda7d129e02669cd691691c14fccd1cdac23b833d7a25e899801865d58ef26\",\"license\":\"Apache-2.0\"},\"contracts/epochs/EpochsManager.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\n\\nimport \\\"../Registries.sol\\\";\\nimport \\\"../staking/Directory.sol\\\";\\nimport \\\"../interfaces/epochs/IEpochsManager.sol\\\";\\nimport \\\"../payments/ticketing/TicketingParameters.sol\\\";\\n\\ncontract EpochsManager is IEpochsManager, Initializable, Ownable2StepUpgradeable, ERC165 {\\n Directory public _directory;\\n\\n Registries public _registries;\\n\\n IERC721 public _rootSeekers;\\n\\n TicketingParameters public _ticketingParameters;\\n\\n /**\\n * @notice Track seekers that have joined for a specific epoch.\\n */\\n mapping(uint256 => mapping(uint256 => address)) public activeSeekers;\\n\\n // Define all Epoch specific parameters here.\\n // When initializing an epoch, these parameters are read,\\n // along with parameters from the other contracts to create the\\n // new epoch.\\n\\n /**\\n * @notice A mapping of all epochs that have been initialized.\\n */\\n mapping(uint256 => Epoch) public epochs;\\n\\n /**\\n * @notice The block number since the first epoch can be initialized.\\n */\\n uint256 public initialEpoch;\\n\\n /**\\n * @notice The duration in blocks an epoch will last for.\\n */\\n uint256 public epochDuration;\\n\\n /**\\n * @notice The value of the integer used as the current\\n * epoch's identifier. This value is incremented as each epoch\\n * is initialized.\\n */\\n uint256 public currentIteration;\\n\\n event NewEpoch(uint256 indexed epochId);\\n event EpochJoined(uint256 indexed epochId, address indexed node, uint256 indexed seekerId);\\n event InitialEpochUpdated(uint256 initialEpoch);\\n event EpochDurationUpdated(uint256 epochDuration);\\n\\n error SeekerOwnerMismatch();\\n error InitialEpochCannotBeZero();\\n error EpochDurationCannotBeZero();\\n error DirectoryCannotBeZeroAddress();\\n error RegistriesCannotBeZeroAddress();\\n error RootSeekerCannotBeZeroAddress();\\n error EpochHasNotEnded(uint256 epochId);\\n error SeekerAccountCannotBeZeroAddress();\\n error TicketingParametersCannotBeZeroAddress();\\n error SeekerAlreadyJoinedEpoch(uint256 epochId, uint256 seekerId);\\n error InitialEpochNotYetReady(uint256 expectedBlock, uint256 currentBlock);\\n\\n function initialize(\\n IERC721 rootSeekers,\\n Directory directory,\\n Registries registries,\\n TicketingParameters ticketingParameters,\\n uint256 _initialEpoch,\\n uint256 _epochDuration\\n ) external initializer {\\n if (address(rootSeekers) == address(0)) {\\n revert RootSeekerCannotBeZeroAddress();\\n }\\n\\n SyloUtils.validateContractInterface(\\n \\\"Directory\\\",\\n address(directory),\\n type(IDirectory).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"Registries\\\",\\n address(registries),\\n type(IRegistries).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"TicketingParameters\\\",\\n address(ticketingParameters),\\n type(ITicketingParameters).interfaceId\\n );\\n\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n _rootSeekers = rootSeekers;\\n _directory = directory;\\n _registries = registries;\\n _ticketingParameters = ticketingParameters;\\n\\n initialEpoch = _initialEpoch;\\n epochDuration = _epochDuration;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IEpochsManager).interfaceId;\\n }\\n\\n /**\\n * @notice Call this to initialize the next epoch. On success, a `NewEpoch` event\\n * will be emitted.\\n * @dev The function will read the current set of network parameters, and store\\n * the parameters in a new Epoch struct. The end block of the current epoch\\n * will also be set to a non-zero value.\\n */\\n function initializeEpoch() external returns (uint256) {\\n if (currentIteration == 0 && initialEpoch > block.number) {\\n revert InitialEpochNotYetReady(initialEpoch, block.number);\\n }\\n\\n Epoch storage current = epochs[currentIteration];\\n\\n uint256 end = current.startBlock + current.duration;\\n if (end > block.number) {\\n revert EpochHasNotEnded(currentIteration);\\n }\\n\\n (\\n uint256 faceValue,\\n uint128 baseLiveWinProb,\\n uint128 expiredWinProb,\\n uint256 ticketDuration,\\n uint32 decayRate\\n ) = _ticketingParameters.getTicketingParameters();\\n\\n uint256 nextEpochId = getNextEpochId();\\n\\n epochs[nextEpochId] = Epoch(\\n block.number,\\n epochDuration,\\n 0,\\n _registries.defaultPayoutPercentage(),\\n decayRate,\\n faceValue,\\n baseLiveWinProb,\\n expiredWinProb,\\n ticketDuration\\n );\\n\\n current.endBlock = block.number;\\n\\n currentIteration = nextEpochId;\\n\\n _directory.setCurrentDirectory(nextEpochId);\\n\\n emit NewEpoch(nextEpochId);\\n\\n return nextEpochId;\\n }\\n\\n /**\\n * @notice Set the first epoch starting block. Only callable by the owner.\\n * @param _initialEpoch The block number when the first epoch can be initialized.\\n */\\n function setInitialEpoch(uint256 _initialEpoch) external onlyOwner {\\n if (_initialEpoch == 0) {\\n revert InitialEpochCannotBeZero();\\n }\\n initialEpoch = _initialEpoch;\\n emit InitialEpochUpdated(_initialEpoch);\\n }\\n\\n /**\\n * @notice Set the epoch duration. Will take effect in the next epoch. Only\\n * callable by the owner.\\n * @param _epochDuration The epoch duration in number of blocks.\\n */\\n function setEpochDuration(uint256 _epochDuration) external onlyOwner {\\n if (_epochDuration == 0) {\\n revert EpochDurationCannotBeZero();\\n }\\n epochDuration = _epochDuration;\\n emit EpochDurationUpdated(epochDuration);\\n }\\n\\n /**\\n * @notice Retrieve the parameters for the current epoch.\\n * @return The current Epoch parameters.\\n */\\n function getCurrentActiveEpoch() external view returns (uint256, Epoch memory) {\\n return (currentIteration, epochs[currentIteration]);\\n }\\n\\n /**\\n * @notice Nodes should call this to join the next epoch. It will\\n * initialize the next reward pool and set the stake for the next directory.\\n * @dev This is a proxy function for `initalizeNextRewardPool` and\\n * `joinNextDirectory`.\\n */\\n function joinNextEpoch() external {\\n Registries.Registry memory registry = _registries.getRegistry(msg.sender);\\n\\n // validate the node's seeker ownership\\n if (registry.seekerAccount == address(0)) {\\n revert SeekerAccountCannotBeZeroAddress();\\n }\\n\\n uint256 seekerId = registry.seekerId;\\n\\n address owner = _rootSeekers.ownerOf(seekerId);\\n if (registry.seekerAccount != owner) {\\n revert SeekerOwnerMismatch();\\n }\\n\\n uint256 nextEpoch = getNextEpochId();\\n if (activeSeekers[nextEpoch][seekerId] != address(0)) {\\n revert SeekerAlreadyJoinedEpoch(nextEpoch, seekerId);\\n }\\n\\n activeSeekers[nextEpoch][seekerId] = msg.sender;\\n\\n _directory._rewardsManager().initializeNextRewardPool(msg.sender);\\n _directory.joinNextDirectory(msg.sender, seekerId);\\n\\n emit EpochJoined(nextEpoch, msg.sender, seekerId);\\n }\\n\\n /**\\n * @notice Retrieve the epoch parameter for the given id.\\n * @param epochId The id of the epoch to retrieve.\\n * @return The epoch parameters associated with the id.\\n */\\n function getEpoch(uint256 epochId) external view returns (Epoch memory) {\\n return epochs[epochId];\\n }\\n\\n /**\\n * @notice Retrieve the integer value that will be used for the\\n * next epoch id.\\n * @return The next epoch id identifier.\\n */\\n function getNextEpochId() public view returns (uint256) {\\n return currentIteration + 1;\\n }\\n}\\n\",\"keccak256\":\"0xc759afdc6022b1490447d2c3c3b4454c59cc86f59fe62cece92764b787a87030\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/IRegistries.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface IRegistries {\\n struct Registry {\\n // Percentage of a tickets value that will be rewarded to\\n // delegated stakers expressed as a fraction of 100000.\\n // This value is currently locked to the default payout percentage\\n // until epochs are implemented.\\n uint32 payoutPercentage;\\n // Public http/s endpoint to retrieve additional metadata\\n // about the node.\\n // The current metadata schema is as follows:\\n // { name: string, multiaddrs: string[] }\\n string publicEndpoint;\\n // The account which owns a seeker that will be used to\\n // operate the Node for this registry.\\n address seekerAccount;\\n // The id of the seeker used to operate the node. The owner\\n // of this id should be the seeker account.\\n uint256 seekerId;\\n }\\n\\n function register(string calldata publicEndpoint) external;\\n\\n function setDefaultPayoutPercentage(uint32 _defaultPayoutPercentage) external;\\n\\n function setSeekerAccount(\\n address seekerAccount,\\n uint256 seekerId,\\n bytes32 nonce,\\n bytes calldata signature\\n ) external;\\n\\n function revokeSeekerAccount(address node) external;\\n\\n function getRegistry(address account) external view returns (Registry memory);\\n\\n function getNodes() external view returns (address[] memory);\\n\\n function getRegistries(\\n uint256 start,\\n uint256 end\\n ) external view returns (address[] memory, Registry[] memory);\\n\\n function getTotalNodes() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x524252752fd14eb66b047848eaaffbc138c6b049f99f2c2f0a5c6a7a4d6e6e36\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/ISeekerPowerOracle.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface ISeekerPowerOracle {\\n function setOracle(address oracle) external;\\n\\n function registerSeekerPowerRestricted(uint256 seekerId, uint256 power) external;\\n\\n function registerSeekerPower(\\n uint256 seekerId,\\n uint256 power,\\n bytes32 nonce,\\n bytes calldata proof\\n ) external;\\n\\n function getSeekerPower(uint256 seekerId) external view returns (uint256);\\n\\n function getProofMessage(\\n uint256 seekerId,\\n uint256 power,\\n bytes32 nonce\\n ) external pure returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x26fb3e81dabde31b8730d4c601c51c881e018b540f19f7c599a8a7f9b8c05523\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/epochs/IEpochsManager.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface IEpochsManager {\\n /**\\n * @dev This struct will hold all network parameters that will be static\\n * for the entire epoch. This value will be stored in a mapping, where the\\n * key is the current epoch id.\\n */\\n struct Epoch {\\n // time related variables\\n uint256 startBlock; // Block the epoch was initialized\\n uint256 duration; // Minimum time epoch will be alive measured in number of blocks\\n uint256 endBlock; // Block the epoch ended (and when the next epoch was initialized)\\n // Zero here represents the epoch has not yet ended.\\n\\n // registry variables\\n uint32 defaultPayoutPercentage;\\n // ticketing variables\\n uint32 decayRate;\\n uint256 faceValue;\\n uint128 baseLiveWinProb;\\n uint128 expiredWinProb;\\n uint256 ticketDuration;\\n }\\n\\n function initializeEpoch() external returns (uint256);\\n\\n function setEpochDuration(uint256 _epochDuration) external;\\n\\n function getCurrentActiveEpoch() external view returns (uint256, Epoch memory);\\n\\n function joinNextEpoch() external;\\n\\n function getEpoch(uint256 epochId) external view returns (Epoch memory);\\n\\n function getNextEpochId() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xeef359833a448742f4eca45ac04eeea0c3e74eb21d3a36bfdae3a1bb7f81e0b5\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/payments/ticketing/IRewardsManager.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface IRewardsManager {\\n /**\\n * @dev This type will hold the necessary information for delegated stakers\\n * to make reward claims against their Node. Every Node will initialize\\n * and store a new Reward Pool for each epoch they participate in.\\n */\\n struct RewardPool {\\n // Tracks the balance of the reward pool owed to the stakers\\n uint256 stakersRewardTotal;\\n // Tracks the block number this reward pool was initialized\\n uint256 initializedAt;\\n // The total active stake for the node for will be the sum of the\\n // stakes owned by its delegators and the node's own stake.\\n uint256 totalActiveStake;\\n // track the cumulative reward factor as of the time the first ticket\\n // for this pool was redeemed\\n int128 initialCumulativeRewardFactor;\\n }\\n\\n struct LastClaim {\\n // The epoch the claim was made.\\n uint256 claimedAt;\\n // The stake at the time the claim was made. This is tracked as\\n // rewards can only be claimed after an epoch has ended, but the\\n // user's stake may have changed by then. This field tracks the\\n // staking value before the change so the reward for that epoch\\n // can be manually calculated.\\n uint256 stake;\\n }\\n\\n function getRewardPool(\\n uint256 epochId,\\n address stakee\\n ) external view returns (RewardPool memory);\\n\\n function getRewardPoolKey(uint256 epochId, address stakee) external pure returns (bytes32);\\n\\n function getRewardPoolStakersTotal(\\n uint256 epochId,\\n address stakee\\n ) external view returns (uint256);\\n\\n function getRewardPoolActiveStake(\\n uint256 epochId,\\n address stakee\\n ) external view returns (uint256);\\n\\n function getPendingRewards(address stakee) external view returns (uint256);\\n\\n function getLastClaim(address stakee, address staker) external view returns (LastClaim memory);\\n\\n function getTotalEpochRewards(uint256 epochId) external view returns (uint256);\\n\\n function getTotalEpochStakingRewards(uint256 epochId) external view returns (uint256);\\n\\n function initializeNextRewardPool(address stakee) external;\\n\\n function incrementRewardPool(address stakee, uint256 amount) external;\\n\\n function claimStakingRewards(address stakee) external returns (uint256);\\n\\n function updatePendingRewards(address stakee, address staker) external;\\n}\\n\",\"keccak256\":\"0x21b8d7f96073802ef4ec87fa15da5fcfd2c1d5e2bf9d6e17583406028e7b31d1\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/payments/ticketing/ITicketingParameters.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface ITicketingParameters {\\n function setFaceValue(uint256 _faceValue) external;\\n\\n function setBaseLiveWinProb(uint128 _baseLiveWinProb) external;\\n\\n function setExpiredWinProb(uint128 _expiredWinProb) external;\\n\\n function setDecayRate(uint32 _decayRate) external;\\n\\n function setTicketDuration(uint256 _ticketDuration) external;\\n\\n function getTicketingParameters()\\n external\\n view\\n returns (uint256, uint128, uint128, uint256, uint32);\\n}\\n\",\"keccak256\":\"0x6fa269d73176bd6543c190b070597fde50b91efdaa724b567bad29c9fbfa908a\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/staking/IDirectory.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface IDirectory {\\n /**\\n * @dev A DirectoryEntry will be stored for every node that joins the\\n * network in a specific epoch. The entry will contain the stakee's\\n * address, and a boundary value which is a sum of the current directory's\\n * total stake, and the current stakee's total stake.\\n */\\n struct DirectoryEntry {\\n address stakee;\\n uint256 boundary;\\n }\\n\\n /**\\n * @dev An EpochDirectory will be stored for every epoch. The\\n * directory will be constructed piece by piece as Nodes join,\\n * each adding their own directory entry based on their current\\n * stake value.\\n */\\n struct EpochDirectory {\\n DirectoryEntry[] entries;\\n mapping(address => uint256) stakes;\\n uint256 totalStake;\\n }\\n\\n function setCurrentDirectory(uint256 epochId) external;\\n\\n function joinNextDirectory(address stakee, uint256 seekerId) external;\\n\\n function scan(uint128 point) external view returns (address stakee);\\n\\n function scanWithEpochId(\\n uint128 point,\\n uint256 epochId\\n ) external view returns (address stakee);\\n\\n function getTotalStakeForStakee(\\n uint256 epochId,\\n address stakee\\n ) external view returns (uint256);\\n\\n function getTotalStake(uint256 epochId) external view returns (uint256);\\n\\n function getEntries(\\n uint256 epochId\\n ) external view returns (address[] memory, uint256[] memory);\\n}\\n\",\"keccak256\":\"0xfacfde1140082a99e6096222a0714bf9e532224a04c594096211c115ab4927f6\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/staking/IStakingManager.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface IStakingManager {\\n /**\\n * For every Node, there will be a mapping of the staker to a\\n * StakeEntry. The stake entry tracks the amount of stake in SOLO,\\n * and also when the stake was updated.\\n */\\n struct StakeEntry {\\n uint256 amount;\\n // Block number this entry was updated at\\n uint256 updatedAt;\\n // Epoch this entry was updated. The stake will become active\\n // in the following epoch\\n uint256 epochId;\\n }\\n\\n /**\\n * Every Node must have stake in order to participate in the Epoch.\\n * Stake can be provided by the Node itself or by other accounts in\\n * the network.\\n */\\n struct Stake {\\n // Track each stake entry associated to a node\\n mapping(address => StakeEntry) stakeEntries;\\n // The total stake held by this contract for a node,\\n // which will be the sum of all addStake and unlockStake calls\\n uint256 totalManagedStake;\\n }\\n\\n /**\\n * This struct will track stake that is in the process of unlocking.\\n */\\n struct Unlock {\\n uint256 amount; // Amount of stake unlocking\\n uint256 unlockAt; // Block number the stake becomes withdrawable\\n }\\n\\n function setUnlockDuration(uint256 _unlockDuration) external;\\n\\n function setMinimumStakeProportion(uint32 _minimumStakeProportion) external;\\n\\n function addStake(uint256 amount, address stakee) external;\\n\\n function unlockStake(uint256 amount, address stakee) external returns (uint256);\\n\\n function withdrawStake(address stakee) external;\\n\\n function cancelUnlocking(uint256 amount, address stakee) external;\\n\\n function calculateCapacityFromSeekerPower(uint256 seekerId) external view returns (uint256);\\n\\n function calculateMaxAdditionalDelegatedStake(address stakee) external view returns (uint256);\\n\\n function getTotalManagedStake() external view returns (uint256);\\n\\n function getStakeEntry(\\n address stakee,\\n address staker\\n ) external view returns (StakeEntry memory);\\n\\n function getStakeeTotalManagedStake(address stakee) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xb3c89c77822db30a1382ec7d11902db579cd48acc36aef965a92b47f8e1164a3\",\"license\":\"Apache-2.0\"},\"contracts/libraries/Manageable.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an list of public managers who may be added or removed.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyManager`, which can be applied to your functions to restrict their use to\\n * other contracts which have explicitly been added.\\n */\\nabstract contract Manageable is Ownable2StepUpgradeable {\\n /**\\n * @dev Tracks the managers added to this contract, where they key is the\\n * address of the managing contract, and the value is the block the manager was added in.\\n * We use this mapping to restrict access to those functions in a similar\\n * fashion to the onlyOwner construct.\\n */\\n mapping(address => uint256) public managers;\\n\\n error OnlyManagers();\\n error ManagerCannotBeZeroAddress();\\n\\n /**\\n * @notice Adds a manager to this contract. Only callable by the owner.\\n * @param manager The address of the manager contract.\\n */\\n function addManager(address manager) external onlyOwner {\\n if (manager == address(0)) {\\n revert ManagerCannotBeZeroAddress();\\n }\\n managers[manager] = block.number;\\n }\\n\\n /**\\n * @notice Removes a manager from this contract. Only callable by the owner.\\n * @param manager The address of the manager contract.\\n */\\n function removeManager(address manager) external onlyOwner {\\n delete managers[manager];\\n }\\n\\n /**\\n * @dev This modifier allows us to specify that certain contracts have\\n * special privileges to call restricted functions.\\n */\\n modifier onlyManager() {\\n if (managers[msg.sender] == 0) {\\n revert OnlyManagers();\\n }\\n _;\\n }\\n\\n // Reserve storage slots for future variables\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xeaf4d3bf238df7e61eaf6903ba7ed54af58a17090fe6197aae3f62d025027db2\",\"license\":\"Apache-2.0\"},\"contracts/libraries/SyloUtils.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/utils/math/SafeCast.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\n\\nerror ContractNameCannotBeEmpty();\\nerror InterfaceIdCannotBeZeroBytes();\\nerror TargetContractCannotBeZeroAddress(string name);\\nerror TargetNotSupportInterface(string name, bytes4 interfaceId);\\n\\nlibrary SyloUtils {\\n /**\\n * @dev The maximum possible SYLO that exists in the network.\\n */\\n uint256 public constant MAX_SYLO = 10_000_000_000 ether;\\n\\n /**\\n * @dev Percentages are expressed as a ratio where 100000 is the denominator.\\n * A large denominator allows for more precision, e.g representing 12.5%\\n * can be done as 12500 / 100000\\n */\\n uint32 public constant PERCENTAGE_DENOMINATOR = 100000;\\n\\n /**\\n * @dev Multiply a value by a given percentage. Converts the provided\\n * uint128 value to uint256 to avoid any reverts on overflow.\\n * @param value The value to multiply.\\n * @param percentage The percentage, as a ratio of 10000.\\n */\\n function percOf(uint128 value, uint32 percentage) internal pure returns (uint256) {\\n return (uint256(value) * percentage) / PERCENTAGE_DENOMINATOR;\\n }\\n\\n /**\\n * @dev Return a fraction as a percentage.\\n * @param numerator The numerator limited to a uint128 value to prevent\\n * phantom overflow.\\n * @param denominator The denominator.\\n * @return The percentage, as a ratio of 10000.\\n */\\n function asPerc(uint128 numerator, uint256 denominator) internal pure returns (uint32) {\\n return SafeCast.toUint32((uint256(numerator) * PERCENTAGE_DENOMINATOR) / denominator);\\n }\\n\\n /**\\n * @dev Validate that a contract implements a given interface.\\n * @param name The name of the contract, used in error messages.\\n * @param target The address of the contract.\\n * @param interfaceId The interface ID to check.\\n */\\n function validateContractInterface(\\n string memory name,\\n address target,\\n bytes4 interfaceId\\n ) internal view {\\n if (bytes(name).length == 0) {\\n revert ContractNameCannotBeEmpty();\\n }\\n if (target == address(0)) {\\n revert TargetContractCannotBeZeroAddress(name);\\n }\\n if (interfaceId == bytes4(0)) {\\n revert InterfaceIdCannotBeZeroBytes();\\n }\\n if (!ERC165(target).supportsInterface(interfaceId)) {\\n revert TargetNotSupportInterface(name, interfaceId);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa5bb1a5b9f8135b5fec1dfa183fab8f6685a4eb6d9daba23864a7d49d01dc8a3\",\"license\":\"Apache-2.0\"},\"contracts/payments/ticketing/RewardsManager.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"abdk-libraries-solidity/ABDKMath64x64.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/math/SafeCast.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\n\\nimport \\\"../../libraries/SyloUtils.sol\\\";\\nimport \\\"../../libraries/Manageable.sol\\\";\\nimport \\\"../../epochs/EpochsManager.sol\\\";\\nimport \\\"../../staking/StakingManager.sol\\\";\\nimport \\\"../../interfaces/epochs/IEpochsManager.sol\\\";\\nimport \\\"../../interfaces/staking/IStakingManager.sol\\\";\\nimport \\\"../../interfaces/payments/ticketing/IRewardsManager.sol\\\";\\n\\n/**\\n * @notice Handles epoch based reward pools that are incremented from redeeming tickets.\\n * Nodes use this contract to set up their reward pool for the next epoch,\\n * and stakers use this contract to track and claim staking rewards.\\n * @dev After deployment, the SyloTicketing contract should be\\n * set up as a manager to be able to call certain restricted functions.\\n */\\ncontract RewardsManager is IRewardsManager, Initializable, Manageable, ERC165 {\\n uint256 internal constant ONE_SYLO = 1 ether;\\n\\n // 64x64 Fixed point representation of 1 SYLO (10**18 >> 64)\\n int128 internal constant ONE_SYLO_FIXED = 18446744073709551616000000000000000000;\\n\\n uint256 internal constant MAX_INT64 = 9223372036854775807;\\n\\n /** ERC20 Sylo token contract. */\\n IERC20 public _token;\\n\\n /** Sylo Staking Manager contract. */\\n StakingManager public _stakingManager;\\n\\n /** Sylo Epochs Manager. */\\n EpochsManager public _epochsManager;\\n\\n /**\\n * @dev Each node will manage a cumulative reward factor (CRF) that is incremented\\n * whenever a ticket is redeemed. This factor acts as a single value\\n * that can be used to calculate any particular staker's reward share. This\\n * prevents the need to individually track each staker's proportion, and also allows\\n * a claim calculation to be performed without iterating through every epoch.\\n *\\n * The CRF is calculated as CRF = CRF + Reward / TotalStake.\\n */\\n mapping(address => int128) private cumulativeRewardFactors;\\n\\n /**\\n * @notice Tracks the last epoch a delegated staker made a reward claim in.\\n * The key to this mapping is a hash of the Node's address and the delegated\\n * stakers address.\\n */\\n mapping(bytes32 => LastClaim) public lastClaims;\\n\\n /**\\n * @notice Tracks each Nodes total pending rewards in SOLOs. This\\n * value is accumulated as Node's redeem tickets. Rewards are pending if the\\n * distribution amongst the stakers has not been accounted for yet. Pending rewards\\n * are transferred to unclaimed rewards once the the staker's share has been\\n * calculated.\\n */\\n mapping(address => uint256) public pendingRewards;\\n\\n /**\\n * @notice Tracks rewards for stakers after the stakers share has been calculated,\\n * but has not actually been claimed by the staker.\\n * The node fee reward is also added to the node's unclaimedStakingRewards.\\n */\\n mapping(bytes32 => uint256) public unclaimedStakingRewards;\\n\\n /**\\n * @notice Tracks each Node's most recently active reward pool\\n */\\n mapping(address => uint256) public latestActiveRewardPools;\\n\\n /**\\n * @notice Tracks total accumulated rewards in each epoch\\n */\\n mapping(uint256 => uint256) public totalEpochRewards;\\n\\n /**\\n * @notice Tracks total accumulated staking rewards in each epoch\\n */\\n mapping(uint256 => uint256) public totalEpochStakingRewards;\\n\\n /**\\n * @notice Tracks each reward pool initialized by a Node. The key to this map\\n * is derived from the epochId and the Node's address.\\n */\\n mapping(bytes32 => RewardPool) public rewardPools;\\n\\n error NoRewardToClaim();\\n error AmountCannotBeZero();\\n error RewardPoolNotExist();\\n error RewardPoolAlreadyExist();\\n error DoNotAllowZeroAddress();\\n error TokenCannotBeZeroAddress();\\n error NoStakeToCreateRewardPool();\\n error StakeeCannotBeZeroAddress();\\n error StakerCannotBeZeroAddress();\\n error StakerKeyCannotBeZeroBytes();\\n error InvalidFixedPointResult();\\n\\n function initialize(\\n IERC20 token,\\n StakingManager stakingManager,\\n EpochsManager epochsManager\\n ) external initializer {\\n if (address(token) == address(0)) {\\n revert TokenCannotBeZeroAddress();\\n }\\n\\n SyloUtils.validateContractInterface(\\n \\\"StakingManager\\\",\\n address(stakingManager),\\n type(IStakingManager).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"EpochsManager\\\",\\n address(epochsManager),\\n type(IEpochsManager).interfaceId\\n );\\n\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n _token = token;\\n _epochsManager = epochsManager;\\n _stakingManager = stakingManager;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IRewardsManager).interfaceId;\\n }\\n\\n /**\\n * @notice Returns the key used to index a reward pool. The key is a hash of\\n * the epochId and Node's address.\\n * @param epochId The epoch ID the reward pool was created in.\\n * @param stakee The address of the Node.\\n * @return A byte-array representing the reward pool key.\\n */\\n function getRewardPoolKey(uint256 epochId, address stakee) public pure returns (bytes32) {\\n return keccak256(abi.encodePacked(epochId, stakee));\\n }\\n\\n /**\\n * @notice Returns the key used to index staking claims. The key is a hash of\\n * the Node's address and the staker's address.\\n * @param stakee The address of the Node.\\n * @param staker The address of the stake.\\n * @return A byte-array representing the key.\\n */\\n function getStakerKey(address stakee, address staker) public pure returns (bytes32) {\\n return keccak256(abi.encodePacked(stakee, staker));\\n }\\n\\n /**\\n * @notice Retrieve the reward pool initialized by the given node, at the specified\\n * epoch.\\n * @param epochId The ID of the epoch the reward pool was initialized in.\\n * @param stakee The address of the Node.\\n * @return The reward pool.\\n */\\n function getRewardPool(\\n uint256 epochId,\\n address stakee\\n ) external view returns (RewardPool memory) {\\n return rewardPools[getRewardPoolKey(epochId, stakee)];\\n }\\n\\n /**\\n * @notice Retrieve the total accumulated reward that will be distributed to a Node's\\n * delegated stakers for a given epoch.\\n * @param epochId The ID of the epoch the reward pool was initialized in.\\n * @param stakee The address of the Node.\\n * @return The total accumulated staker reward in SOLO.\\n */\\n function getRewardPoolStakersTotal(\\n uint256 epochId,\\n address stakee\\n ) external view returns (uint256) {\\n return rewardPools[getRewardPoolKey(epochId, stakee)].stakersRewardTotal;\\n }\\n\\n /**\\n * @notice Retrieve the total active stake that will be used for a Node's reward\\n * pool in a given epoch.\\n * @param epochId The ID of the epoch the reward pool was initialized in.\\n * @param stakee The address of the Node.\\n * @return The total active stake for that reward pool in SOLO.\\n */\\n function getRewardPoolActiveStake(\\n uint256 epochId,\\n address stakee\\n ) external view returns (uint256) {\\n return rewardPools[getRewardPoolKey(epochId, stakee)].totalActiveStake;\\n }\\n\\n /**\\n * @notice Retrieve the total pending staking reward allocated to a Node's\\n * stakers.\\n * @param stakee The address of the Node.\\n * @return The total pending staking reward in SOLO.\\n */\\n function getPendingRewards(address stakee) external view returns (uint256) {\\n return pendingRewards[stakee];\\n }\\n\\n /**\\n * @notice Retrieves the ID of the epoch in which a staker last made their\\n * staking claim.\\n * @param stakee The address of the Node.\\n * @param staker The address of the staker.\\n * @return The ID of the epoch.\\n */\\n function getLastClaim(\\n address stakee,\\n address staker\\n ) external view returns (LastClaim memory) {\\n return lastClaims[getStakerKey(stakee, staker)];\\n }\\n\\n /**\\n * @notice Retrieves the total accumulated rewards for a specific epoch.\\n * @param epochId The epoch id.\\n * @return The total reward in that epoch, including staking rewards and fee\\n * reward.\\n */\\n function getTotalEpochRewards(uint256 epochId) external view returns (uint256) {\\n return totalEpochRewards[epochId];\\n }\\n\\n /**\\n * @notice Retrieves the total accumulated rewards for stakers in a specific epoch.\\n * @param epochId The epoch id.\\n * @return The total staking reward in that epoch.\\n */\\n function getTotalEpochStakingRewards(uint256 epochId) external view returns (uint256) {\\n return totalEpochStakingRewards[epochId];\\n }\\n\\n /**\\n * @notice This is used by Nodes to initialize their reward pool for\\n * the next epoch. This function will revert if the caller has no stake, or\\n * if the reward pool has already been initialized. The total active stake\\n * for the next reward pool is calculated by summing up the total managed\\n * stake held by the RewardsManager contract.\\n */\\n function initializeNextRewardPool(address stakee) external onlyManager {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n\\n uint256 nextEpochId = _epochsManager.getNextEpochId();\\n\\n RewardPool storage nextRewardPool = rewardPools[getRewardPoolKey(nextEpochId, stakee)];\\n if (nextRewardPool.initializedAt != 0) {\\n revert RewardPoolAlreadyExist();\\n }\\n\\n uint256 totalStake = _stakingManager.getStakeeTotalManagedStake(stakee);\\n if (totalStake == 0) {\\n revert NoStakeToCreateRewardPool();\\n }\\n\\n nextRewardPool.totalActiveStake = totalStake;\\n\\n nextRewardPool.initializedAt = block.number;\\n }\\n\\n /**\\n * @dev This function should be called by the Ticketing contract when a\\n * ticket is successfully redeemed. The face value of the ticket\\n * should be split between incrementing the node's reward balance,\\n * and the reward balance for the node's delegated stakers. The face value\\n * will be added to the current reward pool's balance. This function will\\n * fail if the Ticketing contract has not been set as a manager.\\n * @param stakee The address of the Node.\\n * @param amount The face value of the ticket in SOLO.\\n */\\n function incrementRewardPool(address stakee, uint256 amount) external onlyManager {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n if (amount == 0) {\\n revert AmountCannotBeZero();\\n }\\n\\n (uint256 epochId, IEpochsManager.Epoch memory currentEpoch) = _epochsManager\\n .getCurrentActiveEpoch();\\n\\n RewardPool storage rewardPool = rewardPools[getRewardPoolKey(epochId, stakee)];\\n if (rewardPool.initializedAt == 0) {\\n revert RewardPoolNotExist();\\n }\\n\\n // Update the latest active reward pool for the node to be this pool\\n if (latestActiveRewardPools[stakee] < epochId) {\\n latestActiveRewardPools[stakee] = epochId;\\n }\\n\\n uint256 stakersReward = SyloUtils.percOf(\\n SafeCast.toUint128(amount),\\n currentEpoch.defaultPayoutPercentage\\n );\\n\\n // transfer the node's fee reward to it's unclaimed reward value\\n unclaimedStakingRewards[getStakerKey(stakee, stakee)] =\\n unclaimedStakingRewards[getStakerKey(stakee, stakee)] +\\n (amount - stakersReward);\\n\\n // update the value of the reward owed to the stakers\\n pendingRewards[stakee] = pendingRewards[stakee] + stakersReward;\\n\\n // if this is the first ticket redeemed for this reward, set the initial\\n // CRF value for this pool\\n if (rewardPool.stakersRewardTotal == 0) {\\n rewardPool.initialCumulativeRewardFactor = cumulativeRewardFactors[stakee];\\n }\\n\\n rewardPool.stakersRewardTotal = rewardPool.stakersRewardTotal + stakersReward;\\n\\n // We preemptively prevent an overflow revert with the abdk library.\\n // Dividing the stakers reward with the pool's total active\\n // stake may produce a value that is greater than the maximum possible\\n // 64.64 fixed point value.\\n // This error is incredibly niche and unlikely to happen, so we just\\n // revert here as well (with a named error) and remediation involves\\n // just increasing the amount of stake a node has.\\n if (rewardPool.totalActiveStake * MAX_INT64 < stakersReward) {\\n revert InvalidFixedPointResult();\\n }\\n\\n cumulativeRewardFactors[stakee] = ABDKMath64x64.add(\\n cumulativeRewardFactors[stakee],\\n ABDKMath64x64.div(\\n toFixedPointSYLO(stakersReward),\\n toFixedPointSYLO(rewardPool.totalActiveStake)\\n )\\n );\\n\\n totalEpochRewards[epochId] = totalEpochRewards[epochId] + amount;\\n totalEpochStakingRewards[epochId] = totalEpochStakingRewards[epochId] + stakersReward;\\n }\\n\\n /**\\n * @dev This function utilizes the cumulative reward factors, and the staker's\\n * value in stake to calculate the staker's share of the pending reward.\\n */\\n function calculatePendingClaim(\\n bytes32 stakerKey,\\n address stakee,\\n address staker\\n ) internal view returns (uint256) {\\n uint256 claim = calculateInitialClaim(stakerKey, stakee);\\n\\n // find the first reward pool where their stake was active and had\\n // generated rewards\\n uint256 activeAt;\\n RewardPool memory initialActivePool;\\n\\n uint256 currentEpochId = _epochsManager.currentIteration();\\n\\n for (uint256 i = lastClaims[stakerKey].claimedAt + 1; i < currentEpochId; ++i) {\\n initialActivePool = rewardPools[getRewardPoolKey(i, stakee)];\\n // check if node initialized a reward pool for this epoch and\\n // gained rewards\\n if (initialActivePool.initializedAt > 0 && initialActivePool.stakersRewardTotal > 0) {\\n activeAt = i;\\n break;\\n }\\n }\\n\\n if (activeAt == 0) {\\n return claim;\\n }\\n\\n IStakingManager.StakeEntry memory stakeEntry = _stakingManager.getStakeEntry(\\n stakee,\\n staker\\n );\\n\\n // We convert the staker amount to SYLO as the maximum uint256 value that\\n // can be used for the fixed point representation is 2^64-1.\\n int128 initialStake = toFixedPointSYLO(stakeEntry.amount);\\n\\n int128 initialCumulativeRewardFactor = initialActivePool.initialCumulativeRewardFactor;\\n\\n int128 finalCumulativeRewardFactor = getFinalCumulativeRewardFactor(\\n stakee,\\n currentEpochId\\n );\\n\\n return\\n claim +\\n fromFixedPointSYLO(\\n ABDKMath64x64.mul(\\n initialStake,\\n ABDKMath64x64.sub(finalCumulativeRewardFactor, initialCumulativeRewardFactor)\\n )\\n );\\n }\\n\\n /**\\n * Manually calculates the reward claim for the first epoch the claim is being\\n * made for. This manual calculation is necessary as claims are only made up\\n * to the previous epoch.\\n */\\n function calculateInitialClaim(\\n bytes32 stakerKey,\\n address stakee\\n ) internal view returns (uint256) {\\n LastClaim memory lastClaim = lastClaims[stakerKey];\\n\\n // if we have already made a claim up to the previous epoch, then\\n // there is no need to calculate the initial claim\\n if (_epochsManager.currentIteration() == lastClaim.claimedAt) {\\n return 0;\\n }\\n\\n RewardPool memory firstRewardPool = rewardPools[\\n getRewardPoolKey(lastClaim.claimedAt, stakee)\\n ];\\n\\n // if there was no reward pool initialized for the first epoch,\\n // then there is no need to calculate the initial claim\\n if (firstRewardPool.totalActiveStake == 0) {\\n return 0;\\n }\\n\\n return\\n (firstRewardPool.stakersRewardTotal * lastClaim.stake) /\\n firstRewardPool.totalActiveStake;\\n }\\n\\n /**\\n * Determines the cumulative reward factor to use for claim calculations. The\\n * CRF will depend on when the Node last initialized a reward pool, and also when\\n * the staker last made their claim.\\n */\\n function getFinalCumulativeRewardFactor(\\n address stakee,\\n uint256 currentEpochId\\n ) internal view returns (int128) {\\n int128 finalCumulativeRewardFactor;\\n\\n // Get the cumulative reward factor for the Node\\n // for the start of this epoch, since we only perform\\n // calculations up to the end of the previous epoch.\\n if (latestActiveRewardPools[stakee] < currentEpochId) {\\n // If the Node has not been active, then the final\\n // cumulative reward factor will just be the current one.\\n finalCumulativeRewardFactor = cumulativeRewardFactors[stakee];\\n } else {\\n // We are calculating the claim for an active epoch, the\\n // final cumulative reward factor will be taken from the start of this\\n // epoch (end of previous epoch).\\n RewardPool storage latestRewardPool = rewardPools[\\n getRewardPoolKey(latestActiveRewardPools[stakee], stakee)\\n ];\\n finalCumulativeRewardFactor = latestRewardPool.initialCumulativeRewardFactor;\\n }\\n\\n return finalCumulativeRewardFactor;\\n }\\n\\n /**\\n * @notice Call this function to calculate the total reward owed to a staker.\\n * This value will include all epochs since the last claim was made up to\\n * the previous epoch. This will also add any pending rewards to the\\n * final value as well.\\n * @dev This function will utilize the cumulative reward factor to perform the\\n * calculation, keeping the gas cost scaling of this function to a constant value.\\n * @param stakee The address of the Node.\\n * @param staker The address of the staker.\\n * @return The value of the reward owed to the staker in SOLO.\\n */\\n function calculateStakerClaim(address stakee, address staker) public view returns (uint256) {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n if (staker == address(0)) {\\n revert StakerCannotBeZeroAddress();\\n }\\n\\n bytes32 stakerKey = getStakerKey(stakee, staker);\\n uint256 pendingClaim = calculatePendingClaim(stakerKey, stakee, staker);\\n\\n return pendingClaim + unclaimedStakingRewards[stakerKey];\\n }\\n\\n /**\\n * Helper function to convert a uint256 value in SOLOs to a 64.64 fixed point\\n * representation in SYLOs while avoiding any possibility of overflow.\\n * Any remainders from converting SOLO to SYLO is explicitly handled to mitigate\\n * precision loss. The error when using this function is [-1/2^64, 0].\\n */\\n function toFixedPointSYLO(uint256 amount) internal pure returns (int128) {\\n int128 fullSylos = ABDKMath64x64.fromUInt(amount / ONE_SYLO);\\n int128 fracSylos = ABDKMath64x64.fromUInt(amount % ONE_SYLO); // remainder\\n\\n return ABDKMath64x64.add(fullSylos, ABDKMath64x64.div(fracSylos, ONE_SYLO_FIXED));\\n }\\n\\n /**\\n * Helper function to convert a 64.64 fixed point value in SYLOs to a uint256\\n * representation in SOLOs while avoiding any possibility of overflow.\\n */\\n function fromFixedPointSYLO(int128 amount) internal pure returns (uint256) {\\n uint256 fullSylos = ABDKMath64x64.toUInt(amount);\\n uint256 fullSolos = fullSylos * ONE_SYLO;\\n\\n // calculate the value lost when converting the fixed point amount to a uint\\n int128 fracSylos = ABDKMath64x64.sub(amount, ABDKMath64x64.fromUInt(fullSylos));\\n uint256 fracSolos = ABDKMath64x64.toUInt(ABDKMath64x64.mul(fracSylos, ONE_SYLO_FIXED));\\n\\n return fullSolos + fracSolos;\\n }\\n\\n /**\\n * @notice Call this function to claim rewards as a staker. The\\n * SYLO tokens will be transferred to the caller's account. This function will\\n * fail if there exists no reward to claim. Note: Calling this will remove\\n * the current unclaimed reward from being used as stake in the next round.\\n * @param stakee The address of the Node to claim against.\\n */\\n function claimStakingRewards(address stakee) external returns (uint256) {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n\\n bytes32 stakerKey = getStakerKey(stakee, msg.sender);\\n uint256 pendingReward = calculatePendingClaim(stakerKey, stakee, msg.sender);\\n\\n uint256 totalClaim = pendingReward + unclaimedStakingRewards[stakerKey];\\n if (totalClaim == 0) {\\n revert NoRewardToClaim();\\n }\\n\\n delete unclaimedStakingRewards[stakerKey];\\n pendingRewards[stakee] = pendingRewards[stakee] - pendingReward;\\n\\n updateLastClaim(stakee, msg.sender);\\n\\n SafeERC20.safeTransfer(_token, msg.sender, totalClaim);\\n\\n return totalClaim;\\n }\\n\\n /**\\n * @notice This is called by the staking manager to transfer pending rewards\\n * to unclaimed rewards for a staker. This is required as the last used CRF\\n * needs to be updated whenever stake changes.\\n */\\n function updatePendingRewards(address stakee, address staker) external onlyManager {\\n bytes32 stakerKey = getStakerKey(stakee, staker);\\n uint256 pendingReward = calculatePendingClaim(stakerKey, stakee, staker);\\n\\n pendingRewards[stakee] = pendingRewards[stakee] - pendingReward;\\n\\n unclaimedStakingRewards[stakerKey] = unclaimedStakingRewards[stakerKey] + pendingReward;\\n\\n updateLastClaim(stakee, staker);\\n }\\n\\n function updateLastClaim(address stakee, address staker) internal {\\n IStakingManager.StakeEntry memory stakeEntry = _stakingManager.getStakeEntry(\\n stakee,\\n staker\\n );\\n lastClaims[getStakerKey(stakee, staker)] = LastClaim(\\n _epochsManager.currentIteration(),\\n stakeEntry.amount\\n );\\n }\\n}\\n\",\"keccak256\":\"0x906af015c975637b6a99d70795b0652f6e28aaa66e5c64a4bae34bff14c99551\",\"license\":\"Apache-2.0\"},\"contracts/payments/ticketing/TicketingParameters.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\n\\nimport \\\"../../libraries/SyloUtils.sol\\\";\\nimport \\\"../../interfaces/payments/ticketing/ITicketingParameters.sol\\\";\\n\\n/**\\n * @dev Persists the parameters for the ticketing mechanism. This contract is\\n * read by the EpochManager. Extracting the parameters into another\\n * contract is necessary to avoid a cyclic dependency between the ticketing\\n * and epoch contracts.\\n */\\ncontract TicketingParameters is\\n ITicketingParameters,\\n Initializable,\\n Ownable2StepUpgradeable,\\n ERC165\\n{\\n /** @notice The value of a winning ticket in SOLO. */\\n uint256 public faceValue;\\n\\n /**\\n * @notice The probability of a ticket winning during the start of its lifetime.\\n * This is a uint128 value representing the numerator in the probability\\n * ratio where 2^128 - 1 is the denominator.\\n */\\n uint128 public baseLiveWinProb;\\n\\n /**\\n * @notice The probability of a ticket winning after it has expired.\\n * This is a uint128 value representing the numerator in the probability\\n * ratio where 2^128 - 1 is the denominator. Note: Redeeming expired\\n * tickets is currently not supported.\\n */\\n uint128 public expiredWinProb;\\n\\n /**\\n * @notice The length in blocks before a ticket is considered expired.\\n * The default initialization value is 80,000. This equates\\n * to roughly two weeks (15s per block).\\n */\\n uint256 public ticketDuration;\\n\\n /**\\n * @notice A percentage value representing the proportion of the base win\\n * probability that will be decayed once a ticket has expired.\\n * Example: 80% decayRate indicates that a ticket will decay down to 20% of its\\n * base win probability upon reaching the block before its expiry.\\n * The value is expressed as a fraction of 100000.\\n */\\n uint32 public decayRate;\\n\\n event FaceValueUpdated(uint256 faceValue);\\n event BaseLiveWinProbUpdated(uint128 baseLiveWinprob);\\n event ExpiredWinProbUpdated(uint128 expiredWinProb);\\n event TicketDurationUpdated(uint256 ticketDuration);\\n event DecayRateUpdated(uint32 decayRate);\\n\\n error FaceValueCannotBeZero();\\n error TicketDurationCannotBeZero();\\n\\n function initialize(\\n uint256 _faceValue,\\n uint128 _baseLiveWinProb,\\n uint128 _expiredWinProb,\\n uint32 _decayRate,\\n uint256 _ticketDuration\\n ) external initializer {\\n if (_faceValue == 0) {\\n revert FaceValueCannotBeZero();\\n }\\n if (_ticketDuration == 0) {\\n revert TicketDurationCannotBeZero();\\n }\\n\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n faceValue = _faceValue;\\n baseLiveWinProb = _baseLiveWinProb;\\n expiredWinProb = _expiredWinProb;\\n decayRate = _decayRate;\\n ticketDuration = _ticketDuration;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(ITicketingParameters).interfaceId;\\n }\\n\\n /**\\n * @notice Set the face value for tickets in SOLO. Only callable by\\n * the contract owner.\\n * @param _faceValue The face value to set in SOLO.\\n */\\n function setFaceValue(uint256 _faceValue) external onlyOwner {\\n if (_faceValue == 0) {\\n revert FaceValueCannotBeZero();\\n }\\n\\n faceValue = _faceValue;\\n emit FaceValueUpdated(_faceValue);\\n }\\n\\n /**\\n * @notice Set the base live win probability of a ticket. Only callable by\\n * the contract owner.\\n * @param _baseLiveWinProb The probability represented as a value\\n * between 0 to 2**128 - 1.\\n */\\n function setBaseLiveWinProb(uint128 _baseLiveWinProb) external onlyOwner {\\n baseLiveWinProb = _baseLiveWinProb;\\n emit BaseLiveWinProbUpdated(_baseLiveWinProb);\\n }\\n\\n /**\\n * @notice Set the expired win probability of a ticket. Only callable by\\n * the contract owner.\\n * @param _expiredWinProb The probability represented as a value\\n * between 0 to 2**128 - 1.\\n */\\n function setExpiredWinProb(uint128 _expiredWinProb) external onlyOwner {\\n expiredWinProb = _expiredWinProb;\\n emit ExpiredWinProbUpdated(_expiredWinProb);\\n }\\n\\n /**\\n * @notice Set the decay rate of a ticket. Only callable by the\\n * the contract owner.\\n * @param _decayRate The decay rate as a percentage, where the\\n * denominator is 10000.\\n */\\n function setDecayRate(uint32 _decayRate) external onlyOwner {\\n decayRate = _decayRate;\\n emit DecayRateUpdated(_decayRate);\\n }\\n\\n /**\\n * @notice Set the ticket duration of a ticket. Only callable by the\\n * contract owner.\\n * @param _ticketDuration The duration of a ticket in number of blocks.\\n */\\n function setTicketDuration(uint256 _ticketDuration) external onlyOwner {\\n if (_ticketDuration == 0) {\\n revert TicketDurationCannotBeZero();\\n }\\n\\n ticketDuration = _ticketDuration;\\n emit TicketDurationUpdated(_ticketDuration);\\n }\\n\\n /**\\n * @notice Retrieve the current ticketing parameters.\\n * @return faceValue The face value of a ticket in SOLO.\\n * @return baseLiveWinProb The base live win probability of a ticket.\\n * @return expiredWinProb The expired win probability of a ticket.\\n * @return ticketDuration The duration of a ticket in number of blocks.\\n * @return decayRate The decay rate of a ticket.\\n */\\n function getTicketingParameters()\\n external\\n view\\n returns (uint256, uint128, uint128, uint256, uint32)\\n {\\n return (faceValue, baseLiveWinProb, expiredWinProb, ticketDuration, decayRate);\\n }\\n}\\n\",\"keccak256\":\"0x44b4c2eb70c0583f888ff8fca7ad21b084b6c58a453b7dd914275ccabed98ec0\",\"license\":\"Apache-2.0\"},\"contracts/staking/Directory.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/utils/math/Math.sol\\\";\\n\\nimport \\\"./StakingManager.sol\\\";\\nimport \\\"../libraries/SyloUtils.sol\\\";\\nimport \\\"../libraries/Manageable.sol\\\";\\nimport \\\"../interfaces/staking/IDirectory.sol\\\";\\nimport \\\"../payments/ticketing/RewardsManager.sol\\\";\\n\\n/**\\n * @notice The Directory contract constructs and manages a structure holding the current stakes,\\n * which is queried against using the scan function. The scan function allows submitting\\n * random points which will return a staked node's address in proportion to the stake it has.\\n */\\ncontract Directory is IDirectory, Initializable, Manageable, IERC165 {\\n /** Sylo Staking Manager contract */\\n StakingManager public _stakingManager;\\n\\n /** Sylo Rewards Manager contract */\\n RewardsManager public _rewardsManager;\\n\\n /**\\n * @notice The epoch ID of the current directory.\\n */\\n uint256 public currentDirectory;\\n\\n /**\\n * @notice Tracks every directory, which will be indexed by an epoch ID\\n */\\n mapping(uint256 => EpochDirectory) public directories;\\n\\n event CurrentDirectoryUpdated(uint256 indexed currentDirectory);\\n\\n error NoStakeToJoinEpoch();\\n error StakeeAlreadyJoinedEpoch();\\n error StakeeCannotBeZeroAddress();\\n error NoJoiningStakeToJoinEpoch();\\n\\n function initialize(\\n StakingManager stakingManager,\\n RewardsManager rewardsManager\\n ) external initializer {\\n SyloUtils.validateContractInterface(\\n \\\"StakingManager\\\",\\n address(stakingManager),\\n type(IStakingManager).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"RewardsManager\\\",\\n address(rewardsManager),\\n type(IRewardsManager).interfaceId\\n );\\n\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n _stakingManager = stakingManager;\\n _rewardsManager = rewardsManager;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IDirectory).interfaceId;\\n }\\n\\n /**\\n * @notice This function should be called when a new epoch is initialized.\\n * This will set the current directory to the specified epoch. This is only\\n * callable by the owner of this contract, which should be the EpochsManager\\n * contract.\\n * @dev After deployment, the EpochsManager should immediately be set as\\n * the owner.\\n * @param epochId The ID of the specified epoch.\\n */\\n function setCurrentDirectory(uint256 epochId) external onlyManager {\\n currentDirectory = epochId;\\n emit CurrentDirectoryUpdated(epochId);\\n }\\n\\n /**\\n * @notice This function is called by the epochs manager as a prerequisite to when the node joins the next epoch.\\n * @param stakee The address of the node.\\n * @param seekerId The seekerId of the Seeker that the node is\\n * registered with when joining the epoch. It is used to determine the nodes\\n * staking capacity based on its seeker power.\\n *\\n * @dev This will construct the directory as nodes join. The directory is constructed\\n * by creating a boundary value which is a sum of the current directory's total stake, and\\n * the current stakee's total stake, and pushing the new boundary into the entries array.\\n * The previous boundary and the current boundary essentially create a range, where if a\\n * random point were to fall within that range, it would belong to the respective stakee.\\n * The boundary value grows in size as each stakee joins, thus the directory array\\n * always remains sorted. This allows us to perform a binary search on the directory.\\n *\\n * Example\\n *\\n * Stakes: [ Alice/20, Bob/10, Carl/40, Dave/25 ]\\n * TotalStake: 95\\n *\\n * EpochDirectory:\\n *\\n * |-----------|------|----------------|--------|\\n * Alice/20 Bob/30 Carl/70 Dave/95\\n *\\n * The amount of stake that a node will join a directory with is dependent on its\\n * different capacity values. There are two distinct capacity values, one\\n * calculated from the seeker power, and another from the minimum stake\\n * proportion. The final staking amount will not exceed either capacities,\\n * and in the case that the current total stake exceeds both, then the final\\n * will be the minimum of the two values.\\n */\\n function joinNextDirectory(address stakee, uint256 seekerId) external onlyManager {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n\\n uint256 nextEpochId = currentDirectory + 1;\\n\\n uint256 totalStake = _stakingManager.getStakeeTotalManagedStake(stakee);\\n if (totalStake == 0) {\\n revert NoStakeToJoinEpoch();\\n }\\n\\n // staking capacity based on seeker power\\n uint256 seekerStakingCapacity = _stakingManager.calculateCapacityFromSeekerPower(seekerId);\\n\\n // staking capacity based on the min staking proportion constant\\n uint256 minProportionStakingCapacity = _stakingManager.calculateCapacityFromMinStakingProportion(stakee);\\n\\n uint256 joiningStake;\\n if (totalStake > seekerStakingCapacity && totalStake > minProportionStakingCapacity) {\\n joiningStake = Math.min(seekerStakingCapacity, minProportionStakingCapacity);\\n } else if (totalStake > seekerStakingCapacity) {\\n joiningStake = seekerStakingCapacity;\\n } else if (totalStake > minProportionStakingCapacity) {\\n joiningStake = minProportionStakingCapacity;\\n } else { // uncapped\\n joiningStake = totalStake;\\n }\\n\\n if (joiningStake == 0) {\\n revert NoJoiningStakeToJoinEpoch();\\n }\\n\\n if (directories[nextEpochId].stakes[stakee] > 0) {\\n revert StakeeAlreadyJoinedEpoch();\\n }\\n\\n uint256 nextBoundary = directories[nextEpochId].totalStake + joiningStake;\\n\\n directories[nextEpochId].entries.push(DirectoryEntry(stakee, nextBoundary));\\n directories[nextEpochId].stakes[stakee] = joiningStake;\\n directories[nextEpochId].totalStake = nextBoundary;\\n }\\n\\n /**\\n * @notice Call this to perform a stake-weighted scan to find the Node assigned\\n * to the given point of the current directory.\\n * @param point The point, which will usually be a hash of a public key.\\n */\\n function scan(uint128 point) external view returns (address stakee) {\\n return _scan(point, currentDirectory);\\n }\\n\\n /**\\n * @notice Call this to perform a stake-weighted scan to find the Node assigned\\n * to the given point of the requested directory.\\n * @param point The point, which will usually be a hash of a public key.\\n * @param epochId The epoch id associated with the directory to scan.\\n */\\n function scanWithEpochId(\\n uint128 point,\\n uint256 epochId\\n ) external view returns (address stakee) {\\n return _scan(point, epochId);\\n }\\n\\n /**\\n * @notice Call this to perform a stake-weighted scan to find the Node assigned\\n * to the given point of the requested directory (internal).\\n * @dev The current implementation will perform a binary search through\\n * the directory. This can allow gas costs to be low if this needs to be\\n * used in a transaction.\\n * @param point The point, which will usually be a hash of a public key.\\n * @param epochId The epoch id associated with the directory to scan.\\n */\\n function _scan(uint128 point, uint256 epochId) internal view returns (address stakee) {\\n uint256 entryLength = directories[epochId].entries.length;\\n\\n if (entryLength == 0) {\\n return address(0);\\n }\\n\\n // Staking all the Sylo would only be 94 bits, so multiplying this with\\n // a uint128 cannot overflow a uint256.\\n uint256 expectedVal = (directories[epochId].totalStake * uint256(point)) >> 128;\\n\\n uint256 left;\\n uint256 right = entryLength - 1;\\n\\n // perform a binary search through the directory\\n uint256 lower;\\n uint256 upper;\\n uint256 index;\\n\\n while (left <= right) {\\n index = (left + right) >> 1;\\n\\n lower = index == 0 ? 0 : directories[epochId].entries[index - 1].boundary;\\n upper = directories[epochId].entries[index].boundary;\\n\\n if (expectedVal >= lower && expectedVal < upper) {\\n return directories[epochId].entries[index].stakee;\\n } else if (expectedVal < lower) {\\n right = index - 1;\\n } else {\\n // expectedVal >= upper\\n left = index + 1;\\n }\\n }\\n }\\n\\n /**\\n * @notice Retrieve the total stake a Node has for the directory in the\\n * specified epoch.\\n * @param epochId The ID of the epoch.\\n * @param stakee The address of the Node.\\n * @return The amount of stake the Node has for the given directory in SOLO.\\n */\\n function getTotalStakeForStakee(\\n uint256 epochId,\\n address stakee\\n ) external view returns (uint256) {\\n return directories[epochId].stakes[stakee];\\n }\\n\\n /**\\n * @notice Retrieve the total stake for a directory in the specified epoch, which\\n * will be the sum of the stakes for all Nodes participating in that epoch.\\n * @param epochId The ID of the epoch.\\n * @return The total amount of stake in SOLO.\\n */\\n function getTotalStake(uint256 epochId) external view returns (uint256) {\\n return directories[epochId].totalStake;\\n }\\n\\n /**\\n * @notice Retrieve all entries for a directory in a specified epoch.\\n * @return An array of all the directory entries.\\n */\\n function getEntries(\\n uint256 epochId\\n ) external view returns (address[] memory, uint256[] memory) {\\n uint256 entryLength = directories[epochId].entries.length;\\n\\n address[] memory stakees = new address[](entryLength);\\n uint256[] memory boundaries = new uint256[](entryLength);\\n\\n DirectoryEntry memory entry;\\n DirectoryEntry[] memory entries = directories[epochId].entries;\\n\\n for (uint256 i; i < entryLength; ++i) {\\n entry = entries[i];\\n stakees[i] = entry.stakee;\\n boundaries[i] = entry.boundary;\\n }\\n return (stakees, boundaries);\\n }\\n}\\n\",\"keccak256\":\"0x98a344ba0403e7c5e92fe89a67799ec6583767bfa82a76e66c3b6e84ce519e59\",\"license\":\"Apache-2.0\"},\"contracts/staking/StakingManager.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\n\\nimport \\\"../SyloToken.sol\\\";\\nimport \\\"../libraries/SyloUtils.sol\\\";\\nimport \\\"../SeekerPowerOracle.sol\\\";\\nimport \\\"../epochs/EpochsManager.sol\\\";\\nimport \\\"../payments/ticketing/RewardsManager.sol\\\";\\nimport \\\"../interfaces/staking/IStakingManager.sol\\\";\\n\\n/**\\n * @notice Manages stakes and delegated stakes for Nodes. Holding\\n * staked Sylo is necessary for a Node to participate in the\\n * Sylo Network. The stake is used in stake-weighted scan function,\\n * and delegated stakers are rewarded on a pro-rata basis.\\n */\\ncontract StakingManager is IStakingManager, Initializable, Ownable2StepUpgradeable, ERC165 {\\n /** ERC 20 compatible token we are dealing with */\\n IERC20 public _token;\\n\\n /**\\n * @notice Rewards Manager contract. Any changes to stake will automatically\\n * trigger a claim to any outstanding rewards.\\n */\\n RewardsManager public _rewardsManager;\\n\\n EpochsManager public _epochsManager;\\n\\n SeekerPowerOracle public _seekerPowerOracle;\\n\\n /**\\n * @notice Tracks the managed stake for every Node.\\n */\\n mapping(address => Stake) public stakes;\\n\\n /** @notice Tracks overall total stake held by this contract */\\n uint256 public totalManagedStake;\\n\\n /**\\n * @notice Tracks funds that are in the process of being unlocked. This\\n * is indexed by a key that hashes both the address of the staked Node and\\n * the address of the staker.\\n */\\n mapping(bytes32 => Unlock) public unlockings;\\n\\n /**\\n * @notice The number of blocks a user must wait after calling \\\"unlock\\\"\\n * before they can withdraw their stake\\n */\\n uint256 public unlockDuration;\\n\\n /**\\n * @notice Minimum amount of stake that a Node needs to stake\\n * against itself in order to participate in the network. This is\\n * represented as a percentage of the Node's total stake, where\\n * the value is a ratio of 10000.\\n */\\n uint32 public minimumStakeProportion;\\n\\n /**\\n * @notice The multiplier used in determining a Seeker's staking\\n * capacity based on its power level.\\n */\\n uint256 public seekerPowerMultiplier;\\n\\n event UnlockDurationUpdated(uint256 unlockDuration);\\n event MinimumStakeProportionUpdated(uint256 minimumStakeProportion);\\n\\n error NoStakeToUnlock();\\n error StakeNotYetUnlocked();\\n error CannotStakeZeroAmount();\\n error CannotUnlockZeroAmount();\\n error TokenCannotBeZeroAddress();\\n error StakeeCannotBeZeroAddress();\\n error UnlockDurationCannotBeZero();\\n error CannotCancelUnlockZeroAmount();\\n error CannotUnlockMoreThanStaked(uint256 stakeAmount, uint256 unlockAmount);\\n error StakeCapacityReached(uint256 maxCapacity, uint256 currentCapacity);\\n error SeekerPowerNotRegistered(uint256 seekerId);\\n\\n function initialize(\\n IERC20 token,\\n RewardsManager rewardsManager,\\n EpochsManager epochsManager,\\n SeekerPowerOracle seekerPowerOracle,\\n uint256 _unlockDuration,\\n uint32 _minimumStakeProportion,\\n uint256 _seekerPowerMultiplier\\n ) external initializer {\\n if (address(token) == address(0)) {\\n revert TokenCannotBeZeroAddress();\\n }\\n\\n SyloUtils.validateContractInterface(\\n \\\"RewardsManager\\\",\\n address(rewardsManager),\\n type(IRewardsManager).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"EpochsManager\\\",\\n address(epochsManager),\\n type(IEpochsManager).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"SeekerPowerOracle\\\",\\n address(seekerPowerOracle),\\n type(ISeekerPowerOracle).interfaceId\\n );\\n\\n if (_unlockDuration == 0) {\\n revert UnlockDurationCannotBeZero();\\n }\\n\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n _token = token;\\n _rewardsManager = rewardsManager;\\n _epochsManager = epochsManager;\\n _seekerPowerOracle = seekerPowerOracle;\\n unlockDuration = _unlockDuration;\\n minimumStakeProportion = _minimumStakeProportion;\\n seekerPowerMultiplier = _seekerPowerMultiplier;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IStakingManager).interfaceId;\\n }\\n\\n /**\\n * @notice Sets the unlock duration for stakes. Only callable by\\n * the owner.\\n * @param _unlockDuration The unlock duration in number of blocks.\\n */\\n function setUnlockDuration(uint256 _unlockDuration) external onlyOwner {\\n if (_unlockDuration == 0) {\\n revert UnlockDurationCannotBeZero();\\n }\\n\\n unlockDuration = _unlockDuration;\\n emit UnlockDurationUpdated(_unlockDuration);\\n }\\n\\n /**\\n * @notice Sets the minimum stake proportion for Nodes. Only callable by\\n * the owner.\\n * @param _minimumStakeProportion The minimum stake proportion in SOLO.\\n */\\n function setMinimumStakeProportion(uint32 _minimumStakeProportion) external onlyOwner {\\n minimumStakeProportion = _minimumStakeProportion;\\n emit MinimumStakeProportionUpdated(_minimumStakeProportion);\\n }\\n\\n /**\\n * @notice Called by Nodes and delegated stakers to add stake.\\n * This function will fail under the following conditions:\\n * - If the Node address is invalid\\n * - If the specified stake value is zero\\n * - If the additional stake causes the Node to fail to meet the\\n * minimum stake proportion requirement.\\n * @param amount The amount of stake to add in SOLO.\\n * @param stakee The address of the staked Node.\\n */\\n function addStake(uint256 amount, address stakee) external {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n if (amount == 0) {\\n revert CannotStakeZeroAmount();\\n }\\n\\n _addStake(amount, stakee);\\n SafeERC20.safeTransferFrom(_token, msg.sender, address(this), amount);\\n }\\n\\n function _addStake(uint256 amount, address stakee) internal {\\n // automatically move any pending rewards generated by their existing stake\\n _rewardsManager.updatePendingRewards(stakee, msg.sender);\\n\\n uint256 currentEpochId = _epochsManager.currentIteration();\\n\\n Stake storage stake = stakes[stakee];\\n\\n uint256 currentStake = getCurrentStakerAmount(stakee, msg.sender);\\n\\n stake.stakeEntries[msg.sender] = StakeEntry(\\n currentStake + amount,\\n block.number,\\n currentEpochId\\n );\\n\\n stake.totalManagedStake = stake.totalManagedStake + amount;\\n totalManagedStake = totalManagedStake + amount;\\n }\\n\\n /**\\n * @notice Call this function to begin the unlocking process. Calling this\\n * will trigger an automatic claim of any outstanding staking rewards. Any\\n * stake that was already in the unlocking phase will have the specified\\n * amount added to it, and its duration refreshed. This function will fail\\n * under the following conditions:\\n * - If no stake exists for the caller\\n * - If the unlock amount is zero\\n * - If the unlock amount is more than what is staked\\n * Note: If calling as a Node, this function will *not* revert if it causes\\n * the Node to fail to meet the minimum stake proportion. However it will still\\n * prevent the Node from participating in the network until the minimum is met\\n * again.\\n * @param amount The amount of stake to unlock in SOLO.\\n * @param stakee The address of the staked Node.\\n */\\n function unlockStake(uint256 amount, address stakee) external returns (uint256) {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n if (amount == 0) {\\n revert CannotUnlockZeroAmount();\\n }\\n\\n uint256 currentStake = getCurrentStakerAmount(stakee, msg.sender);\\n\\n if (currentStake == 0) {\\n revert NoStakeToUnlock();\\n }\\n if (currentStake < amount) {\\n revert CannotUnlockMoreThanStaked(currentStake, amount);\\n }\\n\\n // automatically move any pending rewards generated by their existing stake\\n _rewardsManager.updatePendingRewards(stakee, msg.sender);\\n\\n uint256 currentEpochId = _epochsManager.currentIteration();\\n\\n Stake storage stake = stakes[stakee];\\n\\n stake.stakeEntries[msg.sender] = StakeEntry(\\n currentStake - amount,\\n block.number,\\n currentEpochId\\n );\\n\\n stake.totalManagedStake = stake.totalManagedStake - amount;\\n totalManagedStake = totalManagedStake - amount;\\n\\n bytes32 key = getKey(stakee, msg.sender);\\n\\n // Keep track of when the stake can be withdrawn\\n Unlock storage unlock = unlockings[key];\\n\\n uint256 unlockAt = block.number + unlockDuration;\\n if (unlock.unlockAt < unlockAt) {\\n unlock.unlockAt = unlockAt;\\n }\\n\\n unlock.amount = unlock.amount + amount;\\n\\n return unlockAt;\\n }\\n\\n /**\\n * @notice Call this function to withdraw stake that has finished unlocking.\\n * This will fail if the stake has not yet unlocked.\\n * @param stakee The address of the staked Node.\\n */\\n function withdrawStake(address stakee) external {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n\\n bytes32 key = getKey(stakee, msg.sender);\\n\\n Unlock storage unlock = unlockings[key];\\n\\n if (unlock.unlockAt >= block.number) {\\n revert StakeNotYetUnlocked();\\n }\\n\\n uint256 amount = unlock.amount;\\n\\n delete unlockings[key];\\n\\n SafeERC20.safeTransfer(_token, msg.sender, amount);\\n }\\n\\n /**\\n * @notice Call this function to cancel any stake that is in the process\\n * of unlocking. As this essentially adds back stake to the Node, this\\n * will trigger an automatic claim of any outstanding staking rewards.\\n * If the specified amount to cancel is greater than the stake that is\\n * currently being unlocked, it will cancel the maximum stake possible.\\n * @param amount The amount of unlocking stake to cancel in SOLO.\\n * @param stakee The address of the staked Node.\\n */\\n function cancelUnlocking(uint256 amount, address stakee) external {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n if (amount == 0) {\\n revert CannotCancelUnlockZeroAmount();\\n }\\n\\n bytes32 key = getKey(stakee, msg.sender);\\n\\n Unlock storage unlock = unlockings[key];\\n\\n if (amount >= unlock.amount) {\\n amount = unlock.amount;\\n delete unlockings[key];\\n } else {\\n unlock.amount = unlock.amount - amount;\\n }\\n\\n _addStake(amount, stakee);\\n }\\n\\n /**\\n * @notice This function determines the staking capacity of\\n * a Seeker based on its power level. The method will revert if\\n * the Seeker's power level has not been registered with the oracle.\\n *\\n * Currently the algorithm is as follows:\\n * staking_capacity = seeker_power * seeker_power_multiplier;\\n */\\n function calculateCapacityFromSeekerPower(uint256 seekerId) external view returns (uint256) {\\n uint256 seekerPower = _seekerPowerOracle.getSeekerPower(seekerId);\\n if (seekerPower == 0) {\\n revert SeekerPowerNotRegistered(seekerId);\\n }\\n\\n // If the Seeker Power is already\\n // at the maximum sylo, then we just return the max sylo value directly.\\n if (seekerPower >= SyloUtils.MAX_SYLO) {\\n return SyloUtils.MAX_SYLO;\\n }\\n\\n uint256 capacity = seekerPower * seekerPowerMultiplier;\\n\\n return capacity > SyloUtils.MAX_SYLO ? SyloUtils.MAX_SYLO : capacity;\\n }\\n\\n /**\\n * @notice This function can be used to a determine a Node's staking capacity,\\n * based on the minimum stake proportion constant.\\n * @param stakee The address of the staked Node.\\n */\\n function calculateCapacityFromMinStakingProportion(address stakee) public view returns (uint256) {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n\\n Stake storage stake = stakes[stakee];\\n\\n uint256 currentlyOwnedStake = stake.stakeEntries[stakee].amount;\\n return (currentlyOwnedStake * SyloUtils.PERCENTAGE_DENOMINATOR) /\\n minimumStakeProportion;\\n }\\n\\n /**\\n * @notice This function should be called by clients to determine how much\\n * additional delegated stake can be allocated to a Node via an addStake or\\n * cancelUnlocking call. This is useful to avoid a revert due to\\n * the minimum stake proportion requirement not being met from the additional stake.\\n * @param stakee The address of the staked Node.\\n */\\n function calculateMaxAdditionalDelegatedStake(address stakee) external view returns (uint256) {\\n uint256 totalMaxStake = calculateCapacityFromMinStakingProportion(stakee);\\n\\n Stake storage stake = stakes[stakee];\\n\\n if (totalMaxStake < stake.totalManagedStake) {\\n revert StakeCapacityReached(totalMaxStake, stake.totalManagedStake);\\n }\\n\\n return totalMaxStake - stake.totalManagedStake;\\n }\\n\\n /**\\n * @notice Retrieve the key used to index a stake entry. The key is a hash\\n * which takes both address of the Node and the staker as input.\\n * @param stakee The address of the staked Node.\\n * @param staker The address of the staker.\\n * @return A byte-array representing the key.\\n */\\n function getKey(address stakee, address staker) public pure returns (bytes32) {\\n return keccak256(abi.encodePacked(stakee, staker));\\n }\\n\\n /**\\n * @notice Retrieve the total stake being managed by this contract.\\n * @return The total amount of managed stake in SOLO.\\n */\\n function getTotalManagedStake() external view returns (uint256) {\\n return totalManagedStake;\\n }\\n\\n /**\\n * @notice Retrieve a stake entry.\\n * @param stakee The address of the staked Node.\\n * @param staker The address of the staker.\\n * @return The stake entry.\\n */\\n function getStakeEntry(\\n address stakee,\\n address staker\\n ) external view returns (StakeEntry memory) {\\n return stakes[stakee].stakeEntries[staker];\\n }\\n\\n /**\\n * @notice Retrieve the total amount of SOLO staked against a Node.\\n * @param stakee The address of the staked Node.\\n * @return The amount of staked SOLO.\\n */\\n function getStakeeTotalManagedStake(address stakee) external view returns (uint256) {\\n return stakes[stakee].totalManagedStake;\\n }\\n\\n /**\\n * @notice Check if a Node is meeting the minimum stake proportion requirement.\\n * @param stakee The address of the staked Node.\\n * @return True if the Node is meeting minimum stake proportion requirement.\\n */\\n function checkMinimumStakeProportion(address stakee) public view returns (bool) {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n\\n Stake storage stake = stakes[stakee];\\n\\n uint256 currentlyOwnedStake = stake.stakeEntries[stakee].amount;\\n uint32 ownedStakeProportion = SyloUtils.asPerc(\\n SafeCast.toUint128(currentlyOwnedStake),\\n stake.totalManagedStake\\n );\\n\\n return ownedStakeProportion >= minimumStakeProportion;\\n }\\n\\n /**\\n * @notice Retrieve the current amount of SOLO staked against a Node by\\n * a specified staker.\\n * @param stakee The address of the staked Node.\\n * @param staker The address of the staker.\\n * @return The amount of staked SOLO.\\n */\\n function getCurrentStakerAmount(address stakee, address staker) public view returns (uint256) {\\n return stakes[stakee].stakeEntries[staker].amount;\\n }\\n}\\n\",\"keccak256\":\"0x039e692a4a3a670977e78ef7145a43d0bc00e48387fafd4f527b60fbb6966628\",\"license\":\"Apache-2.0\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061174b806100206000396000f3fe608060405234801561001057600080fd5b506004361061014d5760003560e01c806388c6abf8116100c3578063c70f1a8c1161007c578063c70f1a8c14610377578063d7c41c791461038a578063e1519a751461039d578063e30c3978146103a5578063e34bf013146103b6578063f2fde38b146103cc57600080fd5b806388c6abf81461025d5780638da5cb5b14610266578063b24651c414610277578063b3e123db1461028a578063bc0bc6ba14610292578063c6b61e4c146102b257600080fd5b8063455266491161011557806345526649146101f15780634ff0876a146101f95780635f7985811461021057806370ef4ad314610244578063715018a61461024d57806379ba50971461025557600080fd5b806301ffc9a714610152578063199f82371461018b57806330024dfe146101b657806336357cd8146101cb57806344f74069146101de575b600080fd5b610176610160366004611221565b6001600160e01b03191663078a0a4b60e41b1490565b60405190151581526020015b60405180910390f35b609a5461019e906001600160a01b031681565b6040516001600160a01b039091168152602001610182565b6101c96101c4366004611252565b6103df565b005b60995461019e906001600160a01b031681565b6101c96101ec366004611252565b610444565b6101c96104a2565b610202609e5481565b604051908152602001610182565b61019e61021e36600461126b565b609b6020908152600092835260408084209091529082529020546001600160a01b031681565b610202609d5481565b6101c96107d0565b6101c96107e4565b610202609f5481565b6033546001600160a01b031661019e565b60985461019e906001600160a01b031681565b61020261085e565b6102a56102a0366004611252565b610874565b6040516101829190611309565b6103216102c0366004611252565b609c60205260009081526040902080546001820154600283015460038401546004850154600586015460069096015494959394929363ffffffff8084169464010000000090940416926001600160801b0380831692600160801b9004169089565b60408051998a5260208a01989098529688019590955263ffffffff938416606088015292909116608086015260a08501526001600160801b0390811660c08501521660e083015261010082015261012001610182565b60975461019e906001600160a01b031681565b6101c9610398366004611333565b610911565b610202610b46565b6065546001600160a01b031661019e565b6103be610e75565b6040516101829291906113a1565b6101c96103da3660046113b6565b610f19565b6103e7610f8a565b806000036104085760405163fd06e18160e01b815260040160405180910390fd5b609e8190556040518181527fbfdcfb557a8f4a07f749e7d744a90c02e13eb5af308b561c2f4f17e58069c836906020015b60405180910390a150565b61044c610f8a565b8060000361046d57604051632bb8431560e21b815260040160405180910390fd5b609d8190556040518181527fda25ad46144a833733d980886507e5ea616378263c675a97ae98a4bc0692e34a90602001610439565b609854604051633e5c75df60e21b81523360048201526000916001600160a01b03169063f971d77c90602401600060405180830381865afa1580156104eb573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610513919081019061148b565b60408101519091506001600160a01b031661054157604051630f32ebab60e21b815260040160405180910390fd5b60608101516099546040516331a9108f60e11b8152600481018390526000916001600160a01b031690636352211e90602401602060405180830381865afa158015610590573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b49190611577565b9050806001600160a01b031683604001516001600160a01b0316146105ec57604051630e6c6ffb60e11b815260040160405180910390fd5b60006105f661085e565b6000818152609b602090815260408083208784529091529020549091506001600160a01b03161561064957604051633da0060360e11b815260048101829052602481018490526044015b60405180910390fd5b6000818152609b6020908152604080832086845282529182902080546001600160a01b031916331790556097548251637ddc62c160e01b815292516001600160a01b039190911692637ddc62c19260048083019391928290030181865afa1580156106b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106dc9190611577565b60405163c829b66d60e01b81523360048201526001600160a01b03919091169063c829b66d90602401600060405180830381600087803b15801561071f57600080fd5b505af1158015610733573d6000803e3d6000fd5b5050609754604051631943d32760e11b8152336004820152602481018790526001600160a01b039091169250633287a64e9150604401600060405180830381600087803b15801561078357600080fd5b505af1158015610797573d6000803e3d6000fd5b505060405185925033915083907f4fc35b30ae04a99dd107660883d5ca3d1042543794e55e0a7a5c8f4b88fbee2a90600090a450505050565b6107d8610f8a565b6107e26000610fe4565b565b60655433906001600160a01b031681146108525760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610640565b61085b81610fe4565b50565b6000609f54600161086f9190611594565b905090565b61087c6111b7565b506000908152609c602090815260409182902082516101208101845281548152600182015492810192909252600281015492820192909252600382015463ffffffff8082166060840152640100000000909104166080820152600482015460a082015260058201546001600160801b0380821660c0840152600160801b9091041660e082015260069091015461010082015290565b600054610100900460ff16158080156109315750600054600160ff909116105b8061094b5750303b15801561094b575060005460ff166001145b6109ae5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610640565b6000805460ff1916600117905580156109d1576000805461ff0019166101001790555b6001600160a01b0387166109f85760405163dd2236bb60e01b815260040160405180910390fd5b610a2b604051806040016040528060098152602001684469726563746f727960b81b81525087638a5d64cd60e01b610ffd565b610a5f6040518060400160405280600a8152602001695265676973747269657360b01b81525086637ccc541d60e11b610ffd565b610a9b604051806040016040528060138152602001725469636b6574696e67506172616d657465727360681b81525085621d8a0b60e21b610ffd565b610aa3611106565b609980546001600160a01b03808a166001600160a01b0319928316179092556097805489841690831617905560988054888416908316179055609a805492871692909116919091179055609d839055609e8290558015610b3d576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050565b6000609f546000148015610b5b575043609d54115b15610b8657609d5460405163c5f4bdd960e01b81526004810191909152436024820152604401610640565b609f546000908152609c6020526040812060018101548154919291610bab9190611594565b905043811115610bd457609f546040516302f0d65360e11b815260040161064091815260200190565b6000806000806000609a60009054906101000a90046001600160a01b03166001600160a01b031663ce1b1d246040518163ffffffff1660e01b815260040160a060405180830381865afa158015610c2f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c5391906115cc565b945094509450945094506000610c6761085e565b9050604051806101200160405280438152602001609e54815260200160008152602001609860009054906101000a90046001600160a01b03166001600160a01b031663d2a78d7f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cdd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d019190611623565b63ffffffff908116825284811660208084019190915260408084018b90526001600160801b03808b166060808701919091528a821660808088019190915260a09687018b90526000898152609c8652849020885181559488015160018601558784015160028087019190915591880151600386018054928a015188166401000000000267ffffffffffffffff199093169190971617179094559385015160048084019190915560c086015160e08701518616600160801b0295169490941760058301556101009094015160069091015543908b0155609f8390556097549151634672ba4b60e11b81526001600160a01b0390921691638ce5749691610e0c9185910190815260200190565b600060405180830381600087803b158015610e2657600080fd5b505af1158015610e3a573d6000803e3d6000fd5b50506040518392507febad8099c467528a56c98b63c8d476d251cf1ffb4c75db94b4d23fa2b6a1e3359150600090a298975050505050505050565b6000610e7f6111b7565b5050609f546000818152609c602090815260409182902082516101208101845281548152600182015492810192909252600281015492820192909252600382015463ffffffff8082166060840152640100000000909104166080820152600482015460a082015260058201546001600160801b0380821660c0840152600160801b9091041660e08201526006909101546101008201529091565b610f21610f8a565b606580546001600160a01b0383166001600160a01b03199091168117909155610f526033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6033546001600160a01b031633146107e25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610640565b606580546001600160a01b031916905561085b81611135565b825160000361101f5760405163d1fc12f760e01b815260040160405180910390fd5b6001600160a01b038216611046578260405161f56160eb1b8152600401610640919061166a565b6001600160e01b0319811661106e5760405163308c995160e01b815260040160405180910390fd5b6040516301ffc9a760e01b81526001600160e01b0319821660048201526001600160a01b038316906301ffc9a790602401602060405180830381865afa1580156110bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e0919061167d565b611101578281604051633f8ccd3b60e21b815260040161064092919061169f565b505050565b600054610100900460ff1661112d5760405162461bcd60e51b8152600401610640906116ca565b6107e2611187565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166111ae5760405162461bcd60e51b8152600401610640906116ca565b6107e233610fe4565b604051806101200160405280600081526020016000815260200160008152602001600063ffffffff168152602001600063ffffffff1681526020016000815260200160006001600160801b0316815260200160006001600160801b03168152602001600081525090565b60006020828403121561123357600080fd5b81356001600160e01b03198116811461124b57600080fd5b9392505050565b60006020828403121561126457600080fd5b5035919050565b6000806040838503121561127e57600080fd5b50508035926020909101359150565b805182526020810151602083015260408101516040830152606081015163ffffffff8082166060850152806080840151166080850152505060a081015160a08301526001600160801b0360c08201511660c083015260e08101516112fc60e08401826001600160801b03169052565b5061010090810151910152565b6101208101611318828461128d565b92915050565b6001600160a01b038116811461085b57600080fd5b60008060008060008060c0878903121561134c57600080fd5b86356113578161131e565b955060208701356113678161131e565b945060408701356113778161131e565b935060608701356113878161131e565b9598949750929560808101359460a0909101359350915050565b828152610140810161124b602083018461128d565b6000602082840312156113c857600080fd5b813561124b8161131e565b634e487b7160e01b600052604160045260246000fd5b6040516080810167ffffffffffffffff8111828210171561140c5761140c6113d3565b60405290565b604051601f8201601f1916810167ffffffffffffffff8111828210171561143b5761143b6113d3565b604052919050565b805163ffffffff8116811461145757600080fd5b919050565b60005b8381101561147757818101518382015260200161145f565b50506000910152565b80516114578161131e565b6000602080838503121561149e57600080fd5b825167ffffffffffffffff808211156114b657600080fd5b90840190608082870312156114ca57600080fd5b6114d26113e9565b6114db83611443565b815283830151828111156114ee57600080fd5b8301601f810188136114ff57600080fd5b805183811115611511576115116113d3565b611523601f8201601f19168701611412565b9350808452888682840101111561153957600080fd5b6115488187860188850161145c565b5050818482015261155b60408401611480565b6040820152606083015160608201528094505050505092915050565b60006020828403121561158957600080fd5b815161124b8161131e565b8082018082111561131857634e487b7160e01b600052601160045260246000fd5b80516001600160801b038116811461145757600080fd5b600080600080600060a086880312156115e457600080fd5b855194506115f4602087016115b5565b9350611602604087016115b5565b92506060860151915061161760808701611443565b90509295509295909350565b60006020828403121561163557600080fd5b61124b82611443565b6000815180845261165681602086016020860161145c565b601f01601f19169290920160200192915050565b60208152600061124b602083018461163e565b60006020828403121561168f57600080fd5b8151801515811461124b57600080fd5b6040815260006116b2604083018561163e565b905063ffffffff60e01b831660208301529392505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea2646970667358221220db122240a944976d7497a81596f9d76ea563d94ee1afaab1f174d7dc08c3587164736f6c63430008120033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061014d5760003560e01c806388c6abf8116100c3578063c70f1a8c1161007c578063c70f1a8c14610377578063d7c41c791461038a578063e1519a751461039d578063e30c3978146103a5578063e34bf013146103b6578063f2fde38b146103cc57600080fd5b806388c6abf81461025d5780638da5cb5b14610266578063b24651c414610277578063b3e123db1461028a578063bc0bc6ba14610292578063c6b61e4c146102b257600080fd5b8063455266491161011557806345526649146101f15780634ff0876a146101f95780635f7985811461021057806370ef4ad314610244578063715018a61461024d57806379ba50971461025557600080fd5b806301ffc9a714610152578063199f82371461018b57806330024dfe146101b657806336357cd8146101cb57806344f74069146101de575b600080fd5b610176610160366004611221565b6001600160e01b03191663078a0a4b60e41b1490565b60405190151581526020015b60405180910390f35b609a5461019e906001600160a01b031681565b6040516001600160a01b039091168152602001610182565b6101c96101c4366004611252565b6103df565b005b60995461019e906001600160a01b031681565b6101c96101ec366004611252565b610444565b6101c96104a2565b610202609e5481565b604051908152602001610182565b61019e61021e36600461126b565b609b6020908152600092835260408084209091529082529020546001600160a01b031681565b610202609d5481565b6101c96107d0565b6101c96107e4565b610202609f5481565b6033546001600160a01b031661019e565b60985461019e906001600160a01b031681565b61020261085e565b6102a56102a0366004611252565b610874565b6040516101829190611309565b6103216102c0366004611252565b609c60205260009081526040902080546001820154600283015460038401546004850154600586015460069096015494959394929363ffffffff8084169464010000000090940416926001600160801b0380831692600160801b9004169089565b60408051998a5260208a01989098529688019590955263ffffffff938416606088015292909116608086015260a08501526001600160801b0390811660c08501521660e083015261010082015261012001610182565b60975461019e906001600160a01b031681565b6101c9610398366004611333565b610911565b610202610b46565b6065546001600160a01b031661019e565b6103be610e75565b6040516101829291906113a1565b6101c96103da3660046113b6565b610f19565b6103e7610f8a565b806000036104085760405163fd06e18160e01b815260040160405180910390fd5b609e8190556040518181527fbfdcfb557a8f4a07f749e7d744a90c02e13eb5af308b561c2f4f17e58069c836906020015b60405180910390a150565b61044c610f8a565b8060000361046d57604051632bb8431560e21b815260040160405180910390fd5b609d8190556040518181527fda25ad46144a833733d980886507e5ea616378263c675a97ae98a4bc0692e34a90602001610439565b609854604051633e5c75df60e21b81523360048201526000916001600160a01b03169063f971d77c90602401600060405180830381865afa1580156104eb573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610513919081019061148b565b60408101519091506001600160a01b031661054157604051630f32ebab60e21b815260040160405180910390fd5b60608101516099546040516331a9108f60e11b8152600481018390526000916001600160a01b031690636352211e90602401602060405180830381865afa158015610590573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b49190611577565b9050806001600160a01b031683604001516001600160a01b0316146105ec57604051630e6c6ffb60e11b815260040160405180910390fd5b60006105f661085e565b6000818152609b602090815260408083208784529091529020549091506001600160a01b03161561064957604051633da0060360e11b815260048101829052602481018490526044015b60405180910390fd5b6000818152609b6020908152604080832086845282529182902080546001600160a01b031916331790556097548251637ddc62c160e01b815292516001600160a01b039190911692637ddc62c19260048083019391928290030181865afa1580156106b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106dc9190611577565b60405163c829b66d60e01b81523360048201526001600160a01b03919091169063c829b66d90602401600060405180830381600087803b15801561071f57600080fd5b505af1158015610733573d6000803e3d6000fd5b5050609754604051631943d32760e11b8152336004820152602481018790526001600160a01b039091169250633287a64e9150604401600060405180830381600087803b15801561078357600080fd5b505af1158015610797573d6000803e3d6000fd5b505060405185925033915083907f4fc35b30ae04a99dd107660883d5ca3d1042543794e55e0a7a5c8f4b88fbee2a90600090a450505050565b6107d8610f8a565b6107e26000610fe4565b565b60655433906001600160a01b031681146108525760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610640565b61085b81610fe4565b50565b6000609f54600161086f9190611594565b905090565b61087c6111b7565b506000908152609c602090815260409182902082516101208101845281548152600182015492810192909252600281015492820192909252600382015463ffffffff8082166060840152640100000000909104166080820152600482015460a082015260058201546001600160801b0380821660c0840152600160801b9091041660e082015260069091015461010082015290565b600054610100900460ff16158080156109315750600054600160ff909116105b8061094b5750303b15801561094b575060005460ff166001145b6109ae5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610640565b6000805460ff1916600117905580156109d1576000805461ff0019166101001790555b6001600160a01b0387166109f85760405163dd2236bb60e01b815260040160405180910390fd5b610a2b604051806040016040528060098152602001684469726563746f727960b81b81525087638a5d64cd60e01b610ffd565b610a5f6040518060400160405280600a8152602001695265676973747269657360b01b81525086637ccc541d60e11b610ffd565b610a9b604051806040016040528060138152602001725469636b6574696e67506172616d657465727360681b81525085621d8a0b60e21b610ffd565b610aa3611106565b609980546001600160a01b03808a166001600160a01b0319928316179092556097805489841690831617905560988054888416908316179055609a805492871692909116919091179055609d839055609e8290558015610b3d576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050565b6000609f546000148015610b5b575043609d54115b15610b8657609d5460405163c5f4bdd960e01b81526004810191909152436024820152604401610640565b609f546000908152609c6020526040812060018101548154919291610bab9190611594565b905043811115610bd457609f546040516302f0d65360e11b815260040161064091815260200190565b6000806000806000609a60009054906101000a90046001600160a01b03166001600160a01b031663ce1b1d246040518163ffffffff1660e01b815260040160a060405180830381865afa158015610c2f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c5391906115cc565b945094509450945094506000610c6761085e565b9050604051806101200160405280438152602001609e54815260200160008152602001609860009054906101000a90046001600160a01b03166001600160a01b031663d2a78d7f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cdd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d019190611623565b63ffffffff908116825284811660208084019190915260408084018b90526001600160801b03808b166060808701919091528a821660808088019190915260a09687018b90526000898152609c8652849020885181559488015160018601558784015160028087019190915591880151600386018054928a015188166401000000000267ffffffffffffffff199093169190971617179094559385015160048084019190915560c086015160e08701518616600160801b0295169490941760058301556101009094015160069091015543908b0155609f8390556097549151634672ba4b60e11b81526001600160a01b0390921691638ce5749691610e0c9185910190815260200190565b600060405180830381600087803b158015610e2657600080fd5b505af1158015610e3a573d6000803e3d6000fd5b50506040518392507febad8099c467528a56c98b63c8d476d251cf1ffb4c75db94b4d23fa2b6a1e3359150600090a298975050505050505050565b6000610e7f6111b7565b5050609f546000818152609c602090815260409182902082516101208101845281548152600182015492810192909252600281015492820192909252600382015463ffffffff8082166060840152640100000000909104166080820152600482015460a082015260058201546001600160801b0380821660c0840152600160801b9091041660e08201526006909101546101008201529091565b610f21610f8a565b606580546001600160a01b0383166001600160a01b03199091168117909155610f526033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6033546001600160a01b031633146107e25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610640565b606580546001600160a01b031916905561085b81611135565b825160000361101f5760405163d1fc12f760e01b815260040160405180910390fd5b6001600160a01b038216611046578260405161f56160eb1b8152600401610640919061166a565b6001600160e01b0319811661106e5760405163308c995160e01b815260040160405180910390fd5b6040516301ffc9a760e01b81526001600160e01b0319821660048201526001600160a01b038316906301ffc9a790602401602060405180830381865afa1580156110bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e0919061167d565b611101578281604051633f8ccd3b60e21b815260040161064092919061169f565b505050565b600054610100900460ff1661112d5760405162461bcd60e51b8152600401610640906116ca565b6107e2611187565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166111ae5760405162461bcd60e51b8152600401610640906116ca565b6107e233610fe4565b604051806101200160405280600081526020016000815260200160008152602001600063ffffffff168152602001600063ffffffff1681526020016000815260200160006001600160801b0316815260200160006001600160801b03168152602001600081525090565b60006020828403121561123357600080fd5b81356001600160e01b03198116811461124b57600080fd5b9392505050565b60006020828403121561126457600080fd5b5035919050565b6000806040838503121561127e57600080fd5b50508035926020909101359150565b805182526020810151602083015260408101516040830152606081015163ffffffff8082166060850152806080840151166080850152505060a081015160a08301526001600160801b0360c08201511660c083015260e08101516112fc60e08401826001600160801b03169052565b5061010090810151910152565b6101208101611318828461128d565b92915050565b6001600160a01b038116811461085b57600080fd5b60008060008060008060c0878903121561134c57600080fd5b86356113578161131e565b955060208701356113678161131e565b945060408701356113778161131e565b935060608701356113878161131e565b9598949750929560808101359460a0909101359350915050565b828152610140810161124b602083018461128d565b6000602082840312156113c857600080fd5b813561124b8161131e565b634e487b7160e01b600052604160045260246000fd5b6040516080810167ffffffffffffffff8111828210171561140c5761140c6113d3565b60405290565b604051601f8201601f1916810167ffffffffffffffff8111828210171561143b5761143b6113d3565b604052919050565b805163ffffffff8116811461145757600080fd5b919050565b60005b8381101561147757818101518382015260200161145f565b50506000910152565b80516114578161131e565b6000602080838503121561149e57600080fd5b825167ffffffffffffffff808211156114b657600080fd5b90840190608082870312156114ca57600080fd5b6114d26113e9565b6114db83611443565b815283830151828111156114ee57600080fd5b8301601f810188136114ff57600080fd5b805183811115611511576115116113d3565b611523601f8201601f19168701611412565b9350808452888682840101111561153957600080fd5b6115488187860188850161145c565b5050818482015261155b60408401611480565b6040820152606083015160608201528094505050505092915050565b60006020828403121561158957600080fd5b815161124b8161131e565b8082018082111561131857634e487b7160e01b600052601160045260246000fd5b80516001600160801b038116811461145757600080fd5b600080600080600060a086880312156115e457600080fd5b855194506115f4602087016115b5565b9350611602604087016115b5565b92506060860151915061161760808701611443565b90509295509295909350565b60006020828403121561163557600080fd5b61124b82611443565b6000815180845261165681602086016020860161145c565b601f01601f19169290920160200192915050565b60208152600061124b602083018461163e565b60006020828403121561168f57600080fd5b8151801515811461124b57600080fd5b6040815260006116b2604083018561163e565b905063ffffffff60e01b831660208301529392505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea2646970667358221220db122240a944976d7497a81596f9d76ea563d94ee1afaab1f174d7dc08c3587164736f6c63430008120033", + "devdoc": { + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "acceptOwnership()": { + "details": "The new owner accepts the ownership transfer." + }, + "getCurrentActiveEpoch()": { + "returns": { + "_0": "The current Epoch parameters." + } + }, + "getEpoch(uint256)": { + "params": { + "epochId": "The id of the epoch to retrieve." + }, + "returns": { + "_0": "The epoch parameters associated with the id." + } + }, + "getNextEpochId()": { + "returns": { + "_0": "The next epoch id identifier." + } + }, + "initializeEpoch()": { + "details": "The function will read the current set of network parameters, and store the parameters in a new Epoch struct. The end block of the current epoch will also be set to a non-zero value." + }, + "joinNextEpoch()": { + "details": "This is a proxy function for `initalizeNextRewardPool` and `joinNextDirectory`." + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pendingOwner()": { + "details": "Returns the address of the pending owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "setEpochDuration(uint256)": { + "params": { + "_epochDuration": "The epoch duration in number of blocks." + } + }, + "setInitialEpoch(uint256)": { + "params": { + "_initialEpoch": "The block number when the first epoch can be initialized." + } + }, + "transferOwnership(address)": { + "details": "Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "activeSeekers(uint256,uint256)": { + "notice": "Track seekers that have joined for a specific epoch." + }, + "currentIteration()": { + "notice": "The value of the integer used as the current epoch's identifier. This value is incremented as each epoch is initialized." + }, + "epochDuration()": { + "notice": "The duration in blocks an epoch will last for." + }, + "epochs(uint256)": { + "notice": "A mapping of all epochs that have been initialized." + }, + "getCurrentActiveEpoch()": { + "notice": "Retrieve the parameters for the current epoch." + }, + "getEpoch(uint256)": { + "notice": "Retrieve the epoch parameter for the given id." + }, + "getNextEpochId()": { + "notice": "Retrieve the integer value that will be used for the next epoch id." + }, + "initialEpoch()": { + "notice": "The block number since the first epoch can be initialized." + }, + "initializeEpoch()": { + "notice": "Call this to initialize the next epoch. On success, a `NewEpoch` event will be emitted." + }, + "joinNextEpoch()": { + "notice": "Nodes should call this to join the next epoch. It will initialize the next reward pool and set the stake for the next directory." + }, + "setEpochDuration(uint256)": { + "notice": "Set the epoch duration. Will take effect in the next epoch. Only callable by the owner." + }, + "setInitialEpoch(uint256)": { + "notice": "Set the first epoch starting block. Only callable by the owner." + }, + "supportsInterface(bytes4)": { + "notice": "Returns true if the contract implements the interface defined by `interfaceId` from ERC165." + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 244, + "contract": "contracts/epochs/EpochsManager.sol:EpochsManager", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 247, + "contract": "contracts/epochs/EpochsManager.sol:EpochsManager", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 777, + "contract": "contracts/epochs/EpochsManager.sol:EpochsManager", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 116, + "contract": "contracts/epochs/EpochsManager.sol:EpochsManager", + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address" + }, + { + "astId": 236, + "contract": "contracts/epochs/EpochsManager.sol:EpochsManager", + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 25, + "contract": "contracts/epochs/EpochsManager.sol:EpochsManager", + "label": "_pendingOwner", + "offset": 0, + "slot": "101", + "type": "t_address" + }, + { + "astId": 104, + "contract": "contracts/epochs/EpochsManager.sol:EpochsManager", + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 9917, + "contract": "contracts/epochs/EpochsManager.sol:EpochsManager", + "label": "_directory", + "offset": 0, + "slot": "151", + "type": "t_contract(Directory)14978" + }, + { + "astId": 9920, + "contract": "contracts/epochs/EpochsManager.sol:EpochsManager", + "label": "_registries", + "offset": 0, + "slot": "152", + "type": "t_contract(Registries)9641" + }, + { + "astId": 9923, + "contract": "contracts/epochs/EpochsManager.sol:EpochsManager", + "label": "_rootSeekers", + "offset": 0, + "slot": "153", + "type": "t_contract(IERC721)1996" + }, + { + "astId": 9926, + "contract": "contracts/epochs/EpochsManager.sol:EpochsManager", + "label": "_ticketingParameters", + "offset": 0, + "slot": "154", + "type": "t_contract(TicketingParameters)14395" + }, + { + "astId": 9933, + "contract": "contracts/epochs/EpochsManager.sol:EpochsManager", + "label": "activeSeekers", + "offset": 0, + "slot": "155", + "type": "t_mapping(t_uint256,t_mapping(t_uint256,t_address))" + }, + { + "astId": 9939, + "contract": "contracts/epochs/EpochsManager.sol:EpochsManager", + "label": "epochs", + "offset": 0, + "slot": "156", + "type": "t_mapping(t_uint256,t_struct(Epoch)10659_storage)" + }, + { + "astId": 9942, + "contract": "contracts/epochs/EpochsManager.sol:EpochsManager", + "label": "initialEpoch", + "offset": 0, + "slot": "157", + "type": "t_uint256" + }, + { + "astId": 9945, + "contract": "contracts/epochs/EpochsManager.sol:EpochsManager", + "label": "epochDuration", + "offset": 0, + "slot": "158", + "type": "t_uint256" + }, + { + "astId": 9948, + "contract": "contracts/epochs/EpochsManager.sol:EpochsManager", + "label": "currentIteration", + "offset": 0, + "slot": "159", + "type": "t_uint256" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(Directory)14978": { + "encoding": "inplace", + "label": "contract Directory", + "numberOfBytes": "20" + }, + "t_contract(IERC721)1996": { + "encoding": "inplace", + "label": "contract IERC721", + "numberOfBytes": "20" + }, + "t_contract(Registries)9641": { + "encoding": "inplace", + "label": "contract Registries", + "numberOfBytes": "20" + }, + "t_contract(TicketingParameters)14395": { + "encoding": "inplace", + "label": "contract TicketingParameters", + "numberOfBytes": "20" + }, + "t_mapping(t_uint256,t_address)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => address)", + "numberOfBytes": "32", + "value": "t_address" + }, + "t_mapping(t_uint256,t_mapping(t_uint256,t_address))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(uint256 => address))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_address)" + }, + "t_mapping(t_uint256,t_struct(Epoch)10659_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct IEpochsManager.Epoch)", + "numberOfBytes": "32", + "value": "t_struct(Epoch)10659_storage" + }, + "t_struct(Epoch)10659_storage": { + "encoding": "inplace", + "label": "struct IEpochsManager.Epoch", + "members": [ + { + "astId": 10642, + "contract": "contracts/epochs/EpochsManager.sol:EpochsManager", + "label": "startBlock", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 10644, + "contract": "contracts/epochs/EpochsManager.sol:EpochsManager", + "label": "duration", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 10646, + "contract": "contracts/epochs/EpochsManager.sol:EpochsManager", + "label": "endBlock", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 10648, + "contract": "contracts/epochs/EpochsManager.sol:EpochsManager", + "label": "defaultPayoutPercentage", + "offset": 0, + "slot": "3", + "type": "t_uint32" + }, + { + "astId": 10650, + "contract": "contracts/epochs/EpochsManager.sol:EpochsManager", + "label": "decayRate", + "offset": 4, + "slot": "3", + "type": "t_uint32" + }, + { + "astId": 10652, + "contract": "contracts/epochs/EpochsManager.sol:EpochsManager", + "label": "faceValue", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 10654, + "contract": "contracts/epochs/EpochsManager.sol:EpochsManager", + "label": "baseLiveWinProb", + "offset": 0, + "slot": "5", + "type": "t_uint128" + }, + { + "astId": 10656, + "contract": "contracts/epochs/EpochsManager.sol:EpochsManager", + "label": "expiredWinProb", + "offset": 16, + "slot": "5", + "type": "t_uint128" + }, + { + "astId": 10658, + "contract": "contracts/epochs/EpochsManager.sol:EpochsManager", + "label": "ticketDuration", + "offset": 0, + "slot": "6", + "type": "t_uint256" + } + ], + "numberOfBytes": "224" + }, + "t_uint128": { + "encoding": "inplace", + "label": "uint128", + "numberOfBytes": "16" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint32": { + "encoding": "inplace", + "label": "uint32", + "numberOfBytes": "4" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/deployments/porcini-dev/EpochsManager_Proxy.json b/deployments/porcini-dev/EpochsManager_Proxy.json new file mode 100644 index 00000000..4ee61017 --- /dev/null +++ b/deployments/porcini-dev/EpochsManager_Proxy.json @@ -0,0 +1,235 @@ +{ + "address": "0x9591e2f0a64E39675c9C3C28D055974fa1b93774", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xa930afab651bf8c278a4e4f8ab96b9d65ddd2cb2ef99c76025b2819ce099466d", + "receipt": { + "to": null, + "from": "0x448c8e9e1816300Dd052e77D2A44c990A2807D15", + "contractAddress": "0x9591e2f0a64E39675c9C3C28D055974fa1b93774", + "transactionIndex": 0, + "gasUsed": "720430", + "logsBloom": "0x80000000000400000000000000000001400000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000008000000020000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x6d34a056f2e4eb7bae613ec24ea805421aaa5a5b2146c052f14913c755e88ad2", + "transactionHash": "0xa930afab651bf8c278a4e4f8ab96b9d65ddd2cb2ef99c76025b2819ce099466d", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 10978371, + "transactionHash": "0xa930afab651bf8c278a4e4f8ab96b9d65ddd2cb2ef99c76025b2819ce099466d", + "address": "0x9591e2f0a64E39675c9C3C28D055974fa1b93774", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000d6f61d3e7a9026c42810e74a05dd4be763adcb53" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0x6d34a056f2e4eb7bae613ec24ea805421aaa5a5b2146c052f14913c755e88ad2" + }, + { + "transactionIndex": 0, + "blockNumber": 10978371, + "transactionHash": "0xa930afab651bf8c278a4e4f8ab96b9d65ddd2cb2ef99c76025b2819ce099466d", + "address": "0x9591e2f0a64E39675c9C3C28D055974fa1b93774", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f06d5edb04f4995fff2c362a14826107f7cccbcc", + "logIndex": 1, + "blockHash": "0x6d34a056f2e4eb7bae613ec24ea805421aaa5a5b2146c052f14913c755e88ad2" + } + ], + "blockNumber": 10978371, + "cumulativeGasUsed": "720430", + "status": 1, + "byzantium": true + }, + "args": [ + "0xD6f61D3e7a9026C42810E74a05dD4bE763AdCB53", + "0xf06d5Edb04F4995FFF2c362a14826107F7CCCBCc", + "0x" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\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\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.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 *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\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 Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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 Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual 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 Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\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(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\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(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) 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\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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 overriden 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 internall 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 overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/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\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\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 * ```\\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`, and `uint256`._\\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 /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\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 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 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 assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/porcini-dev/Registries.json b/deployments/porcini-dev/Registries.json new file mode 100644 index 00000000..ded408f8 --- /dev/null +++ b/deployments/porcini-dev/Registries.json @@ -0,0 +1,758 @@ +{ + "address": "0x76c226017D7B0CEcC467dC0f353268d537252607", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "nodeLength", + "type": "uint256" + } + ], + "name": "EndCannotExceedNumberOfNodes", + "type": "error" + }, + { + "inputs": [], + "name": "EndMustBeGreaterThanStart", + "type": "error" + }, + { + "inputs": [], + "name": "NonceCannotBeReused", + "type": "error" + }, + { + "inputs": [], + "name": "PercentageCannotExceed100000", + "type": "error" + }, + { + "inputs": [], + "name": "ProofNotSignedBySeekerAccount", + "type": "error" + }, + { + "inputs": [], + "name": "PublicEndpointCannotBeEmpty", + "type": "error" + }, + { + "inputs": [], + "name": "RootSeekersCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "SeekerAccountCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "SeekerAccountMustBeMsgSender", + "type": "error" + }, + { + "inputs": [], + "name": "SeekerAccountMustOwnSeekerId", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint32", + "name": "defaultPayoutPercentage", + "type": "uint32" + } + ], + "name": "DefaultPayoutPercentageUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "_rootSeekers", + "outputs": [ + { + "internalType": "contract IERC721", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "defaultPayoutPercentage", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getNodes", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "seekerId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "node", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "nonce", + "type": "bytes32" + } + ], + "name": "getProofMessage", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "start", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "end", + "type": "uint256" + } + ], + "name": "getRegistries", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + }, + { + "components": [ + { + "internalType": "uint32", + "name": "payoutPercentage", + "type": "uint32" + }, + { + "internalType": "string", + "name": "publicEndpoint", + "type": "string" + }, + { + "internalType": "address", + "name": "seekerAccount", + "type": "address" + }, + { + "internalType": "uint256", + "name": "seekerId", + "type": "uint256" + } + ], + "internalType": "struct IRegistries.Registry[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getRegistry", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "payoutPercentage", + "type": "uint32" + }, + { + "internalType": "string", + "name": "publicEndpoint", + "type": "string" + }, + { + "internalType": "address", + "name": "seekerAccount", + "type": "address" + }, + { + "internalType": "uint256", + "name": "seekerId", + "type": "uint256" + } + ], + "internalType": "struct IRegistries.Registry", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalNodes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC721", + "name": "rootSeekers", + "type": "address" + }, + { + "internalType": "uint32", + "name": "_defaultPayoutPercentage", + "type": "uint32" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "nodes", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "publicEndpoint", + "type": "string" + } + ], + "name": "register", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "registries", + "outputs": [ + { + "internalType": "uint32", + "name": "payoutPercentage", + "type": "uint32" + }, + { + "internalType": "string", + "name": "publicEndpoint", + "type": "string" + }, + { + "internalType": "address", + "name": "seekerAccount", + "type": "address" + }, + { + "internalType": "uint256", + "name": "seekerId", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "node", + "type": "address" + } + ], + "name": "revokeSeekerAccount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "seekerRegistration", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_defaultPayoutPercentage", + "type": "uint32" + } + ], + "name": "setDefaultPayoutPercentage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "seekerAccount", + "type": "address" + }, + { + "internalType": "uint256", + "name": "seekerId", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "nonce", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "name": "setSeekerAccount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0xf7f2e9343053fb417910ad0c88e837971eb0fcbf7494c033e71a2932f72c6f4b", + "receipt": { + "to": null, + "from": "0x448c8e9e1816300Dd052e77D2A44c990A2807D15", + "contractAddress": "0x76c226017D7B0CEcC467dC0f353268d537252607", + "transactionIndex": 0, + "gasUsed": "720430", + "logsBloom": "0x00000000000000000000800000000000400200000000000000000004000000000000000000000000000000000000000000000000000000000000400000100000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000800000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x0bd821241ba2edab91c50addb69d20164c726020b4ba10a2fcbe00a5d00f21a7", + "transactionHash": "0xf7f2e9343053fb417910ad0c88e837971eb0fcbf7494c033e71a2932f72c6f4b", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 10978366, + "transactionHash": "0xf7f2e9343053fb417910ad0c88e837971eb0fcbf7494c033e71a2932f72c6f4b", + "address": "0x76c226017D7B0CEcC467dC0f353268d537252607", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x00000000000000000000000016805185f85aa123a5f473755764805f4a3da397" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0x0bd821241ba2edab91c50addb69d20164c726020b4ba10a2fcbe00a5d00f21a7" + }, + { + "transactionIndex": 0, + "blockNumber": 10978366, + "transactionHash": "0xf7f2e9343053fb417910ad0c88e837971eb0fcbf7494c033e71a2932f72c6f4b", + "address": "0x76c226017D7B0CEcC467dC0f353268d537252607", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f06d5edb04f4995fff2c362a14826107f7cccbcc", + "logIndex": 1, + "blockHash": "0x0bd821241ba2edab91c50addb69d20164c726020b4ba10a2fcbe00a5d00f21a7" + } + ], + "blockNumber": 10978366, + "cumulativeGasUsed": "720430", + "status": 1, + "byzantium": true + }, + "args": [ + "0x16805185F85AA123a5F473755764805f4a3DA397", + "0xf06d5Edb04F4995FFF2c362a14826107F7CCCBCc", + "0x" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\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\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.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 *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\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 Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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 Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual 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 Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\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(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\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(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) 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\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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 overriden 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 internall 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 overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/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\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\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 * ```\\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`, and `uint256`._\\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 /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\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 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 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 assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "implementation": "0x16805185F85AA123a5F473755764805f4a3DA397", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/porcini-dev/Registries_Implementation.json b/deployments/porcini-dev/Registries_Implementation.json new file mode 100644 index 00000000..46eb6d2a --- /dev/null +++ b/deployments/porcini-dev/Registries_Implementation.json @@ -0,0 +1,893 @@ +{ + "address": "0x16805185F85AA123a5F473755764805f4a3DA397", + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "nodeLength", + "type": "uint256" + } + ], + "name": "EndCannotExceedNumberOfNodes", + "type": "error" + }, + { + "inputs": [], + "name": "EndMustBeGreaterThanStart", + "type": "error" + }, + { + "inputs": [], + "name": "NonceCannotBeReused", + "type": "error" + }, + { + "inputs": [], + "name": "PercentageCannotExceed100000", + "type": "error" + }, + { + "inputs": [], + "name": "ProofNotSignedBySeekerAccount", + "type": "error" + }, + { + "inputs": [], + "name": "PublicEndpointCannotBeEmpty", + "type": "error" + }, + { + "inputs": [], + "name": "RootSeekersCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "SeekerAccountCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "SeekerAccountMustBeMsgSender", + "type": "error" + }, + { + "inputs": [], + "name": "SeekerAccountMustOwnSeekerId", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint32", + "name": "defaultPayoutPercentage", + "type": "uint32" + } + ], + "name": "DefaultPayoutPercentageUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "_rootSeekers", + "outputs": [ + { + "internalType": "contract IERC721", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "defaultPayoutPercentage", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getNodes", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "seekerId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "node", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "nonce", + "type": "bytes32" + } + ], + "name": "getProofMessage", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "start", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "end", + "type": "uint256" + } + ], + "name": "getRegistries", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + }, + { + "components": [ + { + "internalType": "uint32", + "name": "payoutPercentage", + "type": "uint32" + }, + { + "internalType": "string", + "name": "publicEndpoint", + "type": "string" + }, + { + "internalType": "address", + "name": "seekerAccount", + "type": "address" + }, + { + "internalType": "uint256", + "name": "seekerId", + "type": "uint256" + } + ], + "internalType": "struct IRegistries.Registry[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getRegistry", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "payoutPercentage", + "type": "uint32" + }, + { + "internalType": "string", + "name": "publicEndpoint", + "type": "string" + }, + { + "internalType": "address", + "name": "seekerAccount", + "type": "address" + }, + { + "internalType": "uint256", + "name": "seekerId", + "type": "uint256" + } + ], + "internalType": "struct IRegistries.Registry", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalNodes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC721", + "name": "rootSeekers", + "type": "address" + }, + { + "internalType": "uint32", + "name": "_defaultPayoutPercentage", + "type": "uint32" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "nodes", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "publicEndpoint", + "type": "string" + } + ], + "name": "register", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "registries", + "outputs": [ + { + "internalType": "uint32", + "name": "payoutPercentage", + "type": "uint32" + }, + { + "internalType": "string", + "name": "publicEndpoint", + "type": "string" + }, + { + "internalType": "address", + "name": "seekerAccount", + "type": "address" + }, + { + "internalType": "uint256", + "name": "seekerId", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "node", + "type": "address" + } + ], + "name": "revokeSeekerAccount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "seekerRegistration", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_defaultPayoutPercentage", + "type": "uint32" + } + ], + "name": "setDefaultPayoutPercentage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "seekerAccount", + "type": "address" + }, + { + "internalType": "uint256", + "name": "seekerId", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "nonce", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "name": "setSeekerAccount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xabedf1a6498e8add548a74102616dab13e491e7f69b1d79f2a7ab14c08f2b075", + "receipt": { + "to": null, + "from": "0x448c8e9e1816300Dd052e77D2A44c990A2807D15", + "contractAddress": "0x16805185F85AA123a5F473755764805f4a3DA397", + "transactionIndex": 0, + "gasUsed": "1779897", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x4577eb1036065483e467ff62694e7dc753211591b6fc87340212fa3324724673", + "transactionHash": "0xabedf1a6498e8add548a74102616dab13e491e7f69b1d79f2a7ab14c08f2b075", + "logs": [], + "blockNumber": 10978365, + "cumulativeGasUsed": "1779897", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "76c1e1f3445d6d518cb33f614f9922c9", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"nodeLength\",\"type\":\"uint256\"}],\"name\":\"EndCannotExceedNumberOfNodes\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"EndMustBeGreaterThanStart\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NonceCannotBeReused\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PercentageCannotExceed100000\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ProofNotSignedBySeekerAccount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PublicEndpointCannotBeEmpty\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RootSeekersCannotBeZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SeekerAccountCannotBeZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SeekerAccountMustBeMsgSender\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SeekerAccountMustOwnSeekerId\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"defaultPayoutPercentage\",\"type\":\"uint32\"}],\"name\":\"DefaultPayoutPercentageUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"_rootSeekers\",\"outputs\":[{\"internalType\":\"contract IERC721\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"defaultPayoutPercentage\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getNodes\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"seekerId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"node\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"nonce\",\"type\":\"bytes32\"}],\"name\":\"getProofMessage\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"start\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"end\",\"type\":\"uint256\"}],\"name\":\"getRegistries\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint32\",\"name\":\"payoutPercentage\",\"type\":\"uint32\"},{\"internalType\":\"string\",\"name\":\"publicEndpoint\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"seekerAccount\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"seekerId\",\"type\":\"uint256\"}],\"internalType\":\"struct IRegistries.Registry[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getRegistry\",\"outputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"payoutPercentage\",\"type\":\"uint32\"},{\"internalType\":\"string\",\"name\":\"publicEndpoint\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"seekerAccount\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"seekerId\",\"type\":\"uint256\"}],\"internalType\":\"struct IRegistries.Registry\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalNodes\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC721\",\"name\":\"rootSeekers\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"_defaultPayoutPercentage\",\"type\":\"uint32\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"nodes\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"publicEndpoint\",\"type\":\"string\"}],\"name\":\"register\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"registries\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"payoutPercentage\",\"type\":\"uint32\"},{\"internalType\":\"string\",\"name\":\"publicEndpoint\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"seekerAccount\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"seekerId\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"node\",\"type\":\"address\"}],\"name\":\"revokeSeekerAccount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"seekerRegistration\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"_defaultPayoutPercentage\",\"type\":\"uint32\"}],\"name\":\"setDefaultPayoutPercentage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"seekerAccount\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"seekerId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"nonce\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"setSeekerAccount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"getNodes()\":{\"returns\":{\"_0\":\"An array of node addresses.\"}},\"getProofMessage(uint256,address,bytes32)\":{\"params\":{\"node\":\"The address of the node which that will be operated by the specified seeker.\",\"nonce\":\"The nonce used for this message.\",\"seekerId\":\"The tokenId of the seeker used for operation.\"}},\"getRegistries(uint256,uint256)\":{\"params\":{\"end\":\"The end index which is exclusive.\",\"start\":\"The start index which is inclusive.\"},\"returns\":{\"_0\":\"An array of Registries.\"}},\"getRegistry(address)\":{\"params\":{\"account\":\"The address of the Node.\"},\"returns\":{\"_0\":\"The Node's Registry.\"}},\"getTotalNodes()\":{\"returns\":{\"_0\":\"The number of registered nodes.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"register(string)\":{\"params\":{\"publicEndpoint\":\"The public endpoint of your Node. Essential for clients to be able to retrieve additional information, such as an address to establish a p2p connection.\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"setDefaultPayoutPercentage(uint32)\":{\"params\":{\"_defaultPayoutPercentage\":\"The payout percentage as a value where the denominator is 10000.\"}},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"_rootSeekers()\":{\"notice\":\"ERC721 contract for bridged Seekers. Used for verifying ownership of a seeker.\"},\"defaultPayoutPercentage()\":{\"notice\":\"Payout percentage refers to the portion of a tickets reward that will be allocated to the Node's stakers. This is global, and is currently set for all Nodes.\"},\"getNodes()\":{\"notice\":\"Retrieve all registered nodes.\"},\"getProofMessage(uint256,address,bytes32)\":{\"notice\":\"Helper function for deriving the proof message used to validate seeker ownership.\"},\"getRegistries(uint256,uint256)\":{\"notice\":\"Retrieves a list of registries. Takes in a a start and end indices to allow pagination.\"},\"getRegistry(address)\":{\"notice\":\"Retrieve the registry associated with a Node.\"},\"getTotalNodes()\":{\"notice\":\"Returns the total number of registered nodes.\"},\"nodes(uint256)\":{\"notice\":\"Tracks the address of every registered node.\"},\"register(string)\":{\"notice\":\"Call this as a Node to set or update your Registry entry.\"},\"registries(address)\":{\"notice\":\"Tracks each Node's registry.\"},\"seekerRegistration(uint256)\":{\"notice\":\"Tracks the node address that each seeker id is registered with\"},\"setDefaultPayoutPercentage(uint32)\":{\"notice\":\"Set the global default payout percentage value. Only callable by the owner.\"},\"supportsInterface(bytes4)\":{\"notice\":\"Returns true if the contract implements the interface defined by `interfaceId` from ERC165.\"}},\"notice\":\"This contract manages Registries for Nodes. A Registry is a set of parameters configured by the Node itself. A Node is required to have a valid Registry to be able to participate in the network.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Registries.sol\":\"Registries\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./OwnableUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership} and {acceptOwnership}.\\n *\\n * This module is used through inheritance. It will make available all functions\\n * from parent (Ownable).\\n */\\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\\n function __Ownable2Step_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable2Step_init_unchained() internal onlyInitializing {\\n }\\n address private _pendingOwner;\\n\\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Returns the address of the pending owner.\\n */\\n function pendingOwner() public view virtual returns (address) {\\n return _pendingOwner;\\n }\\n\\n /**\\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual override onlyOwner {\\n _pendingOwner = newOwner;\\n emit OwnershipTransferStarted(owner(), newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual override {\\n delete _pendingOwner;\\n super._transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev The new owner accepts the ownership transfer.\\n */\\n function acceptOwnership() public virtual {\\n address sender = _msgSender();\\n require(pendingOwner() == sender, \\\"Ownable2Step: caller is not the new owner\\\");\\n _transferOwnership(sender);\\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\":\"0x84efb8889801b0ac817324aff6acc691d07bbee816b671817132911d287a8c63\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n\\n /**\\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\":\"0x4075622496acc77fd6d4de4cc30a8577a744d5c75afad33fdeacf1704d6eda98\",\"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/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/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/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\",\"keccak256\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.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/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\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 = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _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(SignedMath.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n 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\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.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 \\\"../Strings.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 ECDSA {\\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\\\", Strings.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\":\"0x809bc3edb4bcbef8263fa616c1b60ee0004b50a8a1bfa164d8f57fd31f520c58\",\"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/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\"},\"@openzeppelin/contracts/utils/math/Math.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 Math {\\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\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)\\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\\n * checks.\\n *\\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\\n * easily result in undesired exploitation or bugs, since developers usually\\n * assume that overflows raise errors. `SafeCast` restores this intuition by\\n * reverting the transaction when such an operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n *\\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\\n * all math on `uint256` and `int256` and then downcasting.\\n */\\nlibrary SafeCast {\\n /**\\n * @dev Returns the downcasted uint248 from uint256, reverting on\\n * overflow (when the input is greater than largest uint248).\\n *\\n * Counterpart to Solidity's `uint248` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 248 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint248(uint256 value) internal pure returns (uint248) {\\n require(value <= type(uint248).max, \\\"SafeCast: value doesn't fit in 248 bits\\\");\\n return uint248(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint240 from uint256, reverting on\\n * overflow (when the input is greater than largest uint240).\\n *\\n * Counterpart to Solidity's `uint240` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 240 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint240(uint256 value) internal pure returns (uint240) {\\n require(value <= type(uint240).max, \\\"SafeCast: value doesn't fit in 240 bits\\\");\\n return uint240(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint232 from uint256, reverting on\\n * overflow (when the input is greater than largest uint232).\\n *\\n * Counterpart to Solidity's `uint232` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 232 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint232(uint256 value) internal pure returns (uint232) {\\n require(value <= type(uint232).max, \\\"SafeCast: value doesn't fit in 232 bits\\\");\\n return uint232(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint224 from uint256, reverting on\\n * overflow (when the input is greater than largest uint224).\\n *\\n * Counterpart to Solidity's `uint224` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 224 bits\\n *\\n * _Available since v4.2._\\n */\\n function toUint224(uint256 value) internal pure returns (uint224) {\\n require(value <= type(uint224).max, \\\"SafeCast: value doesn't fit in 224 bits\\\");\\n return uint224(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint216 from uint256, reverting on\\n * overflow (when the input is greater than largest uint216).\\n *\\n * Counterpart to Solidity's `uint216` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 216 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint216(uint256 value) internal pure returns (uint216) {\\n require(value <= type(uint216).max, \\\"SafeCast: value doesn't fit in 216 bits\\\");\\n return uint216(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint208 from uint256, reverting on\\n * overflow (when the input is greater than largest uint208).\\n *\\n * Counterpart to Solidity's `uint208` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 208 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint208(uint256 value) internal pure returns (uint208) {\\n require(value <= type(uint208).max, \\\"SafeCast: value doesn't fit in 208 bits\\\");\\n return uint208(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint200 from uint256, reverting on\\n * overflow (when the input is greater than largest uint200).\\n *\\n * Counterpart to Solidity's `uint200` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 200 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint200(uint256 value) internal pure returns (uint200) {\\n require(value <= type(uint200).max, \\\"SafeCast: value doesn't fit in 200 bits\\\");\\n return uint200(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint192 from uint256, reverting on\\n * overflow (when the input is greater than largest uint192).\\n *\\n * Counterpart to Solidity's `uint192` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 192 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint192(uint256 value) internal pure returns (uint192) {\\n require(value <= type(uint192).max, \\\"SafeCast: value doesn't fit in 192 bits\\\");\\n return uint192(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint184 from uint256, reverting on\\n * overflow (when the input is greater than largest uint184).\\n *\\n * Counterpart to Solidity's `uint184` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 184 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint184(uint256 value) internal pure returns (uint184) {\\n require(value <= type(uint184).max, \\\"SafeCast: value doesn't fit in 184 bits\\\");\\n return uint184(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint176 from uint256, reverting on\\n * overflow (when the input is greater than largest uint176).\\n *\\n * Counterpart to Solidity's `uint176` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 176 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint176(uint256 value) internal pure returns (uint176) {\\n require(value <= type(uint176).max, \\\"SafeCast: value doesn't fit in 176 bits\\\");\\n return uint176(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint168 from uint256, reverting on\\n * overflow (when the input is greater than largest uint168).\\n *\\n * Counterpart to Solidity's `uint168` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 168 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint168(uint256 value) internal pure returns (uint168) {\\n require(value <= type(uint168).max, \\\"SafeCast: value doesn't fit in 168 bits\\\");\\n return uint168(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint160 from uint256, reverting on\\n * overflow (when the input is greater than largest uint160).\\n *\\n * Counterpart to Solidity's `uint160` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 160 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint160(uint256 value) internal pure returns (uint160) {\\n require(value <= type(uint160).max, \\\"SafeCast: value doesn't fit in 160 bits\\\");\\n return uint160(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint152 from uint256, reverting on\\n * overflow (when the input is greater than largest uint152).\\n *\\n * Counterpart to Solidity's `uint152` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 152 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint152(uint256 value) internal pure returns (uint152) {\\n require(value <= type(uint152).max, \\\"SafeCast: value doesn't fit in 152 bits\\\");\\n return uint152(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint144 from uint256, reverting on\\n * overflow (when the input is greater than largest uint144).\\n *\\n * Counterpart to Solidity's `uint144` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 144 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint144(uint256 value) internal pure returns (uint144) {\\n require(value <= type(uint144).max, \\\"SafeCast: value doesn't fit in 144 bits\\\");\\n return uint144(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint136 from uint256, reverting on\\n * overflow (when the input is greater than largest uint136).\\n *\\n * Counterpart to Solidity's `uint136` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 136 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint136(uint256 value) internal pure returns (uint136) {\\n require(value <= type(uint136).max, \\\"SafeCast: value doesn't fit in 136 bits\\\");\\n return uint136(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint128 from uint256, reverting on\\n * overflow (when the input is greater than largest uint128).\\n *\\n * Counterpart to Solidity's `uint128` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 128 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint128(uint256 value) internal pure returns (uint128) {\\n require(value <= type(uint128).max, \\\"SafeCast: value doesn't fit in 128 bits\\\");\\n return uint128(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint120 from uint256, reverting on\\n * overflow (when the input is greater than largest uint120).\\n *\\n * Counterpart to Solidity's `uint120` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 120 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint120(uint256 value) internal pure returns (uint120) {\\n require(value <= type(uint120).max, \\\"SafeCast: value doesn't fit in 120 bits\\\");\\n return uint120(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint112 from uint256, reverting on\\n * overflow (when the input is greater than largest uint112).\\n *\\n * Counterpart to Solidity's `uint112` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 112 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint112(uint256 value) internal pure returns (uint112) {\\n require(value <= type(uint112).max, \\\"SafeCast: value doesn't fit in 112 bits\\\");\\n return uint112(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint104 from uint256, reverting on\\n * overflow (when the input is greater than largest uint104).\\n *\\n * Counterpart to Solidity's `uint104` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 104 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint104(uint256 value) internal pure returns (uint104) {\\n require(value <= type(uint104).max, \\\"SafeCast: value doesn't fit in 104 bits\\\");\\n return uint104(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint96 from uint256, reverting on\\n * overflow (when the input is greater than largest uint96).\\n *\\n * Counterpart to Solidity's `uint96` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 96 bits\\n *\\n * _Available since v4.2._\\n */\\n function toUint96(uint256 value) internal pure returns (uint96) {\\n require(value <= type(uint96).max, \\\"SafeCast: value doesn't fit in 96 bits\\\");\\n return uint96(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint88 from uint256, reverting on\\n * overflow (when the input is greater than largest uint88).\\n *\\n * Counterpart to Solidity's `uint88` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 88 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint88(uint256 value) internal pure returns (uint88) {\\n require(value <= type(uint88).max, \\\"SafeCast: value doesn't fit in 88 bits\\\");\\n return uint88(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint80 from uint256, reverting on\\n * overflow (when the input is greater than largest uint80).\\n *\\n * Counterpart to Solidity's `uint80` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 80 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint80(uint256 value) internal pure returns (uint80) {\\n require(value <= type(uint80).max, \\\"SafeCast: value doesn't fit in 80 bits\\\");\\n return uint80(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint72 from uint256, reverting on\\n * overflow (when the input is greater than largest uint72).\\n *\\n * Counterpart to Solidity's `uint72` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 72 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint72(uint256 value) internal pure returns (uint72) {\\n require(value <= type(uint72).max, \\\"SafeCast: value doesn't fit in 72 bits\\\");\\n return uint72(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint64 from uint256, reverting on\\n * overflow (when the input is greater than largest uint64).\\n *\\n * Counterpart to Solidity's `uint64` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 64 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint64(uint256 value) internal pure returns (uint64) {\\n require(value <= type(uint64).max, \\\"SafeCast: value doesn't fit in 64 bits\\\");\\n return uint64(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint56 from uint256, reverting on\\n * overflow (when the input is greater than largest uint56).\\n *\\n * Counterpart to Solidity's `uint56` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 56 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint56(uint256 value) internal pure returns (uint56) {\\n require(value <= type(uint56).max, \\\"SafeCast: value doesn't fit in 56 bits\\\");\\n return uint56(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint48 from uint256, reverting on\\n * overflow (when the input is greater than largest uint48).\\n *\\n * Counterpart to Solidity's `uint48` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 48 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint48(uint256 value) internal pure returns (uint48) {\\n require(value <= type(uint48).max, \\\"SafeCast: value doesn't fit in 48 bits\\\");\\n return uint48(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint40 from uint256, reverting on\\n * overflow (when the input is greater than largest uint40).\\n *\\n * Counterpart to Solidity's `uint40` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 40 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint40(uint256 value) internal pure returns (uint40) {\\n require(value <= type(uint40).max, \\\"SafeCast: value doesn't fit in 40 bits\\\");\\n return uint40(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint32 from uint256, reverting on\\n * overflow (when the input is greater than largest uint32).\\n *\\n * Counterpart to Solidity's `uint32` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 32 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint32(uint256 value) internal pure returns (uint32) {\\n require(value <= type(uint32).max, \\\"SafeCast: value doesn't fit in 32 bits\\\");\\n return uint32(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint24 from uint256, reverting on\\n * overflow (when the input is greater than largest uint24).\\n *\\n * Counterpart to Solidity's `uint24` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 24 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint24(uint256 value) internal pure returns (uint24) {\\n require(value <= type(uint24).max, \\\"SafeCast: value doesn't fit in 24 bits\\\");\\n return uint24(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint16 from uint256, reverting on\\n * overflow (when the input is greater than largest uint16).\\n *\\n * Counterpart to Solidity's `uint16` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 16 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint16(uint256 value) internal pure returns (uint16) {\\n require(value <= type(uint16).max, \\\"SafeCast: value doesn't fit in 16 bits\\\");\\n return uint16(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint8 from uint256, reverting on\\n * overflow (when the input is greater than largest uint8).\\n *\\n * Counterpart to Solidity's `uint8` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 8 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint8(uint256 value) internal pure returns (uint8) {\\n require(value <= type(uint8).max, \\\"SafeCast: value doesn't fit in 8 bits\\\");\\n return uint8(value);\\n }\\n\\n /**\\n * @dev Converts a signed int256 into an unsigned uint256.\\n *\\n * Requirements:\\n *\\n * - input must be greater than or equal to 0.\\n *\\n * _Available since v3.0._\\n */\\n function toUint256(int256 value) internal pure returns (uint256) {\\n require(value >= 0, \\\"SafeCast: value must be positive\\\");\\n return uint256(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int248 from int256, reverting on\\n * overflow (when the input is less than smallest int248 or\\n * greater than largest int248).\\n *\\n * Counterpart to Solidity's `int248` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 248 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\\n downcasted = int248(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 248 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int240 from int256, reverting on\\n * overflow (when the input is less than smallest int240 or\\n * greater than largest int240).\\n *\\n * Counterpart to Solidity's `int240` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 240 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\\n downcasted = int240(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 240 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int232 from int256, reverting on\\n * overflow (when the input is less than smallest int232 or\\n * greater than largest int232).\\n *\\n * Counterpart to Solidity's `int232` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 232 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\\n downcasted = int232(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 232 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int224 from int256, reverting on\\n * overflow (when the input is less than smallest int224 or\\n * greater than largest int224).\\n *\\n * Counterpart to Solidity's `int224` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 224 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\\n downcasted = int224(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 224 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int216 from int256, reverting on\\n * overflow (when the input is less than smallest int216 or\\n * greater than largest int216).\\n *\\n * Counterpart to Solidity's `int216` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 216 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\\n downcasted = int216(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 216 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int208 from int256, reverting on\\n * overflow (when the input is less than smallest int208 or\\n * greater than largest int208).\\n *\\n * Counterpart to Solidity's `int208` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 208 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\\n downcasted = int208(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 208 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int200 from int256, reverting on\\n * overflow (when the input is less than smallest int200 or\\n * greater than largest int200).\\n *\\n * Counterpart to Solidity's `int200` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 200 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\\n downcasted = int200(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 200 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int192 from int256, reverting on\\n * overflow (when the input is less than smallest int192 or\\n * greater than largest int192).\\n *\\n * Counterpart to Solidity's `int192` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 192 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\\n downcasted = int192(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 192 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int184 from int256, reverting on\\n * overflow (when the input is less than smallest int184 or\\n * greater than largest int184).\\n *\\n * Counterpart to Solidity's `int184` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 184 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\\n downcasted = int184(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 184 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int176 from int256, reverting on\\n * overflow (when the input is less than smallest int176 or\\n * greater than largest int176).\\n *\\n * Counterpart to Solidity's `int176` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 176 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\\n downcasted = int176(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 176 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int168 from int256, reverting on\\n * overflow (when the input is less than smallest int168 or\\n * greater than largest int168).\\n *\\n * Counterpart to Solidity's `int168` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 168 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\\n downcasted = int168(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 168 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int160 from int256, reverting on\\n * overflow (when the input is less than smallest int160 or\\n * greater than largest int160).\\n *\\n * Counterpart to Solidity's `int160` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 160 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\\n downcasted = int160(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 160 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int152 from int256, reverting on\\n * overflow (when the input is less than smallest int152 or\\n * greater than largest int152).\\n *\\n * Counterpart to Solidity's `int152` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 152 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\\n downcasted = int152(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 152 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int144 from int256, reverting on\\n * overflow (when the input is less than smallest int144 or\\n * greater than largest int144).\\n *\\n * Counterpart to Solidity's `int144` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 144 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\\n downcasted = int144(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 144 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int136 from int256, reverting on\\n * overflow (when the input is less than smallest int136 or\\n * greater than largest int136).\\n *\\n * Counterpart to Solidity's `int136` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 136 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\\n downcasted = int136(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 136 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int128 from int256, reverting on\\n * overflow (when the input is less than smallest int128 or\\n * greater than largest int128).\\n *\\n * Counterpart to Solidity's `int128` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 128 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\\n downcasted = int128(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 128 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int120 from int256, reverting on\\n * overflow (when the input is less than smallest int120 or\\n * greater than largest int120).\\n *\\n * Counterpart to Solidity's `int120` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 120 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\\n downcasted = int120(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 120 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int112 from int256, reverting on\\n * overflow (when the input is less than smallest int112 or\\n * greater than largest int112).\\n *\\n * Counterpart to Solidity's `int112` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 112 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\\n downcasted = int112(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 112 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int104 from int256, reverting on\\n * overflow (when the input is less than smallest int104 or\\n * greater than largest int104).\\n *\\n * Counterpart to Solidity's `int104` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 104 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\\n downcasted = int104(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 104 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int96 from int256, reverting on\\n * overflow (when the input is less than smallest int96 or\\n * greater than largest int96).\\n *\\n * Counterpart to Solidity's `int96` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 96 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\\n downcasted = int96(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 96 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int88 from int256, reverting on\\n * overflow (when the input is less than smallest int88 or\\n * greater than largest int88).\\n *\\n * Counterpart to Solidity's `int88` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 88 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\\n downcasted = int88(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 88 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int80 from int256, reverting on\\n * overflow (when the input is less than smallest int80 or\\n * greater than largest int80).\\n *\\n * Counterpart to Solidity's `int80` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 80 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\\n downcasted = int80(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 80 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int72 from int256, reverting on\\n * overflow (when the input is less than smallest int72 or\\n * greater than largest int72).\\n *\\n * Counterpart to Solidity's `int72` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 72 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\\n downcasted = int72(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 72 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int64 from int256, reverting on\\n * overflow (when the input is less than smallest int64 or\\n * greater than largest int64).\\n *\\n * Counterpart to Solidity's `int64` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 64 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\\n downcasted = int64(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 64 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int56 from int256, reverting on\\n * overflow (when the input is less than smallest int56 or\\n * greater than largest int56).\\n *\\n * Counterpart to Solidity's `int56` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 56 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\\n downcasted = int56(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 56 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int48 from int256, reverting on\\n * overflow (when the input is less than smallest int48 or\\n * greater than largest int48).\\n *\\n * Counterpart to Solidity's `int48` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 48 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\\n downcasted = int48(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 48 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int40 from int256, reverting on\\n * overflow (when the input is less than smallest int40 or\\n * greater than largest int40).\\n *\\n * Counterpart to Solidity's `int40` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 40 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\\n downcasted = int40(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 40 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int32 from int256, reverting on\\n * overflow (when the input is less than smallest int32 or\\n * greater than largest int32).\\n *\\n * Counterpart to Solidity's `int32` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 32 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\\n downcasted = int32(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 32 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int24 from int256, reverting on\\n * overflow (when the input is less than smallest int24 or\\n * greater than largest int24).\\n *\\n * Counterpart to Solidity's `int24` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 24 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\\n downcasted = int24(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 24 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int16 from int256, reverting on\\n * overflow (when the input is less than smallest int16 or\\n * greater than largest int16).\\n *\\n * Counterpart to Solidity's `int16` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 16 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\\n downcasted = int16(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 16 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int8 from int256, reverting on\\n * overflow (when the input is less than smallest int8 or\\n * greater than largest int8).\\n *\\n * Counterpart to Solidity's `int8` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 8 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\\n downcasted = int8(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 8 bits\\\");\\n }\\n\\n /**\\n * @dev Converts an unsigned uint256 into a signed int256.\\n *\\n * Requirements:\\n *\\n * - input must be less than or equal to maxInt256.\\n *\\n * _Available since v3.0._\\n */\\n function toInt256(uint256 value) internal pure returns (int256) {\\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\\n require(value <= uint256(type(int256).max), \\\"SafeCast: value doesn't fit in an int256\\\");\\n return int256(value);\\n }\\n}\\n\",\"keccak256\":\"0x52a8cfb0f5239d11b457dcdd1b326992ef672714ca8da71a157255bddd13f3ad\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.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 SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"contracts/Registries.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\n\\nimport \\\"./libraries/SyloUtils.sol\\\";\\nimport \\\"./interfaces/IRegistries.sol\\\";\\n\\n/**\\n * @notice This contract manages Registries for Nodes. A Registry is a\\n * set of parameters configured by the Node itself. A Node is required\\n * to have a valid Registry to be able to participate in the network.\\n */\\ncontract Registries is IRegistries, Initializable, Ownable2StepUpgradeable, IERC165 {\\n using ECDSA for bytes32;\\n\\n /**\\n * @notice ERC721 contract for bridged Seekers. Used for verifying ownership\\n * of a seeker.\\n */\\n IERC721 public _rootSeekers;\\n\\n /**\\n * @notice Tracks each Node's registry.\\n */\\n mapping(address => IRegistries.Registry) public registries;\\n\\n /**\\n * @notice Tracks the node address that each seeker id is registered with\\n */\\n mapping(uint256 => address) public seekerRegistration;\\n\\n /**\\n * @notice Tracks the address of every registered node.\\n */\\n address[] public nodes;\\n\\n /**\\n * @notice Tracks nonces used when registering the seeker account\\n * to prevent signature re-use.\\n */\\n mapping(bytes32 => address) private signatureNonces;\\n\\n /**\\n * @notice Payout percentage refers to the portion of a tickets reward\\n * that will be allocated to the Node's stakers. This is global, and is\\n * currently set for all Nodes.\\n */\\n uint32 public defaultPayoutPercentage;\\n\\n event DefaultPayoutPercentageUpdated(uint32 defaultPayoutPercentage);\\n\\n error NonceCannotBeReused();\\n error EndMustBeGreaterThanStart();\\n error PercentageCannotExceed100000();\\n error PublicEndpointCannotBeEmpty();\\n error SeekerAccountMustOwnSeekerId();\\n error SeekerAccountMustBeMsgSender();\\n error ProofNotSignedBySeekerAccount();\\n error RootSeekersCannotBeZeroAddress();\\n error SeekerAccountCannotBeZeroAddress();\\n error EndCannotExceedNumberOfNodes(uint256 nodeLength);\\n\\n function initialize(\\n IERC721 rootSeekers,\\n uint32 _defaultPayoutPercentage\\n ) external initializer {\\n if (address(rootSeekers) == address(0)) {\\n revert RootSeekersCannotBeZeroAddress();\\n }\\n if (_defaultPayoutPercentage > 100000) {\\n revert PercentageCannotExceed100000();\\n }\\n\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n _rootSeekers = rootSeekers;\\n defaultPayoutPercentage = _defaultPayoutPercentage;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IRegistries).interfaceId;\\n }\\n\\n /**\\n * @notice Set the global default payout percentage value. Only callable\\n * by the owner.\\n * @param _defaultPayoutPercentage The payout percentage as a value where the\\n * denominator is 10000.\\n */\\n function setDefaultPayoutPercentage(uint32 _defaultPayoutPercentage) external onlyOwner {\\n if (_defaultPayoutPercentage > 100000) {\\n revert PercentageCannotExceed100000();\\n }\\n\\n defaultPayoutPercentage = _defaultPayoutPercentage;\\n emit DefaultPayoutPercentageUpdated(_defaultPayoutPercentage);\\n }\\n\\n /**\\n * @notice Call this as a Node to set or update your Registry entry.\\n * @param publicEndpoint The public endpoint of your Node. Essential for\\n * clients to be able to retrieve additional information, such as\\n * an address to establish a p2p connection.\\n */\\n function register(string calldata publicEndpoint) external {\\n if (bytes(publicEndpoint).length == 0) {\\n revert PublicEndpointCannotBeEmpty();\\n }\\n\\n // This is the nodes first registration\\n if (bytes(registries[msg.sender].publicEndpoint).length == 0) {\\n nodes.push(msg.sender);\\n }\\n\\n registries[msg.sender].publicEndpoint = publicEndpoint;\\n }\\n\\n function setSeekerAccount(\\n address seekerAccount,\\n uint256 seekerId,\\n bytes32 nonce,\\n bytes calldata signature\\n ) external {\\n if (seekerAccount == address(0)) {\\n revert SeekerAccountCannotBeZeroAddress();\\n }\\n if (signatureNonces[nonce] != address(0)) {\\n revert NonceCannotBeReused();\\n }\\n\\n bytes memory proofMessage = getProofMessage(seekerId, msg.sender, nonce);\\n bytes32 ethProof = ECDSA.toEthSignedMessageHash(proofMessage);\\n\\n if (ECDSA.recover(ethProof, signature) != seekerAccount) {\\n revert ProofNotSignedBySeekerAccount();\\n }\\n\\n // Now verify the seeker account actually owns the seeker\\n address owner = _rootSeekers.ownerOf(seekerId);\\n\\n if (seekerAccount != owner) {\\n revert SeekerAccountMustOwnSeekerId();\\n }\\n\\n delete registries[seekerRegistration[seekerId]].seekerId;\\n delete registries[seekerRegistration[seekerId]].seekerAccount;\\n\\n registries[msg.sender].seekerAccount = seekerAccount;\\n registries[msg.sender].seekerId = seekerId;\\n\\n seekerRegistration[seekerId] = msg.sender;\\n\\n signatureNonces[nonce] = seekerAccount;\\n }\\n\\n function revokeSeekerAccount(address node) external {\\n Registry storage registry = registries[node];\\n\\n if (registry.seekerAccount != msg.sender) {\\n revert SeekerAccountMustBeMsgSender();\\n }\\n\\n delete registry.seekerAccount;\\n delete seekerRegistration[registry.seekerId];\\n delete registry.seekerId;\\n }\\n\\n /**\\n * @notice Retrieve the registry associated with a Node.\\n * @param account The address of the Node.\\n * @return The Node's Registry.\\n */\\n function getRegistry(address account) external view returns (Registry memory) {\\n return registries[account];\\n }\\n\\n /**\\n * @notice Retrieve all registered nodes.\\n * @return An array of node addresses.\\n */\\n function getNodes() external view returns (address[] memory) {\\n return nodes;\\n }\\n\\n /**\\n * @notice Retrieves a list of registries. Takes in a\\n * a start and end indices to allow pagination.\\n * @param start The start index which is inclusive.\\n * @param end The end index which is exclusive.\\n * @return An array of Registries.\\n */\\n function getRegistries(\\n uint256 start,\\n uint256 end\\n ) external view returns (address[] memory, Registry[] memory) {\\n uint256 nodesLength = nodes.length;\\n\\n if (end <= start) {\\n revert EndMustBeGreaterThanStart();\\n }\\n if (end > nodesLength) {\\n revert EndCannotExceedNumberOfNodes(nodesLength);\\n }\\n\\n address[] memory _nodes = new address[](end - start);\\n Registry[] memory _registries = new Registry[](_nodes.length);\\n\\n for (uint256 i = start; i < end; ++i) {\\n _nodes[i - start] = nodes[i];\\n _registries[i - start] = registries[nodes[i]];\\n }\\n\\n return (_nodes, _registries);\\n }\\n\\n /**\\n * @notice Returns the total number of registered nodes.\\n * @return The number of registered nodes.\\n */\\n function getTotalNodes() external view returns (uint256) {\\n return nodes.length;\\n }\\n\\n /**\\n * @notice Helper function for deriving the proof message used to\\n * validate seeker ownership.\\n * @param seekerId The tokenId of the seeker used for operation.\\n * @param node The address of the node which that will be operated\\n * by the specified seeker.\\n * @param nonce The nonce used for this message.\\n */\\n function getProofMessage(\\n uint256 seekerId,\\n address node,\\n bytes32 nonce\\n ) public pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n unicode\\\"\\ud83e\\udd16 Hi frend! \\ud83e\\udd16\\\\n\\\\n\\ud83d\\udcdc Signing this message proves that you're the owner of this Seeker NFT and allows your Seeker to be used to operate your Seeker's Node. It's a simple but important step to ensure smooth operation.\\\\n\\\\nThis request will not trigger a blockchain transaction or cost any gas fees.\\\\n\\\\n\\ud83d\\udd25 Your node's address: \\\",\\n Strings.toHexString(uint256(uint160(node)), 20),\\n unicode\\\"\\\\n\\\\n\\ud83c\\udd94 Your seeker id: \\\",\\n Strings.toString(seekerId),\\n unicode\\\"\\\\n\\\\n\\ud83d\\udce6 A unique random value which secures this message: \\\",\\n Strings.toHexString(uint256(nonce), 32)\\n );\\n }\\n}\\n\",\"keccak256\":\"0x492be9b17a6624c5aa9de7b7d93f2ab1d7e6ee6443e60d4f036f7a7c670c343b\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/IRegistries.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface IRegistries {\\n struct Registry {\\n // Percentage of a tickets value that will be rewarded to\\n // delegated stakers expressed as a fraction of 100000.\\n // This value is currently locked to the default payout percentage\\n // until epochs are implemented.\\n uint32 payoutPercentage;\\n // Public http/s endpoint to retrieve additional metadata\\n // about the node.\\n // The current metadata schema is as follows:\\n // { name: string, multiaddrs: string[] }\\n string publicEndpoint;\\n // The account which owns a seeker that will be used to\\n // operate the Node for this registry.\\n address seekerAccount;\\n // The id of the seeker used to operate the node. The owner\\n // of this id should be the seeker account.\\n uint256 seekerId;\\n }\\n\\n function register(string calldata publicEndpoint) external;\\n\\n function setDefaultPayoutPercentage(uint32 _defaultPayoutPercentage) external;\\n\\n function setSeekerAccount(\\n address seekerAccount,\\n uint256 seekerId,\\n bytes32 nonce,\\n bytes calldata signature\\n ) external;\\n\\n function revokeSeekerAccount(address node) external;\\n\\n function getRegistry(address account) external view returns (Registry memory);\\n\\n function getNodes() external view returns (address[] memory);\\n\\n function getRegistries(\\n uint256 start,\\n uint256 end\\n ) external view returns (address[] memory, Registry[] memory);\\n\\n function getTotalNodes() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x524252752fd14eb66b047848eaaffbc138c6b049f99f2c2f0a5c6a7a4d6e6e36\",\"license\":\"Apache-2.0\"},\"contracts/libraries/SyloUtils.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/utils/math/SafeCast.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\n\\nerror ContractNameCannotBeEmpty();\\nerror InterfaceIdCannotBeZeroBytes();\\nerror TargetContractCannotBeZeroAddress(string name);\\nerror TargetNotSupportInterface(string name, bytes4 interfaceId);\\n\\nlibrary SyloUtils {\\n /**\\n * @dev The maximum possible SYLO that exists in the network.\\n */\\n uint256 public constant MAX_SYLO = 10_000_000_000 ether;\\n\\n /**\\n * @dev Percentages are expressed as a ratio where 100000 is the denominator.\\n * A large denominator allows for more precision, e.g representing 12.5%\\n * can be done as 12500 / 100000\\n */\\n uint32 public constant PERCENTAGE_DENOMINATOR = 100000;\\n\\n /**\\n * @dev Multiply a value by a given percentage. Converts the provided\\n * uint128 value to uint256 to avoid any reverts on overflow.\\n * @param value The value to multiply.\\n * @param percentage The percentage, as a ratio of 10000.\\n */\\n function percOf(uint128 value, uint32 percentage) internal pure returns (uint256) {\\n return (uint256(value) * percentage) / PERCENTAGE_DENOMINATOR;\\n }\\n\\n /**\\n * @dev Return a fraction as a percentage.\\n * @param numerator The numerator limited to a uint128 value to prevent\\n * phantom overflow.\\n * @param denominator The denominator.\\n * @return The percentage, as a ratio of 10000.\\n */\\n function asPerc(uint128 numerator, uint256 denominator) internal pure returns (uint32) {\\n return SafeCast.toUint32((uint256(numerator) * PERCENTAGE_DENOMINATOR) / denominator);\\n }\\n\\n /**\\n * @dev Validate that a contract implements a given interface.\\n * @param name The name of the contract, used in error messages.\\n * @param target The address of the contract.\\n * @param interfaceId The interface ID to check.\\n */\\n function validateContractInterface(\\n string memory name,\\n address target,\\n bytes4 interfaceId\\n ) internal view {\\n if (bytes(name).length == 0) {\\n revert ContractNameCannotBeEmpty();\\n }\\n if (target == address(0)) {\\n revert TargetContractCannotBeZeroAddress(name);\\n }\\n if (interfaceId == bytes4(0)) {\\n revert InterfaceIdCannotBeZeroBytes();\\n }\\n if (!ERC165(target).supportsInterface(interfaceId)) {\\n revert TargetNotSupportInterface(name, interfaceId);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa5bb1a5b9f8135b5fec1dfa183fab8f6685a4eb6d9daba23864a7d49d01dc8a3\",\"license\":\"Apache-2.0\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50611f3c806100206000396000f3fe608060405234801561001057600080fd5b50600436106101375760003560e01c8063c5e4c9f9116100b8578063e354f2e71161007c578063e354f2e7146102a1578063ec90622b146102ca578063ef5563ca146102eb578063f2c298be1461030b578063f2fde38b1461031e578063f971d77c1461033157600080fd5b8063c5e4c9f914610220578063caed80df14610233578063d2a78d7f14610256578063e29581aa1461027b578063e30c39781461029057600080fd5b806363584ecd116100ff57806363584ecd146101db578063715018a6146101ec57806379ba5097146101f45780638da5cb5b146101fc5780639998da751461020d57600080fd5b806301ffc9a71461013c5780631c53c2801461017557806336357cd8146101a05780635ba2f1de146101b35780635d4c611f146101c8575b600080fd5b61016061014a3660046115ff565b6001600160e01b031916637ccc541d60e11b1490565b60405190151581526020015b60405180910390f35b610188610183366004611629565b610351565b6040516001600160a01b03909116815260200161016c565b609754610188906001600160a01b031681565b6101c66101c1366004611699565b61037b565b005b6101c66101d636600461171c565b610597565b609a5460405190815260200161016c565b6101c6610617565b6101c661062b565b6033546001600160a01b0316610188565b6101c661021b366004611737565b6106aa565b6101c661022e366004611754565b610720565b610246610241366004611737565b6108b4565b60405161016c94939291906117d9565b609c546102669063ffffffff1681565b60405163ffffffff909116815260200161016c565b610283610976565b60405161016c9190611858565b6065546001600160a01b0316610188565b6101886102af366004611629565b6099602052600090815260409020546001600160a01b031681565b6102dd6102d836600461186b565b6109d8565b60405161016c9291906118da565b6102fe6102f936600461194c565b610c87565b60405161016c9190611984565b6101c6610319366004611997565b610cdb565b6101c661032c366004611737565b610d83565b61034461033f366004611737565b610df4565b60405161016c91906119d9565b609a818154811061036157600080fd5b6000918252602090912001546001600160a01b0316905081565b6001600160a01b0385166103a257604051630f32ebab60e21b815260040160405180910390fd5b6000838152609b60205260409020546001600160a01b0316156103d857604051635989b1a960e11b815260040160405180910390fd5b60006103e5853386610c87565b905060006103f282610ee5565b9050866001600160a01b031661043e8286868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610f2092505050565b6001600160a01b03161461046557604051632e39179560e21b815260040160405180910390fd5b6097546040516331a9108f60e11b8152600481018890526000916001600160a01b031690636352211e90602401602060405180830381865afa1580156104af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d391906119ec565b9050806001600160a01b0316886001600160a01b03161461050757604051630c564dbf60e31b815260040160405180910390fd5b505050600084815260996020908152604080832080546001600160a01b039081168552609884528285206003908101869055825482168652838620600290810180546001600160a01b031990811690915533808952868920928301805483169e9095169d8e1790945591019990995581548916179055948252609b90529290922080549093169093179091555050565b61059f610f46565b620186a08163ffffffff1611156105c95760405163653eef6b60e11b815260040160405180910390fd5b609c805463ffffffff191663ffffffff83169081179091556040519081527fb7310d2ba8ebc993dd82a8a1e07558e8e3e68ffbabf1319312461d04d887fda69060200160405180910390a150565b61061f610f46565b6106296000610fa0565b565b60655433906001600160a01b0316811461069e5760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b6106a781610fa0565b50565b6001600160a01b038082166000908152609860205260409020600281015490911633146106ea5760405163603e767360e11b815260040160405180910390fd5b6002810180546001600160a01b031990811690915560039091018054600090815260996020526040812080549093169092555550565b600054610100900460ff16158080156107405750600054600160ff909116105b8061075a5750303b15801561075a575060005460ff166001145b6107bd5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610695565b6000805460ff1916600117905580156107e0576000805461ff0019166101001790555b6001600160a01b038316610807576040516322d2a86760e21b815260040160405180910390fd5b620186a08263ffffffff1611156108315760405163653eef6b60e11b815260040160405180910390fd5b610839610fb9565b609780546001600160a01b0319166001600160a01b038516179055609c805463ffffffff191663ffffffff841617905580156108af576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b6098602052600090815260409020805460018201805463ffffffff90921692916108dd90611a09565b80601f016020809104026020016040519081016040528092919081815260200182805461090990611a09565b80156109565780601f1061092b57610100808354040283529160200191610956565b820191906000526020600020905b81548152906001019060200180831161093957829003601f168201915b50505050600283015460039093015491926001600160a01b031691905084565b6060609a8054806020026020016040519081016040528092919081815260200182805480156109ce57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116109b0575b5050505050905090565b609a546060908190848411610a005760405163ee6f77d960e01b815260040160405180910390fd5b80841115610a245760405163a81ea1e360e01b815260048101829052602401610695565b6000610a308686611a59565b67ffffffffffffffff811115610a4857610a48611a6c565b604051908082528060200260200182016040528015610a71578160200160208202803683370190505b5090506000815167ffffffffffffffff811115610a9057610a90611a6c565b604051908082528060200260200182016040528015610ac957816020015b610ab66115c8565b815260200190600190039081610aae5790505b509050865b86811015610c7857609a8181548110610ae957610ae9611a82565b6000918252602090912001546001600160a01b031683610b098a84611a59565b81518110610b1957610b19611a82565b60200260200101906001600160a01b031690816001600160a01b03168152505060986000609a8381548110610b5057610b50611a82565b60009182526020808320909101546001600160a01b031683528281019390935260409182019020815160808101909252805463ffffffff1682526001810180549293919291840191610ba190611a09565b80601f0160208091040260200160405190810160405280929190818152602001828054610bcd90611a09565b8015610c1a5780601f10610bef57610100808354040283529160200191610c1a565b820191906000526020600020905b815481529060010190602001808311610bfd57829003601f168201915b505050918352505060028201546001600160a01b0316602082015260039091015460409091015282610c4c8a84611a59565b81518110610c5c57610c5c611a82565b602002602001018190525080610c7190611a98565b9050610ace565b509093509150505b9250929050565b6060610c9d836001600160a01b03166014610fe8565b610ca68561118b565b610cb1846020610fe8565b604051602001610cc393929190611acd565b60405160208183030381529060405290509392505050565b6000819003610cfd576040516309261b3d60e21b815260040160405180910390fd5b3360009081526098602052604090206001018054610d1a90611a09565b9050600003610d6657609a80546001810182556000919091527f44da158ba27f9252712a74ff6a55c5d531f69609f1f6e7f17c4443a8e2089be40180546001600160a01b031916331790555b3360009081526098602052604090206001016108af828483611d48565b610d8b610f46565b606580546001600160a01b0383166001600160a01b03199091168117909155610dbc6033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b610dfc6115c8565b6001600160a01b038216600090815260986020908152604091829020825160808101909352805463ffffffff1683526001810180549192840191610e3f90611a09565b80601f0160208091040260200160405190810160405280929190818152602001828054610e6b90611a09565b8015610eb85780601f10610e8d57610100808354040283529160200191610eb8565b820191906000526020600020905b815481529060010190602001808311610e9b57829003601f168201915b505050918352505060028201546001600160a01b0316602082015260039091015460409091015292915050565b6000610ef1825161118b565b82604051602001610f03929190611e09565b604051602081830303815290604052805190602001209050919050565b6000806000610f2f858561121e565b91509150610f3c81611260565b5090505b92915050565b6033546001600160a01b031633146106295760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610695565b606580546001600160a01b03191690556106a7816113aa565b600054610100900460ff16610fe05760405162461bcd60e51b815260040161069590611e64565b6106296113fc565b60606000610ff7836002611eaf565b611002906002611ec6565b67ffffffffffffffff81111561101a5761101a611a6c565b6040519080825280601f01601f191660200182016040528015611044576020820181803683370190505b509050600360fc1b8160008151811061105f5761105f611a82565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061108e5761108e611a82565b60200101906001600160f81b031916908160001a90535060006110b2846002611eaf565b6110bd906001611ec6565b90505b6001811115611135576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106110f1576110f1611a82565b1a60f81b82828151811061110757611107611a82565b60200101906001600160f81b031916908160001a90535060049490941c9361112e81611ed9565b90506110c0565b5083156111845760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610695565b9392505050565b606060006111988361142c565b600101905060008167ffffffffffffffff8111156111b8576111b8611a6c565b6040519080825280601f01601f1916602001820160405280156111e2576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a85049450846111ec57509392505050565b60008082516041036112545760208301516040840151606085015160001a61124887828585611504565b94509450505050610c80565b50600090506002610c80565b600081600481111561127457611274611ef0565b0361127c5750565b600181600481111561129057611290611ef0565b036112dd5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610695565b60028160048111156112f1576112f1611ef0565b0361133e5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610695565b600381600481111561135257611352611ef0565b036106a75760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610695565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166114235760405162461bcd60e51b815260040161069590611e64565b61062933610fa0565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b831061146b5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310611497576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc1000083106114b557662386f26fc10000830492506010015b6305f5e10083106114cd576305f5e100830492506008015b61271083106114e157612710830492506004015b606483106114f3576064830492506002015b600a8310610f405760010192915050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561153b57506000905060036115bf565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561158f573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166115b8576000600192509250506115bf565b9150600090505b94509492505050565b6040518060800160405280600063ffffffff1681526020016060815260200160006001600160a01b03168152602001600081525090565b60006020828403121561161157600080fd5b81356001600160e01b03198116811461118457600080fd5b60006020828403121561163b57600080fd5b5035919050565b6001600160a01b03811681146106a757600080fd5b60008083601f84011261166957600080fd5b50813567ffffffffffffffff81111561168157600080fd5b602083019150836020828501011115610c8057600080fd5b6000806000806000608086880312156116b157600080fd5b85356116bc81611642565b94506020860135935060408601359250606086013567ffffffffffffffff8111156116e657600080fd5b6116f288828901611657565b969995985093965092949392505050565b803563ffffffff8116811461171757600080fd5b919050565b60006020828403121561172e57600080fd5b61118482611703565b60006020828403121561174957600080fd5b813561118481611642565b6000806040838503121561176757600080fd5b823561177281611642565b915061178060208401611703565b90509250929050565b60005b838110156117a457818101518382015260200161178c565b50506000910152565b600081518084526117c5816020860160208601611789565b601f01601f19169290920160200192915050565b63ffffffff851681526080602082015260006117f860808301866117ad565b6001600160a01b03949094166040830152506060015292915050565b600081518084526020808501945080840160005b8381101561184d5781516001600160a01b031687529582019590820190600101611828565b509495945050505050565b6020815260006111846020830184611814565b6000806040838503121561187e57600080fd5b50508035926020909101359150565b63ffffffff815116825260006020820151608060208501526118b260808501826117ad565b6040848101516001600160a01b03169086015260609384015193909401929092525090919050565b6040815260006118ed6040830185611814565b6020838203818501528185518084528284019150828160051b85010183880160005b8381101561193d57601f1987840301855261192b83835161188d565b9486019492509085019060010161190f565b50909998505050505050505050565b60008060006060848603121561196157600080fd5b83359250602084013561197381611642565b929592945050506040919091013590565b60208152600061118460208301846117ad565b600080602083850312156119aa57600080fd5b823567ffffffffffffffff8111156119c157600080fd5b6119cd85828601611657565b90969095509350505050565b602081526000611184602083018461188d565b6000602082840312156119fe57600080fd5b815161118481611642565b600181811c90821680611a1d57607f821691505b602082108103611a3d57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b81810381811115610f4057610f40611a43565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600060018201611aaa57611aaa611a43565b5060010190565b60008151611ac3818560208601611789565b9290920192915050565b7ff09fa496204869206672656e642120f09fa4960a0af09f939c205369676e696e81527f672074686973206d6573736167652070726f766573207468617420796f75277260208201527f6520746865206f776e6572206f662074686973205365656b6572204e4654206160408201527f6e6420616c6c6f777320796f7572205365656b657220746f206265207573656460608201527f20746f206f70657261746520796f7572205365656b65722773204e6f64652e2060808201527f4974277320612073696d706c652062757420696d706f7274616e74207374657060a08201527f20746f20656e7375726520736d6f6f7468206f7065726174696f6e2e0a0a546860c08201527f697320726571756573742077696c6c206e6f742074726967676572206120626c60e08201527f6f636b636861696e207472616e73616374696f6e206f7220636f737420616e796101008201527f2067617320666565732e0a0af09f94a520596f7572206e6f64652773206164646101208201526503932b9b99d160d51b6101408201526000611cf1611ceb611c9c611c96611c7461014687018a611ab1565b75505784fc34a102cb7bab91039b2b2b5b2b91034b21d1604d1b815260170190565b87611ab1565b7f0a0af09f93a6204120756e697175652072616e646f6d2076616c75652077686981527f636820736563757265732074686973206d6573736167653a2000000000000000602082015260390190565b84611ab1565b95945050505050565b601f8211156108af57600081815260208120601f850160051c81016020861015611d215750805b601f850160051c820191505b81811015611d4057828155600101611d2d565b505050505050565b67ffffffffffffffff831115611d6057611d60611a6c565b611d7483611d6e8354611a09565b83611cfa565b6000601f841160018114611da85760008515611d905750838201355b600019600387901b1c1916600186901b178355611e02565b600083815260209020601f19861690835b82811015611dd95786850135825560209485019460019092019101611db9565b5086821015611df65760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b7f19457468657265756d205369676e6564204d6573736167653a0a000000000000815260008351611e4181601a850160208801611789565b835190830190611e5881601a840160208801611789565b01601a01949350505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b8082028115828204841417610f4057610f40611a43565b80820180821115610f4057610f40611a43565b600081611ee857611ee8611a43565b506000190190565b634e487b7160e01b600052602160045260246000fdfea2646970667358221220d6361e1b4cc92bca53730e58ef6dde4aeba6393d53dc520655b9c322b1a6627c64736f6c63430008120033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101375760003560e01c8063c5e4c9f9116100b8578063e354f2e71161007c578063e354f2e7146102a1578063ec90622b146102ca578063ef5563ca146102eb578063f2c298be1461030b578063f2fde38b1461031e578063f971d77c1461033157600080fd5b8063c5e4c9f914610220578063caed80df14610233578063d2a78d7f14610256578063e29581aa1461027b578063e30c39781461029057600080fd5b806363584ecd116100ff57806363584ecd146101db578063715018a6146101ec57806379ba5097146101f45780638da5cb5b146101fc5780639998da751461020d57600080fd5b806301ffc9a71461013c5780631c53c2801461017557806336357cd8146101a05780635ba2f1de146101b35780635d4c611f146101c8575b600080fd5b61016061014a3660046115ff565b6001600160e01b031916637ccc541d60e11b1490565b60405190151581526020015b60405180910390f35b610188610183366004611629565b610351565b6040516001600160a01b03909116815260200161016c565b609754610188906001600160a01b031681565b6101c66101c1366004611699565b61037b565b005b6101c66101d636600461171c565b610597565b609a5460405190815260200161016c565b6101c6610617565b6101c661062b565b6033546001600160a01b0316610188565b6101c661021b366004611737565b6106aa565b6101c661022e366004611754565b610720565b610246610241366004611737565b6108b4565b60405161016c94939291906117d9565b609c546102669063ffffffff1681565b60405163ffffffff909116815260200161016c565b610283610976565b60405161016c9190611858565b6065546001600160a01b0316610188565b6101886102af366004611629565b6099602052600090815260409020546001600160a01b031681565b6102dd6102d836600461186b565b6109d8565b60405161016c9291906118da565b6102fe6102f936600461194c565b610c87565b60405161016c9190611984565b6101c6610319366004611997565b610cdb565b6101c661032c366004611737565b610d83565b61034461033f366004611737565b610df4565b60405161016c91906119d9565b609a818154811061036157600080fd5b6000918252602090912001546001600160a01b0316905081565b6001600160a01b0385166103a257604051630f32ebab60e21b815260040160405180910390fd5b6000838152609b60205260409020546001600160a01b0316156103d857604051635989b1a960e11b815260040160405180910390fd5b60006103e5853386610c87565b905060006103f282610ee5565b9050866001600160a01b031661043e8286868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610f2092505050565b6001600160a01b03161461046557604051632e39179560e21b815260040160405180910390fd5b6097546040516331a9108f60e11b8152600481018890526000916001600160a01b031690636352211e90602401602060405180830381865afa1580156104af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d391906119ec565b9050806001600160a01b0316886001600160a01b03161461050757604051630c564dbf60e31b815260040160405180910390fd5b505050600084815260996020908152604080832080546001600160a01b039081168552609884528285206003908101869055825482168652838620600290810180546001600160a01b031990811690915533808952868920928301805483169e9095169d8e1790945591019990995581548916179055948252609b90529290922080549093169093179091555050565b61059f610f46565b620186a08163ffffffff1611156105c95760405163653eef6b60e11b815260040160405180910390fd5b609c805463ffffffff191663ffffffff83169081179091556040519081527fb7310d2ba8ebc993dd82a8a1e07558e8e3e68ffbabf1319312461d04d887fda69060200160405180910390a150565b61061f610f46565b6106296000610fa0565b565b60655433906001600160a01b0316811461069e5760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b6106a781610fa0565b50565b6001600160a01b038082166000908152609860205260409020600281015490911633146106ea5760405163603e767360e11b815260040160405180910390fd5b6002810180546001600160a01b031990811690915560039091018054600090815260996020526040812080549093169092555550565b600054610100900460ff16158080156107405750600054600160ff909116105b8061075a5750303b15801561075a575060005460ff166001145b6107bd5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610695565b6000805460ff1916600117905580156107e0576000805461ff0019166101001790555b6001600160a01b038316610807576040516322d2a86760e21b815260040160405180910390fd5b620186a08263ffffffff1611156108315760405163653eef6b60e11b815260040160405180910390fd5b610839610fb9565b609780546001600160a01b0319166001600160a01b038516179055609c805463ffffffff191663ffffffff841617905580156108af576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b6098602052600090815260409020805460018201805463ffffffff90921692916108dd90611a09565b80601f016020809104026020016040519081016040528092919081815260200182805461090990611a09565b80156109565780601f1061092b57610100808354040283529160200191610956565b820191906000526020600020905b81548152906001019060200180831161093957829003601f168201915b50505050600283015460039093015491926001600160a01b031691905084565b6060609a8054806020026020016040519081016040528092919081815260200182805480156109ce57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116109b0575b5050505050905090565b609a546060908190848411610a005760405163ee6f77d960e01b815260040160405180910390fd5b80841115610a245760405163a81ea1e360e01b815260048101829052602401610695565b6000610a308686611a59565b67ffffffffffffffff811115610a4857610a48611a6c565b604051908082528060200260200182016040528015610a71578160200160208202803683370190505b5090506000815167ffffffffffffffff811115610a9057610a90611a6c565b604051908082528060200260200182016040528015610ac957816020015b610ab66115c8565b815260200190600190039081610aae5790505b509050865b86811015610c7857609a8181548110610ae957610ae9611a82565b6000918252602090912001546001600160a01b031683610b098a84611a59565b81518110610b1957610b19611a82565b60200260200101906001600160a01b031690816001600160a01b03168152505060986000609a8381548110610b5057610b50611a82565b60009182526020808320909101546001600160a01b031683528281019390935260409182019020815160808101909252805463ffffffff1682526001810180549293919291840191610ba190611a09565b80601f0160208091040260200160405190810160405280929190818152602001828054610bcd90611a09565b8015610c1a5780601f10610bef57610100808354040283529160200191610c1a565b820191906000526020600020905b815481529060010190602001808311610bfd57829003601f168201915b505050918352505060028201546001600160a01b0316602082015260039091015460409091015282610c4c8a84611a59565b81518110610c5c57610c5c611a82565b602002602001018190525080610c7190611a98565b9050610ace565b509093509150505b9250929050565b6060610c9d836001600160a01b03166014610fe8565b610ca68561118b565b610cb1846020610fe8565b604051602001610cc393929190611acd565b60405160208183030381529060405290509392505050565b6000819003610cfd576040516309261b3d60e21b815260040160405180910390fd5b3360009081526098602052604090206001018054610d1a90611a09565b9050600003610d6657609a80546001810182556000919091527f44da158ba27f9252712a74ff6a55c5d531f69609f1f6e7f17c4443a8e2089be40180546001600160a01b031916331790555b3360009081526098602052604090206001016108af828483611d48565b610d8b610f46565b606580546001600160a01b0383166001600160a01b03199091168117909155610dbc6033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b610dfc6115c8565b6001600160a01b038216600090815260986020908152604091829020825160808101909352805463ffffffff1683526001810180549192840191610e3f90611a09565b80601f0160208091040260200160405190810160405280929190818152602001828054610e6b90611a09565b8015610eb85780601f10610e8d57610100808354040283529160200191610eb8565b820191906000526020600020905b815481529060010190602001808311610e9b57829003601f168201915b505050918352505060028201546001600160a01b0316602082015260039091015460409091015292915050565b6000610ef1825161118b565b82604051602001610f03929190611e09565b604051602081830303815290604052805190602001209050919050565b6000806000610f2f858561121e565b91509150610f3c81611260565b5090505b92915050565b6033546001600160a01b031633146106295760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610695565b606580546001600160a01b03191690556106a7816113aa565b600054610100900460ff16610fe05760405162461bcd60e51b815260040161069590611e64565b6106296113fc565b60606000610ff7836002611eaf565b611002906002611ec6565b67ffffffffffffffff81111561101a5761101a611a6c565b6040519080825280601f01601f191660200182016040528015611044576020820181803683370190505b509050600360fc1b8160008151811061105f5761105f611a82565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061108e5761108e611a82565b60200101906001600160f81b031916908160001a90535060006110b2846002611eaf565b6110bd906001611ec6565b90505b6001811115611135576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106110f1576110f1611a82565b1a60f81b82828151811061110757611107611a82565b60200101906001600160f81b031916908160001a90535060049490941c9361112e81611ed9565b90506110c0565b5083156111845760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610695565b9392505050565b606060006111988361142c565b600101905060008167ffffffffffffffff8111156111b8576111b8611a6c565b6040519080825280601f01601f1916602001820160405280156111e2576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a85049450846111ec57509392505050565b60008082516041036112545760208301516040840151606085015160001a61124887828585611504565b94509450505050610c80565b50600090506002610c80565b600081600481111561127457611274611ef0565b0361127c5750565b600181600481111561129057611290611ef0565b036112dd5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610695565b60028160048111156112f1576112f1611ef0565b0361133e5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610695565b600381600481111561135257611352611ef0565b036106a75760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610695565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166114235760405162461bcd60e51b815260040161069590611e64565b61062933610fa0565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b831061146b5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310611497576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc1000083106114b557662386f26fc10000830492506010015b6305f5e10083106114cd576305f5e100830492506008015b61271083106114e157612710830492506004015b606483106114f3576064830492506002015b600a8310610f405760010192915050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561153b57506000905060036115bf565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561158f573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166115b8576000600192509250506115bf565b9150600090505b94509492505050565b6040518060800160405280600063ffffffff1681526020016060815260200160006001600160a01b03168152602001600081525090565b60006020828403121561161157600080fd5b81356001600160e01b03198116811461118457600080fd5b60006020828403121561163b57600080fd5b5035919050565b6001600160a01b03811681146106a757600080fd5b60008083601f84011261166957600080fd5b50813567ffffffffffffffff81111561168157600080fd5b602083019150836020828501011115610c8057600080fd5b6000806000806000608086880312156116b157600080fd5b85356116bc81611642565b94506020860135935060408601359250606086013567ffffffffffffffff8111156116e657600080fd5b6116f288828901611657565b969995985093965092949392505050565b803563ffffffff8116811461171757600080fd5b919050565b60006020828403121561172e57600080fd5b61118482611703565b60006020828403121561174957600080fd5b813561118481611642565b6000806040838503121561176757600080fd5b823561177281611642565b915061178060208401611703565b90509250929050565b60005b838110156117a457818101518382015260200161178c565b50506000910152565b600081518084526117c5816020860160208601611789565b601f01601f19169290920160200192915050565b63ffffffff851681526080602082015260006117f860808301866117ad565b6001600160a01b03949094166040830152506060015292915050565b600081518084526020808501945080840160005b8381101561184d5781516001600160a01b031687529582019590820190600101611828565b509495945050505050565b6020815260006111846020830184611814565b6000806040838503121561187e57600080fd5b50508035926020909101359150565b63ffffffff815116825260006020820151608060208501526118b260808501826117ad565b6040848101516001600160a01b03169086015260609384015193909401929092525090919050565b6040815260006118ed6040830185611814565b6020838203818501528185518084528284019150828160051b85010183880160005b8381101561193d57601f1987840301855261192b83835161188d565b9486019492509085019060010161190f565b50909998505050505050505050565b60008060006060848603121561196157600080fd5b83359250602084013561197381611642565b929592945050506040919091013590565b60208152600061118460208301846117ad565b600080602083850312156119aa57600080fd5b823567ffffffffffffffff8111156119c157600080fd5b6119cd85828601611657565b90969095509350505050565b602081526000611184602083018461188d565b6000602082840312156119fe57600080fd5b815161118481611642565b600181811c90821680611a1d57607f821691505b602082108103611a3d57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b81810381811115610f4057610f40611a43565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600060018201611aaa57611aaa611a43565b5060010190565b60008151611ac3818560208601611789565b9290920192915050565b7ff09fa496204869206672656e642120f09fa4960a0af09f939c205369676e696e81527f672074686973206d6573736167652070726f766573207468617420796f75277260208201527f6520746865206f776e6572206f662074686973205365656b6572204e4654206160408201527f6e6420616c6c6f777320796f7572205365656b657220746f206265207573656460608201527f20746f206f70657261746520796f7572205365656b65722773204e6f64652e2060808201527f4974277320612073696d706c652062757420696d706f7274616e74207374657060a08201527f20746f20656e7375726520736d6f6f7468206f7065726174696f6e2e0a0a546860c08201527f697320726571756573742077696c6c206e6f742074726967676572206120626c60e08201527f6f636b636861696e207472616e73616374696f6e206f7220636f737420616e796101008201527f2067617320666565732e0a0af09f94a520596f7572206e6f64652773206164646101208201526503932b9b99d160d51b6101408201526000611cf1611ceb611c9c611c96611c7461014687018a611ab1565b75505784fc34a102cb7bab91039b2b2b5b2b91034b21d1604d1b815260170190565b87611ab1565b7f0a0af09f93a6204120756e697175652072616e646f6d2076616c75652077686981527f636820736563757265732074686973206d6573736167653a2000000000000000602082015260390190565b84611ab1565b95945050505050565b601f8211156108af57600081815260208120601f850160051c81016020861015611d215750805b601f850160051c820191505b81811015611d4057828155600101611d2d565b505050505050565b67ffffffffffffffff831115611d6057611d60611a6c565b611d7483611d6e8354611a09565b83611cfa565b6000601f841160018114611da85760008515611d905750838201355b600019600387901b1c1916600186901b178355611e02565b600083815260209020601f19861690835b82811015611dd95786850135825560209485019460019092019101611db9565b5086821015611df65760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b7f19457468657265756d205369676e6564204d6573736167653a0a000000000000815260008351611e4181601a850160208801611789565b835190830190611e5881601a840160208801611789565b01601a01949350505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b8082028115828204841417610f4057610f40611a43565b80820180821115610f4057610f40611a43565b600081611ee857611ee8611a43565b506000190190565b634e487b7160e01b600052602160045260246000fdfea2646970667358221220d6361e1b4cc92bca53730e58ef6dde4aeba6393d53dc520655b9c322b1a6627c64736f6c63430008120033", + "devdoc": { + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "acceptOwnership()": { + "details": "The new owner accepts the ownership transfer." + }, + "getNodes()": { + "returns": { + "_0": "An array of node addresses." + } + }, + "getProofMessage(uint256,address,bytes32)": { + "params": { + "node": "The address of the node which that will be operated by the specified seeker.", + "nonce": "The nonce used for this message.", + "seekerId": "The tokenId of the seeker used for operation." + } + }, + "getRegistries(uint256,uint256)": { + "params": { + "end": "The end index which is exclusive.", + "start": "The start index which is inclusive." + }, + "returns": { + "_0": "An array of Registries." + } + }, + "getRegistry(address)": { + "params": { + "account": "The address of the Node." + }, + "returns": { + "_0": "The Node's Registry." + } + }, + "getTotalNodes()": { + "returns": { + "_0": "The number of registered nodes." + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pendingOwner()": { + "details": "Returns the address of the pending owner." + }, + "register(string)": { + "params": { + "publicEndpoint": "The public endpoint of your Node. Essential for clients to be able to retrieve additional information, such as an address to establish a p2p connection." + } + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "setDefaultPayoutPercentage(uint32)": { + "params": { + "_defaultPayoutPercentage": "The payout percentage as a value where the denominator is 10000." + } + }, + "transferOwnership(address)": { + "details": "Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "_rootSeekers()": { + "notice": "ERC721 contract for bridged Seekers. Used for verifying ownership of a seeker." + }, + "defaultPayoutPercentage()": { + "notice": "Payout percentage refers to the portion of a tickets reward that will be allocated to the Node's stakers. This is global, and is currently set for all Nodes." + }, + "getNodes()": { + "notice": "Retrieve all registered nodes." + }, + "getProofMessage(uint256,address,bytes32)": { + "notice": "Helper function for deriving the proof message used to validate seeker ownership." + }, + "getRegistries(uint256,uint256)": { + "notice": "Retrieves a list of registries. Takes in a a start and end indices to allow pagination." + }, + "getRegistry(address)": { + "notice": "Retrieve the registry associated with a Node." + }, + "getTotalNodes()": { + "notice": "Returns the total number of registered nodes." + }, + "nodes(uint256)": { + "notice": "Tracks the address of every registered node." + }, + "register(string)": { + "notice": "Call this as a Node to set or update your Registry entry." + }, + "registries(address)": { + "notice": "Tracks each Node's registry." + }, + "seekerRegistration(uint256)": { + "notice": "Tracks the node address that each seeker id is registered with" + }, + "setDefaultPayoutPercentage(uint32)": { + "notice": "Set the global default payout percentage value. Only callable by the owner." + }, + "supportsInterface(bytes4)": { + "notice": "Returns true if the contract implements the interface defined by `interfaceId` from ERC165." + } + }, + "notice": "This contract manages Registries for Nodes. A Registry is a set of parameters configured by the Node itself. A Node is required to have a valid Registry to be able to participate in the network.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 244, + "contract": "contracts/Registries.sol:Registries", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 247, + "contract": "contracts/Registries.sol:Registries", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 777, + "contract": "contracts/Registries.sol:Registries", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 116, + "contract": "contracts/Registries.sol:Registries", + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address" + }, + { + "astId": 236, + "contract": "contracts/Registries.sol:Registries", + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 25, + "contract": "contracts/Registries.sol:Registries", + "label": "_pendingOwner", + "offset": 0, + "slot": "101", + "type": "t_address" + }, + { + "astId": 104, + "contract": "contracts/Registries.sol:Registries", + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 9116, + "contract": "contracts/Registries.sol:Registries", + "label": "_rootSeekers", + "offset": 0, + "slot": "151", + "type": "t_contract(IERC721)1996" + }, + { + "astId": 9122, + "contract": "contracts/Registries.sol:Registries", + "label": "registries", + "offset": 0, + "slot": "152", + "type": "t_mapping(t_address,t_struct(Registry)10534_storage)" + }, + { + "astId": 9127, + "contract": "contracts/Registries.sol:Registries", + "label": "seekerRegistration", + "offset": 0, + "slot": "153", + "type": "t_mapping(t_uint256,t_address)" + }, + { + "astId": 9131, + "contract": "contracts/Registries.sol:Registries", + "label": "nodes", + "offset": 0, + "slot": "154", + "type": "t_array(t_address)dyn_storage" + }, + { + "astId": 9136, + "contract": "contracts/Registries.sol:Registries", + "label": "signatureNonces", + "offset": 0, + "slot": "155", + "type": "t_mapping(t_bytes32,t_address)" + }, + { + "astId": 9139, + "contract": "contracts/Registries.sol:Registries", + "label": "defaultPayoutPercentage", + "offset": 0, + "slot": "156", + "type": "t_uint32" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_address)dyn_storage": { + "base": "t_address", + "encoding": "dynamic_array", + "label": "address[]", + "numberOfBytes": "32" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(IERC721)1996": { + "encoding": "inplace", + "label": "contract IERC721", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_struct(Registry)10534_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct IRegistries.Registry)", + "numberOfBytes": "32", + "value": "t_struct(Registry)10534_storage" + }, + "t_mapping(t_bytes32,t_address)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => address)", + "numberOfBytes": "32", + "value": "t_address" + }, + "t_mapping(t_uint256,t_address)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => address)", + "numberOfBytes": "32", + "value": "t_address" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(Registry)10534_storage": { + "encoding": "inplace", + "label": "struct IRegistries.Registry", + "members": [ + { + "astId": 10527, + "contract": "contracts/Registries.sol:Registries", + "label": "payoutPercentage", + "offset": 0, + "slot": "0", + "type": "t_uint32" + }, + { + "astId": 10529, + "contract": "contracts/Registries.sol:Registries", + "label": "publicEndpoint", + "offset": 0, + "slot": "1", + "type": "t_string_storage" + }, + { + "astId": 10531, + "contract": "contracts/Registries.sol:Registries", + "label": "seekerAccount", + "offset": 0, + "slot": "2", + "type": "t_address" + }, + { + "astId": 10533, + "contract": "contracts/Registries.sol:Registries", + "label": "seekerId", + "offset": 0, + "slot": "3", + "type": "t_uint256" + } + ], + "numberOfBytes": "128" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint32": { + "encoding": "inplace", + "label": "uint32", + "numberOfBytes": "4" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/deployments/porcini-dev/Registries_Proxy.json b/deployments/porcini-dev/Registries_Proxy.json new file mode 100644 index 00000000..e8dcfb83 --- /dev/null +++ b/deployments/porcini-dev/Registries_Proxy.json @@ -0,0 +1,235 @@ +{ + "address": "0x76c226017D7B0CEcC467dC0f353268d537252607", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xf7f2e9343053fb417910ad0c88e837971eb0fcbf7494c033e71a2932f72c6f4b", + "receipt": { + "to": null, + "from": "0x448c8e9e1816300Dd052e77D2A44c990A2807D15", + "contractAddress": "0x76c226017D7B0CEcC467dC0f353268d537252607", + "transactionIndex": 0, + "gasUsed": "720430", + "logsBloom": "0x00000000000000000000800000000000400200000000000000000004000000000000000000000000000000000000000000000000000000000000400000100000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000800000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x0bd821241ba2edab91c50addb69d20164c726020b4ba10a2fcbe00a5d00f21a7", + "transactionHash": "0xf7f2e9343053fb417910ad0c88e837971eb0fcbf7494c033e71a2932f72c6f4b", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 10978366, + "transactionHash": "0xf7f2e9343053fb417910ad0c88e837971eb0fcbf7494c033e71a2932f72c6f4b", + "address": "0x76c226017D7B0CEcC467dC0f353268d537252607", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x00000000000000000000000016805185f85aa123a5f473755764805f4a3da397" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0x0bd821241ba2edab91c50addb69d20164c726020b4ba10a2fcbe00a5d00f21a7" + }, + { + "transactionIndex": 0, + "blockNumber": 10978366, + "transactionHash": "0xf7f2e9343053fb417910ad0c88e837971eb0fcbf7494c033e71a2932f72c6f4b", + "address": "0x76c226017D7B0CEcC467dC0f353268d537252607", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f06d5edb04f4995fff2c362a14826107f7cccbcc", + "logIndex": 1, + "blockHash": "0x0bd821241ba2edab91c50addb69d20164c726020b4ba10a2fcbe00a5d00f21a7" + } + ], + "blockNumber": 10978366, + "cumulativeGasUsed": "720430", + "status": 1, + "byzantium": true + }, + "args": [ + "0x16805185F85AA123a5F473755764805f4a3DA397", + "0xf06d5Edb04F4995FFF2c362a14826107F7CCCBCc", + "0x" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\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\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.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 *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\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 Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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 Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual 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 Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\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(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\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(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) 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\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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 overriden 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 internall 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 overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/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\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\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 * ```\\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`, and `uint256`._\\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 /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\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 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 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 assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/porcini-dev/RewardsManager.json b/deployments/porcini-dev/RewardsManager.json new file mode 100644 index 00000000..00c4830f --- /dev/null +++ b/deployments/porcini-dev/RewardsManager.json @@ -0,0 +1,1048 @@ +{ + "address": "0x6802094eC43b1D769AA41A6925244AedB0D294a0", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "inputs": [], + "name": "AmountCannotBeZero", + "type": "error" + }, + { + "inputs": [], + "name": "ContractNameCannotBeEmpty", + "type": "error" + }, + { + "inputs": [], + "name": "DoNotAllowZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "InterfaceIdCannotBeZeroBytes", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidFixedPointResult", + "type": "error" + }, + { + "inputs": [], + "name": "ManagerCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "NoRewardToClaim", + "type": "error" + }, + { + "inputs": [], + "name": "NoStakeToCreateRewardPool", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyManagers", + "type": "error" + }, + { + "inputs": [], + "name": "RewardPoolAlreadyExist", + "type": "error" + }, + { + "inputs": [], + "name": "RewardPoolNotExist", + "type": "error" + }, + { + "inputs": [], + "name": "StakeeCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "StakerCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "StakerKeyCannotBeZeroBytes", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "TargetContractCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "TargetNotSupportInterface", + "type": "error" + }, + { + "inputs": [], + "name": "TokenCannotBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "_epochsManager", + "outputs": [ + { + "internalType": "contract EpochsManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_stakingManager", + "outputs": [ + { + "internalType": "contract StakingManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_token", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "manager", + "type": "address" + } + ], + "name": "addManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + }, + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "calculateStakerClaim", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "name": "claimStakingRewards", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + }, + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "getLastClaim", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "claimedAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "stake", + "type": "uint256" + } + ], + "internalType": "struct IRewardsManager.LastClaim", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "name": "getPendingRewards", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "name": "getRewardPool", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "stakersRewardTotal", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "initializedAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalActiveStake", + "type": "uint256" + }, + { + "internalType": "int128", + "name": "initialCumulativeRewardFactor", + "type": "int128" + } + ], + "internalType": "struct IRewardsManager.RewardPool", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "name": "getRewardPoolActiveStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "name": "getRewardPoolKey", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "name": "getRewardPoolStakersTotal", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + }, + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "getStakerKey", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + } + ], + "name": "getTotalEpochRewards", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + } + ], + "name": "getTotalEpochStakingRewards", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "incrementRewardPool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "internalType": "contract StakingManager", + "name": "stakingManager", + "type": "address" + }, + { + "internalType": "contract EpochsManager", + "name": "epochsManager", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "name": "initializeNextRewardPool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "lastClaims", + "outputs": [ + { + "internalType": "uint256", + "name": "claimedAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "stake", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "latestActiveRewardPools", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "managers", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "pendingRewards", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "manager", + "type": "address" + } + ], + "name": "removeManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "rewardPools", + "outputs": [ + { + "internalType": "uint256", + "name": "stakersRewardTotal", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "initializedAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalActiveStake", + "type": "uint256" + }, + { + "internalType": "int128", + "name": "initialCumulativeRewardFactor", + "type": "int128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "totalEpochRewards", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "totalEpochStakingRewards", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "unclaimedStakingRewards", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + }, + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "updatePendingRewards", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0x083b01c6cd65d95f8517d4f8ee7da3674d99e0f43b6a684cc4c3360566de8b68", + "receipt": { + "to": null, + "from": "0x448c8e9e1816300Dd052e77D2A44c990A2807D15", + "contractAddress": "0x6802094eC43b1D769AA41A6925244AedB0D294a0", + "transactionIndex": 0, + "gasUsed": "720430", + "logsBloom": "0x00000001000000000000000004000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000020000000000080000000000000000000000400002000000000002000000000000000000000200000000000000000000000000000000000000000000000", + "blockHash": "0xe1bc7cea6d306d510b372001cc992c587934d5713d338608038e9f8dd1e2f221", + "transactionHash": "0x083b01c6cd65d95f8517d4f8ee7da3674d99e0f43b6a684cc4c3360566de8b68", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 10978377, + "transactionHash": "0x083b01c6cd65d95f8517d4f8ee7da3674d99e0f43b6a684cc4c3360566de8b68", + "address": "0x6802094eC43b1D769AA41A6925244AedB0D294a0", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x0000000000000000000000006349940ba71f68304529ad1147e33f29c71e192e" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0xe1bc7cea6d306d510b372001cc992c587934d5713d338608038e9f8dd1e2f221" + }, + { + "transactionIndex": 0, + "blockNumber": 10978377, + "transactionHash": "0x083b01c6cd65d95f8517d4f8ee7da3674d99e0f43b6a684cc4c3360566de8b68", + "address": "0x6802094eC43b1D769AA41A6925244AedB0D294a0", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f06d5edb04f4995fff2c362a14826107f7cccbcc", + "logIndex": 1, + "blockHash": "0xe1bc7cea6d306d510b372001cc992c587934d5713d338608038e9f8dd1e2f221" + } + ], + "blockNumber": 10978377, + "cumulativeGasUsed": "720430", + "status": 1, + "byzantium": true + }, + "args": [ + "0x6349940BA71F68304529aD1147e33F29c71E192E", + "0xf06d5Edb04F4995FFF2c362a14826107F7CCCBCc", + "0x" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\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\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.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 *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\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 Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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 Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual 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 Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\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(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\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(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) 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\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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 overriden 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 internall 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 overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/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\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\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 * ```\\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`, and `uint256`._\\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 /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\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 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 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 assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "implementation": "0x6349940BA71F68304529aD1147e33F29c71E192E", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/porcini-dev/RewardsManager_Implementation.json b/deployments/porcini-dev/RewardsManager_Implementation.json new file mode 100644 index 00000000..11544116 --- /dev/null +++ b/deployments/porcini-dev/RewardsManager_Implementation.json @@ -0,0 +1,1393 @@ +{ + "address": "0x6349940BA71F68304529aD1147e33F29c71E192E", + "abi": [ + { + "inputs": [], + "name": "AmountCannotBeZero", + "type": "error" + }, + { + "inputs": [], + "name": "ContractNameCannotBeEmpty", + "type": "error" + }, + { + "inputs": [], + "name": "DoNotAllowZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "InterfaceIdCannotBeZeroBytes", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidFixedPointResult", + "type": "error" + }, + { + "inputs": [], + "name": "ManagerCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "NoRewardToClaim", + "type": "error" + }, + { + "inputs": [], + "name": "NoStakeToCreateRewardPool", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyManagers", + "type": "error" + }, + { + "inputs": [], + "name": "RewardPoolAlreadyExist", + "type": "error" + }, + { + "inputs": [], + "name": "RewardPoolNotExist", + "type": "error" + }, + { + "inputs": [], + "name": "StakeeCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "StakerCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "StakerKeyCannotBeZeroBytes", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "TargetContractCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "TargetNotSupportInterface", + "type": "error" + }, + { + "inputs": [], + "name": "TokenCannotBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "_epochsManager", + "outputs": [ + { + "internalType": "contract EpochsManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_stakingManager", + "outputs": [ + { + "internalType": "contract StakingManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_token", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "manager", + "type": "address" + } + ], + "name": "addManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + }, + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "calculateStakerClaim", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "name": "claimStakingRewards", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + }, + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "getLastClaim", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "claimedAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "stake", + "type": "uint256" + } + ], + "internalType": "struct IRewardsManager.LastClaim", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "name": "getPendingRewards", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "name": "getRewardPool", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "stakersRewardTotal", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "initializedAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalActiveStake", + "type": "uint256" + }, + { + "internalType": "int128", + "name": "initialCumulativeRewardFactor", + "type": "int128" + } + ], + "internalType": "struct IRewardsManager.RewardPool", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "name": "getRewardPoolActiveStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "name": "getRewardPoolKey", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "name": "getRewardPoolStakersTotal", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + }, + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "getStakerKey", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + } + ], + "name": "getTotalEpochRewards", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + } + ], + "name": "getTotalEpochStakingRewards", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "incrementRewardPool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "internalType": "contract StakingManager", + "name": "stakingManager", + "type": "address" + }, + { + "internalType": "contract EpochsManager", + "name": "epochsManager", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "name": "initializeNextRewardPool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "lastClaims", + "outputs": [ + { + "internalType": "uint256", + "name": "claimedAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "stake", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "latestActiveRewardPools", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "managers", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "pendingRewards", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "manager", + "type": "address" + } + ], + "name": "removeManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "rewardPools", + "outputs": [ + { + "internalType": "uint256", + "name": "stakersRewardTotal", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "initializedAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalActiveStake", + "type": "uint256" + }, + { + "internalType": "int128", + "name": "initialCumulativeRewardFactor", + "type": "int128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "totalEpochRewards", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "totalEpochStakingRewards", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "unclaimedStakingRewards", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + }, + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "updatePendingRewards", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x5be13d6d9c9abbcf4aca1fa0efb0967d54b0374d64ed910d68bb38e13988216f", + "receipt": { + "to": null, + "from": "0x448c8e9e1816300Dd052e77D2A44c990A2807D15", + "contractAddress": "0x6349940BA71F68304529aD1147e33F29c71E192E", + "transactionIndex": 0, + "gasUsed": "2019255", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xc4d62635cd1ba360446bdd75fee7fb86ff14cfcda0977c5a7b43cbf61c2f845c", + "transactionHash": "0x5be13d6d9c9abbcf4aca1fa0efb0967d54b0374d64ed910d68bb38e13988216f", + "logs": [], + "blockNumber": 10978375, + "cumulativeGasUsed": "2019255", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "76c1e1f3445d6d518cb33f614f9922c9", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"AmountCannotBeZero\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ContractNameCannotBeEmpty\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DoNotAllowZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InterfaceIdCannotBeZeroBytes\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidFixedPointResult\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ManagerCannotBeZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoRewardToClaim\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoStakeToCreateRewardPool\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyManagers\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RewardPoolAlreadyExist\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RewardPoolNotExist\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StakeeCannotBeZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StakerCannotBeZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StakerKeyCannotBeZeroBytes\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"TargetContractCannotBeZeroAddress\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"TargetNotSupportInterface\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TokenCannotBeZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"_epochsManager\",\"outputs\":[{\"internalType\":\"contract EpochsManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_stakingManager\",\"outputs\":[{\"internalType\":\"contract StakingManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_token\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"manager\",\"type\":\"address\"}],\"name\":\"addManager\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"stakee\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"staker\",\"type\":\"address\"}],\"name\":\"calculateStakerClaim\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"stakee\",\"type\":\"address\"}],\"name\":\"claimStakingRewards\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"stakee\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"staker\",\"type\":\"address\"}],\"name\":\"getLastClaim\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"claimedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"}],\"internalType\":\"struct IRewardsManager.LastClaim\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"stakee\",\"type\":\"address\"}],\"name\":\"getPendingRewards\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"stakee\",\"type\":\"address\"}],\"name\":\"getRewardPool\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stakersRewardTotal\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"initializedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalActiveStake\",\"type\":\"uint256\"},{\"internalType\":\"int128\",\"name\":\"initialCumulativeRewardFactor\",\"type\":\"int128\"}],\"internalType\":\"struct IRewardsManager.RewardPool\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"stakee\",\"type\":\"address\"}],\"name\":\"getRewardPoolActiveStake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"stakee\",\"type\":\"address\"}],\"name\":\"getRewardPoolKey\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"stakee\",\"type\":\"address\"}],\"name\":\"getRewardPoolStakersTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"stakee\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"staker\",\"type\":\"address\"}],\"name\":\"getStakerKey\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"}],\"name\":\"getTotalEpochRewards\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"}],\"name\":\"getTotalEpochStakingRewards\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"stakee\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"incrementRewardPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"contract StakingManager\",\"name\":\"stakingManager\",\"type\":\"address\"},{\"internalType\":\"contract EpochsManager\",\"name\":\"epochsManager\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"stakee\",\"type\":\"address\"}],\"name\":\"initializeNextRewardPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"lastClaims\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"claimedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"latestActiveRewardPools\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"managers\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"pendingRewards\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"manager\",\"type\":\"address\"}],\"name\":\"removeManager\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"rewardPools\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"stakersRewardTotal\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"initializedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalActiveStake\",\"type\":\"uint256\"},{\"internalType\":\"int128\",\"name\":\"initialCumulativeRewardFactor\",\"type\":\"int128\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"totalEpochRewards\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"totalEpochStakingRewards\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"unclaimedStakingRewards\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"stakee\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"staker\",\"type\":\"address\"}],\"name\":\"updatePendingRewards\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"After deployment, the SyloTicketing contract should be set up as a manager to be able to call certain restricted functions.\",\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"addManager(address)\":{\"params\":{\"manager\":\"The address of the manager contract.\"}},\"calculateStakerClaim(address,address)\":{\"details\":\"This function will utilize the cumulative reward factor to perform the calculation, keeping the gas cost scaling of this function to a constant value.\",\"params\":{\"stakee\":\"The address of the Node.\",\"staker\":\"The address of the staker.\"},\"returns\":{\"_0\":\"The value of the reward owed to the staker in SOLO.\"}},\"claimStakingRewards(address)\":{\"params\":{\"stakee\":\"The address of the Node to claim against.\"}},\"getLastClaim(address,address)\":{\"params\":{\"stakee\":\"The address of the Node.\",\"staker\":\"The address of the staker.\"},\"returns\":{\"_0\":\"The ID of the epoch.\"}},\"getPendingRewards(address)\":{\"params\":{\"stakee\":\"The address of the Node.\"},\"returns\":{\"_0\":\"The total pending staking reward in SOLO.\"}},\"getRewardPool(uint256,address)\":{\"params\":{\"epochId\":\"The ID of the epoch the reward pool was initialized in.\",\"stakee\":\"The address of the Node.\"},\"returns\":{\"_0\":\"The reward pool.\"}},\"getRewardPoolActiveStake(uint256,address)\":{\"params\":{\"epochId\":\"The ID of the epoch the reward pool was initialized in.\",\"stakee\":\"The address of the Node.\"},\"returns\":{\"_0\":\"The total active stake for that reward pool in SOLO.\"}},\"getRewardPoolKey(uint256,address)\":{\"params\":{\"epochId\":\"The epoch ID the reward pool was created in.\",\"stakee\":\"The address of the Node.\"},\"returns\":{\"_0\":\"A byte-array representing the reward pool key.\"}},\"getRewardPoolStakersTotal(uint256,address)\":{\"params\":{\"epochId\":\"The ID of the epoch the reward pool was initialized in.\",\"stakee\":\"The address of the Node.\"},\"returns\":{\"_0\":\"The total accumulated staker reward in SOLO.\"}},\"getStakerKey(address,address)\":{\"params\":{\"stakee\":\"The address of the Node.\",\"staker\":\"The address of the stake.\"},\"returns\":{\"_0\":\"A byte-array representing the key.\"}},\"getTotalEpochRewards(uint256)\":{\"params\":{\"epochId\":\"The epoch id.\"},\"returns\":{\"_0\":\"The total reward in that epoch, including staking rewards and fee reward.\"}},\"getTotalEpochStakingRewards(uint256)\":{\"params\":{\"epochId\":\"The epoch id.\"},\"returns\":{\"_0\":\"The total staking reward in that epoch.\"}},\"incrementRewardPool(address,uint256)\":{\"details\":\"This function should be called by the Ticketing contract when a ticket is successfully redeemed. The face value of the ticket should be split between incrementing the node's reward balance, and the reward balance for the node's delegated stakers. The face value will be added to the current reward pool's balance. This function will fail if the Ticketing contract has not been set as a manager.\",\"params\":{\"amount\":\"The face value of the ticket in SOLO.\",\"stakee\":\"The address of the Node.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"removeManager(address)\":{\"params\":{\"manager\":\"The address of the manager contract.\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"}},\"stateVariables\":{\"cumulativeRewardFactors\":{\"details\":\"Each node will manage a cumulative reward factor (CRF) that is incremented whenever a ticket is redeemed. This factor acts as a single value that can be used to calculate any particular staker's reward share. This prevents the need to individually track each staker's proportion, and also allows a claim calculation to be performed without iterating through every epoch. The CRF is calculated as CRF = CRF + Reward / TotalStake.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"_epochsManager()\":{\"notice\":\"Sylo Epochs Manager. \"},\"_stakingManager()\":{\"notice\":\"Sylo Staking Manager contract. \"},\"_token()\":{\"notice\":\"ERC20 Sylo token contract. \"},\"addManager(address)\":{\"notice\":\"Adds a manager to this contract. Only callable by the owner.\"},\"calculateStakerClaim(address,address)\":{\"notice\":\"Call this function to calculate the total reward owed to a staker. This value will include all epochs since the last claim was made up to the previous epoch. This will also add any pending rewards to the final value as well.\"},\"claimStakingRewards(address)\":{\"notice\":\"Call this function to claim rewards as a staker. The SYLO tokens will be transferred to the caller's account. This function will fail if there exists no reward to claim. Note: Calling this will remove the current unclaimed reward from being used as stake in the next round.\"},\"getLastClaim(address,address)\":{\"notice\":\"Retrieves the ID of the epoch in which a staker last made their staking claim.\"},\"getPendingRewards(address)\":{\"notice\":\"Retrieve the total pending staking reward allocated to a Node's stakers.\"},\"getRewardPool(uint256,address)\":{\"notice\":\"Retrieve the reward pool initialized by the given node, at the specified epoch.\"},\"getRewardPoolActiveStake(uint256,address)\":{\"notice\":\"Retrieve the total active stake that will be used for a Node's reward pool in a given epoch.\"},\"getRewardPoolKey(uint256,address)\":{\"notice\":\"Returns the key used to index a reward pool. The key is a hash of the epochId and Node's address.\"},\"getRewardPoolStakersTotal(uint256,address)\":{\"notice\":\"Retrieve the total accumulated reward that will be distributed to a Node's delegated stakers for a given epoch.\"},\"getStakerKey(address,address)\":{\"notice\":\"Returns the key used to index staking claims. The key is a hash of the Node's address and the staker's address.\"},\"getTotalEpochRewards(uint256)\":{\"notice\":\"Retrieves the total accumulated rewards for a specific epoch.\"},\"getTotalEpochStakingRewards(uint256)\":{\"notice\":\"Retrieves the total accumulated rewards for stakers in a specific epoch.\"},\"initializeNextRewardPool(address)\":{\"notice\":\"This is used by Nodes to initialize their reward pool for the next epoch. This function will revert if the caller has no stake, or if the reward pool has already been initialized. The total active stake for the next reward pool is calculated by summing up the total managed stake held by the RewardsManager contract.\"},\"lastClaims(bytes32)\":{\"notice\":\"Tracks the last epoch a delegated staker made a reward claim in. The key to this mapping is a hash of the Node's address and the delegated stakers address.\"},\"latestActiveRewardPools(address)\":{\"notice\":\"Tracks each Node's most recently active reward pool\"},\"pendingRewards(address)\":{\"notice\":\"Tracks each Nodes total pending rewards in SOLOs. This value is accumulated as Node's redeem tickets. Rewards are pending if the distribution amongst the stakers has not been accounted for yet. Pending rewards are transferred to unclaimed rewards once the the staker's share has been calculated.\"},\"removeManager(address)\":{\"notice\":\"Removes a manager from this contract. Only callable by the owner.\"},\"rewardPools(bytes32)\":{\"notice\":\"Tracks each reward pool initialized by a Node. The key to this map is derived from the epochId and the Node's address.\"},\"supportsInterface(bytes4)\":{\"notice\":\"Returns true if the contract implements the interface defined by `interfaceId` from ERC165.\"},\"totalEpochRewards(uint256)\":{\"notice\":\"Tracks total accumulated rewards in each epoch\"},\"totalEpochStakingRewards(uint256)\":{\"notice\":\"Tracks total accumulated staking rewards in each epoch\"},\"unclaimedStakingRewards(bytes32)\":{\"notice\":\"Tracks rewards for stakers after the stakers share has been calculated, but has not actually been claimed by the staker. The node fee reward is also added to the node's unclaimedStakingRewards.\"},\"updatePendingRewards(address,address)\":{\"notice\":\"This is called by the staking manager to transfer pending rewards to unclaimed rewards for a staker. This is required as the last used CRF needs to be updated whenever stake changes.\"}},\"notice\":\"Handles epoch based reward pools that are incremented from redeeming tickets. Nodes use this contract to set up their reward pool for the next epoch, and stakers use this contract to track and claim staking rewards.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/payments/ticketing/RewardsManager.sol\":\"RewardsManager\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./OwnableUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership} and {acceptOwnership}.\\n *\\n * This module is used through inheritance. It will make available all functions\\n * from parent (Ownable).\\n */\\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\\n function __Ownable2Step_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable2Step_init_unchained() internal onlyInitializing {\\n }\\n address private _pendingOwner;\\n\\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Returns the address of the pending owner.\\n */\\n function pendingOwner() public view virtual returns (address) {\\n return _pendingOwner;\\n }\\n\\n /**\\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual override onlyOwner {\\n _pendingOwner = newOwner;\\n emit OwnershipTransferStarted(owner(), newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual override {\\n delete _pendingOwner;\\n super._transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev The new owner accepts the ownership transfer.\\n */\\n function acceptOwnership() public virtual {\\n address sender = _msgSender();\\n require(pendingOwner() == sender, \\\"Ownable2Step: caller is not the new owner\\\");\\n _transferOwnership(sender);\\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\":\"0x84efb8889801b0ac817324aff6acc691d07bbee816b671817132911d287a8c63\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n\\n /**\\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\":\"0x4075622496acc77fd6d4de4cc30a8577a744d5c75afad33fdeacf1704d6eda98\",\"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/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/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/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\",\"keccak256\":\"0xa56ca923f70c1748830700250b19c61b70db9a683516dc5e216694a50445d99c\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.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 IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xec63854014a5b4f2b3290ab9103a21bdf902a508d0f41a8573fea49e98bf571a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.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 \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n /**\\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.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(IERC20 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(IERC20 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(IERC20 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(IERC20 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(IERC20 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 IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n 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(IERC20 token, bytes memory data) private returns (bool) {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\\n // and not revert is the subcall reverts.\\n\\n (bool success, bytes memory returndata) = address(token).call(data);\\n return\\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\\n }\\n}\\n\",\"keccak256\":\"0x909d608c2db6eb165ca178c81289a07ed2e118e444d0025b2a85c97d0b44a4fa\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"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/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\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.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/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\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 = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _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(SignedMath.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n 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\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.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 \\\"../Strings.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 ECDSA {\\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\\\", Strings.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\":\"0x809bc3edb4bcbef8263fa616c1b60ee0004b50a8a1bfa164d8f57fd31f520c58\",\"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/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\"},\"@openzeppelin/contracts/utils/math/Math.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 Math {\\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\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)\\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\\n * checks.\\n *\\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\\n * easily result in undesired exploitation or bugs, since developers usually\\n * assume that overflows raise errors. `SafeCast` restores this intuition by\\n * reverting the transaction when such an operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n *\\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\\n * all math on `uint256` and `int256` and then downcasting.\\n */\\nlibrary SafeCast {\\n /**\\n * @dev Returns the downcasted uint248 from uint256, reverting on\\n * overflow (when the input is greater than largest uint248).\\n *\\n * Counterpart to Solidity's `uint248` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 248 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint248(uint256 value) internal pure returns (uint248) {\\n require(value <= type(uint248).max, \\\"SafeCast: value doesn't fit in 248 bits\\\");\\n return uint248(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint240 from uint256, reverting on\\n * overflow (when the input is greater than largest uint240).\\n *\\n * Counterpart to Solidity's `uint240` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 240 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint240(uint256 value) internal pure returns (uint240) {\\n require(value <= type(uint240).max, \\\"SafeCast: value doesn't fit in 240 bits\\\");\\n return uint240(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint232 from uint256, reverting on\\n * overflow (when the input is greater than largest uint232).\\n *\\n * Counterpart to Solidity's `uint232` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 232 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint232(uint256 value) internal pure returns (uint232) {\\n require(value <= type(uint232).max, \\\"SafeCast: value doesn't fit in 232 bits\\\");\\n return uint232(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint224 from uint256, reverting on\\n * overflow (when the input is greater than largest uint224).\\n *\\n * Counterpart to Solidity's `uint224` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 224 bits\\n *\\n * _Available since v4.2._\\n */\\n function toUint224(uint256 value) internal pure returns (uint224) {\\n require(value <= type(uint224).max, \\\"SafeCast: value doesn't fit in 224 bits\\\");\\n return uint224(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint216 from uint256, reverting on\\n * overflow (when the input is greater than largest uint216).\\n *\\n * Counterpart to Solidity's `uint216` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 216 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint216(uint256 value) internal pure returns (uint216) {\\n require(value <= type(uint216).max, \\\"SafeCast: value doesn't fit in 216 bits\\\");\\n return uint216(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint208 from uint256, reverting on\\n * overflow (when the input is greater than largest uint208).\\n *\\n * Counterpart to Solidity's `uint208` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 208 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint208(uint256 value) internal pure returns (uint208) {\\n require(value <= type(uint208).max, \\\"SafeCast: value doesn't fit in 208 bits\\\");\\n return uint208(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint200 from uint256, reverting on\\n * overflow (when the input is greater than largest uint200).\\n *\\n * Counterpart to Solidity's `uint200` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 200 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint200(uint256 value) internal pure returns (uint200) {\\n require(value <= type(uint200).max, \\\"SafeCast: value doesn't fit in 200 bits\\\");\\n return uint200(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint192 from uint256, reverting on\\n * overflow (when the input is greater than largest uint192).\\n *\\n * Counterpart to Solidity's `uint192` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 192 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint192(uint256 value) internal pure returns (uint192) {\\n require(value <= type(uint192).max, \\\"SafeCast: value doesn't fit in 192 bits\\\");\\n return uint192(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint184 from uint256, reverting on\\n * overflow (when the input is greater than largest uint184).\\n *\\n * Counterpart to Solidity's `uint184` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 184 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint184(uint256 value) internal pure returns (uint184) {\\n require(value <= type(uint184).max, \\\"SafeCast: value doesn't fit in 184 bits\\\");\\n return uint184(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint176 from uint256, reverting on\\n * overflow (when the input is greater than largest uint176).\\n *\\n * Counterpart to Solidity's `uint176` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 176 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint176(uint256 value) internal pure returns (uint176) {\\n require(value <= type(uint176).max, \\\"SafeCast: value doesn't fit in 176 bits\\\");\\n return uint176(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint168 from uint256, reverting on\\n * overflow (when the input is greater than largest uint168).\\n *\\n * Counterpart to Solidity's `uint168` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 168 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint168(uint256 value) internal pure returns (uint168) {\\n require(value <= type(uint168).max, \\\"SafeCast: value doesn't fit in 168 bits\\\");\\n return uint168(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint160 from uint256, reverting on\\n * overflow (when the input is greater than largest uint160).\\n *\\n * Counterpart to Solidity's `uint160` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 160 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint160(uint256 value) internal pure returns (uint160) {\\n require(value <= type(uint160).max, \\\"SafeCast: value doesn't fit in 160 bits\\\");\\n return uint160(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint152 from uint256, reverting on\\n * overflow (when the input is greater than largest uint152).\\n *\\n * Counterpart to Solidity's `uint152` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 152 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint152(uint256 value) internal pure returns (uint152) {\\n require(value <= type(uint152).max, \\\"SafeCast: value doesn't fit in 152 bits\\\");\\n return uint152(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint144 from uint256, reverting on\\n * overflow (when the input is greater than largest uint144).\\n *\\n * Counterpart to Solidity's `uint144` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 144 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint144(uint256 value) internal pure returns (uint144) {\\n require(value <= type(uint144).max, \\\"SafeCast: value doesn't fit in 144 bits\\\");\\n return uint144(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint136 from uint256, reverting on\\n * overflow (when the input is greater than largest uint136).\\n *\\n * Counterpart to Solidity's `uint136` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 136 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint136(uint256 value) internal pure returns (uint136) {\\n require(value <= type(uint136).max, \\\"SafeCast: value doesn't fit in 136 bits\\\");\\n return uint136(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint128 from uint256, reverting on\\n * overflow (when the input is greater than largest uint128).\\n *\\n * Counterpart to Solidity's `uint128` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 128 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint128(uint256 value) internal pure returns (uint128) {\\n require(value <= type(uint128).max, \\\"SafeCast: value doesn't fit in 128 bits\\\");\\n return uint128(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint120 from uint256, reverting on\\n * overflow (when the input is greater than largest uint120).\\n *\\n * Counterpart to Solidity's `uint120` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 120 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint120(uint256 value) internal pure returns (uint120) {\\n require(value <= type(uint120).max, \\\"SafeCast: value doesn't fit in 120 bits\\\");\\n return uint120(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint112 from uint256, reverting on\\n * overflow (when the input is greater than largest uint112).\\n *\\n * Counterpart to Solidity's `uint112` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 112 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint112(uint256 value) internal pure returns (uint112) {\\n require(value <= type(uint112).max, \\\"SafeCast: value doesn't fit in 112 bits\\\");\\n return uint112(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint104 from uint256, reverting on\\n * overflow (when the input is greater than largest uint104).\\n *\\n * Counterpart to Solidity's `uint104` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 104 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint104(uint256 value) internal pure returns (uint104) {\\n require(value <= type(uint104).max, \\\"SafeCast: value doesn't fit in 104 bits\\\");\\n return uint104(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint96 from uint256, reverting on\\n * overflow (when the input is greater than largest uint96).\\n *\\n * Counterpart to Solidity's `uint96` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 96 bits\\n *\\n * _Available since v4.2._\\n */\\n function toUint96(uint256 value) internal pure returns (uint96) {\\n require(value <= type(uint96).max, \\\"SafeCast: value doesn't fit in 96 bits\\\");\\n return uint96(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint88 from uint256, reverting on\\n * overflow (when the input is greater than largest uint88).\\n *\\n * Counterpart to Solidity's `uint88` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 88 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint88(uint256 value) internal pure returns (uint88) {\\n require(value <= type(uint88).max, \\\"SafeCast: value doesn't fit in 88 bits\\\");\\n return uint88(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint80 from uint256, reverting on\\n * overflow (when the input is greater than largest uint80).\\n *\\n * Counterpart to Solidity's `uint80` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 80 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint80(uint256 value) internal pure returns (uint80) {\\n require(value <= type(uint80).max, \\\"SafeCast: value doesn't fit in 80 bits\\\");\\n return uint80(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint72 from uint256, reverting on\\n * overflow (when the input is greater than largest uint72).\\n *\\n * Counterpart to Solidity's `uint72` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 72 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint72(uint256 value) internal pure returns (uint72) {\\n require(value <= type(uint72).max, \\\"SafeCast: value doesn't fit in 72 bits\\\");\\n return uint72(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint64 from uint256, reverting on\\n * overflow (when the input is greater than largest uint64).\\n *\\n * Counterpart to Solidity's `uint64` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 64 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint64(uint256 value) internal pure returns (uint64) {\\n require(value <= type(uint64).max, \\\"SafeCast: value doesn't fit in 64 bits\\\");\\n return uint64(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint56 from uint256, reverting on\\n * overflow (when the input is greater than largest uint56).\\n *\\n * Counterpart to Solidity's `uint56` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 56 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint56(uint256 value) internal pure returns (uint56) {\\n require(value <= type(uint56).max, \\\"SafeCast: value doesn't fit in 56 bits\\\");\\n return uint56(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint48 from uint256, reverting on\\n * overflow (when the input is greater than largest uint48).\\n *\\n * Counterpart to Solidity's `uint48` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 48 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint48(uint256 value) internal pure returns (uint48) {\\n require(value <= type(uint48).max, \\\"SafeCast: value doesn't fit in 48 bits\\\");\\n return uint48(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint40 from uint256, reverting on\\n * overflow (when the input is greater than largest uint40).\\n *\\n * Counterpart to Solidity's `uint40` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 40 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint40(uint256 value) internal pure returns (uint40) {\\n require(value <= type(uint40).max, \\\"SafeCast: value doesn't fit in 40 bits\\\");\\n return uint40(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint32 from uint256, reverting on\\n * overflow (when the input is greater than largest uint32).\\n *\\n * Counterpart to Solidity's `uint32` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 32 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint32(uint256 value) internal pure returns (uint32) {\\n require(value <= type(uint32).max, \\\"SafeCast: value doesn't fit in 32 bits\\\");\\n return uint32(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint24 from uint256, reverting on\\n * overflow (when the input is greater than largest uint24).\\n *\\n * Counterpart to Solidity's `uint24` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 24 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint24(uint256 value) internal pure returns (uint24) {\\n require(value <= type(uint24).max, \\\"SafeCast: value doesn't fit in 24 bits\\\");\\n return uint24(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint16 from uint256, reverting on\\n * overflow (when the input is greater than largest uint16).\\n *\\n * Counterpart to Solidity's `uint16` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 16 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint16(uint256 value) internal pure returns (uint16) {\\n require(value <= type(uint16).max, \\\"SafeCast: value doesn't fit in 16 bits\\\");\\n return uint16(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint8 from uint256, reverting on\\n * overflow (when the input is greater than largest uint8).\\n *\\n * Counterpart to Solidity's `uint8` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 8 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint8(uint256 value) internal pure returns (uint8) {\\n require(value <= type(uint8).max, \\\"SafeCast: value doesn't fit in 8 bits\\\");\\n return uint8(value);\\n }\\n\\n /**\\n * @dev Converts a signed int256 into an unsigned uint256.\\n *\\n * Requirements:\\n *\\n * - input must be greater than or equal to 0.\\n *\\n * _Available since v3.0._\\n */\\n function toUint256(int256 value) internal pure returns (uint256) {\\n require(value >= 0, \\\"SafeCast: value must be positive\\\");\\n return uint256(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int248 from int256, reverting on\\n * overflow (when the input is less than smallest int248 or\\n * greater than largest int248).\\n *\\n * Counterpart to Solidity's `int248` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 248 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\\n downcasted = int248(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 248 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int240 from int256, reverting on\\n * overflow (when the input is less than smallest int240 or\\n * greater than largest int240).\\n *\\n * Counterpart to Solidity's `int240` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 240 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\\n downcasted = int240(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 240 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int232 from int256, reverting on\\n * overflow (when the input is less than smallest int232 or\\n * greater than largest int232).\\n *\\n * Counterpart to Solidity's `int232` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 232 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\\n downcasted = int232(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 232 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int224 from int256, reverting on\\n * overflow (when the input is less than smallest int224 or\\n * greater than largest int224).\\n *\\n * Counterpart to Solidity's `int224` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 224 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\\n downcasted = int224(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 224 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int216 from int256, reverting on\\n * overflow (when the input is less than smallest int216 or\\n * greater than largest int216).\\n *\\n * Counterpart to Solidity's `int216` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 216 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\\n downcasted = int216(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 216 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int208 from int256, reverting on\\n * overflow (when the input is less than smallest int208 or\\n * greater than largest int208).\\n *\\n * Counterpart to Solidity's `int208` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 208 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\\n downcasted = int208(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 208 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int200 from int256, reverting on\\n * overflow (when the input is less than smallest int200 or\\n * greater than largest int200).\\n *\\n * Counterpart to Solidity's `int200` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 200 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\\n downcasted = int200(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 200 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int192 from int256, reverting on\\n * overflow (when the input is less than smallest int192 or\\n * greater than largest int192).\\n *\\n * Counterpart to Solidity's `int192` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 192 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\\n downcasted = int192(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 192 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int184 from int256, reverting on\\n * overflow (when the input is less than smallest int184 or\\n * greater than largest int184).\\n *\\n * Counterpart to Solidity's `int184` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 184 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\\n downcasted = int184(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 184 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int176 from int256, reverting on\\n * overflow (when the input is less than smallest int176 or\\n * greater than largest int176).\\n *\\n * Counterpart to Solidity's `int176` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 176 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\\n downcasted = int176(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 176 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int168 from int256, reverting on\\n * overflow (when the input is less than smallest int168 or\\n * greater than largest int168).\\n *\\n * Counterpart to Solidity's `int168` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 168 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\\n downcasted = int168(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 168 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int160 from int256, reverting on\\n * overflow (when the input is less than smallest int160 or\\n * greater than largest int160).\\n *\\n * Counterpart to Solidity's `int160` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 160 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\\n downcasted = int160(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 160 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int152 from int256, reverting on\\n * overflow (when the input is less than smallest int152 or\\n * greater than largest int152).\\n *\\n * Counterpart to Solidity's `int152` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 152 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\\n downcasted = int152(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 152 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int144 from int256, reverting on\\n * overflow (when the input is less than smallest int144 or\\n * greater than largest int144).\\n *\\n * Counterpart to Solidity's `int144` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 144 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\\n downcasted = int144(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 144 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int136 from int256, reverting on\\n * overflow (when the input is less than smallest int136 or\\n * greater than largest int136).\\n *\\n * Counterpart to Solidity's `int136` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 136 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\\n downcasted = int136(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 136 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int128 from int256, reverting on\\n * overflow (when the input is less than smallest int128 or\\n * greater than largest int128).\\n *\\n * Counterpart to Solidity's `int128` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 128 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\\n downcasted = int128(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 128 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int120 from int256, reverting on\\n * overflow (when the input is less than smallest int120 or\\n * greater than largest int120).\\n *\\n * Counterpart to Solidity's `int120` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 120 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\\n downcasted = int120(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 120 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int112 from int256, reverting on\\n * overflow (when the input is less than smallest int112 or\\n * greater than largest int112).\\n *\\n * Counterpart to Solidity's `int112` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 112 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\\n downcasted = int112(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 112 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int104 from int256, reverting on\\n * overflow (when the input is less than smallest int104 or\\n * greater than largest int104).\\n *\\n * Counterpart to Solidity's `int104` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 104 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\\n downcasted = int104(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 104 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int96 from int256, reverting on\\n * overflow (when the input is less than smallest int96 or\\n * greater than largest int96).\\n *\\n * Counterpart to Solidity's `int96` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 96 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\\n downcasted = int96(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 96 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int88 from int256, reverting on\\n * overflow (when the input is less than smallest int88 or\\n * greater than largest int88).\\n *\\n * Counterpart to Solidity's `int88` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 88 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\\n downcasted = int88(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 88 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int80 from int256, reverting on\\n * overflow (when the input is less than smallest int80 or\\n * greater than largest int80).\\n *\\n * Counterpart to Solidity's `int80` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 80 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\\n downcasted = int80(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 80 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int72 from int256, reverting on\\n * overflow (when the input is less than smallest int72 or\\n * greater than largest int72).\\n *\\n * Counterpart to Solidity's `int72` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 72 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\\n downcasted = int72(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 72 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int64 from int256, reverting on\\n * overflow (when the input is less than smallest int64 or\\n * greater than largest int64).\\n *\\n * Counterpart to Solidity's `int64` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 64 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\\n downcasted = int64(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 64 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int56 from int256, reverting on\\n * overflow (when the input is less than smallest int56 or\\n * greater than largest int56).\\n *\\n * Counterpart to Solidity's `int56` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 56 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\\n downcasted = int56(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 56 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int48 from int256, reverting on\\n * overflow (when the input is less than smallest int48 or\\n * greater than largest int48).\\n *\\n * Counterpart to Solidity's `int48` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 48 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\\n downcasted = int48(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 48 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int40 from int256, reverting on\\n * overflow (when the input is less than smallest int40 or\\n * greater than largest int40).\\n *\\n * Counterpart to Solidity's `int40` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 40 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\\n downcasted = int40(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 40 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int32 from int256, reverting on\\n * overflow (when the input is less than smallest int32 or\\n * greater than largest int32).\\n *\\n * Counterpart to Solidity's `int32` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 32 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\\n downcasted = int32(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 32 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int24 from int256, reverting on\\n * overflow (when the input is less than smallest int24 or\\n * greater than largest int24).\\n *\\n * Counterpart to Solidity's `int24` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 24 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\\n downcasted = int24(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 24 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int16 from int256, reverting on\\n * overflow (when the input is less than smallest int16 or\\n * greater than largest int16).\\n *\\n * Counterpart to Solidity's `int16` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 16 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\\n downcasted = int16(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 16 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int8 from int256, reverting on\\n * overflow (when the input is less than smallest int8 or\\n * greater than largest int8).\\n *\\n * Counterpart to Solidity's `int8` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 8 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\\n downcasted = int8(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 8 bits\\\");\\n }\\n\\n /**\\n * @dev Converts an unsigned uint256 into a signed int256.\\n *\\n * Requirements:\\n *\\n * - input must be less than or equal to maxInt256.\\n *\\n * _Available since v3.0._\\n */\\n function toInt256(uint256 value) internal pure returns (int256) {\\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\\n require(value <= uint256(type(int256).max), \\\"SafeCast: value doesn't fit in an int256\\\");\\n return int256(value);\\n }\\n}\\n\",\"keccak256\":\"0x52a8cfb0f5239d11b457dcdd1b326992ef672714ca8da71a157255bddd13f3ad\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.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 SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"abdk-libraries-solidity/ABDKMath64x64.sol\":{\"content\":\"// SPDX-License-Identifier: BSD-4-Clause\\n/*\\n * ABDK Math 64.64 Smart Contract Library. Copyright \\u00a9 2019 by ABDK Consulting.\\n * Author: Mikhail Vladimirov \\n */\\npragma solidity ^0.8.0;\\n\\n/**\\n * Smart contract library of mathematical functions operating with signed\\n * 64.64-bit fixed point numbers. Signed 64.64-bit fixed point number is\\n * basically a simple fraction whose numerator is signed 128-bit integer and\\n * denominator is 2^64. As long as denominator is always the same, there is no\\n * need to store it, thus in Solidity signed 64.64-bit fixed point numbers are\\n * represented by int128 type holding only the numerator.\\n */\\nlibrary ABDKMath64x64 {\\n /*\\n * Minimum value signed 64.64-bit fixed point number may have. \\n */\\n int128 private constant MIN_64x64 = -0x80000000000000000000000000000000;\\n\\n /*\\n * Maximum value signed 64.64-bit fixed point number may have. \\n */\\n int128 private constant MAX_64x64 = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;\\n\\n /**\\n * Convert signed 256-bit integer number into signed 64.64-bit fixed point\\n * number. Revert on overflow.\\n *\\n * @param x signed 256-bit integer number\\n * @return signed 64.64-bit fixed point number\\n */\\n function fromInt (int256 x) internal pure returns (int128) {\\n unchecked {\\n require (x >= -0x8000000000000000 && x <= 0x7FFFFFFFFFFFFFFF);\\n return int128 (x << 64);\\n }\\n }\\n\\n /**\\n * Convert signed 64.64 fixed point number into signed 64-bit integer number\\n * rounding down.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64-bit integer number\\n */\\n function toInt (int128 x) internal pure returns (int64) {\\n unchecked {\\n return int64 (x >> 64);\\n }\\n }\\n\\n /**\\n * Convert unsigned 256-bit integer number into signed 64.64-bit fixed point\\n * number. Revert on overflow.\\n *\\n * @param x unsigned 256-bit integer number\\n * @return signed 64.64-bit fixed point number\\n */\\n function fromUInt (uint256 x) internal pure returns (int128) {\\n unchecked {\\n require (x <= 0x7FFFFFFFFFFFFFFF);\\n return int128 (int256 (x << 64));\\n }\\n }\\n\\n /**\\n * Convert signed 64.64 fixed point number into unsigned 64-bit integer\\n * number rounding down. Revert on underflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return unsigned 64-bit integer number\\n */\\n function toUInt (int128 x) internal pure returns (uint64) {\\n unchecked {\\n require (x >= 0);\\n return uint64 (uint128 (x >> 64));\\n }\\n }\\n\\n /**\\n * Convert signed 128.128 fixed point number into signed 64.64-bit fixed point\\n * number rounding down. Revert on overflow.\\n *\\n * @param x signed 128.128-bin fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function from128x128 (int256 x) internal pure returns (int128) {\\n unchecked {\\n int256 result = x >> 64;\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Convert signed 64.64 fixed point number into signed 128.128 fixed point\\n * number.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 128.128 fixed point number\\n */\\n function to128x128 (int128 x) internal pure returns (int256) {\\n unchecked {\\n return int256 (x) << 64;\\n }\\n }\\n\\n /**\\n * Calculate x + y. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function add (int128 x, int128 y) internal pure returns (int128) {\\n unchecked {\\n int256 result = int256(x) + y;\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate x - y. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function sub (int128 x, int128 y) internal pure returns (int128) {\\n unchecked {\\n int256 result = int256(x) - y;\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate x * y rounding down. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function mul (int128 x, int128 y) internal pure returns (int128) {\\n unchecked {\\n int256 result = int256(x) * y >> 64;\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate x * y rounding towards zero, where x is signed 64.64 fixed point\\n * number and y is signed 256-bit integer number. Revert on overflow.\\n *\\n * @param x signed 64.64 fixed point number\\n * @param y signed 256-bit integer number\\n * @return signed 256-bit integer number\\n */\\n function muli (int128 x, int256 y) internal pure returns (int256) {\\n unchecked {\\n if (x == MIN_64x64) {\\n require (y >= -0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF &&\\n y <= 0x1000000000000000000000000000000000000000000000000);\\n return -y << 63;\\n } else {\\n bool negativeResult = false;\\n if (x < 0) {\\n x = -x;\\n negativeResult = true;\\n }\\n if (y < 0) {\\n y = -y; // We rely on overflow behavior here\\n negativeResult = !negativeResult;\\n }\\n uint256 absoluteResult = mulu (x, uint256 (y));\\n if (negativeResult) {\\n require (absoluteResult <=\\n 0x8000000000000000000000000000000000000000000000000000000000000000);\\n return -int256 (absoluteResult); // We rely on overflow behavior here\\n } else {\\n require (absoluteResult <=\\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\\n return int256 (absoluteResult);\\n }\\n }\\n }\\n }\\n\\n /**\\n * Calculate x * y rounding down, where x is signed 64.64 fixed point number\\n * and y is unsigned 256-bit integer number. Revert on overflow.\\n *\\n * @param x signed 64.64 fixed point number\\n * @param y unsigned 256-bit integer number\\n * @return unsigned 256-bit integer number\\n */\\n function mulu (int128 x, uint256 y) internal pure returns (uint256) {\\n unchecked {\\n if (y == 0) return 0;\\n\\n require (x >= 0);\\n\\n uint256 lo = (uint256 (int256 (x)) * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) >> 64;\\n uint256 hi = uint256 (int256 (x)) * (y >> 128);\\n\\n require (hi <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\\n hi <<= 64;\\n\\n require (hi <=\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - lo);\\n return hi + lo;\\n }\\n }\\n\\n /**\\n * Calculate x / y rounding towards zero. Revert on overflow or when y is\\n * zero.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function div (int128 x, int128 y) internal pure returns (int128) {\\n unchecked {\\n require (y != 0);\\n int256 result = (int256 (x) << 64) / y;\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate x / y rounding towards zero, where x and y are signed 256-bit\\n * integer numbers. Revert on overflow or when y is zero.\\n *\\n * @param x signed 256-bit integer number\\n * @param y signed 256-bit integer number\\n * @return signed 64.64-bit fixed point number\\n */\\n function divi (int256 x, int256 y) internal pure returns (int128) {\\n unchecked {\\n require (y != 0);\\n\\n bool negativeResult = false;\\n if (x < 0) {\\n x = -x; // We rely on overflow behavior here\\n negativeResult = true;\\n }\\n if (y < 0) {\\n y = -y; // We rely on overflow behavior here\\n negativeResult = !negativeResult;\\n }\\n uint128 absoluteResult = divuu (uint256 (x), uint256 (y));\\n if (negativeResult) {\\n require (absoluteResult <= 0x80000000000000000000000000000000);\\n return -int128 (absoluteResult); // We rely on overflow behavior here\\n } else {\\n require (absoluteResult <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\\n return int128 (absoluteResult); // We rely on overflow behavior here\\n }\\n }\\n }\\n\\n /**\\n * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit\\n * integer numbers. Revert on overflow or when y is zero.\\n *\\n * @param x unsigned 256-bit integer number\\n * @param y unsigned 256-bit integer number\\n * @return signed 64.64-bit fixed point number\\n */\\n function divu (uint256 x, uint256 y) internal pure returns (int128) {\\n unchecked {\\n require (y != 0);\\n uint128 result = divuu (x, y);\\n require (result <= uint128 (MAX_64x64));\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate -x. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function neg (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x != MIN_64x64);\\n return -x;\\n }\\n }\\n\\n /**\\n * Calculate |x|. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function abs (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x != MIN_64x64);\\n return x < 0 ? -x : x;\\n }\\n }\\n\\n /**\\n * Calculate 1 / x rounding towards zero. Revert on overflow or when x is\\n * zero.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function inv (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x != 0);\\n int256 result = int256 (0x100000000000000000000000000000000) / x;\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate arithmetics average of x and y, i.e. (x + y) / 2 rounding down.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function avg (int128 x, int128 y) internal pure returns (int128) {\\n unchecked {\\n return int128 ((int256 (x) + int256 (y)) >> 1);\\n }\\n }\\n\\n /**\\n * Calculate geometric average of x and y, i.e. sqrt (x * y) rounding down.\\n * Revert on overflow or in case x * y is negative.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function gavg (int128 x, int128 y) internal pure returns (int128) {\\n unchecked {\\n int256 m = int256 (x) * int256 (y);\\n require (m >= 0);\\n require (m <\\n 0x4000000000000000000000000000000000000000000000000000000000000000);\\n return int128 (sqrtu (uint256 (m)));\\n }\\n }\\n\\n /**\\n * Calculate x^y assuming 0^0 is 1, where x is signed 64.64 fixed point number\\n * and y is unsigned 256-bit integer number. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y uint256 value\\n * @return signed 64.64-bit fixed point number\\n */\\n function pow (int128 x, uint256 y) internal pure returns (int128) {\\n unchecked {\\n bool negative = x < 0 && y & 1 == 1;\\n\\n uint256 absX = uint128 (x < 0 ? -x : x);\\n uint256 absResult;\\n absResult = 0x100000000000000000000000000000000;\\n\\n if (absX <= 0x10000000000000000) {\\n absX <<= 63;\\n while (y != 0) {\\n if (y & 0x1 != 0) {\\n absResult = absResult * absX >> 127;\\n }\\n absX = absX * absX >> 127;\\n\\n if (y & 0x2 != 0) {\\n absResult = absResult * absX >> 127;\\n }\\n absX = absX * absX >> 127;\\n\\n if (y & 0x4 != 0) {\\n absResult = absResult * absX >> 127;\\n }\\n absX = absX * absX >> 127;\\n\\n if (y & 0x8 != 0) {\\n absResult = absResult * absX >> 127;\\n }\\n absX = absX * absX >> 127;\\n\\n y >>= 4;\\n }\\n\\n absResult >>= 64;\\n } else {\\n uint256 absXShift = 63;\\n if (absX < 0x1000000000000000000000000) { absX <<= 32; absXShift -= 32; }\\n if (absX < 0x10000000000000000000000000000) { absX <<= 16; absXShift -= 16; }\\n if (absX < 0x1000000000000000000000000000000) { absX <<= 8; absXShift -= 8; }\\n if (absX < 0x10000000000000000000000000000000) { absX <<= 4; absXShift -= 4; }\\n if (absX < 0x40000000000000000000000000000000) { absX <<= 2; absXShift -= 2; }\\n if (absX < 0x80000000000000000000000000000000) { absX <<= 1; absXShift -= 1; }\\n\\n uint256 resultShift = 0;\\n while (y != 0) {\\n require (absXShift < 64);\\n\\n if (y & 0x1 != 0) {\\n absResult = absResult * absX >> 127;\\n resultShift += absXShift;\\n if (absResult > 0x100000000000000000000000000000000) {\\n absResult >>= 1;\\n resultShift += 1;\\n }\\n }\\n absX = absX * absX >> 127;\\n absXShift <<= 1;\\n if (absX >= 0x100000000000000000000000000000000) {\\n absX >>= 1;\\n absXShift += 1;\\n }\\n\\n y >>= 1;\\n }\\n\\n require (resultShift < 64);\\n absResult >>= 64 - resultShift;\\n }\\n int256 result = negative ? -int256 (absResult) : int256 (absResult);\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate sqrt (x) rounding down. Revert if x < 0.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function sqrt (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x >= 0);\\n return int128 (sqrtu (uint256 (int256 (x)) << 64));\\n }\\n }\\n\\n /**\\n * Calculate binary logarithm of x. Revert if x <= 0.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function log_2 (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x > 0);\\n\\n int256 msb = 0;\\n int256 xc = x;\\n if (xc >= 0x10000000000000000) { xc >>= 64; msb += 64; }\\n if (xc >= 0x100000000) { xc >>= 32; msb += 32; }\\n if (xc >= 0x10000) { xc >>= 16; msb += 16; }\\n if (xc >= 0x100) { xc >>= 8; msb += 8; }\\n if (xc >= 0x10) { xc >>= 4; msb += 4; }\\n if (xc >= 0x4) { xc >>= 2; msb += 2; }\\n if (xc >= 0x2) msb += 1; // No need to shift xc anymore\\n\\n int256 result = msb - 64 << 64;\\n uint256 ux = uint256 (int256 (x)) << uint256 (127 - msb);\\n for (int256 bit = 0x8000000000000000; bit > 0; bit >>= 1) {\\n ux *= ux;\\n uint256 b = ux >> 255;\\n ux >>= 127 + b;\\n result += bit * int256 (b);\\n }\\n\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate natural logarithm of x. Revert if x <= 0.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function ln (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x > 0);\\n\\n return int128 (int256 (\\n uint256 (int256 (log_2 (x))) * 0xB17217F7D1CF79ABC9E3B39803F2F6AF >> 128));\\n }\\n }\\n\\n /**\\n * Calculate binary exponent of x. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function exp_2 (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x < 0x400000000000000000); // Overflow\\n\\n if (x < -0x400000000000000000) return 0; // Underflow\\n\\n uint256 result = 0x80000000000000000000000000000000;\\n\\n if (x & 0x8000000000000000 > 0)\\n result = result * 0x16A09E667F3BCC908B2FB1366EA957D3E >> 128;\\n if (x & 0x4000000000000000 > 0)\\n result = result * 0x1306FE0A31B7152DE8D5A46305C85EDEC >> 128;\\n if (x & 0x2000000000000000 > 0)\\n result = result * 0x1172B83C7D517ADCDF7C8C50EB14A791F >> 128;\\n if (x & 0x1000000000000000 > 0)\\n result = result * 0x10B5586CF9890F6298B92B71842A98363 >> 128;\\n if (x & 0x800000000000000 > 0)\\n result = result * 0x1059B0D31585743AE7C548EB68CA417FD >> 128;\\n if (x & 0x400000000000000 > 0)\\n result = result * 0x102C9A3E778060EE6F7CACA4F7A29BDE8 >> 128;\\n if (x & 0x200000000000000 > 0)\\n result = result * 0x10163DA9FB33356D84A66AE336DCDFA3F >> 128;\\n if (x & 0x100000000000000 > 0)\\n result = result * 0x100B1AFA5ABCBED6129AB13EC11DC9543 >> 128;\\n if (x & 0x80000000000000 > 0)\\n result = result * 0x10058C86DA1C09EA1FF19D294CF2F679B >> 128;\\n if (x & 0x40000000000000 > 0)\\n result = result * 0x1002C605E2E8CEC506D21BFC89A23A00F >> 128;\\n if (x & 0x20000000000000 > 0)\\n result = result * 0x100162F3904051FA128BCA9C55C31E5DF >> 128;\\n if (x & 0x10000000000000 > 0)\\n result = result * 0x1000B175EFFDC76BA38E31671CA939725 >> 128;\\n if (x & 0x8000000000000 > 0)\\n result = result * 0x100058BA01FB9F96D6CACD4B180917C3D >> 128;\\n if (x & 0x4000000000000 > 0)\\n result = result * 0x10002C5CC37DA9491D0985C348C68E7B3 >> 128;\\n if (x & 0x2000000000000 > 0)\\n result = result * 0x1000162E525EE054754457D5995292026 >> 128;\\n if (x & 0x1000000000000 > 0)\\n result = result * 0x10000B17255775C040618BF4A4ADE83FC >> 128;\\n if (x & 0x800000000000 > 0)\\n result = result * 0x1000058B91B5BC9AE2EED81E9B7D4CFAB >> 128;\\n if (x & 0x400000000000 > 0)\\n result = result * 0x100002C5C89D5EC6CA4D7C8ACC017B7C9 >> 128;\\n if (x & 0x200000000000 > 0)\\n result = result * 0x10000162E43F4F831060E02D839A9D16D >> 128;\\n if (x & 0x100000000000 > 0)\\n result = result * 0x100000B1721BCFC99D9F890EA06911763 >> 128;\\n if (x & 0x80000000000 > 0)\\n result = result * 0x10000058B90CF1E6D97F9CA14DBCC1628 >> 128;\\n if (x & 0x40000000000 > 0)\\n result = result * 0x1000002C5C863B73F016468F6BAC5CA2B >> 128;\\n if (x & 0x20000000000 > 0)\\n result = result * 0x100000162E430E5A18F6119E3C02282A5 >> 128;\\n if (x & 0x10000000000 > 0)\\n result = result * 0x1000000B1721835514B86E6D96EFD1BFE >> 128;\\n if (x & 0x8000000000 > 0)\\n result = result * 0x100000058B90C0B48C6BE5DF846C5B2EF >> 128;\\n if (x & 0x4000000000 > 0)\\n result = result * 0x10000002C5C8601CC6B9E94213C72737A >> 128;\\n if (x & 0x2000000000 > 0)\\n result = result * 0x1000000162E42FFF037DF38AA2B219F06 >> 128;\\n if (x & 0x1000000000 > 0)\\n result = result * 0x10000000B17217FBA9C739AA5819F44F9 >> 128;\\n if (x & 0x800000000 > 0)\\n result = result * 0x1000000058B90BFCDEE5ACD3C1CEDC823 >> 128;\\n if (x & 0x400000000 > 0)\\n result = result * 0x100000002C5C85FE31F35A6A30DA1BE50 >> 128;\\n if (x & 0x200000000 > 0)\\n result = result * 0x10000000162E42FF0999CE3541B9FFFCF >> 128;\\n if (x & 0x100000000 > 0)\\n result = result * 0x100000000B17217F80F4EF5AADDA45554 >> 128;\\n if (x & 0x80000000 > 0)\\n result = result * 0x10000000058B90BFBF8479BD5A81B51AD >> 128;\\n if (x & 0x40000000 > 0)\\n result = result * 0x1000000002C5C85FDF84BD62AE30A74CC >> 128;\\n if (x & 0x20000000 > 0)\\n result = result * 0x100000000162E42FEFB2FED257559BDAA >> 128;\\n if (x & 0x10000000 > 0)\\n result = result * 0x1000000000B17217F7D5A7716BBA4A9AE >> 128;\\n if (x & 0x8000000 > 0)\\n result = result * 0x100000000058B90BFBE9DDBAC5E109CCE >> 128;\\n if (x & 0x4000000 > 0)\\n result = result * 0x10000000002C5C85FDF4B15DE6F17EB0D >> 128;\\n if (x & 0x2000000 > 0)\\n result = result * 0x1000000000162E42FEFA494F1478FDE05 >> 128;\\n if (x & 0x1000000 > 0)\\n result = result * 0x10000000000B17217F7D20CF927C8E94C >> 128;\\n if (x & 0x800000 > 0)\\n result = result * 0x1000000000058B90BFBE8F71CB4E4B33D >> 128;\\n if (x & 0x400000 > 0)\\n result = result * 0x100000000002C5C85FDF477B662B26945 >> 128;\\n if (x & 0x200000 > 0)\\n result = result * 0x10000000000162E42FEFA3AE53369388C >> 128;\\n if (x & 0x100000 > 0)\\n result = result * 0x100000000000B17217F7D1D351A389D40 >> 128;\\n if (x & 0x80000 > 0)\\n result = result * 0x10000000000058B90BFBE8E8B2D3D4EDE >> 128;\\n if (x & 0x40000 > 0)\\n result = result * 0x1000000000002C5C85FDF4741BEA6E77E >> 128;\\n if (x & 0x20000 > 0)\\n result = result * 0x100000000000162E42FEFA39FE95583C2 >> 128;\\n if (x & 0x10000 > 0)\\n result = result * 0x1000000000000B17217F7D1CFB72B45E1 >> 128;\\n if (x & 0x8000 > 0)\\n result = result * 0x100000000000058B90BFBE8E7CC35C3F0 >> 128;\\n if (x & 0x4000 > 0)\\n result = result * 0x10000000000002C5C85FDF473E242EA38 >> 128;\\n if (x & 0x2000 > 0)\\n result = result * 0x1000000000000162E42FEFA39F02B772C >> 128;\\n if (x & 0x1000 > 0)\\n result = result * 0x10000000000000B17217F7D1CF7D83C1A >> 128;\\n if (x & 0x800 > 0)\\n result = result * 0x1000000000000058B90BFBE8E7BDCBE2E >> 128;\\n if (x & 0x400 > 0)\\n result = result * 0x100000000000002C5C85FDF473DEA871F >> 128;\\n if (x & 0x200 > 0)\\n result = result * 0x10000000000000162E42FEFA39EF44D91 >> 128;\\n if (x & 0x100 > 0)\\n result = result * 0x100000000000000B17217F7D1CF79E949 >> 128;\\n if (x & 0x80 > 0)\\n result = result * 0x10000000000000058B90BFBE8E7BCE544 >> 128;\\n if (x & 0x40 > 0)\\n result = result * 0x1000000000000002C5C85FDF473DE6ECA >> 128;\\n if (x & 0x20 > 0)\\n result = result * 0x100000000000000162E42FEFA39EF366F >> 128;\\n if (x & 0x10 > 0)\\n result = result * 0x1000000000000000B17217F7D1CF79AFA >> 128;\\n if (x & 0x8 > 0)\\n result = result * 0x100000000000000058B90BFBE8E7BCD6D >> 128;\\n if (x & 0x4 > 0)\\n result = result * 0x10000000000000002C5C85FDF473DE6B2 >> 128;\\n if (x & 0x2 > 0)\\n result = result * 0x1000000000000000162E42FEFA39EF358 >> 128;\\n if (x & 0x1 > 0)\\n result = result * 0x10000000000000000B17217F7D1CF79AB >> 128;\\n\\n result >>= uint256 (int256 (63 - (x >> 64)));\\n require (result <= uint256 (int256 (MAX_64x64)));\\n\\n return int128 (int256 (result));\\n }\\n }\\n\\n /**\\n * Calculate natural exponent of x. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function exp (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x < 0x400000000000000000); // Overflow\\n\\n if (x < -0x400000000000000000) return 0; // Underflow\\n\\n return exp_2 (\\n int128 (int256 (x) * 0x171547652B82FE1777D0FFDA0D23A7D12 >> 128));\\n }\\n }\\n\\n /**\\n * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit\\n * integer numbers. Revert on overflow or when y is zero.\\n *\\n * @param x unsigned 256-bit integer number\\n * @param y unsigned 256-bit integer number\\n * @return unsigned 64.64-bit fixed point number\\n */\\n function divuu (uint256 x, uint256 y) private pure returns (uint128) {\\n unchecked {\\n require (y != 0);\\n\\n uint256 result;\\n\\n if (x <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)\\n result = (x << 64) / y;\\n else {\\n uint256 msb = 192;\\n uint256 xc = x >> 192;\\n if (xc >= 0x100000000) { xc >>= 32; msb += 32; }\\n if (xc >= 0x10000) { xc >>= 16; msb += 16; }\\n if (xc >= 0x100) { xc >>= 8; msb += 8; }\\n if (xc >= 0x10) { xc >>= 4; msb += 4; }\\n if (xc >= 0x4) { xc >>= 2; msb += 2; }\\n if (xc >= 0x2) msb += 1; // No need to shift xc anymore\\n\\n result = (x << 255 - msb) / ((y - 1 >> msb - 191) + 1);\\n require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\\n\\n uint256 hi = result * (y >> 128);\\n uint256 lo = result * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\\n\\n uint256 xh = x >> 192;\\n uint256 xl = x << 64;\\n\\n if (xl < lo) xh -= 1;\\n xl -= lo; // We rely on overflow behavior here\\n lo = hi << 128;\\n if (xl < lo) xh -= 1;\\n xl -= lo; // We rely on overflow behavior here\\n\\n result += xh == hi >> 128 ? xl / y : 1;\\n }\\n\\n require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\\n return uint128 (result);\\n }\\n }\\n\\n /**\\n * Calculate sqrt (x) rounding down, where x is unsigned 256-bit integer\\n * number.\\n *\\n * @param x unsigned 256-bit integer number\\n * @return unsigned 128-bit integer number\\n */\\n function sqrtu (uint256 x) private pure returns (uint128) {\\n unchecked {\\n if (x == 0) return 0;\\n else {\\n uint256 xx = x;\\n uint256 r = 1;\\n if (xx >= 0x100000000000000000000000000000000) { xx >>= 128; r <<= 64; }\\n if (xx >= 0x10000000000000000) { xx >>= 64; r <<= 32; }\\n if (xx >= 0x100000000) { xx >>= 32; r <<= 16; }\\n if (xx >= 0x10000) { xx >>= 16; r <<= 8; }\\n if (xx >= 0x100) { xx >>= 8; r <<= 4; }\\n if (xx >= 0x10) { xx >>= 4; r <<= 2; }\\n if (xx >= 0x4) { r <<= 1; }\\n r = (r + x / r) >> 1;\\n r = (r + x / r) >> 1;\\n r = (r + x / r) >> 1;\\n r = (r + x / r) >> 1;\\n r = (r + x / r) >> 1;\\n r = (r + x / r) >> 1;\\n r = (r + x / r) >> 1; // Seven iterations should be enough\\n uint256 r1 = x / r;\\n return uint128 (r < r1 ? r : r1);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x1364fdc24192b982f647c7fc68dcb2f6fc1b5e201843e773144bd23a76cb3b97\",\"license\":\"BSD-4-Clause\"},\"contracts/Registries.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\n\\nimport \\\"./libraries/SyloUtils.sol\\\";\\nimport \\\"./interfaces/IRegistries.sol\\\";\\n\\n/**\\n * @notice This contract manages Registries for Nodes. A Registry is a\\n * set of parameters configured by the Node itself. A Node is required\\n * to have a valid Registry to be able to participate in the network.\\n */\\ncontract Registries is IRegistries, Initializable, Ownable2StepUpgradeable, IERC165 {\\n using ECDSA for bytes32;\\n\\n /**\\n * @notice ERC721 contract for bridged Seekers. Used for verifying ownership\\n * of a seeker.\\n */\\n IERC721 public _rootSeekers;\\n\\n /**\\n * @notice Tracks each Node's registry.\\n */\\n mapping(address => IRegistries.Registry) public registries;\\n\\n /**\\n * @notice Tracks the node address that each seeker id is registered with\\n */\\n mapping(uint256 => address) public seekerRegistration;\\n\\n /**\\n * @notice Tracks the address of every registered node.\\n */\\n address[] public nodes;\\n\\n /**\\n * @notice Tracks nonces used when registering the seeker account\\n * to prevent signature re-use.\\n */\\n mapping(bytes32 => address) private signatureNonces;\\n\\n /**\\n * @notice Payout percentage refers to the portion of a tickets reward\\n * that will be allocated to the Node's stakers. This is global, and is\\n * currently set for all Nodes.\\n */\\n uint32 public defaultPayoutPercentage;\\n\\n event DefaultPayoutPercentageUpdated(uint32 defaultPayoutPercentage);\\n\\n error NonceCannotBeReused();\\n error EndMustBeGreaterThanStart();\\n error PercentageCannotExceed100000();\\n error PublicEndpointCannotBeEmpty();\\n error SeekerAccountMustOwnSeekerId();\\n error SeekerAccountMustBeMsgSender();\\n error ProofNotSignedBySeekerAccount();\\n error RootSeekersCannotBeZeroAddress();\\n error SeekerAccountCannotBeZeroAddress();\\n error EndCannotExceedNumberOfNodes(uint256 nodeLength);\\n\\n function initialize(\\n IERC721 rootSeekers,\\n uint32 _defaultPayoutPercentage\\n ) external initializer {\\n if (address(rootSeekers) == address(0)) {\\n revert RootSeekersCannotBeZeroAddress();\\n }\\n if (_defaultPayoutPercentage > 100000) {\\n revert PercentageCannotExceed100000();\\n }\\n\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n _rootSeekers = rootSeekers;\\n defaultPayoutPercentage = _defaultPayoutPercentage;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IRegistries).interfaceId;\\n }\\n\\n /**\\n * @notice Set the global default payout percentage value. Only callable\\n * by the owner.\\n * @param _defaultPayoutPercentage The payout percentage as a value where the\\n * denominator is 10000.\\n */\\n function setDefaultPayoutPercentage(uint32 _defaultPayoutPercentage) external onlyOwner {\\n if (_defaultPayoutPercentage > 100000) {\\n revert PercentageCannotExceed100000();\\n }\\n\\n defaultPayoutPercentage = _defaultPayoutPercentage;\\n emit DefaultPayoutPercentageUpdated(_defaultPayoutPercentage);\\n }\\n\\n /**\\n * @notice Call this as a Node to set or update your Registry entry.\\n * @param publicEndpoint The public endpoint of your Node. Essential for\\n * clients to be able to retrieve additional information, such as\\n * an address to establish a p2p connection.\\n */\\n function register(string calldata publicEndpoint) external {\\n if (bytes(publicEndpoint).length == 0) {\\n revert PublicEndpointCannotBeEmpty();\\n }\\n\\n // This is the nodes first registration\\n if (bytes(registries[msg.sender].publicEndpoint).length == 0) {\\n nodes.push(msg.sender);\\n }\\n\\n registries[msg.sender].publicEndpoint = publicEndpoint;\\n }\\n\\n function setSeekerAccount(\\n address seekerAccount,\\n uint256 seekerId,\\n bytes32 nonce,\\n bytes calldata signature\\n ) external {\\n if (seekerAccount == address(0)) {\\n revert SeekerAccountCannotBeZeroAddress();\\n }\\n if (signatureNonces[nonce] != address(0)) {\\n revert NonceCannotBeReused();\\n }\\n\\n bytes memory proofMessage = getProofMessage(seekerId, msg.sender, nonce);\\n bytes32 ethProof = ECDSA.toEthSignedMessageHash(proofMessage);\\n\\n if (ECDSA.recover(ethProof, signature) != seekerAccount) {\\n revert ProofNotSignedBySeekerAccount();\\n }\\n\\n // Now verify the seeker account actually owns the seeker\\n address owner = _rootSeekers.ownerOf(seekerId);\\n\\n if (seekerAccount != owner) {\\n revert SeekerAccountMustOwnSeekerId();\\n }\\n\\n delete registries[seekerRegistration[seekerId]].seekerId;\\n delete registries[seekerRegistration[seekerId]].seekerAccount;\\n\\n registries[msg.sender].seekerAccount = seekerAccount;\\n registries[msg.sender].seekerId = seekerId;\\n\\n seekerRegistration[seekerId] = msg.sender;\\n\\n signatureNonces[nonce] = seekerAccount;\\n }\\n\\n function revokeSeekerAccount(address node) external {\\n Registry storage registry = registries[node];\\n\\n if (registry.seekerAccount != msg.sender) {\\n revert SeekerAccountMustBeMsgSender();\\n }\\n\\n delete registry.seekerAccount;\\n delete seekerRegistration[registry.seekerId];\\n delete registry.seekerId;\\n }\\n\\n /**\\n * @notice Retrieve the registry associated with a Node.\\n * @param account The address of the Node.\\n * @return The Node's Registry.\\n */\\n function getRegistry(address account) external view returns (Registry memory) {\\n return registries[account];\\n }\\n\\n /**\\n * @notice Retrieve all registered nodes.\\n * @return An array of node addresses.\\n */\\n function getNodes() external view returns (address[] memory) {\\n return nodes;\\n }\\n\\n /**\\n * @notice Retrieves a list of registries. Takes in a\\n * a start and end indices to allow pagination.\\n * @param start The start index which is inclusive.\\n * @param end The end index which is exclusive.\\n * @return An array of Registries.\\n */\\n function getRegistries(\\n uint256 start,\\n uint256 end\\n ) external view returns (address[] memory, Registry[] memory) {\\n uint256 nodesLength = nodes.length;\\n\\n if (end <= start) {\\n revert EndMustBeGreaterThanStart();\\n }\\n if (end > nodesLength) {\\n revert EndCannotExceedNumberOfNodes(nodesLength);\\n }\\n\\n address[] memory _nodes = new address[](end - start);\\n Registry[] memory _registries = new Registry[](_nodes.length);\\n\\n for (uint256 i = start; i < end; ++i) {\\n _nodes[i - start] = nodes[i];\\n _registries[i - start] = registries[nodes[i]];\\n }\\n\\n return (_nodes, _registries);\\n }\\n\\n /**\\n * @notice Returns the total number of registered nodes.\\n * @return The number of registered nodes.\\n */\\n function getTotalNodes() external view returns (uint256) {\\n return nodes.length;\\n }\\n\\n /**\\n * @notice Helper function for deriving the proof message used to\\n * validate seeker ownership.\\n * @param seekerId The tokenId of the seeker used for operation.\\n * @param node The address of the node which that will be operated\\n * by the specified seeker.\\n * @param nonce The nonce used for this message.\\n */\\n function getProofMessage(\\n uint256 seekerId,\\n address node,\\n bytes32 nonce\\n ) public pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n unicode\\\"\\ud83e\\udd16 Hi frend! \\ud83e\\udd16\\\\n\\\\n\\ud83d\\udcdc Signing this message proves that you're the owner of this Seeker NFT and allows your Seeker to be used to operate your Seeker's Node. It's a simple but important step to ensure smooth operation.\\\\n\\\\nThis request will not trigger a blockchain transaction or cost any gas fees.\\\\n\\\\n\\ud83d\\udd25 Your node's address: \\\",\\n Strings.toHexString(uint256(uint160(node)), 20),\\n unicode\\\"\\\\n\\\\n\\ud83c\\udd94 Your seeker id: \\\",\\n Strings.toString(seekerId),\\n unicode\\\"\\\\n\\\\n\\ud83d\\udce6 A unique random value which secures this message: \\\",\\n Strings.toHexString(uint256(nonce), 32)\\n );\\n }\\n}\\n\",\"keccak256\":\"0x492be9b17a6624c5aa9de7b7d93f2ab1d7e6ee6443e60d4f036f7a7c670c343b\",\"license\":\"Apache-2.0\"},\"contracts/SeekerPowerOracle.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\n\\nimport \\\"./interfaces/ISeekerPowerOracle.sol\\\";\\n\\n/**\\n * @notice Acts as a source of information for Seeker Powers. Allows setting\\n * a Seeker's power level via a restricted oracle account call. Seeker Power can also\\n * be set by any account if the correct Oracle signature proof is provided.\\n */\\ncontract SeekerPowerOracle is ISeekerPowerOracle, Initializable, Ownable2StepUpgradeable, ERC165 {\\n /**\\n * @notice The oracle account. This contract accepts any attestations of\\n * Seeker power that have been signed by this account.\\n */\\n address public oracle;\\n\\n /**\\n * @notice Tracks nonce used when register the Seeker power to\\n * prevent signature re-use.\\n */\\n mapping(bytes32 => address) private proofNonces;\\n\\n /**\\n * @notice Tracks the set of Seeker Power levels.\\n */\\n mapping(uint256 => uint256) public seekerPowers;\\n\\n event SeekerPowerUpdated(uint256 indexed seekerId, uint256 indexed power);\\n\\n error UnauthorizedRegisterSeekerPowerCall();\\n error NonceCannotBeReused();\\n\\n function initialize(address _oracle) external initializer {\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n oracle = _oracle;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(ISeekerPowerOracle).interfaceId;\\n }\\n\\n /**\\n * @notice Sets the oracle account.\\n * @param _oracle The oracle account.\\n */\\n function setOracle(address _oracle) external onlyOwner {\\n oracle = _oracle;\\n }\\n\\n /**\\n * @notice Registers a Seeker's power level. Only callable by the\\n * owner or the oracle account.\\n * @param seekerId The id of the Seeker.\\n * @param power The power level of the Seeker.\\n */\\n function registerSeekerPowerRestricted(uint256 seekerId, uint256 power) external {\\n if (msg.sender != oracle) {\\n revert UnauthorizedRegisterSeekerPowerCall();\\n }\\n\\n seekerPowers[seekerId] = power;\\n emit SeekerPowerUpdated(seekerId, power);\\n }\\n\\n /**\\n * @notice Registers a Seeker's power level. Callable by any account\\n * but requires a proof signed by the oracle.\\n * @param seekerId The id of the Seeker.\\n * @param power The power level of the Seeker.\\n */\\n function registerSeekerPower(\\n uint256 seekerId,\\n uint256 power,\\n bytes32 nonce,\\n bytes calldata proof\\n ) external {\\n if (proofNonces[nonce] != address(0)) {\\n revert NonceCannotBeReused();\\n }\\n\\n bytes memory proofMessage = getProofMessage(seekerId, power, nonce);\\n bytes32 ecdsaHash = ECDSA.toEthSignedMessageHash(proofMessage);\\n\\n if (ECDSA.recover(ecdsaHash, proof) != oracle) {\\n revert UnauthorizedRegisterSeekerPowerCall();\\n }\\n\\n seekerPowers[seekerId] = power;\\n proofNonces[nonce] = oracle;\\n\\n emit SeekerPowerUpdated(seekerId, power);\\n }\\n\\n /**\\n * @notice Retrieves a Seeker's stored power level.\\n * @param seekerId The id of the Seeker.\\n */\\n function getSeekerPower(uint256 seekerId) external view returns (uint256) {\\n return seekerPowers[seekerId];\\n }\\n\\n /**\\n * @notice Constructs a proof message for the oracle to sign.\\n * @param seekerId The id of the Seeker.\\n * @param power The power level of the Seeker.\\n */\\n function getProofMessage(\\n uint256 seekerId,\\n uint256 power,\\n bytes32 nonce\\n ) public pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n Strings.toString(seekerId),\\n \\\":\\\",\\n Strings.toString(power),\\n \\\":\\\",\\n Strings.toHexString(uint256(nonce), 32)\\n );\\n }\\n}\\n\",\"keccak256\":\"0xbd652d364b9b0742083dc6dcce34b58aefddda5335afdcb3f8d42358cb89b18a\",\"license\":\"Apache-2.0\"},\"contracts/SyloToken.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/ERC20.sol\\\";\\n\\ncontract SyloToken is ERC20 {\\n constructor() ERC20(\\\"Sylo\\\", \\\"SYLO\\\") {\\n _mint(msg.sender, 10_000_000_000 ether);\\n }\\n}\\n\",\"keccak256\":\"0x75fda7d129e02669cd691691c14fccd1cdac23b833d7a25e899801865d58ef26\",\"license\":\"Apache-2.0\"},\"contracts/epochs/EpochsManager.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\n\\nimport \\\"../Registries.sol\\\";\\nimport \\\"../staking/Directory.sol\\\";\\nimport \\\"../interfaces/epochs/IEpochsManager.sol\\\";\\nimport \\\"../payments/ticketing/TicketingParameters.sol\\\";\\n\\ncontract EpochsManager is IEpochsManager, Initializable, Ownable2StepUpgradeable, ERC165 {\\n Directory public _directory;\\n\\n Registries public _registries;\\n\\n IERC721 public _rootSeekers;\\n\\n TicketingParameters public _ticketingParameters;\\n\\n /**\\n * @notice Track seekers that have joined for a specific epoch.\\n */\\n mapping(uint256 => mapping(uint256 => address)) public activeSeekers;\\n\\n // Define all Epoch specific parameters here.\\n // When initializing an epoch, these parameters are read,\\n // along with parameters from the other contracts to create the\\n // new epoch.\\n\\n /**\\n * @notice A mapping of all epochs that have been initialized.\\n */\\n mapping(uint256 => Epoch) public epochs;\\n\\n /**\\n * @notice The block number since the first epoch can be initialized.\\n */\\n uint256 public initialEpoch;\\n\\n /**\\n * @notice The duration in blocks an epoch will last for.\\n */\\n uint256 public epochDuration;\\n\\n /**\\n * @notice The value of the integer used as the current\\n * epoch's identifier. This value is incremented as each epoch\\n * is initialized.\\n */\\n uint256 public currentIteration;\\n\\n event NewEpoch(uint256 indexed epochId);\\n event EpochJoined(uint256 indexed epochId, address indexed node, uint256 indexed seekerId);\\n event InitialEpochUpdated(uint256 initialEpoch);\\n event EpochDurationUpdated(uint256 epochDuration);\\n\\n error SeekerOwnerMismatch();\\n error InitialEpochCannotBeZero();\\n error EpochDurationCannotBeZero();\\n error DirectoryCannotBeZeroAddress();\\n error RegistriesCannotBeZeroAddress();\\n error RootSeekerCannotBeZeroAddress();\\n error EpochHasNotEnded(uint256 epochId);\\n error SeekerAccountCannotBeZeroAddress();\\n error TicketingParametersCannotBeZeroAddress();\\n error SeekerAlreadyJoinedEpoch(uint256 epochId, uint256 seekerId);\\n error InitialEpochNotYetReady(uint256 expectedBlock, uint256 currentBlock);\\n\\n function initialize(\\n IERC721 rootSeekers,\\n Directory directory,\\n Registries registries,\\n TicketingParameters ticketingParameters,\\n uint256 _initialEpoch,\\n uint256 _epochDuration\\n ) external initializer {\\n if (address(rootSeekers) == address(0)) {\\n revert RootSeekerCannotBeZeroAddress();\\n }\\n\\n SyloUtils.validateContractInterface(\\n \\\"Directory\\\",\\n address(directory),\\n type(IDirectory).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"Registries\\\",\\n address(registries),\\n type(IRegistries).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"TicketingParameters\\\",\\n address(ticketingParameters),\\n type(ITicketingParameters).interfaceId\\n );\\n\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n _rootSeekers = rootSeekers;\\n _directory = directory;\\n _registries = registries;\\n _ticketingParameters = ticketingParameters;\\n\\n initialEpoch = _initialEpoch;\\n epochDuration = _epochDuration;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IEpochsManager).interfaceId;\\n }\\n\\n /**\\n * @notice Call this to initialize the next epoch. On success, a `NewEpoch` event\\n * will be emitted.\\n * @dev The function will read the current set of network parameters, and store\\n * the parameters in a new Epoch struct. The end block of the current epoch\\n * will also be set to a non-zero value.\\n */\\n function initializeEpoch() external returns (uint256) {\\n if (currentIteration == 0 && initialEpoch > block.number) {\\n revert InitialEpochNotYetReady(initialEpoch, block.number);\\n }\\n\\n Epoch storage current = epochs[currentIteration];\\n\\n uint256 end = current.startBlock + current.duration;\\n if (end > block.number) {\\n revert EpochHasNotEnded(currentIteration);\\n }\\n\\n (\\n uint256 faceValue,\\n uint128 baseLiveWinProb,\\n uint128 expiredWinProb,\\n uint256 ticketDuration,\\n uint32 decayRate\\n ) = _ticketingParameters.getTicketingParameters();\\n\\n uint256 nextEpochId = getNextEpochId();\\n\\n epochs[nextEpochId] = Epoch(\\n block.number,\\n epochDuration,\\n 0,\\n _registries.defaultPayoutPercentage(),\\n decayRate,\\n faceValue,\\n baseLiveWinProb,\\n expiredWinProb,\\n ticketDuration\\n );\\n\\n current.endBlock = block.number;\\n\\n currentIteration = nextEpochId;\\n\\n _directory.setCurrentDirectory(nextEpochId);\\n\\n emit NewEpoch(nextEpochId);\\n\\n return nextEpochId;\\n }\\n\\n /**\\n * @notice Set the first epoch starting block. Only callable by the owner.\\n * @param _initialEpoch The block number when the first epoch can be initialized.\\n */\\n function setInitialEpoch(uint256 _initialEpoch) external onlyOwner {\\n if (_initialEpoch == 0) {\\n revert InitialEpochCannotBeZero();\\n }\\n initialEpoch = _initialEpoch;\\n emit InitialEpochUpdated(_initialEpoch);\\n }\\n\\n /**\\n * @notice Set the epoch duration. Will take effect in the next epoch. Only\\n * callable by the owner.\\n * @param _epochDuration The epoch duration in number of blocks.\\n */\\n function setEpochDuration(uint256 _epochDuration) external onlyOwner {\\n if (_epochDuration == 0) {\\n revert EpochDurationCannotBeZero();\\n }\\n epochDuration = _epochDuration;\\n emit EpochDurationUpdated(epochDuration);\\n }\\n\\n /**\\n * @notice Retrieve the parameters for the current epoch.\\n * @return The current Epoch parameters.\\n */\\n function getCurrentActiveEpoch() external view returns (uint256, Epoch memory) {\\n return (currentIteration, epochs[currentIteration]);\\n }\\n\\n /**\\n * @notice Nodes should call this to join the next epoch. It will\\n * initialize the next reward pool and set the stake for the next directory.\\n * @dev This is a proxy function for `initalizeNextRewardPool` and\\n * `joinNextDirectory`.\\n */\\n function joinNextEpoch() external {\\n Registries.Registry memory registry = _registries.getRegistry(msg.sender);\\n\\n // validate the node's seeker ownership\\n if (registry.seekerAccount == address(0)) {\\n revert SeekerAccountCannotBeZeroAddress();\\n }\\n\\n uint256 seekerId = registry.seekerId;\\n\\n address owner = _rootSeekers.ownerOf(seekerId);\\n if (registry.seekerAccount != owner) {\\n revert SeekerOwnerMismatch();\\n }\\n\\n uint256 nextEpoch = getNextEpochId();\\n if (activeSeekers[nextEpoch][seekerId] != address(0)) {\\n revert SeekerAlreadyJoinedEpoch(nextEpoch, seekerId);\\n }\\n\\n activeSeekers[nextEpoch][seekerId] = msg.sender;\\n\\n _directory._rewardsManager().initializeNextRewardPool(msg.sender);\\n _directory.joinNextDirectory(msg.sender, seekerId);\\n\\n emit EpochJoined(nextEpoch, msg.sender, seekerId);\\n }\\n\\n /**\\n * @notice Retrieve the epoch parameter for the given id.\\n * @param epochId The id of the epoch to retrieve.\\n * @return The epoch parameters associated with the id.\\n */\\n function getEpoch(uint256 epochId) external view returns (Epoch memory) {\\n return epochs[epochId];\\n }\\n\\n /**\\n * @notice Retrieve the integer value that will be used for the\\n * next epoch id.\\n * @return The next epoch id identifier.\\n */\\n function getNextEpochId() public view returns (uint256) {\\n return currentIteration + 1;\\n }\\n}\\n\",\"keccak256\":\"0xc759afdc6022b1490447d2c3c3b4454c59cc86f59fe62cece92764b787a87030\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/IRegistries.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface IRegistries {\\n struct Registry {\\n // Percentage of a tickets value that will be rewarded to\\n // delegated stakers expressed as a fraction of 100000.\\n // This value is currently locked to the default payout percentage\\n // until epochs are implemented.\\n uint32 payoutPercentage;\\n // Public http/s endpoint to retrieve additional metadata\\n // about the node.\\n // The current metadata schema is as follows:\\n // { name: string, multiaddrs: string[] }\\n string publicEndpoint;\\n // The account which owns a seeker that will be used to\\n // operate the Node for this registry.\\n address seekerAccount;\\n // The id of the seeker used to operate the node. The owner\\n // of this id should be the seeker account.\\n uint256 seekerId;\\n }\\n\\n function register(string calldata publicEndpoint) external;\\n\\n function setDefaultPayoutPercentage(uint32 _defaultPayoutPercentage) external;\\n\\n function setSeekerAccount(\\n address seekerAccount,\\n uint256 seekerId,\\n bytes32 nonce,\\n bytes calldata signature\\n ) external;\\n\\n function revokeSeekerAccount(address node) external;\\n\\n function getRegistry(address account) external view returns (Registry memory);\\n\\n function getNodes() external view returns (address[] memory);\\n\\n function getRegistries(\\n uint256 start,\\n uint256 end\\n ) external view returns (address[] memory, Registry[] memory);\\n\\n function getTotalNodes() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x524252752fd14eb66b047848eaaffbc138c6b049f99f2c2f0a5c6a7a4d6e6e36\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/ISeekerPowerOracle.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface ISeekerPowerOracle {\\n function setOracle(address oracle) external;\\n\\n function registerSeekerPowerRestricted(uint256 seekerId, uint256 power) external;\\n\\n function registerSeekerPower(\\n uint256 seekerId,\\n uint256 power,\\n bytes32 nonce,\\n bytes calldata proof\\n ) external;\\n\\n function getSeekerPower(uint256 seekerId) external view returns (uint256);\\n\\n function getProofMessage(\\n uint256 seekerId,\\n uint256 power,\\n bytes32 nonce\\n ) external pure returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x26fb3e81dabde31b8730d4c601c51c881e018b540f19f7c599a8a7f9b8c05523\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/epochs/IEpochsManager.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface IEpochsManager {\\n /**\\n * @dev This struct will hold all network parameters that will be static\\n * for the entire epoch. This value will be stored in a mapping, where the\\n * key is the current epoch id.\\n */\\n struct Epoch {\\n // time related variables\\n uint256 startBlock; // Block the epoch was initialized\\n uint256 duration; // Minimum time epoch will be alive measured in number of blocks\\n uint256 endBlock; // Block the epoch ended (and when the next epoch was initialized)\\n // Zero here represents the epoch has not yet ended.\\n\\n // registry variables\\n uint32 defaultPayoutPercentage;\\n // ticketing variables\\n uint32 decayRate;\\n uint256 faceValue;\\n uint128 baseLiveWinProb;\\n uint128 expiredWinProb;\\n uint256 ticketDuration;\\n }\\n\\n function initializeEpoch() external returns (uint256);\\n\\n function setEpochDuration(uint256 _epochDuration) external;\\n\\n function getCurrentActiveEpoch() external view returns (uint256, Epoch memory);\\n\\n function joinNextEpoch() external;\\n\\n function getEpoch(uint256 epochId) external view returns (Epoch memory);\\n\\n function getNextEpochId() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xeef359833a448742f4eca45ac04eeea0c3e74eb21d3a36bfdae3a1bb7f81e0b5\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/payments/ticketing/IRewardsManager.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface IRewardsManager {\\n /**\\n * @dev This type will hold the necessary information for delegated stakers\\n * to make reward claims against their Node. Every Node will initialize\\n * and store a new Reward Pool for each epoch they participate in.\\n */\\n struct RewardPool {\\n // Tracks the balance of the reward pool owed to the stakers\\n uint256 stakersRewardTotal;\\n // Tracks the block number this reward pool was initialized\\n uint256 initializedAt;\\n // The total active stake for the node for will be the sum of the\\n // stakes owned by its delegators and the node's own stake.\\n uint256 totalActiveStake;\\n // track the cumulative reward factor as of the time the first ticket\\n // for this pool was redeemed\\n int128 initialCumulativeRewardFactor;\\n }\\n\\n struct LastClaim {\\n // The epoch the claim was made.\\n uint256 claimedAt;\\n // The stake at the time the claim was made. This is tracked as\\n // rewards can only be claimed after an epoch has ended, but the\\n // user's stake may have changed by then. This field tracks the\\n // staking value before the change so the reward for that epoch\\n // can be manually calculated.\\n uint256 stake;\\n }\\n\\n function getRewardPool(\\n uint256 epochId,\\n address stakee\\n ) external view returns (RewardPool memory);\\n\\n function getRewardPoolKey(uint256 epochId, address stakee) external pure returns (bytes32);\\n\\n function getRewardPoolStakersTotal(\\n uint256 epochId,\\n address stakee\\n ) external view returns (uint256);\\n\\n function getRewardPoolActiveStake(\\n uint256 epochId,\\n address stakee\\n ) external view returns (uint256);\\n\\n function getPendingRewards(address stakee) external view returns (uint256);\\n\\n function getLastClaim(address stakee, address staker) external view returns (LastClaim memory);\\n\\n function getTotalEpochRewards(uint256 epochId) external view returns (uint256);\\n\\n function getTotalEpochStakingRewards(uint256 epochId) external view returns (uint256);\\n\\n function initializeNextRewardPool(address stakee) external;\\n\\n function incrementRewardPool(address stakee, uint256 amount) external;\\n\\n function claimStakingRewards(address stakee) external returns (uint256);\\n\\n function updatePendingRewards(address stakee, address staker) external;\\n}\\n\",\"keccak256\":\"0x21b8d7f96073802ef4ec87fa15da5fcfd2c1d5e2bf9d6e17583406028e7b31d1\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/payments/ticketing/ITicketingParameters.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface ITicketingParameters {\\n function setFaceValue(uint256 _faceValue) external;\\n\\n function setBaseLiveWinProb(uint128 _baseLiveWinProb) external;\\n\\n function setExpiredWinProb(uint128 _expiredWinProb) external;\\n\\n function setDecayRate(uint32 _decayRate) external;\\n\\n function setTicketDuration(uint256 _ticketDuration) external;\\n\\n function getTicketingParameters()\\n external\\n view\\n returns (uint256, uint128, uint128, uint256, uint32);\\n}\\n\",\"keccak256\":\"0x6fa269d73176bd6543c190b070597fde50b91efdaa724b567bad29c9fbfa908a\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/staking/IDirectory.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface IDirectory {\\n /**\\n * @dev A DirectoryEntry will be stored for every node that joins the\\n * network in a specific epoch. The entry will contain the stakee's\\n * address, and a boundary value which is a sum of the current directory's\\n * total stake, and the current stakee's total stake.\\n */\\n struct DirectoryEntry {\\n address stakee;\\n uint256 boundary;\\n }\\n\\n /**\\n * @dev An EpochDirectory will be stored for every epoch. The\\n * directory will be constructed piece by piece as Nodes join,\\n * each adding their own directory entry based on their current\\n * stake value.\\n */\\n struct EpochDirectory {\\n DirectoryEntry[] entries;\\n mapping(address => uint256) stakes;\\n uint256 totalStake;\\n }\\n\\n function setCurrentDirectory(uint256 epochId) external;\\n\\n function joinNextDirectory(address stakee, uint256 seekerId) external;\\n\\n function scan(uint128 point) external view returns (address stakee);\\n\\n function scanWithEpochId(\\n uint128 point,\\n uint256 epochId\\n ) external view returns (address stakee);\\n\\n function getTotalStakeForStakee(\\n uint256 epochId,\\n address stakee\\n ) external view returns (uint256);\\n\\n function getTotalStake(uint256 epochId) external view returns (uint256);\\n\\n function getEntries(\\n uint256 epochId\\n ) external view returns (address[] memory, uint256[] memory);\\n}\\n\",\"keccak256\":\"0xfacfde1140082a99e6096222a0714bf9e532224a04c594096211c115ab4927f6\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/staking/IStakingManager.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface IStakingManager {\\n /**\\n * For every Node, there will be a mapping of the staker to a\\n * StakeEntry. The stake entry tracks the amount of stake in SOLO,\\n * and also when the stake was updated.\\n */\\n struct StakeEntry {\\n uint256 amount;\\n // Block number this entry was updated at\\n uint256 updatedAt;\\n // Epoch this entry was updated. The stake will become active\\n // in the following epoch\\n uint256 epochId;\\n }\\n\\n /**\\n * Every Node must have stake in order to participate in the Epoch.\\n * Stake can be provided by the Node itself or by other accounts in\\n * the network.\\n */\\n struct Stake {\\n // Track each stake entry associated to a node\\n mapping(address => StakeEntry) stakeEntries;\\n // The total stake held by this contract for a node,\\n // which will be the sum of all addStake and unlockStake calls\\n uint256 totalManagedStake;\\n }\\n\\n /**\\n * This struct will track stake that is in the process of unlocking.\\n */\\n struct Unlock {\\n uint256 amount; // Amount of stake unlocking\\n uint256 unlockAt; // Block number the stake becomes withdrawable\\n }\\n\\n function setUnlockDuration(uint256 _unlockDuration) external;\\n\\n function setMinimumStakeProportion(uint32 _minimumStakeProportion) external;\\n\\n function addStake(uint256 amount, address stakee) external;\\n\\n function unlockStake(uint256 amount, address stakee) external returns (uint256);\\n\\n function withdrawStake(address stakee) external;\\n\\n function cancelUnlocking(uint256 amount, address stakee) external;\\n\\n function calculateCapacityFromSeekerPower(uint256 seekerId) external view returns (uint256);\\n\\n function calculateMaxAdditionalDelegatedStake(address stakee) external view returns (uint256);\\n\\n function getTotalManagedStake() external view returns (uint256);\\n\\n function getStakeEntry(\\n address stakee,\\n address staker\\n ) external view returns (StakeEntry memory);\\n\\n function getStakeeTotalManagedStake(address stakee) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xb3c89c77822db30a1382ec7d11902db579cd48acc36aef965a92b47f8e1164a3\",\"license\":\"Apache-2.0\"},\"contracts/libraries/Manageable.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an list of public managers who may be added or removed.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyManager`, which can be applied to your functions to restrict their use to\\n * other contracts which have explicitly been added.\\n */\\nabstract contract Manageable is Ownable2StepUpgradeable {\\n /**\\n * @dev Tracks the managers added to this contract, where they key is the\\n * address of the managing contract, and the value is the block the manager was added in.\\n * We use this mapping to restrict access to those functions in a similar\\n * fashion to the onlyOwner construct.\\n */\\n mapping(address => uint256) public managers;\\n\\n error OnlyManagers();\\n error ManagerCannotBeZeroAddress();\\n\\n /**\\n * @notice Adds a manager to this contract. Only callable by the owner.\\n * @param manager The address of the manager contract.\\n */\\n function addManager(address manager) external onlyOwner {\\n if (manager == address(0)) {\\n revert ManagerCannotBeZeroAddress();\\n }\\n managers[manager] = block.number;\\n }\\n\\n /**\\n * @notice Removes a manager from this contract. Only callable by the owner.\\n * @param manager The address of the manager contract.\\n */\\n function removeManager(address manager) external onlyOwner {\\n delete managers[manager];\\n }\\n\\n /**\\n * @dev This modifier allows us to specify that certain contracts have\\n * special privileges to call restricted functions.\\n */\\n modifier onlyManager() {\\n if (managers[msg.sender] == 0) {\\n revert OnlyManagers();\\n }\\n _;\\n }\\n\\n // Reserve storage slots for future variables\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xeaf4d3bf238df7e61eaf6903ba7ed54af58a17090fe6197aae3f62d025027db2\",\"license\":\"Apache-2.0\"},\"contracts/libraries/SyloUtils.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/utils/math/SafeCast.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\n\\nerror ContractNameCannotBeEmpty();\\nerror InterfaceIdCannotBeZeroBytes();\\nerror TargetContractCannotBeZeroAddress(string name);\\nerror TargetNotSupportInterface(string name, bytes4 interfaceId);\\n\\nlibrary SyloUtils {\\n /**\\n * @dev The maximum possible SYLO that exists in the network.\\n */\\n uint256 public constant MAX_SYLO = 10_000_000_000 ether;\\n\\n /**\\n * @dev Percentages are expressed as a ratio where 100000 is the denominator.\\n * A large denominator allows for more precision, e.g representing 12.5%\\n * can be done as 12500 / 100000\\n */\\n uint32 public constant PERCENTAGE_DENOMINATOR = 100000;\\n\\n /**\\n * @dev Multiply a value by a given percentage. Converts the provided\\n * uint128 value to uint256 to avoid any reverts on overflow.\\n * @param value The value to multiply.\\n * @param percentage The percentage, as a ratio of 10000.\\n */\\n function percOf(uint128 value, uint32 percentage) internal pure returns (uint256) {\\n return (uint256(value) * percentage) / PERCENTAGE_DENOMINATOR;\\n }\\n\\n /**\\n * @dev Return a fraction as a percentage.\\n * @param numerator The numerator limited to a uint128 value to prevent\\n * phantom overflow.\\n * @param denominator The denominator.\\n * @return The percentage, as a ratio of 10000.\\n */\\n function asPerc(uint128 numerator, uint256 denominator) internal pure returns (uint32) {\\n return SafeCast.toUint32((uint256(numerator) * PERCENTAGE_DENOMINATOR) / denominator);\\n }\\n\\n /**\\n * @dev Validate that a contract implements a given interface.\\n * @param name The name of the contract, used in error messages.\\n * @param target The address of the contract.\\n * @param interfaceId The interface ID to check.\\n */\\n function validateContractInterface(\\n string memory name,\\n address target,\\n bytes4 interfaceId\\n ) internal view {\\n if (bytes(name).length == 0) {\\n revert ContractNameCannotBeEmpty();\\n }\\n if (target == address(0)) {\\n revert TargetContractCannotBeZeroAddress(name);\\n }\\n if (interfaceId == bytes4(0)) {\\n revert InterfaceIdCannotBeZeroBytes();\\n }\\n if (!ERC165(target).supportsInterface(interfaceId)) {\\n revert TargetNotSupportInterface(name, interfaceId);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa5bb1a5b9f8135b5fec1dfa183fab8f6685a4eb6d9daba23864a7d49d01dc8a3\",\"license\":\"Apache-2.0\"},\"contracts/payments/ticketing/RewardsManager.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"abdk-libraries-solidity/ABDKMath64x64.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/math/SafeCast.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\n\\nimport \\\"../../libraries/SyloUtils.sol\\\";\\nimport \\\"../../libraries/Manageable.sol\\\";\\nimport \\\"../../epochs/EpochsManager.sol\\\";\\nimport \\\"../../staking/StakingManager.sol\\\";\\nimport \\\"../../interfaces/epochs/IEpochsManager.sol\\\";\\nimport \\\"../../interfaces/staking/IStakingManager.sol\\\";\\nimport \\\"../../interfaces/payments/ticketing/IRewardsManager.sol\\\";\\n\\n/**\\n * @notice Handles epoch based reward pools that are incremented from redeeming tickets.\\n * Nodes use this contract to set up their reward pool for the next epoch,\\n * and stakers use this contract to track and claim staking rewards.\\n * @dev After deployment, the SyloTicketing contract should be\\n * set up as a manager to be able to call certain restricted functions.\\n */\\ncontract RewardsManager is IRewardsManager, Initializable, Manageable, ERC165 {\\n uint256 internal constant ONE_SYLO = 1 ether;\\n\\n // 64x64 Fixed point representation of 1 SYLO (10**18 >> 64)\\n int128 internal constant ONE_SYLO_FIXED = 18446744073709551616000000000000000000;\\n\\n uint256 internal constant MAX_INT64 = 9223372036854775807;\\n\\n /** ERC20 Sylo token contract. */\\n IERC20 public _token;\\n\\n /** Sylo Staking Manager contract. */\\n StakingManager public _stakingManager;\\n\\n /** Sylo Epochs Manager. */\\n EpochsManager public _epochsManager;\\n\\n /**\\n * @dev Each node will manage a cumulative reward factor (CRF) that is incremented\\n * whenever a ticket is redeemed. This factor acts as a single value\\n * that can be used to calculate any particular staker's reward share. This\\n * prevents the need to individually track each staker's proportion, and also allows\\n * a claim calculation to be performed without iterating through every epoch.\\n *\\n * The CRF is calculated as CRF = CRF + Reward / TotalStake.\\n */\\n mapping(address => int128) private cumulativeRewardFactors;\\n\\n /**\\n * @notice Tracks the last epoch a delegated staker made a reward claim in.\\n * The key to this mapping is a hash of the Node's address and the delegated\\n * stakers address.\\n */\\n mapping(bytes32 => LastClaim) public lastClaims;\\n\\n /**\\n * @notice Tracks each Nodes total pending rewards in SOLOs. This\\n * value is accumulated as Node's redeem tickets. Rewards are pending if the\\n * distribution amongst the stakers has not been accounted for yet. Pending rewards\\n * are transferred to unclaimed rewards once the the staker's share has been\\n * calculated.\\n */\\n mapping(address => uint256) public pendingRewards;\\n\\n /**\\n * @notice Tracks rewards for stakers after the stakers share has been calculated,\\n * but has not actually been claimed by the staker.\\n * The node fee reward is also added to the node's unclaimedStakingRewards.\\n */\\n mapping(bytes32 => uint256) public unclaimedStakingRewards;\\n\\n /**\\n * @notice Tracks each Node's most recently active reward pool\\n */\\n mapping(address => uint256) public latestActiveRewardPools;\\n\\n /**\\n * @notice Tracks total accumulated rewards in each epoch\\n */\\n mapping(uint256 => uint256) public totalEpochRewards;\\n\\n /**\\n * @notice Tracks total accumulated staking rewards in each epoch\\n */\\n mapping(uint256 => uint256) public totalEpochStakingRewards;\\n\\n /**\\n * @notice Tracks each reward pool initialized by a Node. The key to this map\\n * is derived from the epochId and the Node's address.\\n */\\n mapping(bytes32 => RewardPool) public rewardPools;\\n\\n error NoRewardToClaim();\\n error AmountCannotBeZero();\\n error RewardPoolNotExist();\\n error RewardPoolAlreadyExist();\\n error DoNotAllowZeroAddress();\\n error TokenCannotBeZeroAddress();\\n error NoStakeToCreateRewardPool();\\n error StakeeCannotBeZeroAddress();\\n error StakerCannotBeZeroAddress();\\n error StakerKeyCannotBeZeroBytes();\\n error InvalidFixedPointResult();\\n\\n function initialize(\\n IERC20 token,\\n StakingManager stakingManager,\\n EpochsManager epochsManager\\n ) external initializer {\\n if (address(token) == address(0)) {\\n revert TokenCannotBeZeroAddress();\\n }\\n\\n SyloUtils.validateContractInterface(\\n \\\"StakingManager\\\",\\n address(stakingManager),\\n type(IStakingManager).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"EpochsManager\\\",\\n address(epochsManager),\\n type(IEpochsManager).interfaceId\\n );\\n\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n _token = token;\\n _epochsManager = epochsManager;\\n _stakingManager = stakingManager;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IRewardsManager).interfaceId;\\n }\\n\\n /**\\n * @notice Returns the key used to index a reward pool. The key is a hash of\\n * the epochId and Node's address.\\n * @param epochId The epoch ID the reward pool was created in.\\n * @param stakee The address of the Node.\\n * @return A byte-array representing the reward pool key.\\n */\\n function getRewardPoolKey(uint256 epochId, address stakee) public pure returns (bytes32) {\\n return keccak256(abi.encodePacked(epochId, stakee));\\n }\\n\\n /**\\n * @notice Returns the key used to index staking claims. The key is a hash of\\n * the Node's address and the staker's address.\\n * @param stakee The address of the Node.\\n * @param staker The address of the stake.\\n * @return A byte-array representing the key.\\n */\\n function getStakerKey(address stakee, address staker) public pure returns (bytes32) {\\n return keccak256(abi.encodePacked(stakee, staker));\\n }\\n\\n /**\\n * @notice Retrieve the reward pool initialized by the given node, at the specified\\n * epoch.\\n * @param epochId The ID of the epoch the reward pool was initialized in.\\n * @param stakee The address of the Node.\\n * @return The reward pool.\\n */\\n function getRewardPool(\\n uint256 epochId,\\n address stakee\\n ) external view returns (RewardPool memory) {\\n return rewardPools[getRewardPoolKey(epochId, stakee)];\\n }\\n\\n /**\\n * @notice Retrieve the total accumulated reward that will be distributed to a Node's\\n * delegated stakers for a given epoch.\\n * @param epochId The ID of the epoch the reward pool was initialized in.\\n * @param stakee The address of the Node.\\n * @return The total accumulated staker reward in SOLO.\\n */\\n function getRewardPoolStakersTotal(\\n uint256 epochId,\\n address stakee\\n ) external view returns (uint256) {\\n return rewardPools[getRewardPoolKey(epochId, stakee)].stakersRewardTotal;\\n }\\n\\n /**\\n * @notice Retrieve the total active stake that will be used for a Node's reward\\n * pool in a given epoch.\\n * @param epochId The ID of the epoch the reward pool was initialized in.\\n * @param stakee The address of the Node.\\n * @return The total active stake for that reward pool in SOLO.\\n */\\n function getRewardPoolActiveStake(\\n uint256 epochId,\\n address stakee\\n ) external view returns (uint256) {\\n return rewardPools[getRewardPoolKey(epochId, stakee)].totalActiveStake;\\n }\\n\\n /**\\n * @notice Retrieve the total pending staking reward allocated to a Node's\\n * stakers.\\n * @param stakee The address of the Node.\\n * @return The total pending staking reward in SOLO.\\n */\\n function getPendingRewards(address stakee) external view returns (uint256) {\\n return pendingRewards[stakee];\\n }\\n\\n /**\\n * @notice Retrieves the ID of the epoch in which a staker last made their\\n * staking claim.\\n * @param stakee The address of the Node.\\n * @param staker The address of the staker.\\n * @return The ID of the epoch.\\n */\\n function getLastClaim(\\n address stakee,\\n address staker\\n ) external view returns (LastClaim memory) {\\n return lastClaims[getStakerKey(stakee, staker)];\\n }\\n\\n /**\\n * @notice Retrieves the total accumulated rewards for a specific epoch.\\n * @param epochId The epoch id.\\n * @return The total reward in that epoch, including staking rewards and fee\\n * reward.\\n */\\n function getTotalEpochRewards(uint256 epochId) external view returns (uint256) {\\n return totalEpochRewards[epochId];\\n }\\n\\n /**\\n * @notice Retrieves the total accumulated rewards for stakers in a specific epoch.\\n * @param epochId The epoch id.\\n * @return The total staking reward in that epoch.\\n */\\n function getTotalEpochStakingRewards(uint256 epochId) external view returns (uint256) {\\n return totalEpochStakingRewards[epochId];\\n }\\n\\n /**\\n * @notice This is used by Nodes to initialize their reward pool for\\n * the next epoch. This function will revert if the caller has no stake, or\\n * if the reward pool has already been initialized. The total active stake\\n * for the next reward pool is calculated by summing up the total managed\\n * stake held by the RewardsManager contract.\\n */\\n function initializeNextRewardPool(address stakee) external onlyManager {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n\\n uint256 nextEpochId = _epochsManager.getNextEpochId();\\n\\n RewardPool storage nextRewardPool = rewardPools[getRewardPoolKey(nextEpochId, stakee)];\\n if (nextRewardPool.initializedAt != 0) {\\n revert RewardPoolAlreadyExist();\\n }\\n\\n uint256 totalStake = _stakingManager.getStakeeTotalManagedStake(stakee);\\n if (totalStake == 0) {\\n revert NoStakeToCreateRewardPool();\\n }\\n\\n nextRewardPool.totalActiveStake = totalStake;\\n\\n nextRewardPool.initializedAt = block.number;\\n }\\n\\n /**\\n * @dev This function should be called by the Ticketing contract when a\\n * ticket is successfully redeemed. The face value of the ticket\\n * should be split between incrementing the node's reward balance,\\n * and the reward balance for the node's delegated stakers. The face value\\n * will be added to the current reward pool's balance. This function will\\n * fail if the Ticketing contract has not been set as a manager.\\n * @param stakee The address of the Node.\\n * @param amount The face value of the ticket in SOLO.\\n */\\n function incrementRewardPool(address stakee, uint256 amount) external onlyManager {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n if (amount == 0) {\\n revert AmountCannotBeZero();\\n }\\n\\n (uint256 epochId, IEpochsManager.Epoch memory currentEpoch) = _epochsManager\\n .getCurrentActiveEpoch();\\n\\n RewardPool storage rewardPool = rewardPools[getRewardPoolKey(epochId, stakee)];\\n if (rewardPool.initializedAt == 0) {\\n revert RewardPoolNotExist();\\n }\\n\\n // Update the latest active reward pool for the node to be this pool\\n if (latestActiveRewardPools[stakee] < epochId) {\\n latestActiveRewardPools[stakee] = epochId;\\n }\\n\\n uint256 stakersReward = SyloUtils.percOf(\\n SafeCast.toUint128(amount),\\n currentEpoch.defaultPayoutPercentage\\n );\\n\\n // transfer the node's fee reward to it's unclaimed reward value\\n unclaimedStakingRewards[getStakerKey(stakee, stakee)] =\\n unclaimedStakingRewards[getStakerKey(stakee, stakee)] +\\n (amount - stakersReward);\\n\\n // update the value of the reward owed to the stakers\\n pendingRewards[stakee] = pendingRewards[stakee] + stakersReward;\\n\\n // if this is the first ticket redeemed for this reward, set the initial\\n // CRF value for this pool\\n if (rewardPool.stakersRewardTotal == 0) {\\n rewardPool.initialCumulativeRewardFactor = cumulativeRewardFactors[stakee];\\n }\\n\\n rewardPool.stakersRewardTotal = rewardPool.stakersRewardTotal + stakersReward;\\n\\n // We preemptively prevent an overflow revert with the abdk library.\\n // Dividing the stakers reward with the pool's total active\\n // stake may produce a value that is greater than the maximum possible\\n // 64.64 fixed point value.\\n // This error is incredibly niche and unlikely to happen, so we just\\n // revert here as well (with a named error) and remediation involves\\n // just increasing the amount of stake a node has.\\n if (rewardPool.totalActiveStake * MAX_INT64 < stakersReward) {\\n revert InvalidFixedPointResult();\\n }\\n\\n cumulativeRewardFactors[stakee] = ABDKMath64x64.add(\\n cumulativeRewardFactors[stakee],\\n ABDKMath64x64.div(\\n toFixedPointSYLO(stakersReward),\\n toFixedPointSYLO(rewardPool.totalActiveStake)\\n )\\n );\\n\\n totalEpochRewards[epochId] = totalEpochRewards[epochId] + amount;\\n totalEpochStakingRewards[epochId] = totalEpochStakingRewards[epochId] + stakersReward;\\n }\\n\\n /**\\n * @dev This function utilizes the cumulative reward factors, and the staker's\\n * value in stake to calculate the staker's share of the pending reward.\\n */\\n function calculatePendingClaim(\\n bytes32 stakerKey,\\n address stakee,\\n address staker\\n ) internal view returns (uint256) {\\n uint256 claim = calculateInitialClaim(stakerKey, stakee);\\n\\n // find the first reward pool where their stake was active and had\\n // generated rewards\\n uint256 activeAt;\\n RewardPool memory initialActivePool;\\n\\n uint256 currentEpochId = _epochsManager.currentIteration();\\n\\n for (uint256 i = lastClaims[stakerKey].claimedAt + 1; i < currentEpochId; ++i) {\\n initialActivePool = rewardPools[getRewardPoolKey(i, stakee)];\\n // check if node initialized a reward pool for this epoch and\\n // gained rewards\\n if (initialActivePool.initializedAt > 0 && initialActivePool.stakersRewardTotal > 0) {\\n activeAt = i;\\n break;\\n }\\n }\\n\\n if (activeAt == 0) {\\n return claim;\\n }\\n\\n IStakingManager.StakeEntry memory stakeEntry = _stakingManager.getStakeEntry(\\n stakee,\\n staker\\n );\\n\\n // We convert the staker amount to SYLO as the maximum uint256 value that\\n // can be used for the fixed point representation is 2^64-1.\\n int128 initialStake = toFixedPointSYLO(stakeEntry.amount);\\n\\n int128 initialCumulativeRewardFactor = initialActivePool.initialCumulativeRewardFactor;\\n\\n int128 finalCumulativeRewardFactor = getFinalCumulativeRewardFactor(\\n stakee,\\n currentEpochId\\n );\\n\\n return\\n claim +\\n fromFixedPointSYLO(\\n ABDKMath64x64.mul(\\n initialStake,\\n ABDKMath64x64.sub(finalCumulativeRewardFactor, initialCumulativeRewardFactor)\\n )\\n );\\n }\\n\\n /**\\n * Manually calculates the reward claim for the first epoch the claim is being\\n * made for. This manual calculation is necessary as claims are only made up\\n * to the previous epoch.\\n */\\n function calculateInitialClaim(\\n bytes32 stakerKey,\\n address stakee\\n ) internal view returns (uint256) {\\n LastClaim memory lastClaim = lastClaims[stakerKey];\\n\\n // if we have already made a claim up to the previous epoch, then\\n // there is no need to calculate the initial claim\\n if (_epochsManager.currentIteration() == lastClaim.claimedAt) {\\n return 0;\\n }\\n\\n RewardPool memory firstRewardPool = rewardPools[\\n getRewardPoolKey(lastClaim.claimedAt, stakee)\\n ];\\n\\n // if there was no reward pool initialized for the first epoch,\\n // then there is no need to calculate the initial claim\\n if (firstRewardPool.totalActiveStake == 0) {\\n return 0;\\n }\\n\\n return\\n (firstRewardPool.stakersRewardTotal * lastClaim.stake) /\\n firstRewardPool.totalActiveStake;\\n }\\n\\n /**\\n * Determines the cumulative reward factor to use for claim calculations. The\\n * CRF will depend on when the Node last initialized a reward pool, and also when\\n * the staker last made their claim.\\n */\\n function getFinalCumulativeRewardFactor(\\n address stakee,\\n uint256 currentEpochId\\n ) internal view returns (int128) {\\n int128 finalCumulativeRewardFactor;\\n\\n // Get the cumulative reward factor for the Node\\n // for the start of this epoch, since we only perform\\n // calculations up to the end of the previous epoch.\\n if (latestActiveRewardPools[stakee] < currentEpochId) {\\n // If the Node has not been active, then the final\\n // cumulative reward factor will just be the current one.\\n finalCumulativeRewardFactor = cumulativeRewardFactors[stakee];\\n } else {\\n // We are calculating the claim for an active epoch, the\\n // final cumulative reward factor will be taken from the start of this\\n // epoch (end of previous epoch).\\n RewardPool storage latestRewardPool = rewardPools[\\n getRewardPoolKey(latestActiveRewardPools[stakee], stakee)\\n ];\\n finalCumulativeRewardFactor = latestRewardPool.initialCumulativeRewardFactor;\\n }\\n\\n return finalCumulativeRewardFactor;\\n }\\n\\n /**\\n * @notice Call this function to calculate the total reward owed to a staker.\\n * This value will include all epochs since the last claim was made up to\\n * the previous epoch. This will also add any pending rewards to the\\n * final value as well.\\n * @dev This function will utilize the cumulative reward factor to perform the\\n * calculation, keeping the gas cost scaling of this function to a constant value.\\n * @param stakee The address of the Node.\\n * @param staker The address of the staker.\\n * @return The value of the reward owed to the staker in SOLO.\\n */\\n function calculateStakerClaim(address stakee, address staker) public view returns (uint256) {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n if (staker == address(0)) {\\n revert StakerCannotBeZeroAddress();\\n }\\n\\n bytes32 stakerKey = getStakerKey(stakee, staker);\\n uint256 pendingClaim = calculatePendingClaim(stakerKey, stakee, staker);\\n\\n return pendingClaim + unclaimedStakingRewards[stakerKey];\\n }\\n\\n /**\\n * Helper function to convert a uint256 value in SOLOs to a 64.64 fixed point\\n * representation in SYLOs while avoiding any possibility of overflow.\\n * Any remainders from converting SOLO to SYLO is explicitly handled to mitigate\\n * precision loss. The error when using this function is [-1/2^64, 0].\\n */\\n function toFixedPointSYLO(uint256 amount) internal pure returns (int128) {\\n int128 fullSylos = ABDKMath64x64.fromUInt(amount / ONE_SYLO);\\n int128 fracSylos = ABDKMath64x64.fromUInt(amount % ONE_SYLO); // remainder\\n\\n return ABDKMath64x64.add(fullSylos, ABDKMath64x64.div(fracSylos, ONE_SYLO_FIXED));\\n }\\n\\n /**\\n * Helper function to convert a 64.64 fixed point value in SYLOs to a uint256\\n * representation in SOLOs while avoiding any possibility of overflow.\\n */\\n function fromFixedPointSYLO(int128 amount) internal pure returns (uint256) {\\n uint256 fullSylos = ABDKMath64x64.toUInt(amount);\\n uint256 fullSolos = fullSylos * ONE_SYLO;\\n\\n // calculate the value lost when converting the fixed point amount to a uint\\n int128 fracSylos = ABDKMath64x64.sub(amount, ABDKMath64x64.fromUInt(fullSylos));\\n uint256 fracSolos = ABDKMath64x64.toUInt(ABDKMath64x64.mul(fracSylos, ONE_SYLO_FIXED));\\n\\n return fullSolos + fracSolos;\\n }\\n\\n /**\\n * @notice Call this function to claim rewards as a staker. The\\n * SYLO tokens will be transferred to the caller's account. This function will\\n * fail if there exists no reward to claim. Note: Calling this will remove\\n * the current unclaimed reward from being used as stake in the next round.\\n * @param stakee The address of the Node to claim against.\\n */\\n function claimStakingRewards(address stakee) external returns (uint256) {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n\\n bytes32 stakerKey = getStakerKey(stakee, msg.sender);\\n uint256 pendingReward = calculatePendingClaim(stakerKey, stakee, msg.sender);\\n\\n uint256 totalClaim = pendingReward + unclaimedStakingRewards[stakerKey];\\n if (totalClaim == 0) {\\n revert NoRewardToClaim();\\n }\\n\\n delete unclaimedStakingRewards[stakerKey];\\n pendingRewards[stakee] = pendingRewards[stakee] - pendingReward;\\n\\n updateLastClaim(stakee, msg.sender);\\n\\n SafeERC20.safeTransfer(_token, msg.sender, totalClaim);\\n\\n return totalClaim;\\n }\\n\\n /**\\n * @notice This is called by the staking manager to transfer pending rewards\\n * to unclaimed rewards for a staker. This is required as the last used CRF\\n * needs to be updated whenever stake changes.\\n */\\n function updatePendingRewards(address stakee, address staker) external onlyManager {\\n bytes32 stakerKey = getStakerKey(stakee, staker);\\n uint256 pendingReward = calculatePendingClaim(stakerKey, stakee, staker);\\n\\n pendingRewards[stakee] = pendingRewards[stakee] - pendingReward;\\n\\n unclaimedStakingRewards[stakerKey] = unclaimedStakingRewards[stakerKey] + pendingReward;\\n\\n updateLastClaim(stakee, staker);\\n }\\n\\n function updateLastClaim(address stakee, address staker) internal {\\n IStakingManager.StakeEntry memory stakeEntry = _stakingManager.getStakeEntry(\\n stakee,\\n staker\\n );\\n lastClaims[getStakerKey(stakee, staker)] = LastClaim(\\n _epochsManager.currentIteration(),\\n stakeEntry.amount\\n );\\n }\\n}\\n\",\"keccak256\":\"0x906af015c975637b6a99d70795b0652f6e28aaa66e5c64a4bae34bff14c99551\",\"license\":\"Apache-2.0\"},\"contracts/payments/ticketing/TicketingParameters.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\n\\nimport \\\"../../libraries/SyloUtils.sol\\\";\\nimport \\\"../../interfaces/payments/ticketing/ITicketingParameters.sol\\\";\\n\\n/**\\n * @dev Persists the parameters for the ticketing mechanism. This contract is\\n * read by the EpochManager. Extracting the parameters into another\\n * contract is necessary to avoid a cyclic dependency between the ticketing\\n * and epoch contracts.\\n */\\ncontract TicketingParameters is\\n ITicketingParameters,\\n Initializable,\\n Ownable2StepUpgradeable,\\n ERC165\\n{\\n /** @notice The value of a winning ticket in SOLO. */\\n uint256 public faceValue;\\n\\n /**\\n * @notice The probability of a ticket winning during the start of its lifetime.\\n * This is a uint128 value representing the numerator in the probability\\n * ratio where 2^128 - 1 is the denominator.\\n */\\n uint128 public baseLiveWinProb;\\n\\n /**\\n * @notice The probability of a ticket winning after it has expired.\\n * This is a uint128 value representing the numerator in the probability\\n * ratio where 2^128 - 1 is the denominator. Note: Redeeming expired\\n * tickets is currently not supported.\\n */\\n uint128 public expiredWinProb;\\n\\n /**\\n * @notice The length in blocks before a ticket is considered expired.\\n * The default initialization value is 80,000. This equates\\n * to roughly two weeks (15s per block).\\n */\\n uint256 public ticketDuration;\\n\\n /**\\n * @notice A percentage value representing the proportion of the base win\\n * probability that will be decayed once a ticket has expired.\\n * Example: 80% decayRate indicates that a ticket will decay down to 20% of its\\n * base win probability upon reaching the block before its expiry.\\n * The value is expressed as a fraction of 100000.\\n */\\n uint32 public decayRate;\\n\\n event FaceValueUpdated(uint256 faceValue);\\n event BaseLiveWinProbUpdated(uint128 baseLiveWinprob);\\n event ExpiredWinProbUpdated(uint128 expiredWinProb);\\n event TicketDurationUpdated(uint256 ticketDuration);\\n event DecayRateUpdated(uint32 decayRate);\\n\\n error FaceValueCannotBeZero();\\n error TicketDurationCannotBeZero();\\n\\n function initialize(\\n uint256 _faceValue,\\n uint128 _baseLiveWinProb,\\n uint128 _expiredWinProb,\\n uint32 _decayRate,\\n uint256 _ticketDuration\\n ) external initializer {\\n if (_faceValue == 0) {\\n revert FaceValueCannotBeZero();\\n }\\n if (_ticketDuration == 0) {\\n revert TicketDurationCannotBeZero();\\n }\\n\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n faceValue = _faceValue;\\n baseLiveWinProb = _baseLiveWinProb;\\n expiredWinProb = _expiredWinProb;\\n decayRate = _decayRate;\\n ticketDuration = _ticketDuration;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(ITicketingParameters).interfaceId;\\n }\\n\\n /**\\n * @notice Set the face value for tickets in SOLO. Only callable by\\n * the contract owner.\\n * @param _faceValue The face value to set in SOLO.\\n */\\n function setFaceValue(uint256 _faceValue) external onlyOwner {\\n if (_faceValue == 0) {\\n revert FaceValueCannotBeZero();\\n }\\n\\n faceValue = _faceValue;\\n emit FaceValueUpdated(_faceValue);\\n }\\n\\n /**\\n * @notice Set the base live win probability of a ticket. Only callable by\\n * the contract owner.\\n * @param _baseLiveWinProb The probability represented as a value\\n * between 0 to 2**128 - 1.\\n */\\n function setBaseLiveWinProb(uint128 _baseLiveWinProb) external onlyOwner {\\n baseLiveWinProb = _baseLiveWinProb;\\n emit BaseLiveWinProbUpdated(_baseLiveWinProb);\\n }\\n\\n /**\\n * @notice Set the expired win probability of a ticket. Only callable by\\n * the contract owner.\\n * @param _expiredWinProb The probability represented as a value\\n * between 0 to 2**128 - 1.\\n */\\n function setExpiredWinProb(uint128 _expiredWinProb) external onlyOwner {\\n expiredWinProb = _expiredWinProb;\\n emit ExpiredWinProbUpdated(_expiredWinProb);\\n }\\n\\n /**\\n * @notice Set the decay rate of a ticket. Only callable by the\\n * the contract owner.\\n * @param _decayRate The decay rate as a percentage, where the\\n * denominator is 10000.\\n */\\n function setDecayRate(uint32 _decayRate) external onlyOwner {\\n decayRate = _decayRate;\\n emit DecayRateUpdated(_decayRate);\\n }\\n\\n /**\\n * @notice Set the ticket duration of a ticket. Only callable by the\\n * contract owner.\\n * @param _ticketDuration The duration of a ticket in number of blocks.\\n */\\n function setTicketDuration(uint256 _ticketDuration) external onlyOwner {\\n if (_ticketDuration == 0) {\\n revert TicketDurationCannotBeZero();\\n }\\n\\n ticketDuration = _ticketDuration;\\n emit TicketDurationUpdated(_ticketDuration);\\n }\\n\\n /**\\n * @notice Retrieve the current ticketing parameters.\\n * @return faceValue The face value of a ticket in SOLO.\\n * @return baseLiveWinProb The base live win probability of a ticket.\\n * @return expiredWinProb The expired win probability of a ticket.\\n * @return ticketDuration The duration of a ticket in number of blocks.\\n * @return decayRate The decay rate of a ticket.\\n */\\n function getTicketingParameters()\\n external\\n view\\n returns (uint256, uint128, uint128, uint256, uint32)\\n {\\n return (faceValue, baseLiveWinProb, expiredWinProb, ticketDuration, decayRate);\\n }\\n}\\n\",\"keccak256\":\"0x44b4c2eb70c0583f888ff8fca7ad21b084b6c58a453b7dd914275ccabed98ec0\",\"license\":\"Apache-2.0\"},\"contracts/staking/Directory.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/utils/math/Math.sol\\\";\\n\\nimport \\\"./StakingManager.sol\\\";\\nimport \\\"../libraries/SyloUtils.sol\\\";\\nimport \\\"../libraries/Manageable.sol\\\";\\nimport \\\"../interfaces/staking/IDirectory.sol\\\";\\nimport \\\"../payments/ticketing/RewardsManager.sol\\\";\\n\\n/**\\n * @notice The Directory contract constructs and manages a structure holding the current stakes,\\n * which is queried against using the scan function. The scan function allows submitting\\n * random points which will return a staked node's address in proportion to the stake it has.\\n */\\ncontract Directory is IDirectory, Initializable, Manageable, IERC165 {\\n /** Sylo Staking Manager contract */\\n StakingManager public _stakingManager;\\n\\n /** Sylo Rewards Manager contract */\\n RewardsManager public _rewardsManager;\\n\\n /**\\n * @notice The epoch ID of the current directory.\\n */\\n uint256 public currentDirectory;\\n\\n /**\\n * @notice Tracks every directory, which will be indexed by an epoch ID\\n */\\n mapping(uint256 => EpochDirectory) public directories;\\n\\n event CurrentDirectoryUpdated(uint256 indexed currentDirectory);\\n\\n error NoStakeToJoinEpoch();\\n error StakeeAlreadyJoinedEpoch();\\n error StakeeCannotBeZeroAddress();\\n error NoJoiningStakeToJoinEpoch();\\n\\n function initialize(\\n StakingManager stakingManager,\\n RewardsManager rewardsManager\\n ) external initializer {\\n SyloUtils.validateContractInterface(\\n \\\"StakingManager\\\",\\n address(stakingManager),\\n type(IStakingManager).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"RewardsManager\\\",\\n address(rewardsManager),\\n type(IRewardsManager).interfaceId\\n );\\n\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n _stakingManager = stakingManager;\\n _rewardsManager = rewardsManager;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IDirectory).interfaceId;\\n }\\n\\n /**\\n * @notice This function should be called when a new epoch is initialized.\\n * This will set the current directory to the specified epoch. This is only\\n * callable by the owner of this contract, which should be the EpochsManager\\n * contract.\\n * @dev After deployment, the EpochsManager should immediately be set as\\n * the owner.\\n * @param epochId The ID of the specified epoch.\\n */\\n function setCurrentDirectory(uint256 epochId) external onlyManager {\\n currentDirectory = epochId;\\n emit CurrentDirectoryUpdated(epochId);\\n }\\n\\n /**\\n * @notice This function is called by the epochs manager as a prerequisite to when the node joins the next epoch.\\n * @param stakee The address of the node.\\n * @param seekerId The seekerId of the Seeker that the node is\\n * registered with when joining the epoch. It is used to determine the nodes\\n * staking capacity based on its seeker power.\\n *\\n * @dev This will construct the directory as nodes join. The directory is constructed\\n * by creating a boundary value which is a sum of the current directory's total stake, and\\n * the current stakee's total stake, and pushing the new boundary into the entries array.\\n * The previous boundary and the current boundary essentially create a range, where if a\\n * random point were to fall within that range, it would belong to the respective stakee.\\n * The boundary value grows in size as each stakee joins, thus the directory array\\n * always remains sorted. This allows us to perform a binary search on the directory.\\n *\\n * Example\\n *\\n * Stakes: [ Alice/20, Bob/10, Carl/40, Dave/25 ]\\n * TotalStake: 95\\n *\\n * EpochDirectory:\\n *\\n * |-----------|------|----------------|--------|\\n * Alice/20 Bob/30 Carl/70 Dave/95\\n *\\n * The amount of stake that a node will join a directory with is dependent on its\\n * different capacity values. There are two distinct capacity values, one\\n * calculated from the seeker power, and another from the minimum stake\\n * proportion. The final staking amount will not exceed either capacities,\\n * and in the case that the current total stake exceeds both, then the final\\n * will be the minimum of the two values.\\n */\\n function joinNextDirectory(address stakee, uint256 seekerId) external onlyManager {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n\\n uint256 nextEpochId = currentDirectory + 1;\\n\\n uint256 totalStake = _stakingManager.getStakeeTotalManagedStake(stakee);\\n if (totalStake == 0) {\\n revert NoStakeToJoinEpoch();\\n }\\n\\n // staking capacity based on seeker power\\n uint256 seekerStakingCapacity = _stakingManager.calculateCapacityFromSeekerPower(seekerId);\\n\\n // staking capacity based on the min staking proportion constant\\n uint256 minProportionStakingCapacity = _stakingManager.calculateCapacityFromMinStakingProportion(stakee);\\n\\n uint256 joiningStake;\\n if (totalStake > seekerStakingCapacity && totalStake > minProportionStakingCapacity) {\\n joiningStake = Math.min(seekerStakingCapacity, minProportionStakingCapacity);\\n } else if (totalStake > seekerStakingCapacity) {\\n joiningStake = seekerStakingCapacity;\\n } else if (totalStake > minProportionStakingCapacity) {\\n joiningStake = minProportionStakingCapacity;\\n } else { // uncapped\\n joiningStake = totalStake;\\n }\\n\\n if (joiningStake == 0) {\\n revert NoJoiningStakeToJoinEpoch();\\n }\\n\\n if (directories[nextEpochId].stakes[stakee] > 0) {\\n revert StakeeAlreadyJoinedEpoch();\\n }\\n\\n uint256 nextBoundary = directories[nextEpochId].totalStake + joiningStake;\\n\\n directories[nextEpochId].entries.push(DirectoryEntry(stakee, nextBoundary));\\n directories[nextEpochId].stakes[stakee] = joiningStake;\\n directories[nextEpochId].totalStake = nextBoundary;\\n }\\n\\n /**\\n * @notice Call this to perform a stake-weighted scan to find the Node assigned\\n * to the given point of the current directory.\\n * @param point The point, which will usually be a hash of a public key.\\n */\\n function scan(uint128 point) external view returns (address stakee) {\\n return _scan(point, currentDirectory);\\n }\\n\\n /**\\n * @notice Call this to perform a stake-weighted scan to find the Node assigned\\n * to the given point of the requested directory.\\n * @param point The point, which will usually be a hash of a public key.\\n * @param epochId The epoch id associated with the directory to scan.\\n */\\n function scanWithEpochId(\\n uint128 point,\\n uint256 epochId\\n ) external view returns (address stakee) {\\n return _scan(point, epochId);\\n }\\n\\n /**\\n * @notice Call this to perform a stake-weighted scan to find the Node assigned\\n * to the given point of the requested directory (internal).\\n * @dev The current implementation will perform a binary search through\\n * the directory. This can allow gas costs to be low if this needs to be\\n * used in a transaction.\\n * @param point The point, which will usually be a hash of a public key.\\n * @param epochId The epoch id associated with the directory to scan.\\n */\\n function _scan(uint128 point, uint256 epochId) internal view returns (address stakee) {\\n uint256 entryLength = directories[epochId].entries.length;\\n\\n if (entryLength == 0) {\\n return address(0);\\n }\\n\\n // Staking all the Sylo would only be 94 bits, so multiplying this with\\n // a uint128 cannot overflow a uint256.\\n uint256 expectedVal = (directories[epochId].totalStake * uint256(point)) >> 128;\\n\\n uint256 left;\\n uint256 right = entryLength - 1;\\n\\n // perform a binary search through the directory\\n uint256 lower;\\n uint256 upper;\\n uint256 index;\\n\\n while (left <= right) {\\n index = (left + right) >> 1;\\n\\n lower = index == 0 ? 0 : directories[epochId].entries[index - 1].boundary;\\n upper = directories[epochId].entries[index].boundary;\\n\\n if (expectedVal >= lower && expectedVal < upper) {\\n return directories[epochId].entries[index].stakee;\\n } else if (expectedVal < lower) {\\n right = index - 1;\\n } else {\\n // expectedVal >= upper\\n left = index + 1;\\n }\\n }\\n }\\n\\n /**\\n * @notice Retrieve the total stake a Node has for the directory in the\\n * specified epoch.\\n * @param epochId The ID of the epoch.\\n * @param stakee The address of the Node.\\n * @return The amount of stake the Node has for the given directory in SOLO.\\n */\\n function getTotalStakeForStakee(\\n uint256 epochId,\\n address stakee\\n ) external view returns (uint256) {\\n return directories[epochId].stakes[stakee];\\n }\\n\\n /**\\n * @notice Retrieve the total stake for a directory in the specified epoch, which\\n * will be the sum of the stakes for all Nodes participating in that epoch.\\n * @param epochId The ID of the epoch.\\n * @return The total amount of stake in SOLO.\\n */\\n function getTotalStake(uint256 epochId) external view returns (uint256) {\\n return directories[epochId].totalStake;\\n }\\n\\n /**\\n * @notice Retrieve all entries for a directory in a specified epoch.\\n * @return An array of all the directory entries.\\n */\\n function getEntries(\\n uint256 epochId\\n ) external view returns (address[] memory, uint256[] memory) {\\n uint256 entryLength = directories[epochId].entries.length;\\n\\n address[] memory stakees = new address[](entryLength);\\n uint256[] memory boundaries = new uint256[](entryLength);\\n\\n DirectoryEntry memory entry;\\n DirectoryEntry[] memory entries = directories[epochId].entries;\\n\\n for (uint256 i; i < entryLength; ++i) {\\n entry = entries[i];\\n stakees[i] = entry.stakee;\\n boundaries[i] = entry.boundary;\\n }\\n return (stakees, boundaries);\\n }\\n}\\n\",\"keccak256\":\"0x98a344ba0403e7c5e92fe89a67799ec6583767bfa82a76e66c3b6e84ce519e59\",\"license\":\"Apache-2.0\"},\"contracts/staking/StakingManager.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\n\\nimport \\\"../SyloToken.sol\\\";\\nimport \\\"../libraries/SyloUtils.sol\\\";\\nimport \\\"../SeekerPowerOracle.sol\\\";\\nimport \\\"../epochs/EpochsManager.sol\\\";\\nimport \\\"../payments/ticketing/RewardsManager.sol\\\";\\nimport \\\"../interfaces/staking/IStakingManager.sol\\\";\\n\\n/**\\n * @notice Manages stakes and delegated stakes for Nodes. Holding\\n * staked Sylo is necessary for a Node to participate in the\\n * Sylo Network. The stake is used in stake-weighted scan function,\\n * and delegated stakers are rewarded on a pro-rata basis.\\n */\\ncontract StakingManager is IStakingManager, Initializable, Ownable2StepUpgradeable, ERC165 {\\n /** ERC 20 compatible token we are dealing with */\\n IERC20 public _token;\\n\\n /**\\n * @notice Rewards Manager contract. Any changes to stake will automatically\\n * trigger a claim to any outstanding rewards.\\n */\\n RewardsManager public _rewardsManager;\\n\\n EpochsManager public _epochsManager;\\n\\n SeekerPowerOracle public _seekerPowerOracle;\\n\\n /**\\n * @notice Tracks the managed stake for every Node.\\n */\\n mapping(address => Stake) public stakes;\\n\\n /** @notice Tracks overall total stake held by this contract */\\n uint256 public totalManagedStake;\\n\\n /**\\n * @notice Tracks funds that are in the process of being unlocked. This\\n * is indexed by a key that hashes both the address of the staked Node and\\n * the address of the staker.\\n */\\n mapping(bytes32 => Unlock) public unlockings;\\n\\n /**\\n * @notice The number of blocks a user must wait after calling \\\"unlock\\\"\\n * before they can withdraw their stake\\n */\\n uint256 public unlockDuration;\\n\\n /**\\n * @notice Minimum amount of stake that a Node needs to stake\\n * against itself in order to participate in the network. This is\\n * represented as a percentage of the Node's total stake, where\\n * the value is a ratio of 10000.\\n */\\n uint32 public minimumStakeProportion;\\n\\n /**\\n * @notice The multiplier used in determining a Seeker's staking\\n * capacity based on its power level.\\n */\\n uint256 public seekerPowerMultiplier;\\n\\n event UnlockDurationUpdated(uint256 unlockDuration);\\n event MinimumStakeProportionUpdated(uint256 minimumStakeProportion);\\n\\n error NoStakeToUnlock();\\n error StakeNotYetUnlocked();\\n error CannotStakeZeroAmount();\\n error CannotUnlockZeroAmount();\\n error TokenCannotBeZeroAddress();\\n error StakeeCannotBeZeroAddress();\\n error UnlockDurationCannotBeZero();\\n error CannotCancelUnlockZeroAmount();\\n error CannotUnlockMoreThanStaked(uint256 stakeAmount, uint256 unlockAmount);\\n error StakeCapacityReached(uint256 maxCapacity, uint256 currentCapacity);\\n error SeekerPowerNotRegistered(uint256 seekerId);\\n\\n function initialize(\\n IERC20 token,\\n RewardsManager rewardsManager,\\n EpochsManager epochsManager,\\n SeekerPowerOracle seekerPowerOracle,\\n uint256 _unlockDuration,\\n uint32 _minimumStakeProportion,\\n uint256 _seekerPowerMultiplier\\n ) external initializer {\\n if (address(token) == address(0)) {\\n revert TokenCannotBeZeroAddress();\\n }\\n\\n SyloUtils.validateContractInterface(\\n \\\"RewardsManager\\\",\\n address(rewardsManager),\\n type(IRewardsManager).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"EpochsManager\\\",\\n address(epochsManager),\\n type(IEpochsManager).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"SeekerPowerOracle\\\",\\n address(seekerPowerOracle),\\n type(ISeekerPowerOracle).interfaceId\\n );\\n\\n if (_unlockDuration == 0) {\\n revert UnlockDurationCannotBeZero();\\n }\\n\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n _token = token;\\n _rewardsManager = rewardsManager;\\n _epochsManager = epochsManager;\\n _seekerPowerOracle = seekerPowerOracle;\\n unlockDuration = _unlockDuration;\\n minimumStakeProportion = _minimumStakeProportion;\\n seekerPowerMultiplier = _seekerPowerMultiplier;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IStakingManager).interfaceId;\\n }\\n\\n /**\\n * @notice Sets the unlock duration for stakes. Only callable by\\n * the owner.\\n * @param _unlockDuration The unlock duration in number of blocks.\\n */\\n function setUnlockDuration(uint256 _unlockDuration) external onlyOwner {\\n if (_unlockDuration == 0) {\\n revert UnlockDurationCannotBeZero();\\n }\\n\\n unlockDuration = _unlockDuration;\\n emit UnlockDurationUpdated(_unlockDuration);\\n }\\n\\n /**\\n * @notice Sets the minimum stake proportion for Nodes. Only callable by\\n * the owner.\\n * @param _minimumStakeProportion The minimum stake proportion in SOLO.\\n */\\n function setMinimumStakeProportion(uint32 _minimumStakeProportion) external onlyOwner {\\n minimumStakeProportion = _minimumStakeProportion;\\n emit MinimumStakeProportionUpdated(_minimumStakeProportion);\\n }\\n\\n /**\\n * @notice Called by Nodes and delegated stakers to add stake.\\n * This function will fail under the following conditions:\\n * - If the Node address is invalid\\n * - If the specified stake value is zero\\n * - If the additional stake causes the Node to fail to meet the\\n * minimum stake proportion requirement.\\n * @param amount The amount of stake to add in SOLO.\\n * @param stakee The address of the staked Node.\\n */\\n function addStake(uint256 amount, address stakee) external {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n if (amount == 0) {\\n revert CannotStakeZeroAmount();\\n }\\n\\n _addStake(amount, stakee);\\n SafeERC20.safeTransferFrom(_token, msg.sender, address(this), amount);\\n }\\n\\n function _addStake(uint256 amount, address stakee) internal {\\n // automatically move any pending rewards generated by their existing stake\\n _rewardsManager.updatePendingRewards(stakee, msg.sender);\\n\\n uint256 currentEpochId = _epochsManager.currentIteration();\\n\\n Stake storage stake = stakes[stakee];\\n\\n uint256 currentStake = getCurrentStakerAmount(stakee, msg.sender);\\n\\n stake.stakeEntries[msg.sender] = StakeEntry(\\n currentStake + amount,\\n block.number,\\n currentEpochId\\n );\\n\\n stake.totalManagedStake = stake.totalManagedStake + amount;\\n totalManagedStake = totalManagedStake + amount;\\n }\\n\\n /**\\n * @notice Call this function to begin the unlocking process. Calling this\\n * will trigger an automatic claim of any outstanding staking rewards. Any\\n * stake that was already in the unlocking phase will have the specified\\n * amount added to it, and its duration refreshed. This function will fail\\n * under the following conditions:\\n * - If no stake exists for the caller\\n * - If the unlock amount is zero\\n * - If the unlock amount is more than what is staked\\n * Note: If calling as a Node, this function will *not* revert if it causes\\n * the Node to fail to meet the minimum stake proportion. However it will still\\n * prevent the Node from participating in the network until the minimum is met\\n * again.\\n * @param amount The amount of stake to unlock in SOLO.\\n * @param stakee The address of the staked Node.\\n */\\n function unlockStake(uint256 amount, address stakee) external returns (uint256) {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n if (amount == 0) {\\n revert CannotUnlockZeroAmount();\\n }\\n\\n uint256 currentStake = getCurrentStakerAmount(stakee, msg.sender);\\n\\n if (currentStake == 0) {\\n revert NoStakeToUnlock();\\n }\\n if (currentStake < amount) {\\n revert CannotUnlockMoreThanStaked(currentStake, amount);\\n }\\n\\n // automatically move any pending rewards generated by their existing stake\\n _rewardsManager.updatePendingRewards(stakee, msg.sender);\\n\\n uint256 currentEpochId = _epochsManager.currentIteration();\\n\\n Stake storage stake = stakes[stakee];\\n\\n stake.stakeEntries[msg.sender] = StakeEntry(\\n currentStake - amount,\\n block.number,\\n currentEpochId\\n );\\n\\n stake.totalManagedStake = stake.totalManagedStake - amount;\\n totalManagedStake = totalManagedStake - amount;\\n\\n bytes32 key = getKey(stakee, msg.sender);\\n\\n // Keep track of when the stake can be withdrawn\\n Unlock storage unlock = unlockings[key];\\n\\n uint256 unlockAt = block.number + unlockDuration;\\n if (unlock.unlockAt < unlockAt) {\\n unlock.unlockAt = unlockAt;\\n }\\n\\n unlock.amount = unlock.amount + amount;\\n\\n return unlockAt;\\n }\\n\\n /**\\n * @notice Call this function to withdraw stake that has finished unlocking.\\n * This will fail if the stake has not yet unlocked.\\n * @param stakee The address of the staked Node.\\n */\\n function withdrawStake(address stakee) external {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n\\n bytes32 key = getKey(stakee, msg.sender);\\n\\n Unlock storage unlock = unlockings[key];\\n\\n if (unlock.unlockAt >= block.number) {\\n revert StakeNotYetUnlocked();\\n }\\n\\n uint256 amount = unlock.amount;\\n\\n delete unlockings[key];\\n\\n SafeERC20.safeTransfer(_token, msg.sender, amount);\\n }\\n\\n /**\\n * @notice Call this function to cancel any stake that is in the process\\n * of unlocking. As this essentially adds back stake to the Node, this\\n * will trigger an automatic claim of any outstanding staking rewards.\\n * If the specified amount to cancel is greater than the stake that is\\n * currently being unlocked, it will cancel the maximum stake possible.\\n * @param amount The amount of unlocking stake to cancel in SOLO.\\n * @param stakee The address of the staked Node.\\n */\\n function cancelUnlocking(uint256 amount, address stakee) external {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n if (amount == 0) {\\n revert CannotCancelUnlockZeroAmount();\\n }\\n\\n bytes32 key = getKey(stakee, msg.sender);\\n\\n Unlock storage unlock = unlockings[key];\\n\\n if (amount >= unlock.amount) {\\n amount = unlock.amount;\\n delete unlockings[key];\\n } else {\\n unlock.amount = unlock.amount - amount;\\n }\\n\\n _addStake(amount, stakee);\\n }\\n\\n /**\\n * @notice This function determines the staking capacity of\\n * a Seeker based on its power level. The method will revert if\\n * the Seeker's power level has not been registered with the oracle.\\n *\\n * Currently the algorithm is as follows:\\n * staking_capacity = seeker_power * seeker_power_multiplier;\\n */\\n function calculateCapacityFromSeekerPower(uint256 seekerId) external view returns (uint256) {\\n uint256 seekerPower = _seekerPowerOracle.getSeekerPower(seekerId);\\n if (seekerPower == 0) {\\n revert SeekerPowerNotRegistered(seekerId);\\n }\\n\\n // If the Seeker Power is already\\n // at the maximum sylo, then we just return the max sylo value directly.\\n if (seekerPower >= SyloUtils.MAX_SYLO) {\\n return SyloUtils.MAX_SYLO;\\n }\\n\\n uint256 capacity = seekerPower * seekerPowerMultiplier;\\n\\n return capacity > SyloUtils.MAX_SYLO ? SyloUtils.MAX_SYLO : capacity;\\n }\\n\\n /**\\n * @notice This function can be used to a determine a Node's staking capacity,\\n * based on the minimum stake proportion constant.\\n * @param stakee The address of the staked Node.\\n */\\n function calculateCapacityFromMinStakingProportion(address stakee) public view returns (uint256) {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n\\n Stake storage stake = stakes[stakee];\\n\\n uint256 currentlyOwnedStake = stake.stakeEntries[stakee].amount;\\n return (currentlyOwnedStake * SyloUtils.PERCENTAGE_DENOMINATOR) /\\n minimumStakeProportion;\\n }\\n\\n /**\\n * @notice This function should be called by clients to determine how much\\n * additional delegated stake can be allocated to a Node via an addStake or\\n * cancelUnlocking call. This is useful to avoid a revert due to\\n * the minimum stake proportion requirement not being met from the additional stake.\\n * @param stakee The address of the staked Node.\\n */\\n function calculateMaxAdditionalDelegatedStake(address stakee) external view returns (uint256) {\\n uint256 totalMaxStake = calculateCapacityFromMinStakingProportion(stakee);\\n\\n Stake storage stake = stakes[stakee];\\n\\n if (totalMaxStake < stake.totalManagedStake) {\\n revert StakeCapacityReached(totalMaxStake, stake.totalManagedStake);\\n }\\n\\n return totalMaxStake - stake.totalManagedStake;\\n }\\n\\n /**\\n * @notice Retrieve the key used to index a stake entry. The key is a hash\\n * which takes both address of the Node and the staker as input.\\n * @param stakee The address of the staked Node.\\n * @param staker The address of the staker.\\n * @return A byte-array representing the key.\\n */\\n function getKey(address stakee, address staker) public pure returns (bytes32) {\\n return keccak256(abi.encodePacked(stakee, staker));\\n }\\n\\n /**\\n * @notice Retrieve the total stake being managed by this contract.\\n * @return The total amount of managed stake in SOLO.\\n */\\n function getTotalManagedStake() external view returns (uint256) {\\n return totalManagedStake;\\n }\\n\\n /**\\n * @notice Retrieve a stake entry.\\n * @param stakee The address of the staked Node.\\n * @param staker The address of the staker.\\n * @return The stake entry.\\n */\\n function getStakeEntry(\\n address stakee,\\n address staker\\n ) external view returns (StakeEntry memory) {\\n return stakes[stakee].stakeEntries[staker];\\n }\\n\\n /**\\n * @notice Retrieve the total amount of SOLO staked against a Node.\\n * @param stakee The address of the staked Node.\\n * @return The amount of staked SOLO.\\n */\\n function getStakeeTotalManagedStake(address stakee) external view returns (uint256) {\\n return stakes[stakee].totalManagedStake;\\n }\\n\\n /**\\n * @notice Check if a Node is meeting the minimum stake proportion requirement.\\n * @param stakee The address of the staked Node.\\n * @return True if the Node is meeting minimum stake proportion requirement.\\n */\\n function checkMinimumStakeProportion(address stakee) public view returns (bool) {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n\\n Stake storage stake = stakes[stakee];\\n\\n uint256 currentlyOwnedStake = stake.stakeEntries[stakee].amount;\\n uint32 ownedStakeProportion = SyloUtils.asPerc(\\n SafeCast.toUint128(currentlyOwnedStake),\\n stake.totalManagedStake\\n );\\n\\n return ownedStakeProportion >= minimumStakeProportion;\\n }\\n\\n /**\\n * @notice Retrieve the current amount of SOLO staked against a Node by\\n * a specified staker.\\n * @param stakee The address of the staked Node.\\n * @param staker The address of the staker.\\n * @return The amount of staked SOLO.\\n */\\n function getCurrentStakerAmount(address stakee, address staker) public view returns (uint256) {\\n return stakes[stakee].stakeEntries[staker].amount;\\n }\\n}\\n\",\"keccak256\":\"0x039e692a4a3a670977e78ef7145a43d0bc00e48387fafd4f527b60fbb6966628\",\"license\":\"Apache-2.0\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50612392806100206000396000f3fe608060405234801561001057600080fd5b50600436106102065760003560e01c80638a87fe681161011a578063c829b66d116100ad578063e30c39781161007c578063e30c397814610585578063ecd0c0c314610596578063f2fde38b146105a9578063f6ed2017146105bc578063fdff9b4d146105e557600080fd5b8063c829b66d14610503578063ce8b486f14610516578063cec6e51f14610529578063d96d57671461057257600080fd5b8063ab56b4f0116100e9578063ab56b4f01461049c578063ac18de43146104ca578063c0c53b8b146104dd578063c3b6f726146104f057600080fd5b80638a87fe68146104455780638da5cb5b1461045857806391b8105a1461046957806396bb1fef1461048957600080fd5b80633150fa8a1161019d5780635653f6791161016c5780635653f679146103ef5780635dba03281461040f578063715018a61461042257806378c041a61461042a57806379ba50971461043d57600080fd5b80633150fa8a1461036d57806331d7a2621461038057806340768fd3146103a057806351e9d686146103b357600080fd5b80631e903c04116101d95780631e903c04146102bd5780631ed9fb0f146102dd5780632073de5c146102fd5780632d06177a1461035857600080fd5b806301ffc9a71461020b578063032fd1ba1461024457806307b4fc01146102725780630ab2502214610292575b600080fd5b61022f610219366004611eb3565b6001600160e01b031916631ed895ad60e11b1490565b60405190151581526020015b60405180910390f35b610264610252366004611edd565b60d16020526000908152604090205481565b60405190815260200161023b565b610264610280366004611f0b565b60d06020526000908152604090205481565b60cb546102a5906001600160a01b031681565b6040516001600160a01b03909116815260200161023b565b6102646102cb366004611edd565b600090815260d1602052604090205490565b6102646102eb366004611edd565b60d26020526000908152604090205481565b61033561030b366004611edd565b60d360205260009081526040902080546001820154600283015460039093015491929091600f0b84565b60408051948552602085019390935291830152600f0b606082015260800161023b565b61036b610366366004611f0b565b610605565b005b61026461037b366004611f28565b610650565b61026461038e366004611f0b565b60ce6020526000908152604090205481565b61036b6103ae366004611f58565b61067b565b6103da6103c1366004611edd565b60cd602052600090815260409020805460019091015482565b6040805192835260208301919091520161023b565b6102646103fd366004611edd565b60cf6020526000908152604090205481565b61036b61041d366004611f84565b610a05565b61036b610ac7565b610264610438366004611f84565b610adb565b61036b610b26565b610264610453366004611f28565b610ba5565b6033546001600160a01b03166102a5565b610264610477366004611edd565b600090815260d2602052604090205490565b610264610497366004611f0b565b610bd5565b6104af6104aa366004611f84565b610cce565b6040805182518152602092830151928101929092520161023b565b61036b6104d8366004611f0b565b610d25565b61036b6104eb366004611fb2565b610d47565b60ca546102a5906001600160a01b031681565b61036b610511366004611f0b565b610f2d565b610264610524366004611f84565b6110d9565b61053c610537366004611f28565b611169565b60405161023b9190815181526020808301519082015260408083015190820152606091820151600f0b9181019190915260800190565b610264610580366004611f28565b6111ef565b6065546001600160a01b03166102a5565b60c9546102a5906001600160a01b031681565b61036b6105b7366004611f0b565b611219565b6102646105ca366004611f0b565b6001600160a01b0316600090815260ce602052604090205490565b6102646105f3366004611f0b565b60976020526000908152604090205481565b61060d61128a565b6001600160a01b038116610634576040516309045a0360e41b815260040160405180910390fd5b6001600160a01b03166000908152609760205260409020439055565b600060d360006106608585610ba5565b81526020019081526020016000206000015490505b92915050565b3360009081526097602052604081205490036106a957604051620ab82160e31b815260040160405180910390fd5b6001600160a01b0382166106d057604051630381bf9b60e01b815260040160405180910390fd5b806000036106f15760405163d11b25af60e01b815260040160405180910390fd5b60008060cb60009054906101000a90046001600160a01b03166001600160a01b031663e34bf0136040518163ffffffff1660e01b815260040161014060405180830381865afa158015610748573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076c9190612065565b91509150600060d360006107808588610ba5565b8152602001908152602001600020905080600101546000036107b557604051631656dc4d60e21b815260040160405180910390fd5b6001600160a01b038516600090815260d060205260409020548311156107f1576001600160a01b038516600090815260d0602052604090208390555b60006108096107ff866112e4565b8460600151611351565b9050610815818661212e565b60cf6000610823898a610adb565b81526020019081526020016000205461083c9190612141565b60cf600061084a898a610adb565b8152602001908152602001600020819055508060ce6000886001600160a01b03166001600160a01b031681526020019081526020016000205461088d9190612141565b6001600160a01b038716600090815260ce6020526040812091909155825490036108ec576001600160a01b038616600090815260cc60205260409020546003830180546001600160801b0319166001600160801b039092169190911790555b81546108f9908290612141565b82556002820154819061091590677fffffffffffffff90612154565b101561093457604051636d77051560e11b815260040160405180910390fd5b6001600160a01b038616600090815260cc602052604090205461097790600f0b61097261096084611381565b61096d8660020154611381565b6113cc565b611424565b6001600160a01b038716600090815260cc6020908152604080832080546001600160801b0319166001600160801b03959095169490941790935586825260d1905220546109c5908690612141565b600085815260d1602090815260408083209390935560d2905220546109eb908290612141565b600094855260d26020526040909420939093555050505050565b336000908152609760205260408120549003610a3357604051620ab82160e31b815260040160405180910390fd5b6000610a3f8383610adb565b90506000610a4e828585611457565b6001600160a01b038516600090815260ce6020526040902054909150610a7590829061212e565b6001600160a01b038516600090815260ce602090815260408083209390935584825260cf90522054610aa8908290612141565b600083815260cf6020526040902055610ac18484611692565b50505050565b610acf61128a565b610ad960006117ba565b565b6040516bffffffffffffffffffffffff19606084811b8216602084015283901b1660348201526000906048015b60405160208183030381529060405280519060200120905092915050565b60655433906001600160a01b03168114610b995760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b610ba2816117ba565b50565b60008282604051602001610b0892919091825260601b6bffffffffffffffffffffffff1916602082015260340190565b60006001600160a01b038216610bfe57604051630381bf9b60e01b815260040160405180910390fd5b6000610c0a8333610adb565b90506000610c19828533611457565b600083815260cf602052604081205491925090610c369083612141565b905080600003610c5957604051635aa9184d60e01b815260040160405180910390fd5b600083815260cf602090815260408083208390556001600160a01b038816835260ce909152902054610c8c90839061212e565b6001600160a01b038616600090815260ce6020526040902055610caf8533611692565b60c954610cc6906001600160a01b031633836117d3565b949350505050565b604080518082019091526000808252602082015260cd6000610cf08585610adb565b815260200190815260200160002060405180604001604052908160008201548152602001600182015481525050905092915050565b610d2d61128a565b6001600160a01b0316600090815260976020526040812055565b600054610100900460ff1615808015610d675750600054600160ff909116105b80610d815750303b158015610d81575060005460ff166001145b610de45760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610b90565b6000805460ff191660011790558015610e07576000805461ff0019166101001790555b6001600160a01b038416610e2e57604051635f5d339960e01b815260040160405180910390fd5b610e666040518060400160405280600e81526020016d29ba30b5b4b733a6b0b730b3b2b960911b815250846303e0261b60e41b61182a565b610e9d6040518060400160405280600d81526020016c22b837b1b439a6b0b730b3b2b960991b8152508363078a0a4b60e41b61182a565b610ea561192e565b60c980546001600160a01b038087166001600160a01b03199283161790925560cb805485841690831617905560ca8054928616929091169190911790558015610ac1576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150505050565b336000908152609760205260408120549003610f5b57604051620ab82160e31b815260040160405180910390fd5b6001600160a01b038116610f8257604051630381bf9b60e01b815260040160405180910390fd5b60cb546040805163b3e123db60e01b815290516000926001600160a01b03169163b3e123db9160048083019260209291908290030181865afa158015610fcc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff0919061216b565b9050600060d360006110028486610ba5565b81526020019081526020016000209050806001015460001461103757604051637182438960e01b815260040160405180910390fd5b60ca546040516313cdd31b60e01b81526001600160a01b03858116600483015260009216906313cdd31b90602401602060405180830381865afa158015611082573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a6919061216b565b9050806000036110c95760405163353dae3760e11b815260040160405180910390fd5b6002820155436001909101555050565b60006001600160a01b03831661110257604051630381bf9b60e01b815260040160405180910390fd5b6001600160a01b03821661112957604051632a5d705360e11b815260040160405180910390fd5b60006111358484610adb565b90506000611144828686611457565b600083815260cf60205260409020549091506111609082612141565b95945050505050565b61119760405180608001604052806000815260200160008152602001600081526020016000600f0b81525090565b60d360006111a58585610ba5565b8152602080820192909252604090810160002081516080810183528154815260018201549381019390935260028101549183019190915260030154600f0b60608201529392505050565b600060d360006111ff8585610ba5565b815260200190815260200160002060020154905092915050565b61122161128a565b606580546001600160a01b0383166001600160a01b031990911681179091556112526033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6033546001600160a01b03163314610ad95760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b90565b60006001600160801b0382111561134d5760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663238206269747360c81b6064820152608401610b90565b5090565b6000620186a061137063ffffffff84166001600160801b038616612154565b61137a919061219a565b9392505050565b60008061139e611399670de0b6b3a76400008561219a565b61195d565b905060006113b7611399670de0b6b3a7640000866121ae565b9050610cc682610972836503782dace9d960521b5b600081600f0b6000036113de57600080fd5b600082600f0b604085600f0b901b816113f9576113f9612184565b05905060016001607f1b0319811280159061141b575060016001607f1b038113155b61137a57600080fd5b6000600f83810b9083900b0160016001607f1b0319811280159061141b575060016001607f1b0381131561137a57600080fd5b600080611464858561197b565b9050600061149660405180608001604052806000815260200160008152602001600081526020016000600f0b81525090565b60cb5460408051631118d57f60e31b815290516000926001600160a01b0316916388c6abf89160048083019260209291908290030181865afa1580156114e0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611504919061216b565b600089815260cd602052604081205491925090611522906001612141565b90505b818110156115aa5760d3600061153b838b610ba5565b81526020808201929092526040908101600020815160808101835281548152600182015493810184905260028201549281019290925260030154600f0b606082015293501580159061158d5750825115155b1561159a578093506115aa565b6115a3816121c2565b9050611525565b50826000036115bf578394505050505061137a565b60ca5460405163f731cb4960e01b81526001600160a01b0389811660048301528881166024830152600092169063f731cb4990604401606060405180830381865afa158015611612573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061163691906121db565b905060006116478260000151611381565b6060850151909150600061165b8b86611aa7565b90506116786116738461166e8486611b33565b611b66565b611b9c565b6116829089612141565b9c9b505050505050505050505050565b60ca5460405163f731cb4960e01b81526001600160a01b0384811660048301528381166024830152600092169063f731cb4990604401606060405180830381865afa1580156116e5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061170991906121db565b6040805180820180835260cb54631118d57f60e31b90915291519293509182916001600160a01b0316906388c6abf8906044808501916020918187030181865afa15801561175b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061177f919061216b565b8152825160209091015260cd60006117978686610adb565b815260208082019290925260400160002082518155910151600190910155505050565b606580546001600160a01b0319169055610ba281611c1d565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611825908490611c6f565b505050565b825160000361184c5760405163d1fc12f760e01b815260040160405180910390fd5b6001600160a01b038216611873578260405161f56160eb1b8152600401610b909190612295565b6001600160e01b0319811661189b5760405163308c995160e01b815260040160405180910390fd5b6040516301ffc9a760e01b81526001600160e01b0319821660048201526001600160a01b038316906301ffc9a790602401602060405180830381865afa1580156118e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061190d91906122a8565b611825578281604051633f8ccd3b60e21b8152600401610b909291906122ca565b600054610100900460ff166119555760405162461bcd60e51b8152600401610b90906122f5565b610ad9611d44565b6000677fffffffffffffff82111561197457600080fd5b5060401b90565b600082815260cd602090815260408083208151808301835281548082526001909201548185015260cb548351631118d57f60e31b81529351919492936001600160a01b03909116926388c6abf8926004808401938290030181865afa1580156119e8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a0c919061216b565b03611a1b576000915050610675565b600060d36000611a2f846000015187610ba5565b815260208082019290925260409081016000908120825160808101845281548152600182015494810194909452600281015492840183905260030154600f0b60608401529192509003611a8757600092505050610675565b604081015160208301518251611a9d9190612154565b611160919061219a565b6001600160a01b038216600090815260d060205260408120548190831115611aeb57506001600160a01b038316600090815260cc6020526040902054600f0b61137a565b6001600160a01b038416600090815260d0602052604081205460d3908290611b139088610ba5565b8152602081019190915260400160002060030154600f0b95945050505050565b6000600f82810b9084900b0360016001607f1b0319811280159061141b575060016001607f1b0381131561137a57600080fd5b6000600f83810b9083900b0260401d60016001607f1b0319811280159061141b575060016001607f1b0381131561137a57600080fd5b600080611ba883611d74565b67ffffffffffffffff1690506000611bc8670de0b6b3a764000083612154565b90506000611bde85611bd98561195d565b611b33565b90506000611bfd611bf8836503782dace9d960521b611b66565b611d74565b67ffffffffffffffff169050611c138184612141565b9695505050505050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000611cc4826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611d909092919063ffffffff16565b9050805160001480611ce5575080806020019051810190611ce591906122a8565b6118255760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610b90565b600054610100900460ff16611d6b5760405162461bcd60e51b8152600401610b90906122f5565b610ad9336117ba565b60008082600f0b1215611d8657600080fd5b50600f0b60401d90565b6060610cc6848460008585600080866001600160a01b03168587604051611db79190612340565b60006040518083038185875af1925050503d8060008114611df4576040519150601f19603f3d011682016040523d82523d6000602084013e611df9565b606091505b5091509150611e0a87838387611e15565b979650505050505050565b60608315611e84578251600003611e7d576001600160a01b0385163b611e7d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610b90565b5081610cc6565b610cc68383815115611e995781518083602001fd5b8060405162461bcd60e51b8152600401610b909190612295565b600060208284031215611ec557600080fd5b81356001600160e01b03198116811461137a57600080fd5b600060208284031215611eef57600080fd5b5035919050565b6001600160a01b0381168114610ba257600080fd5b600060208284031215611f1d57600080fd5b813561137a81611ef6565b60008060408385031215611f3b57600080fd5b823591506020830135611f4d81611ef6565b809150509250929050565b60008060408385031215611f6b57600080fd5b8235611f7681611ef6565b946020939093013593505050565b60008060408385031215611f9757600080fd5b8235611fa281611ef6565b91506020830135611f4d81611ef6565b600080600060608486031215611fc757600080fd5b8335611fd281611ef6565b92506020840135611fe281611ef6565b91506040840135611ff281611ef6565b809150509250925092565b604051610120810167ffffffffffffffff8111828210171561202f57634e487b7160e01b600052604160045260246000fd5b60405290565b805163ffffffff8116811461204957600080fd5b919050565b80516001600160801b038116811461204957600080fd5b60008082840361014081121561207a57600080fd5b8351925061012080601f198301121561209257600080fd5b61209a611ffd565b91506020850151825260408501516020830152606085015160408301526120c360808601612035565b60608301526120d460a08601612035565b608083015260c085015160a08301526120ef60e0860161204e565b60c083015261010061210281870161204e565b60e0840152940151938101939093525092909150565b634e487b7160e01b600052601160045260246000fd5b8181038181111561067557610675612118565b8082018082111561067557610675612118565b808202811582820484141761067557610675612118565b60006020828403121561217d57600080fd5b5051919050565b634e487b7160e01b600052601260045260246000fd5b6000826121a9576121a9612184565b500490565b6000826121bd576121bd612184565b500690565b6000600182016121d4576121d4612118565b5060010190565b6000606082840312156121ed57600080fd5b6040516060810181811067ffffffffffffffff8211171561221e57634e487b7160e01b600052604160045260246000fd5b80604052508251815260208301516020820152604083015160408201528091505092915050565b60005b83811015612260578181015183820152602001612248565b50506000910152565b60008151808452612281816020860160208601612245565b601f01601f19169290920160200192915050565b60208152600061137a6020830184612269565b6000602082840312156122ba57600080fd5b8151801515811461137a57600080fd5b6040815260006122dd6040830185612269565b905063ffffffff60e01b831660208301529392505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60008251612352818460208701612245565b919091019291505056fea26469706673582212208000874aaef2337fdfe6b94fd691efde58f78c30a1364130fd5c3fb1bf350c9264736f6c63430008120033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106102065760003560e01c80638a87fe681161011a578063c829b66d116100ad578063e30c39781161007c578063e30c397814610585578063ecd0c0c314610596578063f2fde38b146105a9578063f6ed2017146105bc578063fdff9b4d146105e557600080fd5b8063c829b66d14610503578063ce8b486f14610516578063cec6e51f14610529578063d96d57671461057257600080fd5b8063ab56b4f0116100e9578063ab56b4f01461049c578063ac18de43146104ca578063c0c53b8b146104dd578063c3b6f726146104f057600080fd5b80638a87fe68146104455780638da5cb5b1461045857806391b8105a1461046957806396bb1fef1461048957600080fd5b80633150fa8a1161019d5780635653f6791161016c5780635653f679146103ef5780635dba03281461040f578063715018a61461042257806378c041a61461042a57806379ba50971461043d57600080fd5b80633150fa8a1461036d57806331d7a2621461038057806340768fd3146103a057806351e9d686146103b357600080fd5b80631e903c04116101d95780631e903c04146102bd5780631ed9fb0f146102dd5780632073de5c146102fd5780632d06177a1461035857600080fd5b806301ffc9a71461020b578063032fd1ba1461024457806307b4fc01146102725780630ab2502214610292575b600080fd5b61022f610219366004611eb3565b6001600160e01b031916631ed895ad60e11b1490565b60405190151581526020015b60405180910390f35b610264610252366004611edd565b60d16020526000908152604090205481565b60405190815260200161023b565b610264610280366004611f0b565b60d06020526000908152604090205481565b60cb546102a5906001600160a01b031681565b6040516001600160a01b03909116815260200161023b565b6102646102cb366004611edd565b600090815260d1602052604090205490565b6102646102eb366004611edd565b60d26020526000908152604090205481565b61033561030b366004611edd565b60d360205260009081526040902080546001820154600283015460039093015491929091600f0b84565b60408051948552602085019390935291830152600f0b606082015260800161023b565b61036b610366366004611f0b565b610605565b005b61026461037b366004611f28565b610650565b61026461038e366004611f0b565b60ce6020526000908152604090205481565b61036b6103ae366004611f58565b61067b565b6103da6103c1366004611edd565b60cd602052600090815260409020805460019091015482565b6040805192835260208301919091520161023b565b6102646103fd366004611edd565b60cf6020526000908152604090205481565b61036b61041d366004611f84565b610a05565b61036b610ac7565b610264610438366004611f84565b610adb565b61036b610b26565b610264610453366004611f28565b610ba5565b6033546001600160a01b03166102a5565b610264610477366004611edd565b600090815260d2602052604090205490565b610264610497366004611f0b565b610bd5565b6104af6104aa366004611f84565b610cce565b6040805182518152602092830151928101929092520161023b565b61036b6104d8366004611f0b565b610d25565b61036b6104eb366004611fb2565b610d47565b60ca546102a5906001600160a01b031681565b61036b610511366004611f0b565b610f2d565b610264610524366004611f84565b6110d9565b61053c610537366004611f28565b611169565b60405161023b9190815181526020808301519082015260408083015190820152606091820151600f0b9181019190915260800190565b610264610580366004611f28565b6111ef565b6065546001600160a01b03166102a5565b60c9546102a5906001600160a01b031681565b61036b6105b7366004611f0b565b611219565b6102646105ca366004611f0b565b6001600160a01b0316600090815260ce602052604090205490565b6102646105f3366004611f0b565b60976020526000908152604090205481565b61060d61128a565b6001600160a01b038116610634576040516309045a0360e41b815260040160405180910390fd5b6001600160a01b03166000908152609760205260409020439055565b600060d360006106608585610ba5565b81526020019081526020016000206000015490505b92915050565b3360009081526097602052604081205490036106a957604051620ab82160e31b815260040160405180910390fd5b6001600160a01b0382166106d057604051630381bf9b60e01b815260040160405180910390fd5b806000036106f15760405163d11b25af60e01b815260040160405180910390fd5b60008060cb60009054906101000a90046001600160a01b03166001600160a01b031663e34bf0136040518163ffffffff1660e01b815260040161014060405180830381865afa158015610748573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076c9190612065565b91509150600060d360006107808588610ba5565b8152602001908152602001600020905080600101546000036107b557604051631656dc4d60e21b815260040160405180910390fd5b6001600160a01b038516600090815260d060205260409020548311156107f1576001600160a01b038516600090815260d0602052604090208390555b60006108096107ff866112e4565b8460600151611351565b9050610815818661212e565b60cf6000610823898a610adb565b81526020019081526020016000205461083c9190612141565b60cf600061084a898a610adb565b8152602001908152602001600020819055508060ce6000886001600160a01b03166001600160a01b031681526020019081526020016000205461088d9190612141565b6001600160a01b038716600090815260ce6020526040812091909155825490036108ec576001600160a01b038616600090815260cc60205260409020546003830180546001600160801b0319166001600160801b039092169190911790555b81546108f9908290612141565b82556002820154819061091590677fffffffffffffff90612154565b101561093457604051636d77051560e11b815260040160405180910390fd5b6001600160a01b038616600090815260cc602052604090205461097790600f0b61097261096084611381565b61096d8660020154611381565b6113cc565b611424565b6001600160a01b038716600090815260cc6020908152604080832080546001600160801b0319166001600160801b03959095169490941790935586825260d1905220546109c5908690612141565b600085815260d1602090815260408083209390935560d2905220546109eb908290612141565b600094855260d26020526040909420939093555050505050565b336000908152609760205260408120549003610a3357604051620ab82160e31b815260040160405180910390fd5b6000610a3f8383610adb565b90506000610a4e828585611457565b6001600160a01b038516600090815260ce6020526040902054909150610a7590829061212e565b6001600160a01b038516600090815260ce602090815260408083209390935584825260cf90522054610aa8908290612141565b600083815260cf6020526040902055610ac18484611692565b50505050565b610acf61128a565b610ad960006117ba565b565b6040516bffffffffffffffffffffffff19606084811b8216602084015283901b1660348201526000906048015b60405160208183030381529060405280519060200120905092915050565b60655433906001600160a01b03168114610b995760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b610ba2816117ba565b50565b60008282604051602001610b0892919091825260601b6bffffffffffffffffffffffff1916602082015260340190565b60006001600160a01b038216610bfe57604051630381bf9b60e01b815260040160405180910390fd5b6000610c0a8333610adb565b90506000610c19828533611457565b600083815260cf602052604081205491925090610c369083612141565b905080600003610c5957604051635aa9184d60e01b815260040160405180910390fd5b600083815260cf602090815260408083208390556001600160a01b038816835260ce909152902054610c8c90839061212e565b6001600160a01b038616600090815260ce6020526040902055610caf8533611692565b60c954610cc6906001600160a01b031633836117d3565b949350505050565b604080518082019091526000808252602082015260cd6000610cf08585610adb565b815260200190815260200160002060405180604001604052908160008201548152602001600182015481525050905092915050565b610d2d61128a565b6001600160a01b0316600090815260976020526040812055565b600054610100900460ff1615808015610d675750600054600160ff909116105b80610d815750303b158015610d81575060005460ff166001145b610de45760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610b90565b6000805460ff191660011790558015610e07576000805461ff0019166101001790555b6001600160a01b038416610e2e57604051635f5d339960e01b815260040160405180910390fd5b610e666040518060400160405280600e81526020016d29ba30b5b4b733a6b0b730b3b2b960911b815250846303e0261b60e41b61182a565b610e9d6040518060400160405280600d81526020016c22b837b1b439a6b0b730b3b2b960991b8152508363078a0a4b60e41b61182a565b610ea561192e565b60c980546001600160a01b038087166001600160a01b03199283161790925560cb805485841690831617905560ca8054928616929091169190911790558015610ac1576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150505050565b336000908152609760205260408120549003610f5b57604051620ab82160e31b815260040160405180910390fd5b6001600160a01b038116610f8257604051630381bf9b60e01b815260040160405180910390fd5b60cb546040805163b3e123db60e01b815290516000926001600160a01b03169163b3e123db9160048083019260209291908290030181865afa158015610fcc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff0919061216b565b9050600060d360006110028486610ba5565b81526020019081526020016000209050806001015460001461103757604051637182438960e01b815260040160405180910390fd5b60ca546040516313cdd31b60e01b81526001600160a01b03858116600483015260009216906313cdd31b90602401602060405180830381865afa158015611082573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a6919061216b565b9050806000036110c95760405163353dae3760e11b815260040160405180910390fd5b6002820155436001909101555050565b60006001600160a01b03831661110257604051630381bf9b60e01b815260040160405180910390fd5b6001600160a01b03821661112957604051632a5d705360e11b815260040160405180910390fd5b60006111358484610adb565b90506000611144828686611457565b600083815260cf60205260409020549091506111609082612141565b95945050505050565b61119760405180608001604052806000815260200160008152602001600081526020016000600f0b81525090565b60d360006111a58585610ba5565b8152602080820192909252604090810160002081516080810183528154815260018201549381019390935260028101549183019190915260030154600f0b60608201529392505050565b600060d360006111ff8585610ba5565b815260200190815260200160002060020154905092915050565b61122161128a565b606580546001600160a01b0383166001600160a01b031990911681179091556112526033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6033546001600160a01b03163314610ad95760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b90565b60006001600160801b0382111561134d5760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663238206269747360c81b6064820152608401610b90565b5090565b6000620186a061137063ffffffff84166001600160801b038616612154565b61137a919061219a565b9392505050565b60008061139e611399670de0b6b3a76400008561219a565b61195d565b905060006113b7611399670de0b6b3a7640000866121ae565b9050610cc682610972836503782dace9d960521b5b600081600f0b6000036113de57600080fd5b600082600f0b604085600f0b901b816113f9576113f9612184565b05905060016001607f1b0319811280159061141b575060016001607f1b038113155b61137a57600080fd5b6000600f83810b9083900b0160016001607f1b0319811280159061141b575060016001607f1b0381131561137a57600080fd5b600080611464858561197b565b9050600061149660405180608001604052806000815260200160008152602001600081526020016000600f0b81525090565b60cb5460408051631118d57f60e31b815290516000926001600160a01b0316916388c6abf89160048083019260209291908290030181865afa1580156114e0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611504919061216b565b600089815260cd602052604081205491925090611522906001612141565b90505b818110156115aa5760d3600061153b838b610ba5565b81526020808201929092526040908101600020815160808101835281548152600182015493810184905260028201549281019290925260030154600f0b606082015293501580159061158d5750825115155b1561159a578093506115aa565b6115a3816121c2565b9050611525565b50826000036115bf578394505050505061137a565b60ca5460405163f731cb4960e01b81526001600160a01b0389811660048301528881166024830152600092169063f731cb4990604401606060405180830381865afa158015611612573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061163691906121db565b905060006116478260000151611381565b6060850151909150600061165b8b86611aa7565b90506116786116738461166e8486611b33565b611b66565b611b9c565b6116829089612141565b9c9b505050505050505050505050565b60ca5460405163f731cb4960e01b81526001600160a01b0384811660048301528381166024830152600092169063f731cb4990604401606060405180830381865afa1580156116e5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061170991906121db565b6040805180820180835260cb54631118d57f60e31b90915291519293509182916001600160a01b0316906388c6abf8906044808501916020918187030181865afa15801561175b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061177f919061216b565b8152825160209091015260cd60006117978686610adb565b815260208082019290925260400160002082518155910151600190910155505050565b606580546001600160a01b0319169055610ba281611c1d565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611825908490611c6f565b505050565b825160000361184c5760405163d1fc12f760e01b815260040160405180910390fd5b6001600160a01b038216611873578260405161f56160eb1b8152600401610b909190612295565b6001600160e01b0319811661189b5760405163308c995160e01b815260040160405180910390fd5b6040516301ffc9a760e01b81526001600160e01b0319821660048201526001600160a01b038316906301ffc9a790602401602060405180830381865afa1580156118e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061190d91906122a8565b611825578281604051633f8ccd3b60e21b8152600401610b909291906122ca565b600054610100900460ff166119555760405162461bcd60e51b8152600401610b90906122f5565b610ad9611d44565b6000677fffffffffffffff82111561197457600080fd5b5060401b90565b600082815260cd602090815260408083208151808301835281548082526001909201548185015260cb548351631118d57f60e31b81529351919492936001600160a01b03909116926388c6abf8926004808401938290030181865afa1580156119e8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a0c919061216b565b03611a1b576000915050610675565b600060d36000611a2f846000015187610ba5565b815260208082019290925260409081016000908120825160808101845281548152600182015494810194909452600281015492840183905260030154600f0b60608401529192509003611a8757600092505050610675565b604081015160208301518251611a9d9190612154565b611160919061219a565b6001600160a01b038216600090815260d060205260408120548190831115611aeb57506001600160a01b038316600090815260cc6020526040902054600f0b61137a565b6001600160a01b038416600090815260d0602052604081205460d3908290611b139088610ba5565b8152602081019190915260400160002060030154600f0b95945050505050565b6000600f82810b9084900b0360016001607f1b0319811280159061141b575060016001607f1b0381131561137a57600080fd5b6000600f83810b9083900b0260401d60016001607f1b0319811280159061141b575060016001607f1b0381131561137a57600080fd5b600080611ba883611d74565b67ffffffffffffffff1690506000611bc8670de0b6b3a764000083612154565b90506000611bde85611bd98561195d565b611b33565b90506000611bfd611bf8836503782dace9d960521b611b66565b611d74565b67ffffffffffffffff169050611c138184612141565b9695505050505050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000611cc4826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611d909092919063ffffffff16565b9050805160001480611ce5575080806020019051810190611ce591906122a8565b6118255760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610b90565b600054610100900460ff16611d6b5760405162461bcd60e51b8152600401610b90906122f5565b610ad9336117ba565b60008082600f0b1215611d8657600080fd5b50600f0b60401d90565b6060610cc6848460008585600080866001600160a01b03168587604051611db79190612340565b60006040518083038185875af1925050503d8060008114611df4576040519150601f19603f3d011682016040523d82523d6000602084013e611df9565b606091505b5091509150611e0a87838387611e15565b979650505050505050565b60608315611e84578251600003611e7d576001600160a01b0385163b611e7d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610b90565b5081610cc6565b610cc68383815115611e995781518083602001fd5b8060405162461bcd60e51b8152600401610b909190612295565b600060208284031215611ec557600080fd5b81356001600160e01b03198116811461137a57600080fd5b600060208284031215611eef57600080fd5b5035919050565b6001600160a01b0381168114610ba257600080fd5b600060208284031215611f1d57600080fd5b813561137a81611ef6565b60008060408385031215611f3b57600080fd5b823591506020830135611f4d81611ef6565b809150509250929050565b60008060408385031215611f6b57600080fd5b8235611f7681611ef6565b946020939093013593505050565b60008060408385031215611f9757600080fd5b8235611fa281611ef6565b91506020830135611f4d81611ef6565b600080600060608486031215611fc757600080fd5b8335611fd281611ef6565b92506020840135611fe281611ef6565b91506040840135611ff281611ef6565b809150509250925092565b604051610120810167ffffffffffffffff8111828210171561202f57634e487b7160e01b600052604160045260246000fd5b60405290565b805163ffffffff8116811461204957600080fd5b919050565b80516001600160801b038116811461204957600080fd5b60008082840361014081121561207a57600080fd5b8351925061012080601f198301121561209257600080fd5b61209a611ffd565b91506020850151825260408501516020830152606085015160408301526120c360808601612035565b60608301526120d460a08601612035565b608083015260c085015160a08301526120ef60e0860161204e565b60c083015261010061210281870161204e565b60e0840152940151938101939093525092909150565b634e487b7160e01b600052601160045260246000fd5b8181038181111561067557610675612118565b8082018082111561067557610675612118565b808202811582820484141761067557610675612118565b60006020828403121561217d57600080fd5b5051919050565b634e487b7160e01b600052601260045260246000fd5b6000826121a9576121a9612184565b500490565b6000826121bd576121bd612184565b500690565b6000600182016121d4576121d4612118565b5060010190565b6000606082840312156121ed57600080fd5b6040516060810181811067ffffffffffffffff8211171561221e57634e487b7160e01b600052604160045260246000fd5b80604052508251815260208301516020820152604083015160408201528091505092915050565b60005b83811015612260578181015183820152602001612248565b50506000910152565b60008151808452612281816020860160208601612245565b601f01601f19169290920160200192915050565b60208152600061137a6020830184612269565b6000602082840312156122ba57600080fd5b8151801515811461137a57600080fd5b6040815260006122dd6040830185612269565b905063ffffffff60e01b831660208301529392505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60008251612352818460208701612245565b919091019291505056fea26469706673582212208000874aaef2337fdfe6b94fd691efde58f78c30a1364130fd5c3fb1bf350c9264736f6c63430008120033", + "devdoc": { + "details": "After deployment, the SyloTicketing contract should be set up as a manager to be able to call certain restricted functions.", + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "acceptOwnership()": { + "details": "The new owner accepts the ownership transfer." + }, + "addManager(address)": { + "params": { + "manager": "The address of the manager contract." + } + }, + "calculateStakerClaim(address,address)": { + "details": "This function will utilize the cumulative reward factor to perform the calculation, keeping the gas cost scaling of this function to a constant value.", + "params": { + "stakee": "The address of the Node.", + "staker": "The address of the staker." + }, + "returns": { + "_0": "The value of the reward owed to the staker in SOLO." + } + }, + "claimStakingRewards(address)": { + "params": { + "stakee": "The address of the Node to claim against." + } + }, + "getLastClaim(address,address)": { + "params": { + "stakee": "The address of the Node.", + "staker": "The address of the staker." + }, + "returns": { + "_0": "The ID of the epoch." + } + }, + "getPendingRewards(address)": { + "params": { + "stakee": "The address of the Node." + }, + "returns": { + "_0": "The total pending staking reward in SOLO." + } + }, + "getRewardPool(uint256,address)": { + "params": { + "epochId": "The ID of the epoch the reward pool was initialized in.", + "stakee": "The address of the Node." + }, + "returns": { + "_0": "The reward pool." + } + }, + "getRewardPoolActiveStake(uint256,address)": { + "params": { + "epochId": "The ID of the epoch the reward pool was initialized in.", + "stakee": "The address of the Node." + }, + "returns": { + "_0": "The total active stake for that reward pool in SOLO." + } + }, + "getRewardPoolKey(uint256,address)": { + "params": { + "epochId": "The epoch ID the reward pool was created in.", + "stakee": "The address of the Node." + }, + "returns": { + "_0": "A byte-array representing the reward pool key." + } + }, + "getRewardPoolStakersTotal(uint256,address)": { + "params": { + "epochId": "The ID of the epoch the reward pool was initialized in.", + "stakee": "The address of the Node." + }, + "returns": { + "_0": "The total accumulated staker reward in SOLO." + } + }, + "getStakerKey(address,address)": { + "params": { + "stakee": "The address of the Node.", + "staker": "The address of the stake." + }, + "returns": { + "_0": "A byte-array representing the key." + } + }, + "getTotalEpochRewards(uint256)": { + "params": { + "epochId": "The epoch id." + }, + "returns": { + "_0": "The total reward in that epoch, including staking rewards and fee reward." + } + }, + "getTotalEpochStakingRewards(uint256)": { + "params": { + "epochId": "The epoch id." + }, + "returns": { + "_0": "The total staking reward in that epoch." + } + }, + "incrementRewardPool(address,uint256)": { + "details": "This function should be called by the Ticketing contract when a ticket is successfully redeemed. The face value of the ticket should be split between incrementing the node's reward balance, and the reward balance for the node's delegated stakers. The face value will be added to the current reward pool's balance. This function will fail if the Ticketing contract has not been set as a manager.", + "params": { + "amount": "The face value of the ticket in SOLO.", + "stakee": "The address of the Node." + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pendingOwner()": { + "details": "Returns the address of the pending owner." + }, + "removeManager(address)": { + "params": { + "manager": "The address of the manager contract." + } + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner." + } + }, + "stateVariables": { + "cumulativeRewardFactors": { + "details": "Each node will manage a cumulative reward factor (CRF) that is incremented whenever a ticket is redeemed. This factor acts as a single value that can be used to calculate any particular staker's reward share. This prevents the need to individually track each staker's proportion, and also allows a claim calculation to be performed without iterating through every epoch. The CRF is calculated as CRF = CRF + Reward / TotalStake." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "_epochsManager()": { + "notice": "Sylo Epochs Manager. " + }, + "_stakingManager()": { + "notice": "Sylo Staking Manager contract. " + }, + "_token()": { + "notice": "ERC20 Sylo token contract. " + }, + "addManager(address)": { + "notice": "Adds a manager to this contract. Only callable by the owner." + }, + "calculateStakerClaim(address,address)": { + "notice": "Call this function to calculate the total reward owed to a staker. This value will include all epochs since the last claim was made up to the previous epoch. This will also add any pending rewards to the final value as well." + }, + "claimStakingRewards(address)": { + "notice": "Call this function to claim rewards as a staker. The SYLO tokens will be transferred to the caller's account. This function will fail if there exists no reward to claim. Note: Calling this will remove the current unclaimed reward from being used as stake in the next round." + }, + "getLastClaim(address,address)": { + "notice": "Retrieves the ID of the epoch in which a staker last made their staking claim." + }, + "getPendingRewards(address)": { + "notice": "Retrieve the total pending staking reward allocated to a Node's stakers." + }, + "getRewardPool(uint256,address)": { + "notice": "Retrieve the reward pool initialized by the given node, at the specified epoch." + }, + "getRewardPoolActiveStake(uint256,address)": { + "notice": "Retrieve the total active stake that will be used for a Node's reward pool in a given epoch." + }, + "getRewardPoolKey(uint256,address)": { + "notice": "Returns the key used to index a reward pool. The key is a hash of the epochId and Node's address." + }, + "getRewardPoolStakersTotal(uint256,address)": { + "notice": "Retrieve the total accumulated reward that will be distributed to a Node's delegated stakers for a given epoch." + }, + "getStakerKey(address,address)": { + "notice": "Returns the key used to index staking claims. The key is a hash of the Node's address and the staker's address." + }, + "getTotalEpochRewards(uint256)": { + "notice": "Retrieves the total accumulated rewards for a specific epoch." + }, + "getTotalEpochStakingRewards(uint256)": { + "notice": "Retrieves the total accumulated rewards for stakers in a specific epoch." + }, + "initializeNextRewardPool(address)": { + "notice": "This is used by Nodes to initialize their reward pool for the next epoch. This function will revert if the caller has no stake, or if the reward pool has already been initialized. The total active stake for the next reward pool is calculated by summing up the total managed stake held by the RewardsManager contract." + }, + "lastClaims(bytes32)": { + "notice": "Tracks the last epoch a delegated staker made a reward claim in. The key to this mapping is a hash of the Node's address and the delegated stakers address." + }, + "latestActiveRewardPools(address)": { + "notice": "Tracks each Node's most recently active reward pool" + }, + "pendingRewards(address)": { + "notice": "Tracks each Nodes total pending rewards in SOLOs. This value is accumulated as Node's redeem tickets. Rewards are pending if the distribution amongst the stakers has not been accounted for yet. Pending rewards are transferred to unclaimed rewards once the the staker's share has been calculated." + }, + "removeManager(address)": { + "notice": "Removes a manager from this contract. Only callable by the owner." + }, + "rewardPools(bytes32)": { + "notice": "Tracks each reward pool initialized by a Node. The key to this map is derived from the epochId and the Node's address." + }, + "supportsInterface(bytes4)": { + "notice": "Returns true if the contract implements the interface defined by `interfaceId` from ERC165." + }, + "totalEpochRewards(uint256)": { + "notice": "Tracks total accumulated rewards in each epoch" + }, + "totalEpochStakingRewards(uint256)": { + "notice": "Tracks total accumulated staking rewards in each epoch" + }, + "unclaimedStakingRewards(bytes32)": { + "notice": "Tracks rewards for stakers after the stakers share has been calculated, but has not actually been claimed by the staker. The node fee reward is also added to the node's unclaimedStakingRewards." + }, + "updatePendingRewards(address,address)": { + "notice": "This is called by the staking manager to transfer pending rewards to unclaimed rewards for a staker. This is required as the last used CRF needs to be updated whenever stake changes." + } + }, + "notice": "Handles epoch based reward pools that are incremented from redeeming tickets. Nodes use this contract to set up their reward pool for the next epoch, and stakers use this contract to track and claim staking rewards.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 244, + "contract": "contracts/payments/ticketing/RewardsManager.sol:RewardsManager", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 247, + "contract": "contracts/payments/ticketing/RewardsManager.sol:RewardsManager", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 777, + "contract": "contracts/payments/ticketing/RewardsManager.sol:RewardsManager", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 116, + "contract": "contracts/payments/ticketing/RewardsManager.sol:RewardsManager", + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address" + }, + { + "astId": 236, + "contract": "contracts/payments/ticketing/RewardsManager.sol:RewardsManager", + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 25, + "contract": "contracts/payments/ticketing/RewardsManager.sol:RewardsManager", + "label": "_pendingOwner", + "offset": 0, + "slot": "101", + "type": "t_address" + }, + { + "astId": 104, + "contract": "contracts/payments/ticketing/RewardsManager.sol:RewardsManager", + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 11127, + "contract": "contracts/payments/ticketing/RewardsManager.sol:RewardsManager", + "label": "managers", + "offset": 0, + "slot": "151", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 11192, + "contract": "contracts/payments/ticketing/RewardsManager.sol:RewardsManager", + "label": "__gap", + "offset": 0, + "slot": "152", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 13026, + "contract": "contracts/payments/ticketing/RewardsManager.sol:RewardsManager", + "label": "_token", + "offset": 0, + "slot": "201", + "type": "t_contract(IERC20)1443" + }, + { + "astId": 13030, + "contract": "contracts/payments/ticketing/RewardsManager.sol:RewardsManager", + "label": "_stakingManager", + "offset": 0, + "slot": "202", + "type": "t_contract(StakingManager)15921" + }, + { + "astId": 13034, + "contract": "contracts/payments/ticketing/RewardsManager.sol:RewardsManager", + "label": "_epochsManager", + "offset": 0, + "slot": "203", + "type": "t_contract(EpochsManager)10429" + }, + { + "astId": 13039, + "contract": "contracts/payments/ticketing/RewardsManager.sol:RewardsManager", + "label": "cumulativeRewardFactors", + "offset": 0, + "slot": "204", + "type": "t_mapping(t_address,t_int128)" + }, + { + "astId": 13045, + "contract": "contracts/payments/ticketing/RewardsManager.sol:RewardsManager", + "label": "lastClaims", + "offset": 0, + "slot": "205", + "type": "t_mapping(t_bytes32,t_struct(LastClaim)10809_storage)" + }, + { + "astId": 13050, + "contract": "contracts/payments/ticketing/RewardsManager.sol:RewardsManager", + "label": "pendingRewards", + "offset": 0, + "slot": "206", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 13055, + "contract": "contracts/payments/ticketing/RewardsManager.sol:RewardsManager", + "label": "unclaimedStakingRewards", + "offset": 0, + "slot": "207", + "type": "t_mapping(t_bytes32,t_uint256)" + }, + { + "astId": 13060, + "contract": "contracts/payments/ticketing/RewardsManager.sol:RewardsManager", + "label": "latestActiveRewardPools", + "offset": 0, + "slot": "208", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 13065, + "contract": "contracts/payments/ticketing/RewardsManager.sol:RewardsManager", + "label": "totalEpochRewards", + "offset": 0, + "slot": "209", + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 13070, + "contract": "contracts/payments/ticketing/RewardsManager.sol:RewardsManager", + "label": "totalEpochStakingRewards", + "offset": 0, + "slot": "210", + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 13076, + "contract": "contracts/payments/ticketing/RewardsManager.sol:RewardsManager", + "label": "rewardPools", + "offset": 0, + "slot": "211", + "type": "t_mapping(t_bytes32,t_struct(RewardPool)10804_storage)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(EpochsManager)10429": { + "encoding": "inplace", + "label": "contract EpochsManager", + "numberOfBytes": "20" + }, + "t_contract(IERC20)1443": { + "encoding": "inplace", + "label": "contract IERC20", + "numberOfBytes": "20" + }, + "t_contract(StakingManager)15921": { + "encoding": "inplace", + "label": "contract StakingManager", + "numberOfBytes": "20" + }, + "t_int128": { + "encoding": "inplace", + "label": "int128", + "numberOfBytes": "16" + }, + "t_mapping(t_address,t_int128)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => int128)", + "numberOfBytes": "32", + "value": "t_int128" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_bytes32,t_struct(LastClaim)10809_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct IRewardsManager.LastClaim)", + "numberOfBytes": "32", + "value": "t_struct(LastClaim)10809_storage" + }, + "t_mapping(t_bytes32,t_struct(RewardPool)10804_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct IRewardsManager.RewardPool)", + "numberOfBytes": "32", + "value": "t_struct(RewardPool)10804_storage" + }, + "t_mapping(t_bytes32,t_uint256)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_uint256,t_uint256)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_struct(LastClaim)10809_storage": { + "encoding": "inplace", + "label": "struct IRewardsManager.LastClaim", + "members": [ + { + "astId": 10806, + "contract": "contracts/payments/ticketing/RewardsManager.sol:RewardsManager", + "label": "claimedAt", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 10808, + "contract": "contracts/payments/ticketing/RewardsManager.sol:RewardsManager", + "label": "stake", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_struct(RewardPool)10804_storage": { + "encoding": "inplace", + "label": "struct IRewardsManager.RewardPool", + "members": [ + { + "astId": 10797, + "contract": "contracts/payments/ticketing/RewardsManager.sol:RewardsManager", + "label": "stakersRewardTotal", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 10799, + "contract": "contracts/payments/ticketing/RewardsManager.sol:RewardsManager", + "label": "initializedAt", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 10801, + "contract": "contracts/payments/ticketing/RewardsManager.sol:RewardsManager", + "label": "totalActiveStake", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 10803, + "contract": "contracts/payments/ticketing/RewardsManager.sol:RewardsManager", + "label": "initialCumulativeRewardFactor", + "offset": 0, + "slot": "3", + "type": "t_int128" + } + ], + "numberOfBytes": "128" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/deployments/porcini-dev/RewardsManager_Proxy.json b/deployments/porcini-dev/RewardsManager_Proxy.json new file mode 100644 index 00000000..8fb930f0 --- /dev/null +++ b/deployments/porcini-dev/RewardsManager_Proxy.json @@ -0,0 +1,235 @@ +{ + "address": "0x6802094eC43b1D769AA41A6925244AedB0D294a0", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x083b01c6cd65d95f8517d4f8ee7da3674d99e0f43b6a684cc4c3360566de8b68", + "receipt": { + "to": null, + "from": "0x448c8e9e1816300Dd052e77D2A44c990A2807D15", + "contractAddress": "0x6802094eC43b1D769AA41A6925244AedB0D294a0", + "transactionIndex": 0, + "gasUsed": "720430", + "logsBloom": "0x00000001000000000000000004000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000020000000000080000000000000000000000400002000000000002000000000000000000000200000000000000000000000000000000000000000000000", + "blockHash": "0xe1bc7cea6d306d510b372001cc992c587934d5713d338608038e9f8dd1e2f221", + "transactionHash": "0x083b01c6cd65d95f8517d4f8ee7da3674d99e0f43b6a684cc4c3360566de8b68", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 10978377, + "transactionHash": "0x083b01c6cd65d95f8517d4f8ee7da3674d99e0f43b6a684cc4c3360566de8b68", + "address": "0x6802094eC43b1D769AA41A6925244AedB0D294a0", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x0000000000000000000000006349940ba71f68304529ad1147e33f29c71e192e" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0xe1bc7cea6d306d510b372001cc992c587934d5713d338608038e9f8dd1e2f221" + }, + { + "transactionIndex": 0, + "blockNumber": 10978377, + "transactionHash": "0x083b01c6cd65d95f8517d4f8ee7da3674d99e0f43b6a684cc4c3360566de8b68", + "address": "0x6802094eC43b1D769AA41A6925244AedB0D294a0", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f06d5edb04f4995fff2c362a14826107f7cccbcc", + "logIndex": 1, + "blockHash": "0xe1bc7cea6d306d510b372001cc992c587934d5713d338608038e9f8dd1e2f221" + } + ], + "blockNumber": 10978377, + "cumulativeGasUsed": "720430", + "status": 1, + "byzantium": true + }, + "args": [ + "0x6349940BA71F68304529aD1147e33F29c71E192E", + "0xf06d5Edb04F4995FFF2c362a14826107F7CCCBCc", + "0x" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\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\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.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 *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\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 Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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 Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual 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 Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\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(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\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(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) 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\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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 overriden 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 internall 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 overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/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\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\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 * ```\\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`, and `uint256`._\\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 /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\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 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 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 assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/porcini-dev/SeekerPowerOracle.json b/deployments/porcini-dev/SeekerPowerOracle.json new file mode 100644 index 00000000..0810f74b --- /dev/null +++ b/deployments/porcini-dev/SeekerPowerOracle.json @@ -0,0 +1,540 @@ +{ + "address": "0xdB51e2219Fc69627ae29D177E4a1c9D9129E8230", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "inputs": [], + "name": "NonceCannotBeReused", + "type": "error" + }, + { + "inputs": [], + "name": "UnauthorizedRegisterSeekerPowerCall", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "seekerId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "power", + "type": "uint256" + } + ], + "name": "SeekerPowerUpdated", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "seekerId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "power", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "nonce", + "type": "bytes32" + } + ], + "name": "getProofMessage", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "seekerId", + "type": "uint256" + } + ], + "name": "getSeekerPower", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_oracle", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "oracle", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "seekerId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "power", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "nonce", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + } + ], + "name": "registerSeekerPower", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "seekerId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "power", + "type": "uint256" + } + ], + "name": "registerSeekerPowerRestricted", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "seekerPowers", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_oracle", + "type": "address" + } + ], + "name": "setOracle", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0xc0c545c9364c293e5dd43c57385a3f5aa90b5ec2c84147645e65fb8db5a25ba8", + "receipt": { + "to": null, + "from": "0x448c8e9e1816300Dd052e77D2A44c990A2807D15", + "contractAddress": "0xdB51e2219Fc69627ae29D177E4a1c9D9129E8230", + "transactionIndex": 0, + "gasUsed": "720430", + "logsBloom": "0x00000000000000000000000000000000400000000000000000800000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000100000000004000000000000000000000000000000000000000000000000060000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000001000000000000000000000000000", + "blockHash": "0x8ddf32c76b0532ccc2a335649fe46e093419236f8e8df241f9878b2c8748e199", + "transactionHash": "0xc0c545c9364c293e5dd43c57385a3f5aa90b5ec2c84147645e65fb8db5a25ba8", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 10978384, + "transactionHash": "0xc0c545c9364c293e5dd43c57385a3f5aa90b5ec2c84147645e65fb8db5a25ba8", + "address": "0xdB51e2219Fc69627ae29D177E4a1c9D9129E8230", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x0000000000000000000000002e2f4d5a29dbd67433dadb806c1573af5fb99657" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0x8ddf32c76b0532ccc2a335649fe46e093419236f8e8df241f9878b2c8748e199" + }, + { + "transactionIndex": 0, + "blockNumber": 10978384, + "transactionHash": "0xc0c545c9364c293e5dd43c57385a3f5aa90b5ec2c84147645e65fb8db5a25ba8", + "address": "0xdB51e2219Fc69627ae29D177E4a1c9D9129E8230", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f06d5edb04f4995fff2c362a14826107f7cccbcc", + "logIndex": 1, + "blockHash": "0x8ddf32c76b0532ccc2a335649fe46e093419236f8e8df241f9878b2c8748e199" + } + ], + "blockNumber": 10978384, + "cumulativeGasUsed": "720430", + "status": 1, + "byzantium": true + }, + "args": [ + "0x2E2f4d5A29dbD67433DaDB806C1573Af5Fb99657", + "0xf06d5Edb04F4995FFF2c362a14826107F7CCCBCc", + "0x" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\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\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.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 *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\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 Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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 Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual 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 Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\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(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\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(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) 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\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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 overriden 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 internall 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 overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/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\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\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 * ```\\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`, and `uint256`._\\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 /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\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 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 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 assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "implementation": "0x2E2f4d5A29dbD67433DaDB806C1573Af5Fb99657", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/porcini-dev/SeekerPowerOracle_Implementation.json b/deployments/porcini-dev/SeekerPowerOracle_Implementation.json new file mode 100644 index 00000000..0929a27f --- /dev/null +++ b/deployments/porcini-dev/SeekerPowerOracle_Implementation.json @@ -0,0 +1,553 @@ +{ + "address": "0x2E2f4d5A29dbD67433DaDB806C1573Af5Fb99657", + "abi": [ + { + "inputs": [], + "name": "NonceCannotBeReused", + "type": "error" + }, + { + "inputs": [], + "name": "UnauthorizedRegisterSeekerPowerCall", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "seekerId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "power", + "type": "uint256" + } + ], + "name": "SeekerPowerUpdated", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "seekerId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "power", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "nonce", + "type": "bytes32" + } + ], + "name": "getProofMessage", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "seekerId", + "type": "uint256" + } + ], + "name": "getSeekerPower", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_oracle", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "oracle", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "seekerId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "power", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "nonce", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + } + ], + "name": "registerSeekerPower", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "seekerId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "power", + "type": "uint256" + } + ], + "name": "registerSeekerPowerRestricted", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "seekerPowers", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_oracle", + "type": "address" + } + ], + "name": "setOracle", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x0ccd881809b3e4086b728ba3fdbf40f7bca3669e0a323e0f2b428b8c7255c92e", + "receipt": { + "to": null, + "from": "0x448c8e9e1816300Dd052e77D2A44c990A2807D15", + "contractAddress": "0x2E2f4d5A29dbD67433DaDB806C1573Af5Fb99657", + "transactionIndex": 0, + "gasUsed": "989359", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x9ab4b2fbb0ea1e1141d50e343ed0d4bac4708dcfeb738320f2799328efae6a77", + "transactionHash": "0x0ccd881809b3e4086b728ba3fdbf40f7bca3669e0a323e0f2b428b8c7255c92e", + "logs": [], + "blockNumber": 10978383, + "cumulativeGasUsed": "989359", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "61c534572f64110305c1d307d9b45348", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"NonceCannotBeReused\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnauthorizedRegisterSeekerPowerCall\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"seekerId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"power\",\"type\":\"uint256\"}],\"name\":\"SeekerPowerUpdated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"seekerId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"power\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"nonce\",\"type\":\"bytes32\"}],\"name\":\"getProofMessage\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"seekerId\",\"type\":\"uint256\"}],\"name\":\"getSeekerPower\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_oracle\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"oracle\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"seekerId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"power\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"nonce\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"proof\",\"type\":\"bytes\"}],\"name\":\"registerSeekerPower\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"seekerId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"power\",\"type\":\"uint256\"}],\"name\":\"registerSeekerPowerRestricted\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"seekerPowers\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_oracle\",\"type\":\"address\"}],\"name\":\"setOracle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"getProofMessage(uint256,uint256,bytes32)\":{\"params\":{\"power\":\"The power level of the Seeker.\",\"seekerId\":\"The id of the Seeker.\"}},\"getSeekerPower(uint256)\":{\"params\":{\"seekerId\":\"The id of the Seeker.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"registerSeekerPower(uint256,uint256,bytes32,bytes)\":{\"params\":{\"power\":\"The power level of the Seeker.\",\"seekerId\":\"The id of the Seeker.\"}},\"registerSeekerPowerRestricted(uint256,uint256)\":{\"params\":{\"power\":\"The power level of the Seeker.\",\"seekerId\":\"The id of the Seeker.\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"setOracle(address)\":{\"params\":{\"_oracle\":\"The oracle account.\"}},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getProofMessage(uint256,uint256,bytes32)\":{\"notice\":\"Constructs a proof message for the oracle to sign.\"},\"getSeekerPower(uint256)\":{\"notice\":\"Retrieves a Seeker's stored power level.\"},\"oracle()\":{\"notice\":\"The oracle account. This contract accepts any attestations of Seeker power that have been signed by this account.\"},\"registerSeekerPower(uint256,uint256,bytes32,bytes)\":{\"notice\":\"Registers a Seeker's power level. Callable by any account but requires a proof signed by the oracle.\"},\"registerSeekerPowerRestricted(uint256,uint256)\":{\"notice\":\"Registers a Seeker's power level. Only callable by the owner or the oracle account.\"},\"seekerPowers(uint256)\":{\"notice\":\"Tracks the set of Seeker Power levels.\"},\"setOracle(address)\":{\"notice\":\"Sets the oracle account.\"},\"supportsInterface(bytes4)\":{\"notice\":\"Returns true if the contract implements the interface defined by `interfaceId` from ERC165.\"}},\"notice\":\"Acts as a source of information for Seeker Powers. Allows setting a Seeker's power level via a restricted oracle account call. Seeker Power can also be set by any account if the correct Oracle signature proof is provided.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/SeekerPowerOracle.sol\":\"SeekerPowerOracle\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./OwnableUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership} and {acceptOwnership}.\\n *\\n * This module is used through inheritance. It will make available all functions\\n * from parent (Ownable).\\n */\\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\\n function __Ownable2Step_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable2Step_init_unchained() internal onlyInitializing {\\n }\\n address private _pendingOwner;\\n\\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Returns the address of the pending owner.\\n */\\n function pendingOwner() public view virtual returns (address) {\\n return _pendingOwner;\\n }\\n\\n /**\\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual override onlyOwner {\\n _pendingOwner = newOwner;\\n emit OwnershipTransferStarted(owner(), newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual override {\\n delete _pendingOwner;\\n super._transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev The new owner accepts the ownership transfer.\\n */\\n function acceptOwnership() public virtual {\\n address sender = _msgSender();\\n require(pendingOwner() == sender, \\\"Ownable2Step: caller is not the new owner\\\");\\n _transferOwnership(sender);\\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\":\"0x84efb8889801b0ac817324aff6acc691d07bbee816b671817132911d287a8c63\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n\\n /**\\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\":\"0x4075622496acc77fd6d4de4cc30a8577a744d5c75afad33fdeacf1704d6eda98\",\"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/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/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/utils/Strings.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/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\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 = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _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(SignedMath.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n 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\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.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 \\\"../Strings.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 ECDSA {\\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\\\", Strings.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\":\"0x809bc3edb4bcbef8263fa616c1b60ee0004b50a8a1bfa164d8f57fd31f520c58\",\"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/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\"},\"@openzeppelin/contracts/utils/math/Math.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 Math {\\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\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.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 SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"contracts/SeekerPowerOracle.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\n\\nimport \\\"./interfaces/ISeekerPowerOracle.sol\\\";\\n\\n/**\\n * @notice Acts as a source of information for Seeker Powers. Allows setting\\n * a Seeker's power level via a restricted oracle account call. Seeker Power can also\\n * be set by any account if the correct Oracle signature proof is provided.\\n */\\ncontract SeekerPowerOracle is ISeekerPowerOracle, Initializable, Ownable2StepUpgradeable, ERC165 {\\n /**\\n * @notice The oracle account. This contract accepts any attestations of\\n * Seeker power that have been signed by this account.\\n */\\n address public oracle;\\n\\n /**\\n * @notice Tracks nonce used when register the Seeker power to\\n * prevent signature re-use.\\n */\\n mapping(bytes32 => address) private proofNonces;\\n\\n /**\\n * @notice Tracks the set of Seeker Power levels.\\n */\\n mapping(uint256 => uint256) public seekerPowers;\\n\\n event SeekerPowerUpdated(uint256 indexed seekerId, uint256 indexed power);\\n\\n error UnauthorizedRegisterSeekerPowerCall();\\n error NonceCannotBeReused();\\n\\n function initialize(address _oracle) external initializer {\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n oracle = _oracle;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(ISeekerPowerOracle).interfaceId;\\n }\\n\\n /**\\n * @notice Sets the oracle account.\\n * @param _oracle The oracle account.\\n */\\n function setOracle(address _oracle) external onlyOwner {\\n oracle = _oracle;\\n }\\n\\n /**\\n * @notice Registers a Seeker's power level. Only callable by the\\n * owner or the oracle account.\\n * @param seekerId The id of the Seeker.\\n * @param power The power level of the Seeker.\\n */\\n function registerSeekerPowerRestricted(uint256 seekerId, uint256 power) external {\\n if (msg.sender != oracle) {\\n revert UnauthorizedRegisterSeekerPowerCall();\\n }\\n\\n seekerPowers[seekerId] = power;\\n emit SeekerPowerUpdated(seekerId, power);\\n }\\n\\n /**\\n * @notice Registers a Seeker's power level. Callable by any account\\n * but requires a proof signed by the oracle.\\n * @param seekerId The id of the Seeker.\\n * @param power The power level of the Seeker.\\n */\\n function registerSeekerPower(\\n uint256 seekerId,\\n uint256 power,\\n bytes32 nonce,\\n bytes calldata proof\\n ) external {\\n if (proofNonces[nonce] != address(0)) {\\n revert NonceCannotBeReused();\\n }\\n\\n bytes memory proofMessage = getProofMessage(seekerId, power, nonce);\\n bytes32 ecdsaHash = ECDSA.toEthSignedMessageHash(proofMessage);\\n\\n if (ECDSA.recover(ecdsaHash, proof) != oracle) {\\n revert UnauthorizedRegisterSeekerPowerCall();\\n }\\n\\n seekerPowers[seekerId] = power;\\n proofNonces[nonce] = oracle;\\n\\n emit SeekerPowerUpdated(seekerId, power);\\n }\\n\\n /**\\n * @notice Retrieves a Seeker's stored power level.\\n * @param seekerId The id of the Seeker.\\n */\\n function getSeekerPower(uint256 seekerId) external view returns (uint256) {\\n return seekerPowers[seekerId];\\n }\\n\\n /**\\n * @notice Constructs a proof message for the oracle to sign.\\n * @param seekerId The id of the Seeker.\\n * @param power The power level of the Seeker.\\n */\\n function getProofMessage(\\n uint256 seekerId,\\n uint256 power,\\n bytes32 nonce\\n ) public pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n Strings.toString(seekerId),\\n \\\":\\\",\\n Strings.toString(power),\\n \\\":\\\",\\n Strings.toHexString(uint256(nonce), 32)\\n );\\n }\\n}\\n\",\"keccak256\":\"0xbd652d364b9b0742083dc6dcce34b58aefddda5335afdcb3f8d42358cb89b18a\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/ISeekerPowerOracle.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface ISeekerPowerOracle {\\n function setOracle(address oracle) external;\\n\\n function registerSeekerPowerRestricted(uint256 seekerId, uint256 power) external;\\n\\n function registerSeekerPower(\\n uint256 seekerId,\\n uint256 power,\\n bytes32 nonce,\\n bytes calldata proof\\n ) external;\\n\\n function getSeekerPower(uint256 seekerId) external view returns (uint256);\\n\\n function getProofMessage(\\n uint256 seekerId,\\n uint256 power,\\n bytes32 nonce\\n ) external pure returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x26fb3e81dabde31b8730d4c601c51c881e018b540f19f7c599a8a7f9b8c05523\",\"license\":\"Apache-2.0\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506110f0806100206000396000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063ac0350741161008c578063bbf311b311610066578063bbf311b31461020a578063c4d66de81461021d578063e30c397814610230578063f2fde38b1461024157600080fd5b8063ac035074146101b7578063b3b52807146101ca578063b955c567146101ea57600080fd5b806379ba5097116100c857806379ba5097146101605780637adbf973146101685780637dc0d1d01461017b5780638da5cb5b146101a657600080fd5b806301ffc9a7146100ef57806366a0896414610128578063715018a614610156575b600080fd5b6101136100fd366004610d83565b6001600160e01b03191663b83e19d760e01b1490565b60405190151581526020015b60405180910390f35b610148610136366004610dad565b60009081526099602052604090205490565b60405190815260200161011f565b61015e610254565b005b61015e610268565b61015e610176366004610dc6565b6102e7565b60975461018e906001600160a01b031681565b6040516001600160a01b03909116815260200161011f565b6033546001600160a01b031661018e565b61015e6101c5366004610def565b610311565b6101dd6101d8366004610e11565b61037b565b60405161011f9190610e61565b6101486101f8366004610dad565b60996020526000908152604090205481565b61015e610218366004610e94565b6103c4565b61015e61022b366004610dc6565b6104ff565b6065546001600160a01b031661018e565b61015e61024f366004610dc6565b61062c565b61025c61069d565b61026660006106f7565b565b60655433906001600160a01b031681146102db5760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b6102e4816106f7565b50565b6102ef61069d565b609780546001600160a01b0319166001600160a01b0392909216919091179055565b6097546001600160a01b0316331461033c5760405163441e21ad60e01b815260040160405180910390fd5b60008281526099602052604080822083905551829184917f51e90e779fee3d4d807fb1ebd78153a738db91e236abd2e1372e8355ed6ed6f29190a35050565b606061038684610710565b61038f84610710565b61039a8460206107a3565b6040516020016103ac93929190610f21565b60405160208183030381529060405290509392505050565b6000838152609860205260409020546001600160a01b0316156103fa57604051635989b1a960e11b815260040160405180910390fd5b600061040786868661037b565b9050600061041482610948565b609754604080516020601f88018190048102820181019092528681529293506001600160a01b039091169161046691849190889088908190840183828082843760009201919091525061098392505050565b6001600160a01b03161461048d5760405163441e21ad60e01b815260040160405180910390fd5b6000878152609960209081526040808320899055609754888452609890925280832080546001600160a01b0319166001600160a01b039093169290921790915551879189917f51e90e779fee3d4d807fb1ebd78153a738db91e236abd2e1372e8355ed6ed6f29190a350505050505050565b600054610100900460ff161580801561051f5750600054600160ff909116105b806105395750303b158015610539575060005460ff166001145b61059c5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016102d2565b6000805460ff1916600117905580156105bf576000805461ff0019166101001790555b6105c76109a7565b609780546001600160a01b0319166001600160a01b0384161790558015610628576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050565b61063461069d565b606580546001600160a01b0383166001600160a01b031990911681179091556106656033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6033546001600160a01b031633146102665760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102d2565b606580546001600160a01b03191690556102e4816109d6565b6060600061071d83610a28565b600101905060008167ffffffffffffffff81111561073d5761073d610f7b565b6040519080825280601f01601f191660200182016040528015610767576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461077157509392505050565b606060006107b2836002610fa7565b6107bd906002610fbe565b67ffffffffffffffff8111156107d5576107d5610f7b565b6040519080825280601f01601f1916602001820160405280156107ff576020820181803683370190505b509050600360fc1b8160008151811061081a5761081a610fd1565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061084957610849610fd1565b60200101906001600160f81b031916908160001a905350600061086d846002610fa7565b610878906001610fbe565b90505b60018111156108f0576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106108ac576108ac610fd1565b1a60f81b8282815181106108c2576108c2610fd1565b60200101906001600160f81b031916908160001a90535060049490941c936108e981610fe7565b905061087b565b50831561093f5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016102d2565b90505b92915050565b60006109548251610710565b82604051602001610966929190610ffe565b604051602081830303815290604052805190602001209050919050565b60008060006109928585610b00565b9150915061099f81610b45565b509392505050565b600054610100900460ff166109ce5760405162461bcd60e51b81526004016102d290611059565b610266610c8f565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310610a675772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310610a93576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310610ab157662386f26fc10000830492506010015b6305f5e1008310610ac9576305f5e100830492506008015b6127108310610add57612710830492506004015b60648310610aef576064830492506002015b600a83106109425760010192915050565b6000808251604103610b365760208301516040840151606085015160001a610b2a87828585610cbf565b94509450505050610b3e565b506000905060025b9250929050565b6000816004811115610b5957610b596110a4565b03610b615750565b6001816004811115610b7557610b756110a4565b03610bc25760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016102d2565b6002816004811115610bd657610bd66110a4565b03610c235760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016102d2565b6003816004811115610c3757610c376110a4565b036102e45760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016102d2565b600054610100900460ff16610cb65760405162461bcd60e51b81526004016102d290611059565b610266336106f7565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115610cf65750600090506003610d7a565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015610d4a573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610d7357600060019250925050610d7a565b9150600090505b94509492505050565b600060208284031215610d9557600080fd5b81356001600160e01b03198116811461093f57600080fd5b600060208284031215610dbf57600080fd5b5035919050565b600060208284031215610dd857600080fd5b81356001600160a01b038116811461093f57600080fd5b60008060408385031215610e0257600080fd5b50508035926020909101359150565b600080600060608486031215610e2657600080fd5b505081359360208301359350604090920135919050565b60005b83811015610e58578181015183820152602001610e40565b50506000910152565b6020815260008251806020840152610e80816040850160208701610e3d565b601f01601f19169190910160400192915050565b600080600080600060808688031215610eac57600080fd5b853594506020860135935060408601359250606086013567ffffffffffffffff80821115610ed957600080fd5b818801915088601f830112610eed57600080fd5b813581811115610efc57600080fd5b896020828501011115610f0e57600080fd5b9699959850939650602001949392505050565b60008451610f33818460208901610e3d565b8083019050601d60f91b8082528551610f53816001850160208a01610e3d565b60019201918201528351610f6e816002840160208801610e3d565b0160020195945050505050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761094257610942610f91565b8082018082111561094257610942610f91565b634e487b7160e01b600052603260045260246000fd5b600081610ff657610ff6610f91565b506000190190565b7f19457468657265756d205369676e6564204d6573736167653a0a00000000000081526000835161103681601a850160208801610e3d565b83519083019061104d81601a840160208801610e3d565b01601a01949350505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b634e487b7160e01b600052602160045260246000fdfea26469706673582212206e73458124cd19e40f974ed31c23e8c8b90ff8e39f215dc9615d0b7b7d51d02864736f6c63430008120033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063ac0350741161008c578063bbf311b311610066578063bbf311b31461020a578063c4d66de81461021d578063e30c397814610230578063f2fde38b1461024157600080fd5b8063ac035074146101b7578063b3b52807146101ca578063b955c567146101ea57600080fd5b806379ba5097116100c857806379ba5097146101605780637adbf973146101685780637dc0d1d01461017b5780638da5cb5b146101a657600080fd5b806301ffc9a7146100ef57806366a0896414610128578063715018a614610156575b600080fd5b6101136100fd366004610d83565b6001600160e01b03191663b83e19d760e01b1490565b60405190151581526020015b60405180910390f35b610148610136366004610dad565b60009081526099602052604090205490565b60405190815260200161011f565b61015e610254565b005b61015e610268565b61015e610176366004610dc6565b6102e7565b60975461018e906001600160a01b031681565b6040516001600160a01b03909116815260200161011f565b6033546001600160a01b031661018e565b61015e6101c5366004610def565b610311565b6101dd6101d8366004610e11565b61037b565b60405161011f9190610e61565b6101486101f8366004610dad565b60996020526000908152604090205481565b61015e610218366004610e94565b6103c4565b61015e61022b366004610dc6565b6104ff565b6065546001600160a01b031661018e565b61015e61024f366004610dc6565b61062c565b61025c61069d565b61026660006106f7565b565b60655433906001600160a01b031681146102db5760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b6102e4816106f7565b50565b6102ef61069d565b609780546001600160a01b0319166001600160a01b0392909216919091179055565b6097546001600160a01b0316331461033c5760405163441e21ad60e01b815260040160405180910390fd5b60008281526099602052604080822083905551829184917f51e90e779fee3d4d807fb1ebd78153a738db91e236abd2e1372e8355ed6ed6f29190a35050565b606061038684610710565b61038f84610710565b61039a8460206107a3565b6040516020016103ac93929190610f21565b60405160208183030381529060405290509392505050565b6000838152609860205260409020546001600160a01b0316156103fa57604051635989b1a960e11b815260040160405180910390fd5b600061040786868661037b565b9050600061041482610948565b609754604080516020601f88018190048102820181019092528681529293506001600160a01b039091169161046691849190889088908190840183828082843760009201919091525061098392505050565b6001600160a01b03161461048d5760405163441e21ad60e01b815260040160405180910390fd5b6000878152609960209081526040808320899055609754888452609890925280832080546001600160a01b0319166001600160a01b039093169290921790915551879189917f51e90e779fee3d4d807fb1ebd78153a738db91e236abd2e1372e8355ed6ed6f29190a350505050505050565b600054610100900460ff161580801561051f5750600054600160ff909116105b806105395750303b158015610539575060005460ff166001145b61059c5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016102d2565b6000805460ff1916600117905580156105bf576000805461ff0019166101001790555b6105c76109a7565b609780546001600160a01b0319166001600160a01b0384161790558015610628576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050565b61063461069d565b606580546001600160a01b0383166001600160a01b031990911681179091556106656033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6033546001600160a01b031633146102665760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102d2565b606580546001600160a01b03191690556102e4816109d6565b6060600061071d83610a28565b600101905060008167ffffffffffffffff81111561073d5761073d610f7b565b6040519080825280601f01601f191660200182016040528015610767576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461077157509392505050565b606060006107b2836002610fa7565b6107bd906002610fbe565b67ffffffffffffffff8111156107d5576107d5610f7b565b6040519080825280601f01601f1916602001820160405280156107ff576020820181803683370190505b509050600360fc1b8160008151811061081a5761081a610fd1565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061084957610849610fd1565b60200101906001600160f81b031916908160001a905350600061086d846002610fa7565b610878906001610fbe565b90505b60018111156108f0576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106108ac576108ac610fd1565b1a60f81b8282815181106108c2576108c2610fd1565b60200101906001600160f81b031916908160001a90535060049490941c936108e981610fe7565b905061087b565b50831561093f5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016102d2565b90505b92915050565b60006109548251610710565b82604051602001610966929190610ffe565b604051602081830303815290604052805190602001209050919050565b60008060006109928585610b00565b9150915061099f81610b45565b509392505050565b600054610100900460ff166109ce5760405162461bcd60e51b81526004016102d290611059565b610266610c8f565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310610a675772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310610a93576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310610ab157662386f26fc10000830492506010015b6305f5e1008310610ac9576305f5e100830492506008015b6127108310610add57612710830492506004015b60648310610aef576064830492506002015b600a83106109425760010192915050565b6000808251604103610b365760208301516040840151606085015160001a610b2a87828585610cbf565b94509450505050610b3e565b506000905060025b9250929050565b6000816004811115610b5957610b596110a4565b03610b615750565b6001816004811115610b7557610b756110a4565b03610bc25760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016102d2565b6002816004811115610bd657610bd66110a4565b03610c235760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016102d2565b6003816004811115610c3757610c376110a4565b036102e45760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016102d2565b600054610100900460ff16610cb65760405162461bcd60e51b81526004016102d290611059565b610266336106f7565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115610cf65750600090506003610d7a565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015610d4a573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610d7357600060019250925050610d7a565b9150600090505b94509492505050565b600060208284031215610d9557600080fd5b81356001600160e01b03198116811461093f57600080fd5b600060208284031215610dbf57600080fd5b5035919050565b600060208284031215610dd857600080fd5b81356001600160a01b038116811461093f57600080fd5b60008060408385031215610e0257600080fd5b50508035926020909101359150565b600080600060608486031215610e2657600080fd5b505081359360208301359350604090920135919050565b60005b83811015610e58578181015183820152602001610e40565b50506000910152565b6020815260008251806020840152610e80816040850160208701610e3d565b601f01601f19169190910160400192915050565b600080600080600060808688031215610eac57600080fd5b853594506020860135935060408601359250606086013567ffffffffffffffff80821115610ed957600080fd5b818801915088601f830112610eed57600080fd5b813581811115610efc57600080fd5b896020828501011115610f0e57600080fd5b9699959850939650602001949392505050565b60008451610f33818460208901610e3d565b8083019050601d60f91b8082528551610f53816001850160208a01610e3d565b60019201918201528351610f6e816002840160208801610e3d565b0160020195945050505050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761094257610942610f91565b8082018082111561094257610942610f91565b634e487b7160e01b600052603260045260246000fd5b600081610ff657610ff6610f91565b506000190190565b7f19457468657265756d205369676e6564204d6573736167653a0a00000000000081526000835161103681601a850160208801610e3d565b83519083019061104d81601a840160208801610e3d565b01601a01949350505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b634e487b7160e01b600052602160045260246000fdfea26469706673582212206e73458124cd19e40f974ed31c23e8c8b90ff8e39f215dc9615d0b7b7d51d02864736f6c63430008120033", + "devdoc": { + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "acceptOwnership()": { + "details": "The new owner accepts the ownership transfer." + }, + "getProofMessage(uint256,uint256,bytes32)": { + "params": { + "power": "The power level of the Seeker.", + "seekerId": "The id of the Seeker." + } + }, + "getSeekerPower(uint256)": { + "params": { + "seekerId": "The id of the Seeker." + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pendingOwner()": { + "details": "Returns the address of the pending owner." + }, + "registerSeekerPower(uint256,uint256,bytes32,bytes)": { + "params": { + "power": "The power level of the Seeker.", + "seekerId": "The id of the Seeker." + } + }, + "registerSeekerPowerRestricted(uint256,uint256)": { + "params": { + "power": "The power level of the Seeker.", + "seekerId": "The id of the Seeker." + } + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "setOracle(address)": { + "params": { + "_oracle": "The oracle account." + } + }, + "transferOwnership(address)": { + "details": "Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "getProofMessage(uint256,uint256,bytes32)": { + "notice": "Constructs a proof message for the oracle to sign." + }, + "getSeekerPower(uint256)": { + "notice": "Retrieves a Seeker's stored power level." + }, + "oracle()": { + "notice": "The oracle account. This contract accepts any attestations of Seeker power that have been signed by this account." + }, + "registerSeekerPower(uint256,uint256,bytes32,bytes)": { + "notice": "Registers a Seeker's power level. Callable by any account but requires a proof signed by the oracle." + }, + "registerSeekerPowerRestricted(uint256,uint256)": { + "notice": "Registers a Seeker's power level. Only callable by the owner or the oracle account." + }, + "seekerPowers(uint256)": { + "notice": "Tracks the set of Seeker Power levels." + }, + "setOracle(address)": { + "notice": "Sets the oracle account." + }, + "supportsInterface(bytes4)": { + "notice": "Returns true if the contract implements the interface defined by `interfaceId` from ERC165." + } + }, + "notice": "Acts as a source of information for Seeker Powers. Allows setting a Seeker's power level via a restricted oracle account call. Seeker Power can also be set by any account if the correct Oracle signature proof is provided.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 244, + "contract": "contracts/SeekerPowerOracle.sol:SeekerPowerOracle", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 247, + "contract": "contracts/SeekerPowerOracle.sol:SeekerPowerOracle", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 777, + "contract": "contracts/SeekerPowerOracle.sol:SeekerPowerOracle", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 116, + "contract": "contracts/SeekerPowerOracle.sol:SeekerPowerOracle", + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address" + }, + { + "astId": 236, + "contract": "contracts/SeekerPowerOracle.sol:SeekerPowerOracle", + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 25, + "contract": "contracts/SeekerPowerOracle.sol:SeekerPowerOracle", + "label": "_pendingOwner", + "offset": 0, + "slot": "101", + "type": "t_address" + }, + { + "astId": 104, + "contract": "contracts/SeekerPowerOracle.sol:SeekerPowerOracle", + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 9661, + "contract": "contracts/SeekerPowerOracle.sol:SeekerPowerOracle", + "label": "oracle", + "offset": 0, + "slot": "151", + "type": "t_address" + }, + { + "astId": 9666, + "contract": "contracts/SeekerPowerOracle.sol:SeekerPowerOracle", + "label": "proofNonces", + "offset": 0, + "slot": "152", + "type": "t_mapping(t_bytes32,t_address)" + }, + { + "astId": 9671, + "contract": "contracts/SeekerPowerOracle.sol:SeekerPowerOracle", + "label": "seekerPowers", + "offset": 0, + "slot": "153", + "type": "t_mapping(t_uint256,t_uint256)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes32,t_address)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => address)", + "numberOfBytes": "32", + "value": "t_address" + }, + "t_mapping(t_uint256,t_uint256)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/deployments/porcini-dev/SeekerPowerOracle_Proxy.json b/deployments/porcini-dev/SeekerPowerOracle_Proxy.json new file mode 100644 index 00000000..33b14594 --- /dev/null +++ b/deployments/porcini-dev/SeekerPowerOracle_Proxy.json @@ -0,0 +1,235 @@ +{ + "address": "0xdB51e2219Fc69627ae29D177E4a1c9D9129E8230", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xc0c545c9364c293e5dd43c57385a3f5aa90b5ec2c84147645e65fb8db5a25ba8", + "receipt": { + "to": null, + "from": "0x448c8e9e1816300Dd052e77D2A44c990A2807D15", + "contractAddress": "0xdB51e2219Fc69627ae29D177E4a1c9D9129E8230", + "transactionIndex": 0, + "gasUsed": "720430", + "logsBloom": "0x00000000000000000000000000000000400000000000000000800000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000100000000004000000000000000000000000000000000000000000000000060000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000001000000000000000000000000000", + "blockHash": "0x8ddf32c76b0532ccc2a335649fe46e093419236f8e8df241f9878b2c8748e199", + "transactionHash": "0xc0c545c9364c293e5dd43c57385a3f5aa90b5ec2c84147645e65fb8db5a25ba8", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 10978384, + "transactionHash": "0xc0c545c9364c293e5dd43c57385a3f5aa90b5ec2c84147645e65fb8db5a25ba8", + "address": "0xdB51e2219Fc69627ae29D177E4a1c9D9129E8230", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x0000000000000000000000002e2f4d5a29dbd67433dadb806c1573af5fb99657" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0x8ddf32c76b0532ccc2a335649fe46e093419236f8e8df241f9878b2c8748e199" + }, + { + "transactionIndex": 0, + "blockNumber": 10978384, + "transactionHash": "0xc0c545c9364c293e5dd43c57385a3f5aa90b5ec2c84147645e65fb8db5a25ba8", + "address": "0xdB51e2219Fc69627ae29D177E4a1c9D9129E8230", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f06d5edb04f4995fff2c362a14826107f7cccbcc", + "logIndex": 1, + "blockHash": "0x8ddf32c76b0532ccc2a335649fe46e093419236f8e8df241f9878b2c8748e199" + } + ], + "blockNumber": 10978384, + "cumulativeGasUsed": "720430", + "status": 1, + "byzantium": true + }, + "args": [ + "0x2E2f4d5A29dbD67433DaDB806C1573Af5Fb99657", + "0xf06d5Edb04F4995FFF2c362a14826107F7CCCBCc", + "0x" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\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\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.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 *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\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 Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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 Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual 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 Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\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(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\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(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) 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\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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 overriden 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 internall 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 overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/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\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\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 * ```\\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`, and `uint256`._\\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 /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\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 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 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 assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/porcini-dev/StakingManager.json b/deployments/porcini-dev/StakingManager.json new file mode 100644 index 00000000..aafa27c8 --- /dev/null +++ b/deployments/porcini-dev/StakingManager.json @@ -0,0 +1,991 @@ +{ + "address": "0x9DBdad1AF4c0ab8065A2AD0e55172590d6655cFf", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "inputs": [], + "name": "CannotCancelUnlockZeroAmount", + "type": "error" + }, + { + "inputs": [], + "name": "CannotStakeZeroAmount", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "stakeAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "unlockAmount", + "type": "uint256" + } + ], + "name": "CannotUnlockMoreThanStaked", + "type": "error" + }, + { + "inputs": [], + "name": "CannotUnlockZeroAmount", + "type": "error" + }, + { + "inputs": [], + "name": "ContractNameCannotBeEmpty", + "type": "error" + }, + { + "inputs": [], + "name": "InterfaceIdCannotBeZeroBytes", + "type": "error" + }, + { + "inputs": [], + "name": "NoStakeToUnlock", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "seekerId", + "type": "uint256" + } + ], + "name": "SeekerPowerNotRegistered", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "maxCapacity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "currentCapacity", + "type": "uint256" + } + ], + "name": "StakeCapacityReached", + "type": "error" + }, + { + "inputs": [], + "name": "StakeNotYetUnlocked", + "type": "error" + }, + { + "inputs": [], + "name": "StakeeCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "TargetContractCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "TargetNotSupportInterface", + "type": "error" + }, + { + "inputs": [], + "name": "TokenCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "UnlockDurationCannotBeZero", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "minimumStakeProportion", + "type": "uint256" + } + ], + "name": "MinimumStakeProportionUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "unlockDuration", + "type": "uint256" + } + ], + "name": "UnlockDurationUpdated", + "type": "event" + }, + { + "inputs": [], + "name": "_epochsManager", + "outputs": [ + { + "internalType": "contract EpochsManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_rewardsManager", + "outputs": [ + { + "internalType": "contract RewardsManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_seekerPowerOracle", + "outputs": [ + { + "internalType": "contract SeekerPowerOracle", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_token", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "name": "addStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "name": "calculateCapacityFromMinStakingProportion", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "seekerId", + "type": "uint256" + } + ], + "name": "calculateCapacityFromSeekerPower", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "name": "calculateMaxAdditionalDelegatedStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "name": "cancelUnlocking", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "name": "checkMinimumStakeProportion", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + }, + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "getCurrentStakerAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + }, + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "getKey", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + }, + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "getStakeEntry", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "updatedAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + } + ], + "internalType": "struct IStakingManager.StakeEntry", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "name": "getStakeeTotalManagedStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalManagedStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "internalType": "contract RewardsManager", + "name": "rewardsManager", + "type": "address" + }, + { + "internalType": "contract EpochsManager", + "name": "epochsManager", + "type": "address" + }, + { + "internalType": "contract SeekerPowerOracle", + "name": "seekerPowerOracle", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_unlockDuration", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "_minimumStakeProportion", + "type": "uint32" + }, + { + "internalType": "uint256", + "name": "_seekerPowerMultiplier", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "minimumStakeProportion", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "seekerPowerMultiplier", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_minimumStakeProportion", + "type": "uint32" + } + ], + "name": "setMinimumStakeProportion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_unlockDuration", + "type": "uint256" + } + ], + "name": "setUnlockDuration", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "stakes", + "outputs": [ + { + "internalType": "uint256", + "name": "totalManagedStake", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalManagedStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unlockDuration", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "name": "unlockStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "unlockings", + "outputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "unlockAt", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "name": "withdrawStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0x509239272057bc4c557b4cddba9c932f662c0ae5a7a7abff67277a3db7bd2bd6", + "receipt": { + "to": null, + "from": "0x448c8e9e1816300Dd052e77D2A44c990A2807D15", + "contractAddress": "0x9DBdad1AF4c0ab8065A2AD0e55172590d6655cFf", + "transactionIndex": 0, + "gasUsed": "720430", + "logsBloom": "0x00000000000000000000000000000000400000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000400000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000002000000000002000000000000000c00000000000400000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x935857de77b32a472c7e5a89dd3d7ef8eb15a5da4d32ab571acc25b636e0afa5", + "transactionHash": "0x509239272057bc4c557b4cddba9c932f662c0ae5a7a7abff67277a3db7bd2bd6", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 10978373, + "transactionHash": "0x509239272057bc4c557b4cddba9c932f662c0ae5a7a7abff67277a3db7bd2bd6", + "address": "0x9DBdad1AF4c0ab8065A2AD0e55172590d6655cFf", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000b90b73e736112efa0cf9efa8614254c5e1a5b52c" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0x935857de77b32a472c7e5a89dd3d7ef8eb15a5da4d32ab571acc25b636e0afa5" + }, + { + "transactionIndex": 0, + "blockNumber": 10978373, + "transactionHash": "0x509239272057bc4c557b4cddba9c932f662c0ae5a7a7abff67277a3db7bd2bd6", + "address": "0x9DBdad1AF4c0ab8065A2AD0e55172590d6655cFf", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f06d5edb04f4995fff2c362a14826107f7cccbcc", + "logIndex": 1, + "blockHash": "0x935857de77b32a472c7e5a89dd3d7ef8eb15a5da4d32ab571acc25b636e0afa5" + } + ], + "blockNumber": 10978373, + "cumulativeGasUsed": "720430", + "status": 1, + "byzantium": true + }, + "args": [ + "0xb90b73e736112eFa0Cf9eFA8614254C5e1a5b52c", + "0xf06d5Edb04F4995FFF2c362a14826107F7CCCBCc", + "0x" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\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\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.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 *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\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 Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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 Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual 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 Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\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(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\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(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) 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\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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 overriden 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 internall 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 overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/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\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\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 * ```\\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`, and `uint256`._\\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 /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\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 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 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 assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "implementation": "0xb90b73e736112eFa0Cf9eFA8614254C5e1a5b52c", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/porcini-dev/StakingManager_Implementation.json b/deployments/porcini-dev/StakingManager_Implementation.json new file mode 100644 index 00000000..206488f4 --- /dev/null +++ b/deployments/porcini-dev/StakingManager_Implementation.json @@ -0,0 +1,1280 @@ +{ + "address": "0xb90b73e736112eFa0Cf9eFA8614254C5e1a5b52c", + "abi": [ + { + "inputs": [], + "name": "CannotCancelUnlockZeroAmount", + "type": "error" + }, + { + "inputs": [], + "name": "CannotStakeZeroAmount", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "stakeAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "unlockAmount", + "type": "uint256" + } + ], + "name": "CannotUnlockMoreThanStaked", + "type": "error" + }, + { + "inputs": [], + "name": "CannotUnlockZeroAmount", + "type": "error" + }, + { + "inputs": [], + "name": "ContractNameCannotBeEmpty", + "type": "error" + }, + { + "inputs": [], + "name": "InterfaceIdCannotBeZeroBytes", + "type": "error" + }, + { + "inputs": [], + "name": "NoStakeToUnlock", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "seekerId", + "type": "uint256" + } + ], + "name": "SeekerPowerNotRegistered", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "maxCapacity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "currentCapacity", + "type": "uint256" + } + ], + "name": "StakeCapacityReached", + "type": "error" + }, + { + "inputs": [], + "name": "StakeNotYetUnlocked", + "type": "error" + }, + { + "inputs": [], + "name": "StakeeCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "TargetContractCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "TargetNotSupportInterface", + "type": "error" + }, + { + "inputs": [], + "name": "TokenCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "UnlockDurationCannotBeZero", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "minimumStakeProportion", + "type": "uint256" + } + ], + "name": "MinimumStakeProportionUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "unlockDuration", + "type": "uint256" + } + ], + "name": "UnlockDurationUpdated", + "type": "event" + }, + { + "inputs": [], + "name": "_epochsManager", + "outputs": [ + { + "internalType": "contract EpochsManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_rewardsManager", + "outputs": [ + { + "internalType": "contract RewardsManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_seekerPowerOracle", + "outputs": [ + { + "internalType": "contract SeekerPowerOracle", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_token", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "name": "addStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "name": "calculateCapacityFromMinStakingProportion", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "seekerId", + "type": "uint256" + } + ], + "name": "calculateCapacityFromSeekerPower", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "name": "calculateMaxAdditionalDelegatedStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "name": "cancelUnlocking", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "name": "checkMinimumStakeProportion", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + }, + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "getCurrentStakerAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + }, + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "getKey", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + }, + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "getStakeEntry", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "updatedAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + } + ], + "internalType": "struct IStakingManager.StakeEntry", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "name": "getStakeeTotalManagedStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalManagedStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "internalType": "contract RewardsManager", + "name": "rewardsManager", + "type": "address" + }, + { + "internalType": "contract EpochsManager", + "name": "epochsManager", + "type": "address" + }, + { + "internalType": "contract SeekerPowerOracle", + "name": "seekerPowerOracle", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_unlockDuration", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "_minimumStakeProportion", + "type": "uint32" + }, + { + "internalType": "uint256", + "name": "_seekerPowerMultiplier", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "minimumStakeProportion", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "seekerPowerMultiplier", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_minimumStakeProportion", + "type": "uint32" + } + ], + "name": "setMinimumStakeProportion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_unlockDuration", + "type": "uint256" + } + ], + "name": "setUnlockDuration", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "stakes", + "outputs": [ + { + "internalType": "uint256", + "name": "totalManagedStake", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalManagedStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unlockDuration", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "name": "unlockStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "unlockings", + "outputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "unlockAt", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakee", + "type": "address" + } + ], + "name": "withdrawStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x4bcfed647f423ae8706dad6f35f9a8f62f227a863c5177aafed8109404fb3915", + "receipt": { + "to": null, + "from": "0x448c8e9e1816300Dd052e77D2A44c990A2807D15", + "contractAddress": "0xb90b73e736112eFa0Cf9eFA8614254C5e1a5b52c", + "transactionIndex": 0, + "gasUsed": "1551128", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x42661fb4366dca38360a57c207cfb8e4034bda2347597f8b68693ce832c135da", + "transactionHash": "0x4bcfed647f423ae8706dad6f35f9a8f62f227a863c5177aafed8109404fb3915", + "logs": [], + "blockNumber": 10978372, + "cumulativeGasUsed": "1551128", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "76c1e1f3445d6d518cb33f614f9922c9", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"CannotCancelUnlockZeroAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CannotStakeZeroAmount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"stakeAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unlockAmount\",\"type\":\"uint256\"}],\"name\":\"CannotUnlockMoreThanStaked\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CannotUnlockZeroAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ContractNameCannotBeEmpty\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InterfaceIdCannotBeZeroBytes\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoStakeToUnlock\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"seekerId\",\"type\":\"uint256\"}],\"name\":\"SeekerPowerNotRegistered\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"maxCapacity\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"currentCapacity\",\"type\":\"uint256\"}],\"name\":\"StakeCapacityReached\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StakeNotYetUnlocked\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StakeeCannotBeZeroAddress\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"TargetContractCannotBeZeroAddress\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"TargetNotSupportInterface\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TokenCannotBeZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnlockDurationCannotBeZero\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minimumStakeProportion\",\"type\":\"uint256\"}],\"name\":\"MinimumStakeProportionUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unlockDuration\",\"type\":\"uint256\"}],\"name\":\"UnlockDurationUpdated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"_epochsManager\",\"outputs\":[{\"internalType\":\"contract EpochsManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_rewardsManager\",\"outputs\":[{\"internalType\":\"contract RewardsManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_seekerPowerOracle\",\"outputs\":[{\"internalType\":\"contract SeekerPowerOracle\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_token\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"stakee\",\"type\":\"address\"}],\"name\":\"addStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"stakee\",\"type\":\"address\"}],\"name\":\"calculateCapacityFromMinStakingProportion\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"seekerId\",\"type\":\"uint256\"}],\"name\":\"calculateCapacityFromSeekerPower\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"stakee\",\"type\":\"address\"}],\"name\":\"calculateMaxAdditionalDelegatedStake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"stakee\",\"type\":\"address\"}],\"name\":\"cancelUnlocking\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"stakee\",\"type\":\"address\"}],\"name\":\"checkMinimumStakeProportion\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"stakee\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"staker\",\"type\":\"address\"}],\"name\":\"getCurrentStakerAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"stakee\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"staker\",\"type\":\"address\"}],\"name\":\"getKey\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"stakee\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"staker\",\"type\":\"address\"}],\"name\":\"getStakeEntry\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"}],\"internalType\":\"struct IStakingManager.StakeEntry\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"stakee\",\"type\":\"address\"}],\"name\":\"getStakeeTotalManagedStake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalManagedStake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"contract RewardsManager\",\"name\":\"rewardsManager\",\"type\":\"address\"},{\"internalType\":\"contract EpochsManager\",\"name\":\"epochsManager\",\"type\":\"address\"},{\"internalType\":\"contract SeekerPowerOracle\",\"name\":\"seekerPowerOracle\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_unlockDuration\",\"type\":\"uint256\"},{\"internalType\":\"uint32\",\"name\":\"_minimumStakeProportion\",\"type\":\"uint32\"},{\"internalType\":\"uint256\",\"name\":\"_seekerPowerMultiplier\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minimumStakeProportion\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"seekerPowerMultiplier\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"_minimumStakeProportion\",\"type\":\"uint32\"}],\"name\":\"setMinimumStakeProportion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_unlockDuration\",\"type\":\"uint256\"}],\"name\":\"setUnlockDuration\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"stakes\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"totalManagedStake\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalManagedStake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unlockDuration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"stakee\",\"type\":\"address\"}],\"name\":\"unlockStake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"unlockings\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unlockAt\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"stakee\",\"type\":\"address\"}],\"name\":\"withdrawStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"addStake(uint256,address)\":{\"params\":{\"amount\":\"The amount of stake to add in SOLO.\",\"stakee\":\"The address of the staked Node.\"}},\"calculateCapacityFromMinStakingProportion(address)\":{\"params\":{\"stakee\":\"The address of the staked Node.\"}},\"calculateMaxAdditionalDelegatedStake(address)\":{\"params\":{\"stakee\":\"The address of the staked Node.\"}},\"cancelUnlocking(uint256,address)\":{\"params\":{\"amount\":\"The amount of unlocking stake to cancel in SOLO.\",\"stakee\":\"The address of the staked Node.\"}},\"checkMinimumStakeProportion(address)\":{\"params\":{\"stakee\":\"The address of the staked Node.\"},\"returns\":{\"_0\":\"True if the Node is meeting minimum stake proportion requirement.\"}},\"getCurrentStakerAmount(address,address)\":{\"params\":{\"stakee\":\"The address of the staked Node.\",\"staker\":\"The address of the staker.\"},\"returns\":{\"_0\":\"The amount of staked SOLO.\"}},\"getKey(address,address)\":{\"params\":{\"stakee\":\"The address of the staked Node.\",\"staker\":\"The address of the staker.\"},\"returns\":{\"_0\":\"A byte-array representing the key.\"}},\"getStakeEntry(address,address)\":{\"params\":{\"stakee\":\"The address of the staked Node.\",\"staker\":\"The address of the staker.\"},\"returns\":{\"_0\":\"The stake entry.\"}},\"getStakeeTotalManagedStake(address)\":{\"params\":{\"stakee\":\"The address of the staked Node.\"},\"returns\":{\"_0\":\"The amount of staked SOLO.\"}},\"getTotalManagedStake()\":{\"returns\":{\"_0\":\"The total amount of managed stake in SOLO.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"setMinimumStakeProportion(uint32)\":{\"params\":{\"_minimumStakeProportion\":\"The minimum stake proportion in SOLO.\"}},\"setUnlockDuration(uint256)\":{\"params\":{\"_unlockDuration\":\"The unlock duration in number of blocks.\"}},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"},\"unlockStake(uint256,address)\":{\"params\":{\"amount\":\"The amount of stake to unlock in SOLO.\",\"stakee\":\"The address of the staked Node.\"}},\"withdrawStake(address)\":{\"params\":{\"stakee\":\"The address of the staked Node.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"_rewardsManager()\":{\"notice\":\"Rewards Manager contract. Any changes to stake will automatically trigger a claim to any outstanding rewards.\"},\"_token()\":{\"notice\":\"ERC 20 compatible token we are dealing with \"},\"addStake(uint256,address)\":{\"notice\":\"Called by Nodes and delegated stakers to add stake. This function will fail under the following conditions: - If the Node address is invalid - If the specified stake value is zero - If the additional stake causes the Node to fail to meet the minimum stake proportion requirement.\"},\"calculateCapacityFromMinStakingProportion(address)\":{\"notice\":\"This function can be used to a determine a Node's staking capacity, based on the minimum stake proportion constant.\"},\"calculateCapacityFromSeekerPower(uint256)\":{\"notice\":\"This function determines the staking capacity of a Seeker based on its power level. The method will revert if the Seeker's power level has not been registered with the oracle. Currently the algorithm is as follows: staking_capacity = seeker_power * seeker_power_multiplier;\"},\"calculateMaxAdditionalDelegatedStake(address)\":{\"notice\":\"This function should be called by clients to determine how much additional delegated stake can be allocated to a Node via an addStake or cancelUnlocking call. This is useful to avoid a revert due to the minimum stake proportion requirement not being met from the additional stake.\"},\"cancelUnlocking(uint256,address)\":{\"notice\":\"Call this function to cancel any stake that is in the process of unlocking. As this essentially adds back stake to the Node, this will trigger an automatic claim of any outstanding staking rewards. If the specified amount to cancel is greater than the stake that is currently being unlocked, it will cancel the maximum stake possible.\"},\"checkMinimumStakeProportion(address)\":{\"notice\":\"Check if a Node is meeting the minimum stake proportion requirement.\"},\"getCurrentStakerAmount(address,address)\":{\"notice\":\"Retrieve the current amount of SOLO staked against a Node by a specified staker.\"},\"getKey(address,address)\":{\"notice\":\"Retrieve the key used to index a stake entry. The key is a hash which takes both address of the Node and the staker as input.\"},\"getStakeEntry(address,address)\":{\"notice\":\"Retrieve a stake entry.\"},\"getStakeeTotalManagedStake(address)\":{\"notice\":\"Retrieve the total amount of SOLO staked against a Node.\"},\"getTotalManagedStake()\":{\"notice\":\"Retrieve the total stake being managed by this contract.\"},\"minimumStakeProportion()\":{\"notice\":\"Minimum amount of stake that a Node needs to stake against itself in order to participate in the network. This is represented as a percentage of the Node's total stake, where the value is a ratio of 10000.\"},\"seekerPowerMultiplier()\":{\"notice\":\"The multiplier used in determining a Seeker's staking capacity based on its power level.\"},\"setMinimumStakeProportion(uint32)\":{\"notice\":\"Sets the minimum stake proportion for Nodes. Only callable by the owner.\"},\"setUnlockDuration(uint256)\":{\"notice\":\"Sets the unlock duration for stakes. Only callable by the owner.\"},\"stakes(address)\":{\"notice\":\"Tracks the managed stake for every Node.\"},\"supportsInterface(bytes4)\":{\"notice\":\"Returns true if the contract implements the interface defined by `interfaceId` from ERC165.\"},\"totalManagedStake()\":{\"notice\":\"Tracks overall total stake held by this contract \"},\"unlockDuration()\":{\"notice\":\"The number of blocks a user must wait after calling \\\"unlock\\\" before they can withdraw their stake\"},\"unlockStake(uint256,address)\":{\"notice\":\"Call this function to begin the unlocking process. Calling this will trigger an automatic claim of any outstanding staking rewards. Any stake that was already in the unlocking phase will have the specified amount added to it, and its duration refreshed. This function will fail under the following conditions: - If no stake exists for the caller - If the unlock amount is zero - If the unlock amount is more than what is staked Note: If calling as a Node, this function will *not* revert if it causes the Node to fail to meet the minimum stake proportion. However it will still prevent the Node from participating in the network until the minimum is met again.\"},\"unlockings(bytes32)\":{\"notice\":\"Tracks funds that are in the process of being unlocked. This is indexed by a key that hashes both the address of the staked Node and the address of the staker.\"},\"withdrawStake(address)\":{\"notice\":\"Call this function to withdraw stake that has finished unlocking. This will fail if the stake has not yet unlocked.\"}},\"notice\":\"Manages stakes and delegated stakes for Nodes. Holding staked Sylo is necessary for a Node to participate in the Sylo Network. The stake is used in stake-weighted scan function, and delegated stakers are rewarded on a pro-rata basis.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/staking/StakingManager.sol\":\"StakingManager\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./OwnableUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership} and {acceptOwnership}.\\n *\\n * This module is used through inheritance. It will make available all functions\\n * from parent (Ownable).\\n */\\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\\n function __Ownable2Step_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable2Step_init_unchained() internal onlyInitializing {\\n }\\n address private _pendingOwner;\\n\\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Returns the address of the pending owner.\\n */\\n function pendingOwner() public view virtual returns (address) {\\n return _pendingOwner;\\n }\\n\\n /**\\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual override onlyOwner {\\n _pendingOwner = newOwner;\\n emit OwnershipTransferStarted(owner(), newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual override {\\n delete _pendingOwner;\\n super._transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev The new owner accepts the ownership transfer.\\n */\\n function acceptOwnership() public virtual {\\n address sender = _msgSender();\\n require(pendingOwner() == sender, \\\"Ownable2Step: caller is not the new owner\\\");\\n _transferOwnership(sender);\\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\":\"0x84efb8889801b0ac817324aff6acc691d07bbee816b671817132911d287a8c63\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n\\n /**\\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\":\"0x4075622496acc77fd6d4de4cc30a8577a744d5c75afad33fdeacf1704d6eda98\",\"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/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/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/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\",\"keccak256\":\"0xa56ca923f70c1748830700250b19c61b70db9a683516dc5e216694a50445d99c\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.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 IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xec63854014a5b4f2b3290ab9103a21bdf902a508d0f41a8573fea49e98bf571a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.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 \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n /**\\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.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(IERC20 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(IERC20 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(IERC20 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(IERC20 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(IERC20 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 IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n 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(IERC20 token, bytes memory data) private returns (bool) {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\\n // and not revert is the subcall reverts.\\n\\n (bool success, bytes memory returndata) = address(token).call(data);\\n return\\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\\n }\\n}\\n\",\"keccak256\":\"0x909d608c2db6eb165ca178c81289a07ed2e118e444d0025b2a85c97d0b44a4fa\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"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/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\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.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/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\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 = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _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(SignedMath.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n 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\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.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 \\\"../Strings.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 ECDSA {\\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\\\", Strings.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\":\"0x809bc3edb4bcbef8263fa616c1b60ee0004b50a8a1bfa164d8f57fd31f520c58\",\"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/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\"},\"@openzeppelin/contracts/utils/math/Math.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 Math {\\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\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)\\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\\n * checks.\\n *\\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\\n * easily result in undesired exploitation or bugs, since developers usually\\n * assume that overflows raise errors. `SafeCast` restores this intuition by\\n * reverting the transaction when such an operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n *\\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\\n * all math on `uint256` and `int256` and then downcasting.\\n */\\nlibrary SafeCast {\\n /**\\n * @dev Returns the downcasted uint248 from uint256, reverting on\\n * overflow (when the input is greater than largest uint248).\\n *\\n * Counterpart to Solidity's `uint248` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 248 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint248(uint256 value) internal pure returns (uint248) {\\n require(value <= type(uint248).max, \\\"SafeCast: value doesn't fit in 248 bits\\\");\\n return uint248(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint240 from uint256, reverting on\\n * overflow (when the input is greater than largest uint240).\\n *\\n * Counterpart to Solidity's `uint240` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 240 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint240(uint256 value) internal pure returns (uint240) {\\n require(value <= type(uint240).max, \\\"SafeCast: value doesn't fit in 240 bits\\\");\\n return uint240(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint232 from uint256, reverting on\\n * overflow (when the input is greater than largest uint232).\\n *\\n * Counterpart to Solidity's `uint232` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 232 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint232(uint256 value) internal pure returns (uint232) {\\n require(value <= type(uint232).max, \\\"SafeCast: value doesn't fit in 232 bits\\\");\\n return uint232(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint224 from uint256, reverting on\\n * overflow (when the input is greater than largest uint224).\\n *\\n * Counterpart to Solidity's `uint224` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 224 bits\\n *\\n * _Available since v4.2._\\n */\\n function toUint224(uint256 value) internal pure returns (uint224) {\\n require(value <= type(uint224).max, \\\"SafeCast: value doesn't fit in 224 bits\\\");\\n return uint224(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint216 from uint256, reverting on\\n * overflow (when the input is greater than largest uint216).\\n *\\n * Counterpart to Solidity's `uint216` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 216 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint216(uint256 value) internal pure returns (uint216) {\\n require(value <= type(uint216).max, \\\"SafeCast: value doesn't fit in 216 bits\\\");\\n return uint216(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint208 from uint256, reverting on\\n * overflow (when the input is greater than largest uint208).\\n *\\n * Counterpart to Solidity's `uint208` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 208 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint208(uint256 value) internal pure returns (uint208) {\\n require(value <= type(uint208).max, \\\"SafeCast: value doesn't fit in 208 bits\\\");\\n return uint208(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint200 from uint256, reverting on\\n * overflow (when the input is greater than largest uint200).\\n *\\n * Counterpart to Solidity's `uint200` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 200 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint200(uint256 value) internal pure returns (uint200) {\\n require(value <= type(uint200).max, \\\"SafeCast: value doesn't fit in 200 bits\\\");\\n return uint200(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint192 from uint256, reverting on\\n * overflow (when the input is greater than largest uint192).\\n *\\n * Counterpart to Solidity's `uint192` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 192 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint192(uint256 value) internal pure returns (uint192) {\\n require(value <= type(uint192).max, \\\"SafeCast: value doesn't fit in 192 bits\\\");\\n return uint192(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint184 from uint256, reverting on\\n * overflow (when the input is greater than largest uint184).\\n *\\n * Counterpart to Solidity's `uint184` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 184 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint184(uint256 value) internal pure returns (uint184) {\\n require(value <= type(uint184).max, \\\"SafeCast: value doesn't fit in 184 bits\\\");\\n return uint184(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint176 from uint256, reverting on\\n * overflow (when the input is greater than largest uint176).\\n *\\n * Counterpart to Solidity's `uint176` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 176 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint176(uint256 value) internal pure returns (uint176) {\\n require(value <= type(uint176).max, \\\"SafeCast: value doesn't fit in 176 bits\\\");\\n return uint176(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint168 from uint256, reverting on\\n * overflow (when the input is greater than largest uint168).\\n *\\n * Counterpart to Solidity's `uint168` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 168 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint168(uint256 value) internal pure returns (uint168) {\\n require(value <= type(uint168).max, \\\"SafeCast: value doesn't fit in 168 bits\\\");\\n return uint168(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint160 from uint256, reverting on\\n * overflow (when the input is greater than largest uint160).\\n *\\n * Counterpart to Solidity's `uint160` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 160 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint160(uint256 value) internal pure returns (uint160) {\\n require(value <= type(uint160).max, \\\"SafeCast: value doesn't fit in 160 bits\\\");\\n return uint160(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint152 from uint256, reverting on\\n * overflow (when the input is greater than largest uint152).\\n *\\n * Counterpart to Solidity's `uint152` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 152 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint152(uint256 value) internal pure returns (uint152) {\\n require(value <= type(uint152).max, \\\"SafeCast: value doesn't fit in 152 bits\\\");\\n return uint152(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint144 from uint256, reverting on\\n * overflow (when the input is greater than largest uint144).\\n *\\n * Counterpart to Solidity's `uint144` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 144 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint144(uint256 value) internal pure returns (uint144) {\\n require(value <= type(uint144).max, \\\"SafeCast: value doesn't fit in 144 bits\\\");\\n return uint144(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint136 from uint256, reverting on\\n * overflow (when the input is greater than largest uint136).\\n *\\n * Counterpart to Solidity's `uint136` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 136 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint136(uint256 value) internal pure returns (uint136) {\\n require(value <= type(uint136).max, \\\"SafeCast: value doesn't fit in 136 bits\\\");\\n return uint136(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint128 from uint256, reverting on\\n * overflow (when the input is greater than largest uint128).\\n *\\n * Counterpart to Solidity's `uint128` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 128 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint128(uint256 value) internal pure returns (uint128) {\\n require(value <= type(uint128).max, \\\"SafeCast: value doesn't fit in 128 bits\\\");\\n return uint128(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint120 from uint256, reverting on\\n * overflow (when the input is greater than largest uint120).\\n *\\n * Counterpart to Solidity's `uint120` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 120 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint120(uint256 value) internal pure returns (uint120) {\\n require(value <= type(uint120).max, \\\"SafeCast: value doesn't fit in 120 bits\\\");\\n return uint120(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint112 from uint256, reverting on\\n * overflow (when the input is greater than largest uint112).\\n *\\n * Counterpart to Solidity's `uint112` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 112 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint112(uint256 value) internal pure returns (uint112) {\\n require(value <= type(uint112).max, \\\"SafeCast: value doesn't fit in 112 bits\\\");\\n return uint112(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint104 from uint256, reverting on\\n * overflow (when the input is greater than largest uint104).\\n *\\n * Counterpart to Solidity's `uint104` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 104 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint104(uint256 value) internal pure returns (uint104) {\\n require(value <= type(uint104).max, \\\"SafeCast: value doesn't fit in 104 bits\\\");\\n return uint104(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint96 from uint256, reverting on\\n * overflow (when the input is greater than largest uint96).\\n *\\n * Counterpart to Solidity's `uint96` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 96 bits\\n *\\n * _Available since v4.2._\\n */\\n function toUint96(uint256 value) internal pure returns (uint96) {\\n require(value <= type(uint96).max, \\\"SafeCast: value doesn't fit in 96 bits\\\");\\n return uint96(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint88 from uint256, reverting on\\n * overflow (when the input is greater than largest uint88).\\n *\\n * Counterpart to Solidity's `uint88` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 88 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint88(uint256 value) internal pure returns (uint88) {\\n require(value <= type(uint88).max, \\\"SafeCast: value doesn't fit in 88 bits\\\");\\n return uint88(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint80 from uint256, reverting on\\n * overflow (when the input is greater than largest uint80).\\n *\\n * Counterpart to Solidity's `uint80` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 80 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint80(uint256 value) internal pure returns (uint80) {\\n require(value <= type(uint80).max, \\\"SafeCast: value doesn't fit in 80 bits\\\");\\n return uint80(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint72 from uint256, reverting on\\n * overflow (when the input is greater than largest uint72).\\n *\\n * Counterpart to Solidity's `uint72` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 72 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint72(uint256 value) internal pure returns (uint72) {\\n require(value <= type(uint72).max, \\\"SafeCast: value doesn't fit in 72 bits\\\");\\n return uint72(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint64 from uint256, reverting on\\n * overflow (when the input is greater than largest uint64).\\n *\\n * Counterpart to Solidity's `uint64` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 64 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint64(uint256 value) internal pure returns (uint64) {\\n require(value <= type(uint64).max, \\\"SafeCast: value doesn't fit in 64 bits\\\");\\n return uint64(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint56 from uint256, reverting on\\n * overflow (when the input is greater than largest uint56).\\n *\\n * Counterpart to Solidity's `uint56` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 56 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint56(uint256 value) internal pure returns (uint56) {\\n require(value <= type(uint56).max, \\\"SafeCast: value doesn't fit in 56 bits\\\");\\n return uint56(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint48 from uint256, reverting on\\n * overflow (when the input is greater than largest uint48).\\n *\\n * Counterpart to Solidity's `uint48` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 48 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint48(uint256 value) internal pure returns (uint48) {\\n require(value <= type(uint48).max, \\\"SafeCast: value doesn't fit in 48 bits\\\");\\n return uint48(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint40 from uint256, reverting on\\n * overflow (when the input is greater than largest uint40).\\n *\\n * Counterpart to Solidity's `uint40` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 40 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint40(uint256 value) internal pure returns (uint40) {\\n require(value <= type(uint40).max, \\\"SafeCast: value doesn't fit in 40 bits\\\");\\n return uint40(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint32 from uint256, reverting on\\n * overflow (when the input is greater than largest uint32).\\n *\\n * Counterpart to Solidity's `uint32` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 32 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint32(uint256 value) internal pure returns (uint32) {\\n require(value <= type(uint32).max, \\\"SafeCast: value doesn't fit in 32 bits\\\");\\n return uint32(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint24 from uint256, reverting on\\n * overflow (when the input is greater than largest uint24).\\n *\\n * Counterpart to Solidity's `uint24` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 24 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint24(uint256 value) internal pure returns (uint24) {\\n require(value <= type(uint24).max, \\\"SafeCast: value doesn't fit in 24 bits\\\");\\n return uint24(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint16 from uint256, reverting on\\n * overflow (when the input is greater than largest uint16).\\n *\\n * Counterpart to Solidity's `uint16` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 16 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint16(uint256 value) internal pure returns (uint16) {\\n require(value <= type(uint16).max, \\\"SafeCast: value doesn't fit in 16 bits\\\");\\n return uint16(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint8 from uint256, reverting on\\n * overflow (when the input is greater than largest uint8).\\n *\\n * Counterpart to Solidity's `uint8` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 8 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint8(uint256 value) internal pure returns (uint8) {\\n require(value <= type(uint8).max, \\\"SafeCast: value doesn't fit in 8 bits\\\");\\n return uint8(value);\\n }\\n\\n /**\\n * @dev Converts a signed int256 into an unsigned uint256.\\n *\\n * Requirements:\\n *\\n * - input must be greater than or equal to 0.\\n *\\n * _Available since v3.0._\\n */\\n function toUint256(int256 value) internal pure returns (uint256) {\\n require(value >= 0, \\\"SafeCast: value must be positive\\\");\\n return uint256(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int248 from int256, reverting on\\n * overflow (when the input is less than smallest int248 or\\n * greater than largest int248).\\n *\\n * Counterpart to Solidity's `int248` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 248 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\\n downcasted = int248(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 248 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int240 from int256, reverting on\\n * overflow (when the input is less than smallest int240 or\\n * greater than largest int240).\\n *\\n * Counterpart to Solidity's `int240` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 240 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\\n downcasted = int240(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 240 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int232 from int256, reverting on\\n * overflow (when the input is less than smallest int232 or\\n * greater than largest int232).\\n *\\n * Counterpart to Solidity's `int232` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 232 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\\n downcasted = int232(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 232 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int224 from int256, reverting on\\n * overflow (when the input is less than smallest int224 or\\n * greater than largest int224).\\n *\\n * Counterpart to Solidity's `int224` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 224 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\\n downcasted = int224(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 224 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int216 from int256, reverting on\\n * overflow (when the input is less than smallest int216 or\\n * greater than largest int216).\\n *\\n * Counterpart to Solidity's `int216` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 216 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\\n downcasted = int216(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 216 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int208 from int256, reverting on\\n * overflow (when the input is less than smallest int208 or\\n * greater than largest int208).\\n *\\n * Counterpart to Solidity's `int208` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 208 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\\n downcasted = int208(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 208 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int200 from int256, reverting on\\n * overflow (when the input is less than smallest int200 or\\n * greater than largest int200).\\n *\\n * Counterpart to Solidity's `int200` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 200 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\\n downcasted = int200(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 200 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int192 from int256, reverting on\\n * overflow (when the input is less than smallest int192 or\\n * greater than largest int192).\\n *\\n * Counterpart to Solidity's `int192` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 192 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\\n downcasted = int192(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 192 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int184 from int256, reverting on\\n * overflow (when the input is less than smallest int184 or\\n * greater than largest int184).\\n *\\n * Counterpart to Solidity's `int184` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 184 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\\n downcasted = int184(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 184 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int176 from int256, reverting on\\n * overflow (when the input is less than smallest int176 or\\n * greater than largest int176).\\n *\\n * Counterpart to Solidity's `int176` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 176 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\\n downcasted = int176(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 176 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int168 from int256, reverting on\\n * overflow (when the input is less than smallest int168 or\\n * greater than largest int168).\\n *\\n * Counterpart to Solidity's `int168` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 168 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\\n downcasted = int168(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 168 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int160 from int256, reverting on\\n * overflow (when the input is less than smallest int160 or\\n * greater than largest int160).\\n *\\n * Counterpart to Solidity's `int160` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 160 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\\n downcasted = int160(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 160 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int152 from int256, reverting on\\n * overflow (when the input is less than smallest int152 or\\n * greater than largest int152).\\n *\\n * Counterpart to Solidity's `int152` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 152 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\\n downcasted = int152(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 152 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int144 from int256, reverting on\\n * overflow (when the input is less than smallest int144 or\\n * greater than largest int144).\\n *\\n * Counterpart to Solidity's `int144` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 144 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\\n downcasted = int144(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 144 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int136 from int256, reverting on\\n * overflow (when the input is less than smallest int136 or\\n * greater than largest int136).\\n *\\n * Counterpart to Solidity's `int136` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 136 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\\n downcasted = int136(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 136 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int128 from int256, reverting on\\n * overflow (when the input is less than smallest int128 or\\n * greater than largest int128).\\n *\\n * Counterpart to Solidity's `int128` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 128 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\\n downcasted = int128(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 128 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int120 from int256, reverting on\\n * overflow (when the input is less than smallest int120 or\\n * greater than largest int120).\\n *\\n * Counterpart to Solidity's `int120` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 120 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\\n downcasted = int120(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 120 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int112 from int256, reverting on\\n * overflow (when the input is less than smallest int112 or\\n * greater than largest int112).\\n *\\n * Counterpart to Solidity's `int112` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 112 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\\n downcasted = int112(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 112 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int104 from int256, reverting on\\n * overflow (when the input is less than smallest int104 or\\n * greater than largest int104).\\n *\\n * Counterpart to Solidity's `int104` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 104 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\\n downcasted = int104(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 104 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int96 from int256, reverting on\\n * overflow (when the input is less than smallest int96 or\\n * greater than largest int96).\\n *\\n * Counterpart to Solidity's `int96` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 96 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\\n downcasted = int96(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 96 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int88 from int256, reverting on\\n * overflow (when the input is less than smallest int88 or\\n * greater than largest int88).\\n *\\n * Counterpart to Solidity's `int88` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 88 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\\n downcasted = int88(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 88 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int80 from int256, reverting on\\n * overflow (when the input is less than smallest int80 or\\n * greater than largest int80).\\n *\\n * Counterpart to Solidity's `int80` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 80 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\\n downcasted = int80(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 80 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int72 from int256, reverting on\\n * overflow (when the input is less than smallest int72 or\\n * greater than largest int72).\\n *\\n * Counterpart to Solidity's `int72` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 72 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\\n downcasted = int72(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 72 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int64 from int256, reverting on\\n * overflow (when the input is less than smallest int64 or\\n * greater than largest int64).\\n *\\n * Counterpart to Solidity's `int64` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 64 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\\n downcasted = int64(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 64 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int56 from int256, reverting on\\n * overflow (when the input is less than smallest int56 or\\n * greater than largest int56).\\n *\\n * Counterpart to Solidity's `int56` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 56 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\\n downcasted = int56(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 56 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int48 from int256, reverting on\\n * overflow (when the input is less than smallest int48 or\\n * greater than largest int48).\\n *\\n * Counterpart to Solidity's `int48` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 48 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\\n downcasted = int48(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 48 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int40 from int256, reverting on\\n * overflow (when the input is less than smallest int40 or\\n * greater than largest int40).\\n *\\n * Counterpart to Solidity's `int40` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 40 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\\n downcasted = int40(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 40 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int32 from int256, reverting on\\n * overflow (when the input is less than smallest int32 or\\n * greater than largest int32).\\n *\\n * Counterpart to Solidity's `int32` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 32 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\\n downcasted = int32(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 32 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int24 from int256, reverting on\\n * overflow (when the input is less than smallest int24 or\\n * greater than largest int24).\\n *\\n * Counterpart to Solidity's `int24` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 24 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\\n downcasted = int24(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 24 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int16 from int256, reverting on\\n * overflow (when the input is less than smallest int16 or\\n * greater than largest int16).\\n *\\n * Counterpart to Solidity's `int16` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 16 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\\n downcasted = int16(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 16 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int8 from int256, reverting on\\n * overflow (when the input is less than smallest int8 or\\n * greater than largest int8).\\n *\\n * Counterpart to Solidity's `int8` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 8 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\\n downcasted = int8(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 8 bits\\\");\\n }\\n\\n /**\\n * @dev Converts an unsigned uint256 into a signed int256.\\n *\\n * Requirements:\\n *\\n * - input must be less than or equal to maxInt256.\\n *\\n * _Available since v3.0._\\n */\\n function toInt256(uint256 value) internal pure returns (int256) {\\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\\n require(value <= uint256(type(int256).max), \\\"SafeCast: value doesn't fit in an int256\\\");\\n return int256(value);\\n }\\n}\\n\",\"keccak256\":\"0x52a8cfb0f5239d11b457dcdd1b326992ef672714ca8da71a157255bddd13f3ad\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.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 SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"abdk-libraries-solidity/ABDKMath64x64.sol\":{\"content\":\"// SPDX-License-Identifier: BSD-4-Clause\\n/*\\n * ABDK Math 64.64 Smart Contract Library. Copyright \\u00a9 2019 by ABDK Consulting.\\n * Author: Mikhail Vladimirov \\n */\\npragma solidity ^0.8.0;\\n\\n/**\\n * Smart contract library of mathematical functions operating with signed\\n * 64.64-bit fixed point numbers. Signed 64.64-bit fixed point number is\\n * basically a simple fraction whose numerator is signed 128-bit integer and\\n * denominator is 2^64. As long as denominator is always the same, there is no\\n * need to store it, thus in Solidity signed 64.64-bit fixed point numbers are\\n * represented by int128 type holding only the numerator.\\n */\\nlibrary ABDKMath64x64 {\\n /*\\n * Minimum value signed 64.64-bit fixed point number may have. \\n */\\n int128 private constant MIN_64x64 = -0x80000000000000000000000000000000;\\n\\n /*\\n * Maximum value signed 64.64-bit fixed point number may have. \\n */\\n int128 private constant MAX_64x64 = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;\\n\\n /**\\n * Convert signed 256-bit integer number into signed 64.64-bit fixed point\\n * number. Revert on overflow.\\n *\\n * @param x signed 256-bit integer number\\n * @return signed 64.64-bit fixed point number\\n */\\n function fromInt (int256 x) internal pure returns (int128) {\\n unchecked {\\n require (x >= -0x8000000000000000 && x <= 0x7FFFFFFFFFFFFFFF);\\n return int128 (x << 64);\\n }\\n }\\n\\n /**\\n * Convert signed 64.64 fixed point number into signed 64-bit integer number\\n * rounding down.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64-bit integer number\\n */\\n function toInt (int128 x) internal pure returns (int64) {\\n unchecked {\\n return int64 (x >> 64);\\n }\\n }\\n\\n /**\\n * Convert unsigned 256-bit integer number into signed 64.64-bit fixed point\\n * number. Revert on overflow.\\n *\\n * @param x unsigned 256-bit integer number\\n * @return signed 64.64-bit fixed point number\\n */\\n function fromUInt (uint256 x) internal pure returns (int128) {\\n unchecked {\\n require (x <= 0x7FFFFFFFFFFFFFFF);\\n return int128 (int256 (x << 64));\\n }\\n }\\n\\n /**\\n * Convert signed 64.64 fixed point number into unsigned 64-bit integer\\n * number rounding down. Revert on underflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return unsigned 64-bit integer number\\n */\\n function toUInt (int128 x) internal pure returns (uint64) {\\n unchecked {\\n require (x >= 0);\\n return uint64 (uint128 (x >> 64));\\n }\\n }\\n\\n /**\\n * Convert signed 128.128 fixed point number into signed 64.64-bit fixed point\\n * number rounding down. Revert on overflow.\\n *\\n * @param x signed 128.128-bin fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function from128x128 (int256 x) internal pure returns (int128) {\\n unchecked {\\n int256 result = x >> 64;\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Convert signed 64.64 fixed point number into signed 128.128 fixed point\\n * number.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 128.128 fixed point number\\n */\\n function to128x128 (int128 x) internal pure returns (int256) {\\n unchecked {\\n return int256 (x) << 64;\\n }\\n }\\n\\n /**\\n * Calculate x + y. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function add (int128 x, int128 y) internal pure returns (int128) {\\n unchecked {\\n int256 result = int256(x) + y;\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate x - y. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function sub (int128 x, int128 y) internal pure returns (int128) {\\n unchecked {\\n int256 result = int256(x) - y;\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate x * y rounding down. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function mul (int128 x, int128 y) internal pure returns (int128) {\\n unchecked {\\n int256 result = int256(x) * y >> 64;\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate x * y rounding towards zero, where x is signed 64.64 fixed point\\n * number and y is signed 256-bit integer number. Revert on overflow.\\n *\\n * @param x signed 64.64 fixed point number\\n * @param y signed 256-bit integer number\\n * @return signed 256-bit integer number\\n */\\n function muli (int128 x, int256 y) internal pure returns (int256) {\\n unchecked {\\n if (x == MIN_64x64) {\\n require (y >= -0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF &&\\n y <= 0x1000000000000000000000000000000000000000000000000);\\n return -y << 63;\\n } else {\\n bool negativeResult = false;\\n if (x < 0) {\\n x = -x;\\n negativeResult = true;\\n }\\n if (y < 0) {\\n y = -y; // We rely on overflow behavior here\\n negativeResult = !negativeResult;\\n }\\n uint256 absoluteResult = mulu (x, uint256 (y));\\n if (negativeResult) {\\n require (absoluteResult <=\\n 0x8000000000000000000000000000000000000000000000000000000000000000);\\n return -int256 (absoluteResult); // We rely on overflow behavior here\\n } else {\\n require (absoluteResult <=\\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\\n return int256 (absoluteResult);\\n }\\n }\\n }\\n }\\n\\n /**\\n * Calculate x * y rounding down, where x is signed 64.64 fixed point number\\n * and y is unsigned 256-bit integer number. Revert on overflow.\\n *\\n * @param x signed 64.64 fixed point number\\n * @param y unsigned 256-bit integer number\\n * @return unsigned 256-bit integer number\\n */\\n function mulu (int128 x, uint256 y) internal pure returns (uint256) {\\n unchecked {\\n if (y == 0) return 0;\\n\\n require (x >= 0);\\n\\n uint256 lo = (uint256 (int256 (x)) * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) >> 64;\\n uint256 hi = uint256 (int256 (x)) * (y >> 128);\\n\\n require (hi <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\\n hi <<= 64;\\n\\n require (hi <=\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - lo);\\n return hi + lo;\\n }\\n }\\n\\n /**\\n * Calculate x / y rounding towards zero. Revert on overflow or when y is\\n * zero.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function div (int128 x, int128 y) internal pure returns (int128) {\\n unchecked {\\n require (y != 0);\\n int256 result = (int256 (x) << 64) / y;\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate x / y rounding towards zero, where x and y are signed 256-bit\\n * integer numbers. Revert on overflow or when y is zero.\\n *\\n * @param x signed 256-bit integer number\\n * @param y signed 256-bit integer number\\n * @return signed 64.64-bit fixed point number\\n */\\n function divi (int256 x, int256 y) internal pure returns (int128) {\\n unchecked {\\n require (y != 0);\\n\\n bool negativeResult = false;\\n if (x < 0) {\\n x = -x; // We rely on overflow behavior here\\n negativeResult = true;\\n }\\n if (y < 0) {\\n y = -y; // We rely on overflow behavior here\\n negativeResult = !negativeResult;\\n }\\n uint128 absoluteResult = divuu (uint256 (x), uint256 (y));\\n if (negativeResult) {\\n require (absoluteResult <= 0x80000000000000000000000000000000);\\n return -int128 (absoluteResult); // We rely on overflow behavior here\\n } else {\\n require (absoluteResult <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\\n return int128 (absoluteResult); // We rely on overflow behavior here\\n }\\n }\\n }\\n\\n /**\\n * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit\\n * integer numbers. Revert on overflow or when y is zero.\\n *\\n * @param x unsigned 256-bit integer number\\n * @param y unsigned 256-bit integer number\\n * @return signed 64.64-bit fixed point number\\n */\\n function divu (uint256 x, uint256 y) internal pure returns (int128) {\\n unchecked {\\n require (y != 0);\\n uint128 result = divuu (x, y);\\n require (result <= uint128 (MAX_64x64));\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate -x. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function neg (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x != MIN_64x64);\\n return -x;\\n }\\n }\\n\\n /**\\n * Calculate |x|. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function abs (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x != MIN_64x64);\\n return x < 0 ? -x : x;\\n }\\n }\\n\\n /**\\n * Calculate 1 / x rounding towards zero. Revert on overflow or when x is\\n * zero.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function inv (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x != 0);\\n int256 result = int256 (0x100000000000000000000000000000000) / x;\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate arithmetics average of x and y, i.e. (x + y) / 2 rounding down.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function avg (int128 x, int128 y) internal pure returns (int128) {\\n unchecked {\\n return int128 ((int256 (x) + int256 (y)) >> 1);\\n }\\n }\\n\\n /**\\n * Calculate geometric average of x and y, i.e. sqrt (x * y) rounding down.\\n * Revert on overflow or in case x * y is negative.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function gavg (int128 x, int128 y) internal pure returns (int128) {\\n unchecked {\\n int256 m = int256 (x) * int256 (y);\\n require (m >= 0);\\n require (m <\\n 0x4000000000000000000000000000000000000000000000000000000000000000);\\n return int128 (sqrtu (uint256 (m)));\\n }\\n }\\n\\n /**\\n * Calculate x^y assuming 0^0 is 1, where x is signed 64.64 fixed point number\\n * and y is unsigned 256-bit integer number. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y uint256 value\\n * @return signed 64.64-bit fixed point number\\n */\\n function pow (int128 x, uint256 y) internal pure returns (int128) {\\n unchecked {\\n bool negative = x < 0 && y & 1 == 1;\\n\\n uint256 absX = uint128 (x < 0 ? -x : x);\\n uint256 absResult;\\n absResult = 0x100000000000000000000000000000000;\\n\\n if (absX <= 0x10000000000000000) {\\n absX <<= 63;\\n while (y != 0) {\\n if (y & 0x1 != 0) {\\n absResult = absResult * absX >> 127;\\n }\\n absX = absX * absX >> 127;\\n\\n if (y & 0x2 != 0) {\\n absResult = absResult * absX >> 127;\\n }\\n absX = absX * absX >> 127;\\n\\n if (y & 0x4 != 0) {\\n absResult = absResult * absX >> 127;\\n }\\n absX = absX * absX >> 127;\\n\\n if (y & 0x8 != 0) {\\n absResult = absResult * absX >> 127;\\n }\\n absX = absX * absX >> 127;\\n\\n y >>= 4;\\n }\\n\\n absResult >>= 64;\\n } else {\\n uint256 absXShift = 63;\\n if (absX < 0x1000000000000000000000000) { absX <<= 32; absXShift -= 32; }\\n if (absX < 0x10000000000000000000000000000) { absX <<= 16; absXShift -= 16; }\\n if (absX < 0x1000000000000000000000000000000) { absX <<= 8; absXShift -= 8; }\\n if (absX < 0x10000000000000000000000000000000) { absX <<= 4; absXShift -= 4; }\\n if (absX < 0x40000000000000000000000000000000) { absX <<= 2; absXShift -= 2; }\\n if (absX < 0x80000000000000000000000000000000) { absX <<= 1; absXShift -= 1; }\\n\\n uint256 resultShift = 0;\\n while (y != 0) {\\n require (absXShift < 64);\\n\\n if (y & 0x1 != 0) {\\n absResult = absResult * absX >> 127;\\n resultShift += absXShift;\\n if (absResult > 0x100000000000000000000000000000000) {\\n absResult >>= 1;\\n resultShift += 1;\\n }\\n }\\n absX = absX * absX >> 127;\\n absXShift <<= 1;\\n if (absX >= 0x100000000000000000000000000000000) {\\n absX >>= 1;\\n absXShift += 1;\\n }\\n\\n y >>= 1;\\n }\\n\\n require (resultShift < 64);\\n absResult >>= 64 - resultShift;\\n }\\n int256 result = negative ? -int256 (absResult) : int256 (absResult);\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate sqrt (x) rounding down. Revert if x < 0.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function sqrt (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x >= 0);\\n return int128 (sqrtu (uint256 (int256 (x)) << 64));\\n }\\n }\\n\\n /**\\n * Calculate binary logarithm of x. Revert if x <= 0.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function log_2 (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x > 0);\\n\\n int256 msb = 0;\\n int256 xc = x;\\n if (xc >= 0x10000000000000000) { xc >>= 64; msb += 64; }\\n if (xc >= 0x100000000) { xc >>= 32; msb += 32; }\\n if (xc >= 0x10000) { xc >>= 16; msb += 16; }\\n if (xc >= 0x100) { xc >>= 8; msb += 8; }\\n if (xc >= 0x10) { xc >>= 4; msb += 4; }\\n if (xc >= 0x4) { xc >>= 2; msb += 2; }\\n if (xc >= 0x2) msb += 1; // No need to shift xc anymore\\n\\n int256 result = msb - 64 << 64;\\n uint256 ux = uint256 (int256 (x)) << uint256 (127 - msb);\\n for (int256 bit = 0x8000000000000000; bit > 0; bit >>= 1) {\\n ux *= ux;\\n uint256 b = ux >> 255;\\n ux >>= 127 + b;\\n result += bit * int256 (b);\\n }\\n\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate natural logarithm of x. Revert if x <= 0.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function ln (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x > 0);\\n\\n return int128 (int256 (\\n uint256 (int256 (log_2 (x))) * 0xB17217F7D1CF79ABC9E3B39803F2F6AF >> 128));\\n }\\n }\\n\\n /**\\n * Calculate binary exponent of x. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function exp_2 (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x < 0x400000000000000000); // Overflow\\n\\n if (x < -0x400000000000000000) return 0; // Underflow\\n\\n uint256 result = 0x80000000000000000000000000000000;\\n\\n if (x & 0x8000000000000000 > 0)\\n result = result * 0x16A09E667F3BCC908B2FB1366EA957D3E >> 128;\\n if (x & 0x4000000000000000 > 0)\\n result = result * 0x1306FE0A31B7152DE8D5A46305C85EDEC >> 128;\\n if (x & 0x2000000000000000 > 0)\\n result = result * 0x1172B83C7D517ADCDF7C8C50EB14A791F >> 128;\\n if (x & 0x1000000000000000 > 0)\\n result = result * 0x10B5586CF9890F6298B92B71842A98363 >> 128;\\n if (x & 0x800000000000000 > 0)\\n result = result * 0x1059B0D31585743AE7C548EB68CA417FD >> 128;\\n if (x & 0x400000000000000 > 0)\\n result = result * 0x102C9A3E778060EE6F7CACA4F7A29BDE8 >> 128;\\n if (x & 0x200000000000000 > 0)\\n result = result * 0x10163DA9FB33356D84A66AE336DCDFA3F >> 128;\\n if (x & 0x100000000000000 > 0)\\n result = result * 0x100B1AFA5ABCBED6129AB13EC11DC9543 >> 128;\\n if (x & 0x80000000000000 > 0)\\n result = result * 0x10058C86DA1C09EA1FF19D294CF2F679B >> 128;\\n if (x & 0x40000000000000 > 0)\\n result = result * 0x1002C605E2E8CEC506D21BFC89A23A00F >> 128;\\n if (x & 0x20000000000000 > 0)\\n result = result * 0x100162F3904051FA128BCA9C55C31E5DF >> 128;\\n if (x & 0x10000000000000 > 0)\\n result = result * 0x1000B175EFFDC76BA38E31671CA939725 >> 128;\\n if (x & 0x8000000000000 > 0)\\n result = result * 0x100058BA01FB9F96D6CACD4B180917C3D >> 128;\\n if (x & 0x4000000000000 > 0)\\n result = result * 0x10002C5CC37DA9491D0985C348C68E7B3 >> 128;\\n if (x & 0x2000000000000 > 0)\\n result = result * 0x1000162E525EE054754457D5995292026 >> 128;\\n if (x & 0x1000000000000 > 0)\\n result = result * 0x10000B17255775C040618BF4A4ADE83FC >> 128;\\n if (x & 0x800000000000 > 0)\\n result = result * 0x1000058B91B5BC9AE2EED81E9B7D4CFAB >> 128;\\n if (x & 0x400000000000 > 0)\\n result = result * 0x100002C5C89D5EC6CA4D7C8ACC017B7C9 >> 128;\\n if (x & 0x200000000000 > 0)\\n result = result * 0x10000162E43F4F831060E02D839A9D16D >> 128;\\n if (x & 0x100000000000 > 0)\\n result = result * 0x100000B1721BCFC99D9F890EA06911763 >> 128;\\n if (x & 0x80000000000 > 0)\\n result = result * 0x10000058B90CF1E6D97F9CA14DBCC1628 >> 128;\\n if (x & 0x40000000000 > 0)\\n result = result * 0x1000002C5C863B73F016468F6BAC5CA2B >> 128;\\n if (x & 0x20000000000 > 0)\\n result = result * 0x100000162E430E5A18F6119E3C02282A5 >> 128;\\n if (x & 0x10000000000 > 0)\\n result = result * 0x1000000B1721835514B86E6D96EFD1BFE >> 128;\\n if (x & 0x8000000000 > 0)\\n result = result * 0x100000058B90C0B48C6BE5DF846C5B2EF >> 128;\\n if (x & 0x4000000000 > 0)\\n result = result * 0x10000002C5C8601CC6B9E94213C72737A >> 128;\\n if (x & 0x2000000000 > 0)\\n result = result * 0x1000000162E42FFF037DF38AA2B219F06 >> 128;\\n if (x & 0x1000000000 > 0)\\n result = result * 0x10000000B17217FBA9C739AA5819F44F9 >> 128;\\n if (x & 0x800000000 > 0)\\n result = result * 0x1000000058B90BFCDEE5ACD3C1CEDC823 >> 128;\\n if (x & 0x400000000 > 0)\\n result = result * 0x100000002C5C85FE31F35A6A30DA1BE50 >> 128;\\n if (x & 0x200000000 > 0)\\n result = result * 0x10000000162E42FF0999CE3541B9FFFCF >> 128;\\n if (x & 0x100000000 > 0)\\n result = result * 0x100000000B17217F80F4EF5AADDA45554 >> 128;\\n if (x & 0x80000000 > 0)\\n result = result * 0x10000000058B90BFBF8479BD5A81B51AD >> 128;\\n if (x & 0x40000000 > 0)\\n result = result * 0x1000000002C5C85FDF84BD62AE30A74CC >> 128;\\n if (x & 0x20000000 > 0)\\n result = result * 0x100000000162E42FEFB2FED257559BDAA >> 128;\\n if (x & 0x10000000 > 0)\\n result = result * 0x1000000000B17217F7D5A7716BBA4A9AE >> 128;\\n if (x & 0x8000000 > 0)\\n result = result * 0x100000000058B90BFBE9DDBAC5E109CCE >> 128;\\n if (x & 0x4000000 > 0)\\n result = result * 0x10000000002C5C85FDF4B15DE6F17EB0D >> 128;\\n if (x & 0x2000000 > 0)\\n result = result * 0x1000000000162E42FEFA494F1478FDE05 >> 128;\\n if (x & 0x1000000 > 0)\\n result = result * 0x10000000000B17217F7D20CF927C8E94C >> 128;\\n if (x & 0x800000 > 0)\\n result = result * 0x1000000000058B90BFBE8F71CB4E4B33D >> 128;\\n if (x & 0x400000 > 0)\\n result = result * 0x100000000002C5C85FDF477B662B26945 >> 128;\\n if (x & 0x200000 > 0)\\n result = result * 0x10000000000162E42FEFA3AE53369388C >> 128;\\n if (x & 0x100000 > 0)\\n result = result * 0x100000000000B17217F7D1D351A389D40 >> 128;\\n if (x & 0x80000 > 0)\\n result = result * 0x10000000000058B90BFBE8E8B2D3D4EDE >> 128;\\n if (x & 0x40000 > 0)\\n result = result * 0x1000000000002C5C85FDF4741BEA6E77E >> 128;\\n if (x & 0x20000 > 0)\\n result = result * 0x100000000000162E42FEFA39FE95583C2 >> 128;\\n if (x & 0x10000 > 0)\\n result = result * 0x1000000000000B17217F7D1CFB72B45E1 >> 128;\\n if (x & 0x8000 > 0)\\n result = result * 0x100000000000058B90BFBE8E7CC35C3F0 >> 128;\\n if (x & 0x4000 > 0)\\n result = result * 0x10000000000002C5C85FDF473E242EA38 >> 128;\\n if (x & 0x2000 > 0)\\n result = result * 0x1000000000000162E42FEFA39F02B772C >> 128;\\n if (x & 0x1000 > 0)\\n result = result * 0x10000000000000B17217F7D1CF7D83C1A >> 128;\\n if (x & 0x800 > 0)\\n result = result * 0x1000000000000058B90BFBE8E7BDCBE2E >> 128;\\n if (x & 0x400 > 0)\\n result = result * 0x100000000000002C5C85FDF473DEA871F >> 128;\\n if (x & 0x200 > 0)\\n result = result * 0x10000000000000162E42FEFA39EF44D91 >> 128;\\n if (x & 0x100 > 0)\\n result = result * 0x100000000000000B17217F7D1CF79E949 >> 128;\\n if (x & 0x80 > 0)\\n result = result * 0x10000000000000058B90BFBE8E7BCE544 >> 128;\\n if (x & 0x40 > 0)\\n result = result * 0x1000000000000002C5C85FDF473DE6ECA >> 128;\\n if (x & 0x20 > 0)\\n result = result * 0x100000000000000162E42FEFA39EF366F >> 128;\\n if (x & 0x10 > 0)\\n result = result * 0x1000000000000000B17217F7D1CF79AFA >> 128;\\n if (x & 0x8 > 0)\\n result = result * 0x100000000000000058B90BFBE8E7BCD6D >> 128;\\n if (x & 0x4 > 0)\\n result = result * 0x10000000000000002C5C85FDF473DE6B2 >> 128;\\n if (x & 0x2 > 0)\\n result = result * 0x1000000000000000162E42FEFA39EF358 >> 128;\\n if (x & 0x1 > 0)\\n result = result * 0x10000000000000000B17217F7D1CF79AB >> 128;\\n\\n result >>= uint256 (int256 (63 - (x >> 64)));\\n require (result <= uint256 (int256 (MAX_64x64)));\\n\\n return int128 (int256 (result));\\n }\\n }\\n\\n /**\\n * Calculate natural exponent of x. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function exp (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x < 0x400000000000000000); // Overflow\\n\\n if (x < -0x400000000000000000) return 0; // Underflow\\n\\n return exp_2 (\\n int128 (int256 (x) * 0x171547652B82FE1777D0FFDA0D23A7D12 >> 128));\\n }\\n }\\n\\n /**\\n * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit\\n * integer numbers. Revert on overflow or when y is zero.\\n *\\n * @param x unsigned 256-bit integer number\\n * @param y unsigned 256-bit integer number\\n * @return unsigned 64.64-bit fixed point number\\n */\\n function divuu (uint256 x, uint256 y) private pure returns (uint128) {\\n unchecked {\\n require (y != 0);\\n\\n uint256 result;\\n\\n if (x <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)\\n result = (x << 64) / y;\\n else {\\n uint256 msb = 192;\\n uint256 xc = x >> 192;\\n if (xc >= 0x100000000) { xc >>= 32; msb += 32; }\\n if (xc >= 0x10000) { xc >>= 16; msb += 16; }\\n if (xc >= 0x100) { xc >>= 8; msb += 8; }\\n if (xc >= 0x10) { xc >>= 4; msb += 4; }\\n if (xc >= 0x4) { xc >>= 2; msb += 2; }\\n if (xc >= 0x2) msb += 1; // No need to shift xc anymore\\n\\n result = (x << 255 - msb) / ((y - 1 >> msb - 191) + 1);\\n require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\\n\\n uint256 hi = result * (y >> 128);\\n uint256 lo = result * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\\n\\n uint256 xh = x >> 192;\\n uint256 xl = x << 64;\\n\\n if (xl < lo) xh -= 1;\\n xl -= lo; // We rely on overflow behavior here\\n lo = hi << 128;\\n if (xl < lo) xh -= 1;\\n xl -= lo; // We rely on overflow behavior here\\n\\n result += xh == hi >> 128 ? xl / y : 1;\\n }\\n\\n require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\\n return uint128 (result);\\n }\\n }\\n\\n /**\\n * Calculate sqrt (x) rounding down, where x is unsigned 256-bit integer\\n * number.\\n *\\n * @param x unsigned 256-bit integer number\\n * @return unsigned 128-bit integer number\\n */\\n function sqrtu (uint256 x) private pure returns (uint128) {\\n unchecked {\\n if (x == 0) return 0;\\n else {\\n uint256 xx = x;\\n uint256 r = 1;\\n if (xx >= 0x100000000000000000000000000000000) { xx >>= 128; r <<= 64; }\\n if (xx >= 0x10000000000000000) { xx >>= 64; r <<= 32; }\\n if (xx >= 0x100000000) { xx >>= 32; r <<= 16; }\\n if (xx >= 0x10000) { xx >>= 16; r <<= 8; }\\n if (xx >= 0x100) { xx >>= 8; r <<= 4; }\\n if (xx >= 0x10) { xx >>= 4; r <<= 2; }\\n if (xx >= 0x4) { r <<= 1; }\\n r = (r + x / r) >> 1;\\n r = (r + x / r) >> 1;\\n r = (r + x / r) >> 1;\\n r = (r + x / r) >> 1;\\n r = (r + x / r) >> 1;\\n r = (r + x / r) >> 1;\\n r = (r + x / r) >> 1; // Seven iterations should be enough\\n uint256 r1 = x / r;\\n return uint128 (r < r1 ? r : r1);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x1364fdc24192b982f647c7fc68dcb2f6fc1b5e201843e773144bd23a76cb3b97\",\"license\":\"BSD-4-Clause\"},\"contracts/Registries.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\n\\nimport \\\"./libraries/SyloUtils.sol\\\";\\nimport \\\"./interfaces/IRegistries.sol\\\";\\n\\n/**\\n * @notice This contract manages Registries for Nodes. A Registry is a\\n * set of parameters configured by the Node itself. A Node is required\\n * to have a valid Registry to be able to participate in the network.\\n */\\ncontract Registries is IRegistries, Initializable, Ownable2StepUpgradeable, IERC165 {\\n using ECDSA for bytes32;\\n\\n /**\\n * @notice ERC721 contract for bridged Seekers. Used for verifying ownership\\n * of a seeker.\\n */\\n IERC721 public _rootSeekers;\\n\\n /**\\n * @notice Tracks each Node's registry.\\n */\\n mapping(address => IRegistries.Registry) public registries;\\n\\n /**\\n * @notice Tracks the node address that each seeker id is registered with\\n */\\n mapping(uint256 => address) public seekerRegistration;\\n\\n /**\\n * @notice Tracks the address of every registered node.\\n */\\n address[] public nodes;\\n\\n /**\\n * @notice Tracks nonces used when registering the seeker account\\n * to prevent signature re-use.\\n */\\n mapping(bytes32 => address) private signatureNonces;\\n\\n /**\\n * @notice Payout percentage refers to the portion of a tickets reward\\n * that will be allocated to the Node's stakers. This is global, and is\\n * currently set for all Nodes.\\n */\\n uint32 public defaultPayoutPercentage;\\n\\n event DefaultPayoutPercentageUpdated(uint32 defaultPayoutPercentage);\\n\\n error NonceCannotBeReused();\\n error EndMustBeGreaterThanStart();\\n error PercentageCannotExceed100000();\\n error PublicEndpointCannotBeEmpty();\\n error SeekerAccountMustOwnSeekerId();\\n error SeekerAccountMustBeMsgSender();\\n error ProofNotSignedBySeekerAccount();\\n error RootSeekersCannotBeZeroAddress();\\n error SeekerAccountCannotBeZeroAddress();\\n error EndCannotExceedNumberOfNodes(uint256 nodeLength);\\n\\n function initialize(\\n IERC721 rootSeekers,\\n uint32 _defaultPayoutPercentage\\n ) external initializer {\\n if (address(rootSeekers) == address(0)) {\\n revert RootSeekersCannotBeZeroAddress();\\n }\\n if (_defaultPayoutPercentage > 100000) {\\n revert PercentageCannotExceed100000();\\n }\\n\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n _rootSeekers = rootSeekers;\\n defaultPayoutPercentage = _defaultPayoutPercentage;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IRegistries).interfaceId;\\n }\\n\\n /**\\n * @notice Set the global default payout percentage value. Only callable\\n * by the owner.\\n * @param _defaultPayoutPercentage The payout percentage as a value where the\\n * denominator is 10000.\\n */\\n function setDefaultPayoutPercentage(uint32 _defaultPayoutPercentage) external onlyOwner {\\n if (_defaultPayoutPercentage > 100000) {\\n revert PercentageCannotExceed100000();\\n }\\n\\n defaultPayoutPercentage = _defaultPayoutPercentage;\\n emit DefaultPayoutPercentageUpdated(_defaultPayoutPercentage);\\n }\\n\\n /**\\n * @notice Call this as a Node to set or update your Registry entry.\\n * @param publicEndpoint The public endpoint of your Node. Essential for\\n * clients to be able to retrieve additional information, such as\\n * an address to establish a p2p connection.\\n */\\n function register(string calldata publicEndpoint) external {\\n if (bytes(publicEndpoint).length == 0) {\\n revert PublicEndpointCannotBeEmpty();\\n }\\n\\n // This is the nodes first registration\\n if (bytes(registries[msg.sender].publicEndpoint).length == 0) {\\n nodes.push(msg.sender);\\n }\\n\\n registries[msg.sender].publicEndpoint = publicEndpoint;\\n }\\n\\n function setSeekerAccount(\\n address seekerAccount,\\n uint256 seekerId,\\n bytes32 nonce,\\n bytes calldata signature\\n ) external {\\n if (seekerAccount == address(0)) {\\n revert SeekerAccountCannotBeZeroAddress();\\n }\\n if (signatureNonces[nonce] != address(0)) {\\n revert NonceCannotBeReused();\\n }\\n\\n bytes memory proofMessage = getProofMessage(seekerId, msg.sender, nonce);\\n bytes32 ethProof = ECDSA.toEthSignedMessageHash(proofMessage);\\n\\n if (ECDSA.recover(ethProof, signature) != seekerAccount) {\\n revert ProofNotSignedBySeekerAccount();\\n }\\n\\n // Now verify the seeker account actually owns the seeker\\n address owner = _rootSeekers.ownerOf(seekerId);\\n\\n if (seekerAccount != owner) {\\n revert SeekerAccountMustOwnSeekerId();\\n }\\n\\n delete registries[seekerRegistration[seekerId]].seekerId;\\n delete registries[seekerRegistration[seekerId]].seekerAccount;\\n\\n registries[msg.sender].seekerAccount = seekerAccount;\\n registries[msg.sender].seekerId = seekerId;\\n\\n seekerRegistration[seekerId] = msg.sender;\\n\\n signatureNonces[nonce] = seekerAccount;\\n }\\n\\n function revokeSeekerAccount(address node) external {\\n Registry storage registry = registries[node];\\n\\n if (registry.seekerAccount != msg.sender) {\\n revert SeekerAccountMustBeMsgSender();\\n }\\n\\n delete registry.seekerAccount;\\n delete seekerRegistration[registry.seekerId];\\n delete registry.seekerId;\\n }\\n\\n /**\\n * @notice Retrieve the registry associated with a Node.\\n * @param account The address of the Node.\\n * @return The Node's Registry.\\n */\\n function getRegistry(address account) external view returns (Registry memory) {\\n return registries[account];\\n }\\n\\n /**\\n * @notice Retrieve all registered nodes.\\n * @return An array of node addresses.\\n */\\n function getNodes() external view returns (address[] memory) {\\n return nodes;\\n }\\n\\n /**\\n * @notice Retrieves a list of registries. Takes in a\\n * a start and end indices to allow pagination.\\n * @param start The start index which is inclusive.\\n * @param end The end index which is exclusive.\\n * @return An array of Registries.\\n */\\n function getRegistries(\\n uint256 start,\\n uint256 end\\n ) external view returns (address[] memory, Registry[] memory) {\\n uint256 nodesLength = nodes.length;\\n\\n if (end <= start) {\\n revert EndMustBeGreaterThanStart();\\n }\\n if (end > nodesLength) {\\n revert EndCannotExceedNumberOfNodes(nodesLength);\\n }\\n\\n address[] memory _nodes = new address[](end - start);\\n Registry[] memory _registries = new Registry[](_nodes.length);\\n\\n for (uint256 i = start; i < end; ++i) {\\n _nodes[i - start] = nodes[i];\\n _registries[i - start] = registries[nodes[i]];\\n }\\n\\n return (_nodes, _registries);\\n }\\n\\n /**\\n * @notice Returns the total number of registered nodes.\\n * @return The number of registered nodes.\\n */\\n function getTotalNodes() external view returns (uint256) {\\n return nodes.length;\\n }\\n\\n /**\\n * @notice Helper function for deriving the proof message used to\\n * validate seeker ownership.\\n * @param seekerId The tokenId of the seeker used for operation.\\n * @param node The address of the node which that will be operated\\n * by the specified seeker.\\n * @param nonce The nonce used for this message.\\n */\\n function getProofMessage(\\n uint256 seekerId,\\n address node,\\n bytes32 nonce\\n ) public pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n unicode\\\"\\ud83e\\udd16 Hi frend! \\ud83e\\udd16\\\\n\\\\n\\ud83d\\udcdc Signing this message proves that you're the owner of this Seeker NFT and allows your Seeker to be used to operate your Seeker's Node. It's a simple but important step to ensure smooth operation.\\\\n\\\\nThis request will not trigger a blockchain transaction or cost any gas fees.\\\\n\\\\n\\ud83d\\udd25 Your node's address: \\\",\\n Strings.toHexString(uint256(uint160(node)), 20),\\n unicode\\\"\\\\n\\\\n\\ud83c\\udd94 Your seeker id: \\\",\\n Strings.toString(seekerId),\\n unicode\\\"\\\\n\\\\n\\ud83d\\udce6 A unique random value which secures this message: \\\",\\n Strings.toHexString(uint256(nonce), 32)\\n );\\n }\\n}\\n\",\"keccak256\":\"0x492be9b17a6624c5aa9de7b7d93f2ab1d7e6ee6443e60d4f036f7a7c670c343b\",\"license\":\"Apache-2.0\"},\"contracts/SeekerPowerOracle.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\n\\nimport \\\"./interfaces/ISeekerPowerOracle.sol\\\";\\n\\n/**\\n * @notice Acts as a source of information for Seeker Powers. Allows setting\\n * a Seeker's power level via a restricted oracle account call. Seeker Power can also\\n * be set by any account if the correct Oracle signature proof is provided.\\n */\\ncontract SeekerPowerOracle is ISeekerPowerOracle, Initializable, Ownable2StepUpgradeable, ERC165 {\\n /**\\n * @notice The oracle account. This contract accepts any attestations of\\n * Seeker power that have been signed by this account.\\n */\\n address public oracle;\\n\\n /**\\n * @notice Tracks nonce used when register the Seeker power to\\n * prevent signature re-use.\\n */\\n mapping(bytes32 => address) private proofNonces;\\n\\n /**\\n * @notice Tracks the set of Seeker Power levels.\\n */\\n mapping(uint256 => uint256) public seekerPowers;\\n\\n event SeekerPowerUpdated(uint256 indexed seekerId, uint256 indexed power);\\n\\n error UnauthorizedRegisterSeekerPowerCall();\\n error NonceCannotBeReused();\\n\\n function initialize(address _oracle) external initializer {\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n oracle = _oracle;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(ISeekerPowerOracle).interfaceId;\\n }\\n\\n /**\\n * @notice Sets the oracle account.\\n * @param _oracle The oracle account.\\n */\\n function setOracle(address _oracle) external onlyOwner {\\n oracle = _oracle;\\n }\\n\\n /**\\n * @notice Registers a Seeker's power level. Only callable by the\\n * owner or the oracle account.\\n * @param seekerId The id of the Seeker.\\n * @param power The power level of the Seeker.\\n */\\n function registerSeekerPowerRestricted(uint256 seekerId, uint256 power) external {\\n if (msg.sender != oracle) {\\n revert UnauthorizedRegisterSeekerPowerCall();\\n }\\n\\n seekerPowers[seekerId] = power;\\n emit SeekerPowerUpdated(seekerId, power);\\n }\\n\\n /**\\n * @notice Registers a Seeker's power level. Callable by any account\\n * but requires a proof signed by the oracle.\\n * @param seekerId The id of the Seeker.\\n * @param power The power level of the Seeker.\\n */\\n function registerSeekerPower(\\n uint256 seekerId,\\n uint256 power,\\n bytes32 nonce,\\n bytes calldata proof\\n ) external {\\n if (proofNonces[nonce] != address(0)) {\\n revert NonceCannotBeReused();\\n }\\n\\n bytes memory proofMessage = getProofMessage(seekerId, power, nonce);\\n bytes32 ecdsaHash = ECDSA.toEthSignedMessageHash(proofMessage);\\n\\n if (ECDSA.recover(ecdsaHash, proof) != oracle) {\\n revert UnauthorizedRegisterSeekerPowerCall();\\n }\\n\\n seekerPowers[seekerId] = power;\\n proofNonces[nonce] = oracle;\\n\\n emit SeekerPowerUpdated(seekerId, power);\\n }\\n\\n /**\\n * @notice Retrieves a Seeker's stored power level.\\n * @param seekerId The id of the Seeker.\\n */\\n function getSeekerPower(uint256 seekerId) external view returns (uint256) {\\n return seekerPowers[seekerId];\\n }\\n\\n /**\\n * @notice Constructs a proof message for the oracle to sign.\\n * @param seekerId The id of the Seeker.\\n * @param power The power level of the Seeker.\\n */\\n function getProofMessage(\\n uint256 seekerId,\\n uint256 power,\\n bytes32 nonce\\n ) public pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n Strings.toString(seekerId),\\n \\\":\\\",\\n Strings.toString(power),\\n \\\":\\\",\\n Strings.toHexString(uint256(nonce), 32)\\n );\\n }\\n}\\n\",\"keccak256\":\"0xbd652d364b9b0742083dc6dcce34b58aefddda5335afdcb3f8d42358cb89b18a\",\"license\":\"Apache-2.0\"},\"contracts/SyloToken.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/ERC20.sol\\\";\\n\\ncontract SyloToken is ERC20 {\\n constructor() ERC20(\\\"Sylo\\\", \\\"SYLO\\\") {\\n _mint(msg.sender, 10_000_000_000 ether);\\n }\\n}\\n\",\"keccak256\":\"0x75fda7d129e02669cd691691c14fccd1cdac23b833d7a25e899801865d58ef26\",\"license\":\"Apache-2.0\"},\"contracts/epochs/EpochsManager.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\n\\nimport \\\"../Registries.sol\\\";\\nimport \\\"../staking/Directory.sol\\\";\\nimport \\\"../interfaces/epochs/IEpochsManager.sol\\\";\\nimport \\\"../payments/ticketing/TicketingParameters.sol\\\";\\n\\ncontract EpochsManager is IEpochsManager, Initializable, Ownable2StepUpgradeable, ERC165 {\\n Directory public _directory;\\n\\n Registries public _registries;\\n\\n IERC721 public _rootSeekers;\\n\\n TicketingParameters public _ticketingParameters;\\n\\n /**\\n * @notice Track seekers that have joined for a specific epoch.\\n */\\n mapping(uint256 => mapping(uint256 => address)) public activeSeekers;\\n\\n // Define all Epoch specific parameters here.\\n // When initializing an epoch, these parameters are read,\\n // along with parameters from the other contracts to create the\\n // new epoch.\\n\\n /**\\n * @notice A mapping of all epochs that have been initialized.\\n */\\n mapping(uint256 => Epoch) public epochs;\\n\\n /**\\n * @notice The block number since the first epoch can be initialized.\\n */\\n uint256 public initialEpoch;\\n\\n /**\\n * @notice The duration in blocks an epoch will last for.\\n */\\n uint256 public epochDuration;\\n\\n /**\\n * @notice The value of the integer used as the current\\n * epoch's identifier. This value is incremented as each epoch\\n * is initialized.\\n */\\n uint256 public currentIteration;\\n\\n event NewEpoch(uint256 indexed epochId);\\n event EpochJoined(uint256 indexed epochId, address indexed node, uint256 indexed seekerId);\\n event InitialEpochUpdated(uint256 initialEpoch);\\n event EpochDurationUpdated(uint256 epochDuration);\\n\\n error SeekerOwnerMismatch();\\n error InitialEpochCannotBeZero();\\n error EpochDurationCannotBeZero();\\n error DirectoryCannotBeZeroAddress();\\n error RegistriesCannotBeZeroAddress();\\n error RootSeekerCannotBeZeroAddress();\\n error EpochHasNotEnded(uint256 epochId);\\n error SeekerAccountCannotBeZeroAddress();\\n error TicketingParametersCannotBeZeroAddress();\\n error SeekerAlreadyJoinedEpoch(uint256 epochId, uint256 seekerId);\\n error InitialEpochNotYetReady(uint256 expectedBlock, uint256 currentBlock);\\n\\n function initialize(\\n IERC721 rootSeekers,\\n Directory directory,\\n Registries registries,\\n TicketingParameters ticketingParameters,\\n uint256 _initialEpoch,\\n uint256 _epochDuration\\n ) external initializer {\\n if (address(rootSeekers) == address(0)) {\\n revert RootSeekerCannotBeZeroAddress();\\n }\\n\\n SyloUtils.validateContractInterface(\\n \\\"Directory\\\",\\n address(directory),\\n type(IDirectory).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"Registries\\\",\\n address(registries),\\n type(IRegistries).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"TicketingParameters\\\",\\n address(ticketingParameters),\\n type(ITicketingParameters).interfaceId\\n );\\n\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n _rootSeekers = rootSeekers;\\n _directory = directory;\\n _registries = registries;\\n _ticketingParameters = ticketingParameters;\\n\\n initialEpoch = _initialEpoch;\\n epochDuration = _epochDuration;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IEpochsManager).interfaceId;\\n }\\n\\n /**\\n * @notice Call this to initialize the next epoch. On success, a `NewEpoch` event\\n * will be emitted.\\n * @dev The function will read the current set of network parameters, and store\\n * the parameters in a new Epoch struct. The end block of the current epoch\\n * will also be set to a non-zero value.\\n */\\n function initializeEpoch() external returns (uint256) {\\n if (currentIteration == 0 && initialEpoch > block.number) {\\n revert InitialEpochNotYetReady(initialEpoch, block.number);\\n }\\n\\n Epoch storage current = epochs[currentIteration];\\n\\n uint256 end = current.startBlock + current.duration;\\n if (end > block.number) {\\n revert EpochHasNotEnded(currentIteration);\\n }\\n\\n (\\n uint256 faceValue,\\n uint128 baseLiveWinProb,\\n uint128 expiredWinProb,\\n uint256 ticketDuration,\\n uint32 decayRate\\n ) = _ticketingParameters.getTicketingParameters();\\n\\n uint256 nextEpochId = getNextEpochId();\\n\\n epochs[nextEpochId] = Epoch(\\n block.number,\\n epochDuration,\\n 0,\\n _registries.defaultPayoutPercentage(),\\n decayRate,\\n faceValue,\\n baseLiveWinProb,\\n expiredWinProb,\\n ticketDuration\\n );\\n\\n current.endBlock = block.number;\\n\\n currentIteration = nextEpochId;\\n\\n _directory.setCurrentDirectory(nextEpochId);\\n\\n emit NewEpoch(nextEpochId);\\n\\n return nextEpochId;\\n }\\n\\n /**\\n * @notice Set the first epoch starting block. Only callable by the owner.\\n * @param _initialEpoch The block number when the first epoch can be initialized.\\n */\\n function setInitialEpoch(uint256 _initialEpoch) external onlyOwner {\\n if (_initialEpoch == 0) {\\n revert InitialEpochCannotBeZero();\\n }\\n initialEpoch = _initialEpoch;\\n emit InitialEpochUpdated(_initialEpoch);\\n }\\n\\n /**\\n * @notice Set the epoch duration. Will take effect in the next epoch. Only\\n * callable by the owner.\\n * @param _epochDuration The epoch duration in number of blocks.\\n */\\n function setEpochDuration(uint256 _epochDuration) external onlyOwner {\\n if (_epochDuration == 0) {\\n revert EpochDurationCannotBeZero();\\n }\\n epochDuration = _epochDuration;\\n emit EpochDurationUpdated(epochDuration);\\n }\\n\\n /**\\n * @notice Retrieve the parameters for the current epoch.\\n * @return The current Epoch parameters.\\n */\\n function getCurrentActiveEpoch() external view returns (uint256, Epoch memory) {\\n return (currentIteration, epochs[currentIteration]);\\n }\\n\\n /**\\n * @notice Nodes should call this to join the next epoch. It will\\n * initialize the next reward pool and set the stake for the next directory.\\n * @dev This is a proxy function for `initalizeNextRewardPool` and\\n * `joinNextDirectory`.\\n */\\n function joinNextEpoch() external {\\n Registries.Registry memory registry = _registries.getRegistry(msg.sender);\\n\\n // validate the node's seeker ownership\\n if (registry.seekerAccount == address(0)) {\\n revert SeekerAccountCannotBeZeroAddress();\\n }\\n\\n uint256 seekerId = registry.seekerId;\\n\\n address owner = _rootSeekers.ownerOf(seekerId);\\n if (registry.seekerAccount != owner) {\\n revert SeekerOwnerMismatch();\\n }\\n\\n uint256 nextEpoch = getNextEpochId();\\n if (activeSeekers[nextEpoch][seekerId] != address(0)) {\\n revert SeekerAlreadyJoinedEpoch(nextEpoch, seekerId);\\n }\\n\\n activeSeekers[nextEpoch][seekerId] = msg.sender;\\n\\n _directory._rewardsManager().initializeNextRewardPool(msg.sender);\\n _directory.joinNextDirectory(msg.sender, seekerId);\\n\\n emit EpochJoined(nextEpoch, msg.sender, seekerId);\\n }\\n\\n /**\\n * @notice Retrieve the epoch parameter for the given id.\\n * @param epochId The id of the epoch to retrieve.\\n * @return The epoch parameters associated with the id.\\n */\\n function getEpoch(uint256 epochId) external view returns (Epoch memory) {\\n return epochs[epochId];\\n }\\n\\n /**\\n * @notice Retrieve the integer value that will be used for the\\n * next epoch id.\\n * @return The next epoch id identifier.\\n */\\n function getNextEpochId() public view returns (uint256) {\\n return currentIteration + 1;\\n }\\n}\\n\",\"keccak256\":\"0xc759afdc6022b1490447d2c3c3b4454c59cc86f59fe62cece92764b787a87030\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/IRegistries.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface IRegistries {\\n struct Registry {\\n // Percentage of a tickets value that will be rewarded to\\n // delegated stakers expressed as a fraction of 100000.\\n // This value is currently locked to the default payout percentage\\n // until epochs are implemented.\\n uint32 payoutPercentage;\\n // Public http/s endpoint to retrieve additional metadata\\n // about the node.\\n // The current metadata schema is as follows:\\n // { name: string, multiaddrs: string[] }\\n string publicEndpoint;\\n // The account which owns a seeker that will be used to\\n // operate the Node for this registry.\\n address seekerAccount;\\n // The id of the seeker used to operate the node. The owner\\n // of this id should be the seeker account.\\n uint256 seekerId;\\n }\\n\\n function register(string calldata publicEndpoint) external;\\n\\n function setDefaultPayoutPercentage(uint32 _defaultPayoutPercentage) external;\\n\\n function setSeekerAccount(\\n address seekerAccount,\\n uint256 seekerId,\\n bytes32 nonce,\\n bytes calldata signature\\n ) external;\\n\\n function revokeSeekerAccount(address node) external;\\n\\n function getRegistry(address account) external view returns (Registry memory);\\n\\n function getNodes() external view returns (address[] memory);\\n\\n function getRegistries(\\n uint256 start,\\n uint256 end\\n ) external view returns (address[] memory, Registry[] memory);\\n\\n function getTotalNodes() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x524252752fd14eb66b047848eaaffbc138c6b049f99f2c2f0a5c6a7a4d6e6e36\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/ISeekerPowerOracle.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface ISeekerPowerOracle {\\n function setOracle(address oracle) external;\\n\\n function registerSeekerPowerRestricted(uint256 seekerId, uint256 power) external;\\n\\n function registerSeekerPower(\\n uint256 seekerId,\\n uint256 power,\\n bytes32 nonce,\\n bytes calldata proof\\n ) external;\\n\\n function getSeekerPower(uint256 seekerId) external view returns (uint256);\\n\\n function getProofMessage(\\n uint256 seekerId,\\n uint256 power,\\n bytes32 nonce\\n ) external pure returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x26fb3e81dabde31b8730d4c601c51c881e018b540f19f7c599a8a7f9b8c05523\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/epochs/IEpochsManager.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface IEpochsManager {\\n /**\\n * @dev This struct will hold all network parameters that will be static\\n * for the entire epoch. This value will be stored in a mapping, where the\\n * key is the current epoch id.\\n */\\n struct Epoch {\\n // time related variables\\n uint256 startBlock; // Block the epoch was initialized\\n uint256 duration; // Minimum time epoch will be alive measured in number of blocks\\n uint256 endBlock; // Block the epoch ended (and when the next epoch was initialized)\\n // Zero here represents the epoch has not yet ended.\\n\\n // registry variables\\n uint32 defaultPayoutPercentage;\\n // ticketing variables\\n uint32 decayRate;\\n uint256 faceValue;\\n uint128 baseLiveWinProb;\\n uint128 expiredWinProb;\\n uint256 ticketDuration;\\n }\\n\\n function initializeEpoch() external returns (uint256);\\n\\n function setEpochDuration(uint256 _epochDuration) external;\\n\\n function getCurrentActiveEpoch() external view returns (uint256, Epoch memory);\\n\\n function joinNextEpoch() external;\\n\\n function getEpoch(uint256 epochId) external view returns (Epoch memory);\\n\\n function getNextEpochId() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xeef359833a448742f4eca45ac04eeea0c3e74eb21d3a36bfdae3a1bb7f81e0b5\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/payments/ticketing/IRewardsManager.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface IRewardsManager {\\n /**\\n * @dev This type will hold the necessary information for delegated stakers\\n * to make reward claims against their Node. Every Node will initialize\\n * and store a new Reward Pool for each epoch they participate in.\\n */\\n struct RewardPool {\\n // Tracks the balance of the reward pool owed to the stakers\\n uint256 stakersRewardTotal;\\n // Tracks the block number this reward pool was initialized\\n uint256 initializedAt;\\n // The total active stake for the node for will be the sum of the\\n // stakes owned by its delegators and the node's own stake.\\n uint256 totalActiveStake;\\n // track the cumulative reward factor as of the time the first ticket\\n // for this pool was redeemed\\n int128 initialCumulativeRewardFactor;\\n }\\n\\n struct LastClaim {\\n // The epoch the claim was made.\\n uint256 claimedAt;\\n // The stake at the time the claim was made. This is tracked as\\n // rewards can only be claimed after an epoch has ended, but the\\n // user's stake may have changed by then. This field tracks the\\n // staking value before the change so the reward for that epoch\\n // can be manually calculated.\\n uint256 stake;\\n }\\n\\n function getRewardPool(\\n uint256 epochId,\\n address stakee\\n ) external view returns (RewardPool memory);\\n\\n function getRewardPoolKey(uint256 epochId, address stakee) external pure returns (bytes32);\\n\\n function getRewardPoolStakersTotal(\\n uint256 epochId,\\n address stakee\\n ) external view returns (uint256);\\n\\n function getRewardPoolActiveStake(\\n uint256 epochId,\\n address stakee\\n ) external view returns (uint256);\\n\\n function getPendingRewards(address stakee) external view returns (uint256);\\n\\n function getLastClaim(address stakee, address staker) external view returns (LastClaim memory);\\n\\n function getTotalEpochRewards(uint256 epochId) external view returns (uint256);\\n\\n function getTotalEpochStakingRewards(uint256 epochId) external view returns (uint256);\\n\\n function initializeNextRewardPool(address stakee) external;\\n\\n function incrementRewardPool(address stakee, uint256 amount) external;\\n\\n function claimStakingRewards(address stakee) external returns (uint256);\\n\\n function updatePendingRewards(address stakee, address staker) external;\\n}\\n\",\"keccak256\":\"0x21b8d7f96073802ef4ec87fa15da5fcfd2c1d5e2bf9d6e17583406028e7b31d1\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/payments/ticketing/ITicketingParameters.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface ITicketingParameters {\\n function setFaceValue(uint256 _faceValue) external;\\n\\n function setBaseLiveWinProb(uint128 _baseLiveWinProb) external;\\n\\n function setExpiredWinProb(uint128 _expiredWinProb) external;\\n\\n function setDecayRate(uint32 _decayRate) external;\\n\\n function setTicketDuration(uint256 _ticketDuration) external;\\n\\n function getTicketingParameters()\\n external\\n view\\n returns (uint256, uint128, uint128, uint256, uint32);\\n}\\n\",\"keccak256\":\"0x6fa269d73176bd6543c190b070597fde50b91efdaa724b567bad29c9fbfa908a\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/staking/IDirectory.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface IDirectory {\\n /**\\n * @dev A DirectoryEntry will be stored for every node that joins the\\n * network in a specific epoch. The entry will contain the stakee's\\n * address, and a boundary value which is a sum of the current directory's\\n * total stake, and the current stakee's total stake.\\n */\\n struct DirectoryEntry {\\n address stakee;\\n uint256 boundary;\\n }\\n\\n /**\\n * @dev An EpochDirectory will be stored for every epoch. The\\n * directory will be constructed piece by piece as Nodes join,\\n * each adding their own directory entry based on their current\\n * stake value.\\n */\\n struct EpochDirectory {\\n DirectoryEntry[] entries;\\n mapping(address => uint256) stakes;\\n uint256 totalStake;\\n }\\n\\n function setCurrentDirectory(uint256 epochId) external;\\n\\n function joinNextDirectory(address stakee, uint256 seekerId) external;\\n\\n function scan(uint128 point) external view returns (address stakee);\\n\\n function scanWithEpochId(\\n uint128 point,\\n uint256 epochId\\n ) external view returns (address stakee);\\n\\n function getTotalStakeForStakee(\\n uint256 epochId,\\n address stakee\\n ) external view returns (uint256);\\n\\n function getTotalStake(uint256 epochId) external view returns (uint256);\\n\\n function getEntries(\\n uint256 epochId\\n ) external view returns (address[] memory, uint256[] memory);\\n}\\n\",\"keccak256\":\"0xfacfde1140082a99e6096222a0714bf9e532224a04c594096211c115ab4927f6\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/staking/IStakingManager.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface IStakingManager {\\n /**\\n * For every Node, there will be a mapping of the staker to a\\n * StakeEntry. The stake entry tracks the amount of stake in SOLO,\\n * and also when the stake was updated.\\n */\\n struct StakeEntry {\\n uint256 amount;\\n // Block number this entry was updated at\\n uint256 updatedAt;\\n // Epoch this entry was updated. The stake will become active\\n // in the following epoch\\n uint256 epochId;\\n }\\n\\n /**\\n * Every Node must have stake in order to participate in the Epoch.\\n * Stake can be provided by the Node itself or by other accounts in\\n * the network.\\n */\\n struct Stake {\\n // Track each stake entry associated to a node\\n mapping(address => StakeEntry) stakeEntries;\\n // The total stake held by this contract for a node,\\n // which will be the sum of all addStake and unlockStake calls\\n uint256 totalManagedStake;\\n }\\n\\n /**\\n * This struct will track stake that is in the process of unlocking.\\n */\\n struct Unlock {\\n uint256 amount; // Amount of stake unlocking\\n uint256 unlockAt; // Block number the stake becomes withdrawable\\n }\\n\\n function setUnlockDuration(uint256 _unlockDuration) external;\\n\\n function setMinimumStakeProportion(uint32 _minimumStakeProportion) external;\\n\\n function addStake(uint256 amount, address stakee) external;\\n\\n function unlockStake(uint256 amount, address stakee) external returns (uint256);\\n\\n function withdrawStake(address stakee) external;\\n\\n function cancelUnlocking(uint256 amount, address stakee) external;\\n\\n function calculateCapacityFromSeekerPower(uint256 seekerId) external view returns (uint256);\\n\\n function calculateMaxAdditionalDelegatedStake(address stakee) external view returns (uint256);\\n\\n function getTotalManagedStake() external view returns (uint256);\\n\\n function getStakeEntry(\\n address stakee,\\n address staker\\n ) external view returns (StakeEntry memory);\\n\\n function getStakeeTotalManagedStake(address stakee) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xb3c89c77822db30a1382ec7d11902db579cd48acc36aef965a92b47f8e1164a3\",\"license\":\"Apache-2.0\"},\"contracts/libraries/Manageable.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an list of public managers who may be added or removed.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyManager`, which can be applied to your functions to restrict their use to\\n * other contracts which have explicitly been added.\\n */\\nabstract contract Manageable is Ownable2StepUpgradeable {\\n /**\\n * @dev Tracks the managers added to this contract, where they key is the\\n * address of the managing contract, and the value is the block the manager was added in.\\n * We use this mapping to restrict access to those functions in a similar\\n * fashion to the onlyOwner construct.\\n */\\n mapping(address => uint256) public managers;\\n\\n error OnlyManagers();\\n error ManagerCannotBeZeroAddress();\\n\\n /**\\n * @notice Adds a manager to this contract. Only callable by the owner.\\n * @param manager The address of the manager contract.\\n */\\n function addManager(address manager) external onlyOwner {\\n if (manager == address(0)) {\\n revert ManagerCannotBeZeroAddress();\\n }\\n managers[manager] = block.number;\\n }\\n\\n /**\\n * @notice Removes a manager from this contract. Only callable by the owner.\\n * @param manager The address of the manager contract.\\n */\\n function removeManager(address manager) external onlyOwner {\\n delete managers[manager];\\n }\\n\\n /**\\n * @dev This modifier allows us to specify that certain contracts have\\n * special privileges to call restricted functions.\\n */\\n modifier onlyManager() {\\n if (managers[msg.sender] == 0) {\\n revert OnlyManagers();\\n }\\n _;\\n }\\n\\n // Reserve storage slots for future variables\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xeaf4d3bf238df7e61eaf6903ba7ed54af58a17090fe6197aae3f62d025027db2\",\"license\":\"Apache-2.0\"},\"contracts/libraries/SyloUtils.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/utils/math/SafeCast.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\n\\nerror ContractNameCannotBeEmpty();\\nerror InterfaceIdCannotBeZeroBytes();\\nerror TargetContractCannotBeZeroAddress(string name);\\nerror TargetNotSupportInterface(string name, bytes4 interfaceId);\\n\\nlibrary SyloUtils {\\n /**\\n * @dev The maximum possible SYLO that exists in the network.\\n */\\n uint256 public constant MAX_SYLO = 10_000_000_000 ether;\\n\\n /**\\n * @dev Percentages are expressed as a ratio where 100000 is the denominator.\\n * A large denominator allows for more precision, e.g representing 12.5%\\n * can be done as 12500 / 100000\\n */\\n uint32 public constant PERCENTAGE_DENOMINATOR = 100000;\\n\\n /**\\n * @dev Multiply a value by a given percentage. Converts the provided\\n * uint128 value to uint256 to avoid any reverts on overflow.\\n * @param value The value to multiply.\\n * @param percentage The percentage, as a ratio of 10000.\\n */\\n function percOf(uint128 value, uint32 percentage) internal pure returns (uint256) {\\n return (uint256(value) * percentage) / PERCENTAGE_DENOMINATOR;\\n }\\n\\n /**\\n * @dev Return a fraction as a percentage.\\n * @param numerator The numerator limited to a uint128 value to prevent\\n * phantom overflow.\\n * @param denominator The denominator.\\n * @return The percentage, as a ratio of 10000.\\n */\\n function asPerc(uint128 numerator, uint256 denominator) internal pure returns (uint32) {\\n return SafeCast.toUint32((uint256(numerator) * PERCENTAGE_DENOMINATOR) / denominator);\\n }\\n\\n /**\\n * @dev Validate that a contract implements a given interface.\\n * @param name The name of the contract, used in error messages.\\n * @param target The address of the contract.\\n * @param interfaceId The interface ID to check.\\n */\\n function validateContractInterface(\\n string memory name,\\n address target,\\n bytes4 interfaceId\\n ) internal view {\\n if (bytes(name).length == 0) {\\n revert ContractNameCannotBeEmpty();\\n }\\n if (target == address(0)) {\\n revert TargetContractCannotBeZeroAddress(name);\\n }\\n if (interfaceId == bytes4(0)) {\\n revert InterfaceIdCannotBeZeroBytes();\\n }\\n if (!ERC165(target).supportsInterface(interfaceId)) {\\n revert TargetNotSupportInterface(name, interfaceId);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa5bb1a5b9f8135b5fec1dfa183fab8f6685a4eb6d9daba23864a7d49d01dc8a3\",\"license\":\"Apache-2.0\"},\"contracts/payments/ticketing/RewardsManager.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"abdk-libraries-solidity/ABDKMath64x64.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/math/SafeCast.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\n\\nimport \\\"../../libraries/SyloUtils.sol\\\";\\nimport \\\"../../libraries/Manageable.sol\\\";\\nimport \\\"../../epochs/EpochsManager.sol\\\";\\nimport \\\"../../staking/StakingManager.sol\\\";\\nimport \\\"../../interfaces/epochs/IEpochsManager.sol\\\";\\nimport \\\"../../interfaces/staking/IStakingManager.sol\\\";\\nimport \\\"../../interfaces/payments/ticketing/IRewardsManager.sol\\\";\\n\\n/**\\n * @notice Handles epoch based reward pools that are incremented from redeeming tickets.\\n * Nodes use this contract to set up their reward pool for the next epoch,\\n * and stakers use this contract to track and claim staking rewards.\\n * @dev After deployment, the SyloTicketing contract should be\\n * set up as a manager to be able to call certain restricted functions.\\n */\\ncontract RewardsManager is IRewardsManager, Initializable, Manageable, ERC165 {\\n uint256 internal constant ONE_SYLO = 1 ether;\\n\\n // 64x64 Fixed point representation of 1 SYLO (10**18 >> 64)\\n int128 internal constant ONE_SYLO_FIXED = 18446744073709551616000000000000000000;\\n\\n uint256 internal constant MAX_INT64 = 9223372036854775807;\\n\\n /** ERC20 Sylo token contract. */\\n IERC20 public _token;\\n\\n /** Sylo Staking Manager contract. */\\n StakingManager public _stakingManager;\\n\\n /** Sylo Epochs Manager. */\\n EpochsManager public _epochsManager;\\n\\n /**\\n * @dev Each node will manage a cumulative reward factor (CRF) that is incremented\\n * whenever a ticket is redeemed. This factor acts as a single value\\n * that can be used to calculate any particular staker's reward share. This\\n * prevents the need to individually track each staker's proportion, and also allows\\n * a claim calculation to be performed without iterating through every epoch.\\n *\\n * The CRF is calculated as CRF = CRF + Reward / TotalStake.\\n */\\n mapping(address => int128) private cumulativeRewardFactors;\\n\\n /**\\n * @notice Tracks the last epoch a delegated staker made a reward claim in.\\n * The key to this mapping is a hash of the Node's address and the delegated\\n * stakers address.\\n */\\n mapping(bytes32 => LastClaim) public lastClaims;\\n\\n /**\\n * @notice Tracks each Nodes total pending rewards in SOLOs. This\\n * value is accumulated as Node's redeem tickets. Rewards are pending if the\\n * distribution amongst the stakers has not been accounted for yet. Pending rewards\\n * are transferred to unclaimed rewards once the the staker's share has been\\n * calculated.\\n */\\n mapping(address => uint256) public pendingRewards;\\n\\n /**\\n * @notice Tracks rewards for stakers after the stakers share has been calculated,\\n * but has not actually been claimed by the staker.\\n * The node fee reward is also added to the node's unclaimedStakingRewards.\\n */\\n mapping(bytes32 => uint256) public unclaimedStakingRewards;\\n\\n /**\\n * @notice Tracks each Node's most recently active reward pool\\n */\\n mapping(address => uint256) public latestActiveRewardPools;\\n\\n /**\\n * @notice Tracks total accumulated rewards in each epoch\\n */\\n mapping(uint256 => uint256) public totalEpochRewards;\\n\\n /**\\n * @notice Tracks total accumulated staking rewards in each epoch\\n */\\n mapping(uint256 => uint256) public totalEpochStakingRewards;\\n\\n /**\\n * @notice Tracks each reward pool initialized by a Node. The key to this map\\n * is derived from the epochId and the Node's address.\\n */\\n mapping(bytes32 => RewardPool) public rewardPools;\\n\\n error NoRewardToClaim();\\n error AmountCannotBeZero();\\n error RewardPoolNotExist();\\n error RewardPoolAlreadyExist();\\n error DoNotAllowZeroAddress();\\n error TokenCannotBeZeroAddress();\\n error NoStakeToCreateRewardPool();\\n error StakeeCannotBeZeroAddress();\\n error StakerCannotBeZeroAddress();\\n error StakerKeyCannotBeZeroBytes();\\n error InvalidFixedPointResult();\\n\\n function initialize(\\n IERC20 token,\\n StakingManager stakingManager,\\n EpochsManager epochsManager\\n ) external initializer {\\n if (address(token) == address(0)) {\\n revert TokenCannotBeZeroAddress();\\n }\\n\\n SyloUtils.validateContractInterface(\\n \\\"StakingManager\\\",\\n address(stakingManager),\\n type(IStakingManager).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"EpochsManager\\\",\\n address(epochsManager),\\n type(IEpochsManager).interfaceId\\n );\\n\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n _token = token;\\n _epochsManager = epochsManager;\\n _stakingManager = stakingManager;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IRewardsManager).interfaceId;\\n }\\n\\n /**\\n * @notice Returns the key used to index a reward pool. The key is a hash of\\n * the epochId and Node's address.\\n * @param epochId The epoch ID the reward pool was created in.\\n * @param stakee The address of the Node.\\n * @return A byte-array representing the reward pool key.\\n */\\n function getRewardPoolKey(uint256 epochId, address stakee) public pure returns (bytes32) {\\n return keccak256(abi.encodePacked(epochId, stakee));\\n }\\n\\n /**\\n * @notice Returns the key used to index staking claims. The key is a hash of\\n * the Node's address and the staker's address.\\n * @param stakee The address of the Node.\\n * @param staker The address of the stake.\\n * @return A byte-array representing the key.\\n */\\n function getStakerKey(address stakee, address staker) public pure returns (bytes32) {\\n return keccak256(abi.encodePacked(stakee, staker));\\n }\\n\\n /**\\n * @notice Retrieve the reward pool initialized by the given node, at the specified\\n * epoch.\\n * @param epochId The ID of the epoch the reward pool was initialized in.\\n * @param stakee The address of the Node.\\n * @return The reward pool.\\n */\\n function getRewardPool(\\n uint256 epochId,\\n address stakee\\n ) external view returns (RewardPool memory) {\\n return rewardPools[getRewardPoolKey(epochId, stakee)];\\n }\\n\\n /**\\n * @notice Retrieve the total accumulated reward that will be distributed to a Node's\\n * delegated stakers for a given epoch.\\n * @param epochId The ID of the epoch the reward pool was initialized in.\\n * @param stakee The address of the Node.\\n * @return The total accumulated staker reward in SOLO.\\n */\\n function getRewardPoolStakersTotal(\\n uint256 epochId,\\n address stakee\\n ) external view returns (uint256) {\\n return rewardPools[getRewardPoolKey(epochId, stakee)].stakersRewardTotal;\\n }\\n\\n /**\\n * @notice Retrieve the total active stake that will be used for a Node's reward\\n * pool in a given epoch.\\n * @param epochId The ID of the epoch the reward pool was initialized in.\\n * @param stakee The address of the Node.\\n * @return The total active stake for that reward pool in SOLO.\\n */\\n function getRewardPoolActiveStake(\\n uint256 epochId,\\n address stakee\\n ) external view returns (uint256) {\\n return rewardPools[getRewardPoolKey(epochId, stakee)].totalActiveStake;\\n }\\n\\n /**\\n * @notice Retrieve the total pending staking reward allocated to a Node's\\n * stakers.\\n * @param stakee The address of the Node.\\n * @return The total pending staking reward in SOLO.\\n */\\n function getPendingRewards(address stakee) external view returns (uint256) {\\n return pendingRewards[stakee];\\n }\\n\\n /**\\n * @notice Retrieves the ID of the epoch in which a staker last made their\\n * staking claim.\\n * @param stakee The address of the Node.\\n * @param staker The address of the staker.\\n * @return The ID of the epoch.\\n */\\n function getLastClaim(\\n address stakee,\\n address staker\\n ) external view returns (LastClaim memory) {\\n return lastClaims[getStakerKey(stakee, staker)];\\n }\\n\\n /**\\n * @notice Retrieves the total accumulated rewards for a specific epoch.\\n * @param epochId The epoch id.\\n * @return The total reward in that epoch, including staking rewards and fee\\n * reward.\\n */\\n function getTotalEpochRewards(uint256 epochId) external view returns (uint256) {\\n return totalEpochRewards[epochId];\\n }\\n\\n /**\\n * @notice Retrieves the total accumulated rewards for stakers in a specific epoch.\\n * @param epochId The epoch id.\\n * @return The total staking reward in that epoch.\\n */\\n function getTotalEpochStakingRewards(uint256 epochId) external view returns (uint256) {\\n return totalEpochStakingRewards[epochId];\\n }\\n\\n /**\\n * @notice This is used by Nodes to initialize their reward pool for\\n * the next epoch. This function will revert if the caller has no stake, or\\n * if the reward pool has already been initialized. The total active stake\\n * for the next reward pool is calculated by summing up the total managed\\n * stake held by the RewardsManager contract.\\n */\\n function initializeNextRewardPool(address stakee) external onlyManager {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n\\n uint256 nextEpochId = _epochsManager.getNextEpochId();\\n\\n RewardPool storage nextRewardPool = rewardPools[getRewardPoolKey(nextEpochId, stakee)];\\n if (nextRewardPool.initializedAt != 0) {\\n revert RewardPoolAlreadyExist();\\n }\\n\\n uint256 totalStake = _stakingManager.getStakeeTotalManagedStake(stakee);\\n if (totalStake == 0) {\\n revert NoStakeToCreateRewardPool();\\n }\\n\\n nextRewardPool.totalActiveStake = totalStake;\\n\\n nextRewardPool.initializedAt = block.number;\\n }\\n\\n /**\\n * @dev This function should be called by the Ticketing contract when a\\n * ticket is successfully redeemed. The face value of the ticket\\n * should be split between incrementing the node's reward balance,\\n * and the reward balance for the node's delegated stakers. The face value\\n * will be added to the current reward pool's balance. This function will\\n * fail if the Ticketing contract has not been set as a manager.\\n * @param stakee The address of the Node.\\n * @param amount The face value of the ticket in SOLO.\\n */\\n function incrementRewardPool(address stakee, uint256 amount) external onlyManager {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n if (amount == 0) {\\n revert AmountCannotBeZero();\\n }\\n\\n (uint256 epochId, IEpochsManager.Epoch memory currentEpoch) = _epochsManager\\n .getCurrentActiveEpoch();\\n\\n RewardPool storage rewardPool = rewardPools[getRewardPoolKey(epochId, stakee)];\\n if (rewardPool.initializedAt == 0) {\\n revert RewardPoolNotExist();\\n }\\n\\n // Update the latest active reward pool for the node to be this pool\\n if (latestActiveRewardPools[stakee] < epochId) {\\n latestActiveRewardPools[stakee] = epochId;\\n }\\n\\n uint256 stakersReward = SyloUtils.percOf(\\n SafeCast.toUint128(amount),\\n currentEpoch.defaultPayoutPercentage\\n );\\n\\n // transfer the node's fee reward to it's unclaimed reward value\\n unclaimedStakingRewards[getStakerKey(stakee, stakee)] =\\n unclaimedStakingRewards[getStakerKey(stakee, stakee)] +\\n (amount - stakersReward);\\n\\n // update the value of the reward owed to the stakers\\n pendingRewards[stakee] = pendingRewards[stakee] + stakersReward;\\n\\n // if this is the first ticket redeemed for this reward, set the initial\\n // CRF value for this pool\\n if (rewardPool.stakersRewardTotal == 0) {\\n rewardPool.initialCumulativeRewardFactor = cumulativeRewardFactors[stakee];\\n }\\n\\n rewardPool.stakersRewardTotal = rewardPool.stakersRewardTotal + stakersReward;\\n\\n // We preemptively prevent an overflow revert with the abdk library.\\n // Dividing the stakers reward with the pool's total active\\n // stake may produce a value that is greater than the maximum possible\\n // 64.64 fixed point value.\\n // This error is incredibly niche and unlikely to happen, so we just\\n // revert here as well (with a named error) and remediation involves\\n // just increasing the amount of stake a node has.\\n if (rewardPool.totalActiveStake * MAX_INT64 < stakersReward) {\\n revert InvalidFixedPointResult();\\n }\\n\\n cumulativeRewardFactors[stakee] = ABDKMath64x64.add(\\n cumulativeRewardFactors[stakee],\\n ABDKMath64x64.div(\\n toFixedPointSYLO(stakersReward),\\n toFixedPointSYLO(rewardPool.totalActiveStake)\\n )\\n );\\n\\n totalEpochRewards[epochId] = totalEpochRewards[epochId] + amount;\\n totalEpochStakingRewards[epochId] = totalEpochStakingRewards[epochId] + stakersReward;\\n }\\n\\n /**\\n * @dev This function utilizes the cumulative reward factors, and the staker's\\n * value in stake to calculate the staker's share of the pending reward.\\n */\\n function calculatePendingClaim(\\n bytes32 stakerKey,\\n address stakee,\\n address staker\\n ) internal view returns (uint256) {\\n uint256 claim = calculateInitialClaim(stakerKey, stakee);\\n\\n // find the first reward pool where their stake was active and had\\n // generated rewards\\n uint256 activeAt;\\n RewardPool memory initialActivePool;\\n\\n uint256 currentEpochId = _epochsManager.currentIteration();\\n\\n for (uint256 i = lastClaims[stakerKey].claimedAt + 1; i < currentEpochId; ++i) {\\n initialActivePool = rewardPools[getRewardPoolKey(i, stakee)];\\n // check if node initialized a reward pool for this epoch and\\n // gained rewards\\n if (initialActivePool.initializedAt > 0 && initialActivePool.stakersRewardTotal > 0) {\\n activeAt = i;\\n break;\\n }\\n }\\n\\n if (activeAt == 0) {\\n return claim;\\n }\\n\\n IStakingManager.StakeEntry memory stakeEntry = _stakingManager.getStakeEntry(\\n stakee,\\n staker\\n );\\n\\n // We convert the staker amount to SYLO as the maximum uint256 value that\\n // can be used for the fixed point representation is 2^64-1.\\n int128 initialStake = toFixedPointSYLO(stakeEntry.amount);\\n\\n int128 initialCumulativeRewardFactor = initialActivePool.initialCumulativeRewardFactor;\\n\\n int128 finalCumulativeRewardFactor = getFinalCumulativeRewardFactor(\\n stakee,\\n currentEpochId\\n );\\n\\n return\\n claim +\\n fromFixedPointSYLO(\\n ABDKMath64x64.mul(\\n initialStake,\\n ABDKMath64x64.sub(finalCumulativeRewardFactor, initialCumulativeRewardFactor)\\n )\\n );\\n }\\n\\n /**\\n * Manually calculates the reward claim for the first epoch the claim is being\\n * made for. This manual calculation is necessary as claims are only made up\\n * to the previous epoch.\\n */\\n function calculateInitialClaim(\\n bytes32 stakerKey,\\n address stakee\\n ) internal view returns (uint256) {\\n LastClaim memory lastClaim = lastClaims[stakerKey];\\n\\n // if we have already made a claim up to the previous epoch, then\\n // there is no need to calculate the initial claim\\n if (_epochsManager.currentIteration() == lastClaim.claimedAt) {\\n return 0;\\n }\\n\\n RewardPool memory firstRewardPool = rewardPools[\\n getRewardPoolKey(lastClaim.claimedAt, stakee)\\n ];\\n\\n // if there was no reward pool initialized for the first epoch,\\n // then there is no need to calculate the initial claim\\n if (firstRewardPool.totalActiveStake == 0) {\\n return 0;\\n }\\n\\n return\\n (firstRewardPool.stakersRewardTotal * lastClaim.stake) /\\n firstRewardPool.totalActiveStake;\\n }\\n\\n /**\\n * Determines the cumulative reward factor to use for claim calculations. The\\n * CRF will depend on when the Node last initialized a reward pool, and also when\\n * the staker last made their claim.\\n */\\n function getFinalCumulativeRewardFactor(\\n address stakee,\\n uint256 currentEpochId\\n ) internal view returns (int128) {\\n int128 finalCumulativeRewardFactor;\\n\\n // Get the cumulative reward factor for the Node\\n // for the start of this epoch, since we only perform\\n // calculations up to the end of the previous epoch.\\n if (latestActiveRewardPools[stakee] < currentEpochId) {\\n // If the Node has not been active, then the final\\n // cumulative reward factor will just be the current one.\\n finalCumulativeRewardFactor = cumulativeRewardFactors[stakee];\\n } else {\\n // We are calculating the claim for an active epoch, the\\n // final cumulative reward factor will be taken from the start of this\\n // epoch (end of previous epoch).\\n RewardPool storage latestRewardPool = rewardPools[\\n getRewardPoolKey(latestActiveRewardPools[stakee], stakee)\\n ];\\n finalCumulativeRewardFactor = latestRewardPool.initialCumulativeRewardFactor;\\n }\\n\\n return finalCumulativeRewardFactor;\\n }\\n\\n /**\\n * @notice Call this function to calculate the total reward owed to a staker.\\n * This value will include all epochs since the last claim was made up to\\n * the previous epoch. This will also add any pending rewards to the\\n * final value as well.\\n * @dev This function will utilize the cumulative reward factor to perform the\\n * calculation, keeping the gas cost scaling of this function to a constant value.\\n * @param stakee The address of the Node.\\n * @param staker The address of the staker.\\n * @return The value of the reward owed to the staker in SOLO.\\n */\\n function calculateStakerClaim(address stakee, address staker) public view returns (uint256) {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n if (staker == address(0)) {\\n revert StakerCannotBeZeroAddress();\\n }\\n\\n bytes32 stakerKey = getStakerKey(stakee, staker);\\n uint256 pendingClaim = calculatePendingClaim(stakerKey, stakee, staker);\\n\\n return pendingClaim + unclaimedStakingRewards[stakerKey];\\n }\\n\\n /**\\n * Helper function to convert a uint256 value in SOLOs to a 64.64 fixed point\\n * representation in SYLOs while avoiding any possibility of overflow.\\n * Any remainders from converting SOLO to SYLO is explicitly handled to mitigate\\n * precision loss. The error when using this function is [-1/2^64, 0].\\n */\\n function toFixedPointSYLO(uint256 amount) internal pure returns (int128) {\\n int128 fullSylos = ABDKMath64x64.fromUInt(amount / ONE_SYLO);\\n int128 fracSylos = ABDKMath64x64.fromUInt(amount % ONE_SYLO); // remainder\\n\\n return ABDKMath64x64.add(fullSylos, ABDKMath64x64.div(fracSylos, ONE_SYLO_FIXED));\\n }\\n\\n /**\\n * Helper function to convert a 64.64 fixed point value in SYLOs to a uint256\\n * representation in SOLOs while avoiding any possibility of overflow.\\n */\\n function fromFixedPointSYLO(int128 amount) internal pure returns (uint256) {\\n uint256 fullSylos = ABDKMath64x64.toUInt(amount);\\n uint256 fullSolos = fullSylos * ONE_SYLO;\\n\\n // calculate the value lost when converting the fixed point amount to a uint\\n int128 fracSylos = ABDKMath64x64.sub(amount, ABDKMath64x64.fromUInt(fullSylos));\\n uint256 fracSolos = ABDKMath64x64.toUInt(ABDKMath64x64.mul(fracSylos, ONE_SYLO_FIXED));\\n\\n return fullSolos + fracSolos;\\n }\\n\\n /**\\n * @notice Call this function to claim rewards as a staker. The\\n * SYLO tokens will be transferred to the caller's account. This function will\\n * fail if there exists no reward to claim. Note: Calling this will remove\\n * the current unclaimed reward from being used as stake in the next round.\\n * @param stakee The address of the Node to claim against.\\n */\\n function claimStakingRewards(address stakee) external returns (uint256) {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n\\n bytes32 stakerKey = getStakerKey(stakee, msg.sender);\\n uint256 pendingReward = calculatePendingClaim(stakerKey, stakee, msg.sender);\\n\\n uint256 totalClaim = pendingReward + unclaimedStakingRewards[stakerKey];\\n if (totalClaim == 0) {\\n revert NoRewardToClaim();\\n }\\n\\n delete unclaimedStakingRewards[stakerKey];\\n pendingRewards[stakee] = pendingRewards[stakee] - pendingReward;\\n\\n updateLastClaim(stakee, msg.sender);\\n\\n SafeERC20.safeTransfer(_token, msg.sender, totalClaim);\\n\\n return totalClaim;\\n }\\n\\n /**\\n * @notice This is called by the staking manager to transfer pending rewards\\n * to unclaimed rewards for a staker. This is required as the last used CRF\\n * needs to be updated whenever stake changes.\\n */\\n function updatePendingRewards(address stakee, address staker) external onlyManager {\\n bytes32 stakerKey = getStakerKey(stakee, staker);\\n uint256 pendingReward = calculatePendingClaim(stakerKey, stakee, staker);\\n\\n pendingRewards[stakee] = pendingRewards[stakee] - pendingReward;\\n\\n unclaimedStakingRewards[stakerKey] = unclaimedStakingRewards[stakerKey] + pendingReward;\\n\\n updateLastClaim(stakee, staker);\\n }\\n\\n function updateLastClaim(address stakee, address staker) internal {\\n IStakingManager.StakeEntry memory stakeEntry = _stakingManager.getStakeEntry(\\n stakee,\\n staker\\n );\\n lastClaims[getStakerKey(stakee, staker)] = LastClaim(\\n _epochsManager.currentIteration(),\\n stakeEntry.amount\\n );\\n }\\n}\\n\",\"keccak256\":\"0x906af015c975637b6a99d70795b0652f6e28aaa66e5c64a4bae34bff14c99551\",\"license\":\"Apache-2.0\"},\"contracts/payments/ticketing/TicketingParameters.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\n\\nimport \\\"../../libraries/SyloUtils.sol\\\";\\nimport \\\"../../interfaces/payments/ticketing/ITicketingParameters.sol\\\";\\n\\n/**\\n * @dev Persists the parameters for the ticketing mechanism. This contract is\\n * read by the EpochManager. Extracting the parameters into another\\n * contract is necessary to avoid a cyclic dependency between the ticketing\\n * and epoch contracts.\\n */\\ncontract TicketingParameters is\\n ITicketingParameters,\\n Initializable,\\n Ownable2StepUpgradeable,\\n ERC165\\n{\\n /** @notice The value of a winning ticket in SOLO. */\\n uint256 public faceValue;\\n\\n /**\\n * @notice The probability of a ticket winning during the start of its lifetime.\\n * This is a uint128 value representing the numerator in the probability\\n * ratio where 2^128 - 1 is the denominator.\\n */\\n uint128 public baseLiveWinProb;\\n\\n /**\\n * @notice The probability of a ticket winning after it has expired.\\n * This is a uint128 value representing the numerator in the probability\\n * ratio where 2^128 - 1 is the denominator. Note: Redeeming expired\\n * tickets is currently not supported.\\n */\\n uint128 public expiredWinProb;\\n\\n /**\\n * @notice The length in blocks before a ticket is considered expired.\\n * The default initialization value is 80,000. This equates\\n * to roughly two weeks (15s per block).\\n */\\n uint256 public ticketDuration;\\n\\n /**\\n * @notice A percentage value representing the proportion of the base win\\n * probability that will be decayed once a ticket has expired.\\n * Example: 80% decayRate indicates that a ticket will decay down to 20% of its\\n * base win probability upon reaching the block before its expiry.\\n * The value is expressed as a fraction of 100000.\\n */\\n uint32 public decayRate;\\n\\n event FaceValueUpdated(uint256 faceValue);\\n event BaseLiveWinProbUpdated(uint128 baseLiveWinprob);\\n event ExpiredWinProbUpdated(uint128 expiredWinProb);\\n event TicketDurationUpdated(uint256 ticketDuration);\\n event DecayRateUpdated(uint32 decayRate);\\n\\n error FaceValueCannotBeZero();\\n error TicketDurationCannotBeZero();\\n\\n function initialize(\\n uint256 _faceValue,\\n uint128 _baseLiveWinProb,\\n uint128 _expiredWinProb,\\n uint32 _decayRate,\\n uint256 _ticketDuration\\n ) external initializer {\\n if (_faceValue == 0) {\\n revert FaceValueCannotBeZero();\\n }\\n if (_ticketDuration == 0) {\\n revert TicketDurationCannotBeZero();\\n }\\n\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n faceValue = _faceValue;\\n baseLiveWinProb = _baseLiveWinProb;\\n expiredWinProb = _expiredWinProb;\\n decayRate = _decayRate;\\n ticketDuration = _ticketDuration;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(ITicketingParameters).interfaceId;\\n }\\n\\n /**\\n * @notice Set the face value for tickets in SOLO. Only callable by\\n * the contract owner.\\n * @param _faceValue The face value to set in SOLO.\\n */\\n function setFaceValue(uint256 _faceValue) external onlyOwner {\\n if (_faceValue == 0) {\\n revert FaceValueCannotBeZero();\\n }\\n\\n faceValue = _faceValue;\\n emit FaceValueUpdated(_faceValue);\\n }\\n\\n /**\\n * @notice Set the base live win probability of a ticket. Only callable by\\n * the contract owner.\\n * @param _baseLiveWinProb The probability represented as a value\\n * between 0 to 2**128 - 1.\\n */\\n function setBaseLiveWinProb(uint128 _baseLiveWinProb) external onlyOwner {\\n baseLiveWinProb = _baseLiveWinProb;\\n emit BaseLiveWinProbUpdated(_baseLiveWinProb);\\n }\\n\\n /**\\n * @notice Set the expired win probability of a ticket. Only callable by\\n * the contract owner.\\n * @param _expiredWinProb The probability represented as a value\\n * between 0 to 2**128 - 1.\\n */\\n function setExpiredWinProb(uint128 _expiredWinProb) external onlyOwner {\\n expiredWinProb = _expiredWinProb;\\n emit ExpiredWinProbUpdated(_expiredWinProb);\\n }\\n\\n /**\\n * @notice Set the decay rate of a ticket. Only callable by the\\n * the contract owner.\\n * @param _decayRate The decay rate as a percentage, where the\\n * denominator is 10000.\\n */\\n function setDecayRate(uint32 _decayRate) external onlyOwner {\\n decayRate = _decayRate;\\n emit DecayRateUpdated(_decayRate);\\n }\\n\\n /**\\n * @notice Set the ticket duration of a ticket. Only callable by the\\n * contract owner.\\n * @param _ticketDuration The duration of a ticket in number of blocks.\\n */\\n function setTicketDuration(uint256 _ticketDuration) external onlyOwner {\\n if (_ticketDuration == 0) {\\n revert TicketDurationCannotBeZero();\\n }\\n\\n ticketDuration = _ticketDuration;\\n emit TicketDurationUpdated(_ticketDuration);\\n }\\n\\n /**\\n * @notice Retrieve the current ticketing parameters.\\n * @return faceValue The face value of a ticket in SOLO.\\n * @return baseLiveWinProb The base live win probability of a ticket.\\n * @return expiredWinProb The expired win probability of a ticket.\\n * @return ticketDuration The duration of a ticket in number of blocks.\\n * @return decayRate The decay rate of a ticket.\\n */\\n function getTicketingParameters()\\n external\\n view\\n returns (uint256, uint128, uint128, uint256, uint32)\\n {\\n return (faceValue, baseLiveWinProb, expiredWinProb, ticketDuration, decayRate);\\n }\\n}\\n\",\"keccak256\":\"0x44b4c2eb70c0583f888ff8fca7ad21b084b6c58a453b7dd914275ccabed98ec0\",\"license\":\"Apache-2.0\"},\"contracts/staking/Directory.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/utils/math/Math.sol\\\";\\n\\nimport \\\"./StakingManager.sol\\\";\\nimport \\\"../libraries/SyloUtils.sol\\\";\\nimport \\\"../libraries/Manageable.sol\\\";\\nimport \\\"../interfaces/staking/IDirectory.sol\\\";\\nimport \\\"../payments/ticketing/RewardsManager.sol\\\";\\n\\n/**\\n * @notice The Directory contract constructs and manages a structure holding the current stakes,\\n * which is queried against using the scan function. The scan function allows submitting\\n * random points which will return a staked node's address in proportion to the stake it has.\\n */\\ncontract Directory is IDirectory, Initializable, Manageable, IERC165 {\\n /** Sylo Staking Manager contract */\\n StakingManager public _stakingManager;\\n\\n /** Sylo Rewards Manager contract */\\n RewardsManager public _rewardsManager;\\n\\n /**\\n * @notice The epoch ID of the current directory.\\n */\\n uint256 public currentDirectory;\\n\\n /**\\n * @notice Tracks every directory, which will be indexed by an epoch ID\\n */\\n mapping(uint256 => EpochDirectory) public directories;\\n\\n event CurrentDirectoryUpdated(uint256 indexed currentDirectory);\\n\\n error NoStakeToJoinEpoch();\\n error StakeeAlreadyJoinedEpoch();\\n error StakeeCannotBeZeroAddress();\\n error NoJoiningStakeToJoinEpoch();\\n\\n function initialize(\\n StakingManager stakingManager,\\n RewardsManager rewardsManager\\n ) external initializer {\\n SyloUtils.validateContractInterface(\\n \\\"StakingManager\\\",\\n address(stakingManager),\\n type(IStakingManager).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"RewardsManager\\\",\\n address(rewardsManager),\\n type(IRewardsManager).interfaceId\\n );\\n\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n _stakingManager = stakingManager;\\n _rewardsManager = rewardsManager;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IDirectory).interfaceId;\\n }\\n\\n /**\\n * @notice This function should be called when a new epoch is initialized.\\n * This will set the current directory to the specified epoch. This is only\\n * callable by the owner of this contract, which should be the EpochsManager\\n * contract.\\n * @dev After deployment, the EpochsManager should immediately be set as\\n * the owner.\\n * @param epochId The ID of the specified epoch.\\n */\\n function setCurrentDirectory(uint256 epochId) external onlyManager {\\n currentDirectory = epochId;\\n emit CurrentDirectoryUpdated(epochId);\\n }\\n\\n /**\\n * @notice This function is called by the epochs manager as a prerequisite to when the node joins the next epoch.\\n * @param stakee The address of the node.\\n * @param seekerId The seekerId of the Seeker that the node is\\n * registered with when joining the epoch. It is used to determine the nodes\\n * staking capacity based on its seeker power.\\n *\\n * @dev This will construct the directory as nodes join. The directory is constructed\\n * by creating a boundary value which is a sum of the current directory's total stake, and\\n * the current stakee's total stake, and pushing the new boundary into the entries array.\\n * The previous boundary and the current boundary essentially create a range, where if a\\n * random point were to fall within that range, it would belong to the respective stakee.\\n * The boundary value grows in size as each stakee joins, thus the directory array\\n * always remains sorted. This allows us to perform a binary search on the directory.\\n *\\n * Example\\n *\\n * Stakes: [ Alice/20, Bob/10, Carl/40, Dave/25 ]\\n * TotalStake: 95\\n *\\n * EpochDirectory:\\n *\\n * |-----------|------|----------------|--------|\\n * Alice/20 Bob/30 Carl/70 Dave/95\\n *\\n * The amount of stake that a node will join a directory with is dependent on its\\n * different capacity values. There are two distinct capacity values, one\\n * calculated from the seeker power, and another from the minimum stake\\n * proportion. The final staking amount will not exceed either capacities,\\n * and in the case that the current total stake exceeds both, then the final\\n * will be the minimum of the two values.\\n */\\n function joinNextDirectory(address stakee, uint256 seekerId) external onlyManager {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n\\n uint256 nextEpochId = currentDirectory + 1;\\n\\n uint256 totalStake = _stakingManager.getStakeeTotalManagedStake(stakee);\\n if (totalStake == 0) {\\n revert NoStakeToJoinEpoch();\\n }\\n\\n // staking capacity based on seeker power\\n uint256 seekerStakingCapacity = _stakingManager.calculateCapacityFromSeekerPower(seekerId);\\n\\n // staking capacity based on the min staking proportion constant\\n uint256 minProportionStakingCapacity = _stakingManager.calculateCapacityFromMinStakingProportion(stakee);\\n\\n uint256 joiningStake;\\n if (totalStake > seekerStakingCapacity && totalStake > minProportionStakingCapacity) {\\n joiningStake = Math.min(seekerStakingCapacity, minProportionStakingCapacity);\\n } else if (totalStake > seekerStakingCapacity) {\\n joiningStake = seekerStakingCapacity;\\n } else if (totalStake > minProportionStakingCapacity) {\\n joiningStake = minProportionStakingCapacity;\\n } else { // uncapped\\n joiningStake = totalStake;\\n }\\n\\n if (joiningStake == 0) {\\n revert NoJoiningStakeToJoinEpoch();\\n }\\n\\n if (directories[nextEpochId].stakes[stakee] > 0) {\\n revert StakeeAlreadyJoinedEpoch();\\n }\\n\\n uint256 nextBoundary = directories[nextEpochId].totalStake + joiningStake;\\n\\n directories[nextEpochId].entries.push(DirectoryEntry(stakee, nextBoundary));\\n directories[nextEpochId].stakes[stakee] = joiningStake;\\n directories[nextEpochId].totalStake = nextBoundary;\\n }\\n\\n /**\\n * @notice Call this to perform a stake-weighted scan to find the Node assigned\\n * to the given point of the current directory.\\n * @param point The point, which will usually be a hash of a public key.\\n */\\n function scan(uint128 point) external view returns (address stakee) {\\n return _scan(point, currentDirectory);\\n }\\n\\n /**\\n * @notice Call this to perform a stake-weighted scan to find the Node assigned\\n * to the given point of the requested directory.\\n * @param point The point, which will usually be a hash of a public key.\\n * @param epochId The epoch id associated with the directory to scan.\\n */\\n function scanWithEpochId(\\n uint128 point,\\n uint256 epochId\\n ) external view returns (address stakee) {\\n return _scan(point, epochId);\\n }\\n\\n /**\\n * @notice Call this to perform a stake-weighted scan to find the Node assigned\\n * to the given point of the requested directory (internal).\\n * @dev The current implementation will perform a binary search through\\n * the directory. This can allow gas costs to be low if this needs to be\\n * used in a transaction.\\n * @param point The point, which will usually be a hash of a public key.\\n * @param epochId The epoch id associated with the directory to scan.\\n */\\n function _scan(uint128 point, uint256 epochId) internal view returns (address stakee) {\\n uint256 entryLength = directories[epochId].entries.length;\\n\\n if (entryLength == 0) {\\n return address(0);\\n }\\n\\n // Staking all the Sylo would only be 94 bits, so multiplying this with\\n // a uint128 cannot overflow a uint256.\\n uint256 expectedVal = (directories[epochId].totalStake * uint256(point)) >> 128;\\n\\n uint256 left;\\n uint256 right = entryLength - 1;\\n\\n // perform a binary search through the directory\\n uint256 lower;\\n uint256 upper;\\n uint256 index;\\n\\n while (left <= right) {\\n index = (left + right) >> 1;\\n\\n lower = index == 0 ? 0 : directories[epochId].entries[index - 1].boundary;\\n upper = directories[epochId].entries[index].boundary;\\n\\n if (expectedVal >= lower && expectedVal < upper) {\\n return directories[epochId].entries[index].stakee;\\n } else if (expectedVal < lower) {\\n right = index - 1;\\n } else {\\n // expectedVal >= upper\\n left = index + 1;\\n }\\n }\\n }\\n\\n /**\\n * @notice Retrieve the total stake a Node has for the directory in the\\n * specified epoch.\\n * @param epochId The ID of the epoch.\\n * @param stakee The address of the Node.\\n * @return The amount of stake the Node has for the given directory in SOLO.\\n */\\n function getTotalStakeForStakee(\\n uint256 epochId,\\n address stakee\\n ) external view returns (uint256) {\\n return directories[epochId].stakes[stakee];\\n }\\n\\n /**\\n * @notice Retrieve the total stake for a directory in the specified epoch, which\\n * will be the sum of the stakes for all Nodes participating in that epoch.\\n * @param epochId The ID of the epoch.\\n * @return The total amount of stake in SOLO.\\n */\\n function getTotalStake(uint256 epochId) external view returns (uint256) {\\n return directories[epochId].totalStake;\\n }\\n\\n /**\\n * @notice Retrieve all entries for a directory in a specified epoch.\\n * @return An array of all the directory entries.\\n */\\n function getEntries(\\n uint256 epochId\\n ) external view returns (address[] memory, uint256[] memory) {\\n uint256 entryLength = directories[epochId].entries.length;\\n\\n address[] memory stakees = new address[](entryLength);\\n uint256[] memory boundaries = new uint256[](entryLength);\\n\\n DirectoryEntry memory entry;\\n DirectoryEntry[] memory entries = directories[epochId].entries;\\n\\n for (uint256 i; i < entryLength; ++i) {\\n entry = entries[i];\\n stakees[i] = entry.stakee;\\n boundaries[i] = entry.boundary;\\n }\\n return (stakees, boundaries);\\n }\\n}\\n\",\"keccak256\":\"0x98a344ba0403e7c5e92fe89a67799ec6583767bfa82a76e66c3b6e84ce519e59\",\"license\":\"Apache-2.0\"},\"contracts/staking/StakingManager.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\n\\nimport \\\"../SyloToken.sol\\\";\\nimport \\\"../libraries/SyloUtils.sol\\\";\\nimport \\\"../SeekerPowerOracle.sol\\\";\\nimport \\\"../epochs/EpochsManager.sol\\\";\\nimport \\\"../payments/ticketing/RewardsManager.sol\\\";\\nimport \\\"../interfaces/staking/IStakingManager.sol\\\";\\n\\n/**\\n * @notice Manages stakes and delegated stakes for Nodes. Holding\\n * staked Sylo is necessary for a Node to participate in the\\n * Sylo Network. The stake is used in stake-weighted scan function,\\n * and delegated stakers are rewarded on a pro-rata basis.\\n */\\ncontract StakingManager is IStakingManager, Initializable, Ownable2StepUpgradeable, ERC165 {\\n /** ERC 20 compatible token we are dealing with */\\n IERC20 public _token;\\n\\n /**\\n * @notice Rewards Manager contract. Any changes to stake will automatically\\n * trigger a claim to any outstanding rewards.\\n */\\n RewardsManager public _rewardsManager;\\n\\n EpochsManager public _epochsManager;\\n\\n SeekerPowerOracle public _seekerPowerOracle;\\n\\n /**\\n * @notice Tracks the managed stake for every Node.\\n */\\n mapping(address => Stake) public stakes;\\n\\n /** @notice Tracks overall total stake held by this contract */\\n uint256 public totalManagedStake;\\n\\n /**\\n * @notice Tracks funds that are in the process of being unlocked. This\\n * is indexed by a key that hashes both the address of the staked Node and\\n * the address of the staker.\\n */\\n mapping(bytes32 => Unlock) public unlockings;\\n\\n /**\\n * @notice The number of blocks a user must wait after calling \\\"unlock\\\"\\n * before they can withdraw their stake\\n */\\n uint256 public unlockDuration;\\n\\n /**\\n * @notice Minimum amount of stake that a Node needs to stake\\n * against itself in order to participate in the network. This is\\n * represented as a percentage of the Node's total stake, where\\n * the value is a ratio of 10000.\\n */\\n uint32 public minimumStakeProportion;\\n\\n /**\\n * @notice The multiplier used in determining a Seeker's staking\\n * capacity based on its power level.\\n */\\n uint256 public seekerPowerMultiplier;\\n\\n event UnlockDurationUpdated(uint256 unlockDuration);\\n event MinimumStakeProportionUpdated(uint256 minimumStakeProportion);\\n\\n error NoStakeToUnlock();\\n error StakeNotYetUnlocked();\\n error CannotStakeZeroAmount();\\n error CannotUnlockZeroAmount();\\n error TokenCannotBeZeroAddress();\\n error StakeeCannotBeZeroAddress();\\n error UnlockDurationCannotBeZero();\\n error CannotCancelUnlockZeroAmount();\\n error CannotUnlockMoreThanStaked(uint256 stakeAmount, uint256 unlockAmount);\\n error StakeCapacityReached(uint256 maxCapacity, uint256 currentCapacity);\\n error SeekerPowerNotRegistered(uint256 seekerId);\\n\\n function initialize(\\n IERC20 token,\\n RewardsManager rewardsManager,\\n EpochsManager epochsManager,\\n SeekerPowerOracle seekerPowerOracle,\\n uint256 _unlockDuration,\\n uint32 _minimumStakeProportion,\\n uint256 _seekerPowerMultiplier\\n ) external initializer {\\n if (address(token) == address(0)) {\\n revert TokenCannotBeZeroAddress();\\n }\\n\\n SyloUtils.validateContractInterface(\\n \\\"RewardsManager\\\",\\n address(rewardsManager),\\n type(IRewardsManager).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"EpochsManager\\\",\\n address(epochsManager),\\n type(IEpochsManager).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"SeekerPowerOracle\\\",\\n address(seekerPowerOracle),\\n type(ISeekerPowerOracle).interfaceId\\n );\\n\\n if (_unlockDuration == 0) {\\n revert UnlockDurationCannotBeZero();\\n }\\n\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n _token = token;\\n _rewardsManager = rewardsManager;\\n _epochsManager = epochsManager;\\n _seekerPowerOracle = seekerPowerOracle;\\n unlockDuration = _unlockDuration;\\n minimumStakeProportion = _minimumStakeProportion;\\n seekerPowerMultiplier = _seekerPowerMultiplier;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IStakingManager).interfaceId;\\n }\\n\\n /**\\n * @notice Sets the unlock duration for stakes. Only callable by\\n * the owner.\\n * @param _unlockDuration The unlock duration in number of blocks.\\n */\\n function setUnlockDuration(uint256 _unlockDuration) external onlyOwner {\\n if (_unlockDuration == 0) {\\n revert UnlockDurationCannotBeZero();\\n }\\n\\n unlockDuration = _unlockDuration;\\n emit UnlockDurationUpdated(_unlockDuration);\\n }\\n\\n /**\\n * @notice Sets the minimum stake proportion for Nodes. Only callable by\\n * the owner.\\n * @param _minimumStakeProportion The minimum stake proportion in SOLO.\\n */\\n function setMinimumStakeProportion(uint32 _minimumStakeProportion) external onlyOwner {\\n minimumStakeProportion = _minimumStakeProportion;\\n emit MinimumStakeProportionUpdated(_minimumStakeProportion);\\n }\\n\\n /**\\n * @notice Called by Nodes and delegated stakers to add stake.\\n * This function will fail under the following conditions:\\n * - If the Node address is invalid\\n * - If the specified stake value is zero\\n * - If the additional stake causes the Node to fail to meet the\\n * minimum stake proportion requirement.\\n * @param amount The amount of stake to add in SOLO.\\n * @param stakee The address of the staked Node.\\n */\\n function addStake(uint256 amount, address stakee) external {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n if (amount == 0) {\\n revert CannotStakeZeroAmount();\\n }\\n\\n _addStake(amount, stakee);\\n SafeERC20.safeTransferFrom(_token, msg.sender, address(this), amount);\\n }\\n\\n function _addStake(uint256 amount, address stakee) internal {\\n // automatically move any pending rewards generated by their existing stake\\n _rewardsManager.updatePendingRewards(stakee, msg.sender);\\n\\n uint256 currentEpochId = _epochsManager.currentIteration();\\n\\n Stake storage stake = stakes[stakee];\\n\\n uint256 currentStake = getCurrentStakerAmount(stakee, msg.sender);\\n\\n stake.stakeEntries[msg.sender] = StakeEntry(\\n currentStake + amount,\\n block.number,\\n currentEpochId\\n );\\n\\n stake.totalManagedStake = stake.totalManagedStake + amount;\\n totalManagedStake = totalManagedStake + amount;\\n }\\n\\n /**\\n * @notice Call this function to begin the unlocking process. Calling this\\n * will trigger an automatic claim of any outstanding staking rewards. Any\\n * stake that was already in the unlocking phase will have the specified\\n * amount added to it, and its duration refreshed. This function will fail\\n * under the following conditions:\\n * - If no stake exists for the caller\\n * - If the unlock amount is zero\\n * - If the unlock amount is more than what is staked\\n * Note: If calling as a Node, this function will *not* revert if it causes\\n * the Node to fail to meet the minimum stake proportion. However it will still\\n * prevent the Node from participating in the network until the minimum is met\\n * again.\\n * @param amount The amount of stake to unlock in SOLO.\\n * @param stakee The address of the staked Node.\\n */\\n function unlockStake(uint256 amount, address stakee) external returns (uint256) {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n if (amount == 0) {\\n revert CannotUnlockZeroAmount();\\n }\\n\\n uint256 currentStake = getCurrentStakerAmount(stakee, msg.sender);\\n\\n if (currentStake == 0) {\\n revert NoStakeToUnlock();\\n }\\n if (currentStake < amount) {\\n revert CannotUnlockMoreThanStaked(currentStake, amount);\\n }\\n\\n // automatically move any pending rewards generated by their existing stake\\n _rewardsManager.updatePendingRewards(stakee, msg.sender);\\n\\n uint256 currentEpochId = _epochsManager.currentIteration();\\n\\n Stake storage stake = stakes[stakee];\\n\\n stake.stakeEntries[msg.sender] = StakeEntry(\\n currentStake - amount,\\n block.number,\\n currentEpochId\\n );\\n\\n stake.totalManagedStake = stake.totalManagedStake - amount;\\n totalManagedStake = totalManagedStake - amount;\\n\\n bytes32 key = getKey(stakee, msg.sender);\\n\\n // Keep track of when the stake can be withdrawn\\n Unlock storage unlock = unlockings[key];\\n\\n uint256 unlockAt = block.number + unlockDuration;\\n if (unlock.unlockAt < unlockAt) {\\n unlock.unlockAt = unlockAt;\\n }\\n\\n unlock.amount = unlock.amount + amount;\\n\\n return unlockAt;\\n }\\n\\n /**\\n * @notice Call this function to withdraw stake that has finished unlocking.\\n * This will fail if the stake has not yet unlocked.\\n * @param stakee The address of the staked Node.\\n */\\n function withdrawStake(address stakee) external {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n\\n bytes32 key = getKey(stakee, msg.sender);\\n\\n Unlock storage unlock = unlockings[key];\\n\\n if (unlock.unlockAt >= block.number) {\\n revert StakeNotYetUnlocked();\\n }\\n\\n uint256 amount = unlock.amount;\\n\\n delete unlockings[key];\\n\\n SafeERC20.safeTransfer(_token, msg.sender, amount);\\n }\\n\\n /**\\n * @notice Call this function to cancel any stake that is in the process\\n * of unlocking. As this essentially adds back stake to the Node, this\\n * will trigger an automatic claim of any outstanding staking rewards.\\n * If the specified amount to cancel is greater than the stake that is\\n * currently being unlocked, it will cancel the maximum stake possible.\\n * @param amount The amount of unlocking stake to cancel in SOLO.\\n * @param stakee The address of the staked Node.\\n */\\n function cancelUnlocking(uint256 amount, address stakee) external {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n if (amount == 0) {\\n revert CannotCancelUnlockZeroAmount();\\n }\\n\\n bytes32 key = getKey(stakee, msg.sender);\\n\\n Unlock storage unlock = unlockings[key];\\n\\n if (amount >= unlock.amount) {\\n amount = unlock.amount;\\n delete unlockings[key];\\n } else {\\n unlock.amount = unlock.amount - amount;\\n }\\n\\n _addStake(amount, stakee);\\n }\\n\\n /**\\n * @notice This function determines the staking capacity of\\n * a Seeker based on its power level. The method will revert if\\n * the Seeker's power level has not been registered with the oracle.\\n *\\n * Currently the algorithm is as follows:\\n * staking_capacity = seeker_power * seeker_power_multiplier;\\n */\\n function calculateCapacityFromSeekerPower(uint256 seekerId) external view returns (uint256) {\\n uint256 seekerPower = _seekerPowerOracle.getSeekerPower(seekerId);\\n if (seekerPower == 0) {\\n revert SeekerPowerNotRegistered(seekerId);\\n }\\n\\n // If the Seeker Power is already\\n // at the maximum sylo, then we just return the max sylo value directly.\\n if (seekerPower >= SyloUtils.MAX_SYLO) {\\n return SyloUtils.MAX_SYLO;\\n }\\n\\n uint256 capacity = seekerPower * seekerPowerMultiplier;\\n\\n return capacity > SyloUtils.MAX_SYLO ? SyloUtils.MAX_SYLO : capacity;\\n }\\n\\n /**\\n * @notice This function can be used to a determine a Node's staking capacity,\\n * based on the minimum stake proportion constant.\\n * @param stakee The address of the staked Node.\\n */\\n function calculateCapacityFromMinStakingProportion(address stakee) public view returns (uint256) {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n\\n Stake storage stake = stakes[stakee];\\n\\n uint256 currentlyOwnedStake = stake.stakeEntries[stakee].amount;\\n return (currentlyOwnedStake * SyloUtils.PERCENTAGE_DENOMINATOR) /\\n minimumStakeProportion;\\n }\\n\\n /**\\n * @notice This function should be called by clients to determine how much\\n * additional delegated stake can be allocated to a Node via an addStake or\\n * cancelUnlocking call. This is useful to avoid a revert due to\\n * the minimum stake proportion requirement not being met from the additional stake.\\n * @param stakee The address of the staked Node.\\n */\\n function calculateMaxAdditionalDelegatedStake(address stakee) external view returns (uint256) {\\n uint256 totalMaxStake = calculateCapacityFromMinStakingProportion(stakee);\\n\\n Stake storage stake = stakes[stakee];\\n\\n if (totalMaxStake < stake.totalManagedStake) {\\n revert StakeCapacityReached(totalMaxStake, stake.totalManagedStake);\\n }\\n\\n return totalMaxStake - stake.totalManagedStake;\\n }\\n\\n /**\\n * @notice Retrieve the key used to index a stake entry. The key is a hash\\n * which takes both address of the Node and the staker as input.\\n * @param stakee The address of the staked Node.\\n * @param staker The address of the staker.\\n * @return A byte-array representing the key.\\n */\\n function getKey(address stakee, address staker) public pure returns (bytes32) {\\n return keccak256(abi.encodePacked(stakee, staker));\\n }\\n\\n /**\\n * @notice Retrieve the total stake being managed by this contract.\\n * @return The total amount of managed stake in SOLO.\\n */\\n function getTotalManagedStake() external view returns (uint256) {\\n return totalManagedStake;\\n }\\n\\n /**\\n * @notice Retrieve a stake entry.\\n * @param stakee The address of the staked Node.\\n * @param staker The address of the staker.\\n * @return The stake entry.\\n */\\n function getStakeEntry(\\n address stakee,\\n address staker\\n ) external view returns (StakeEntry memory) {\\n return stakes[stakee].stakeEntries[staker];\\n }\\n\\n /**\\n * @notice Retrieve the total amount of SOLO staked against a Node.\\n * @param stakee The address of the staked Node.\\n * @return The amount of staked SOLO.\\n */\\n function getStakeeTotalManagedStake(address stakee) external view returns (uint256) {\\n return stakes[stakee].totalManagedStake;\\n }\\n\\n /**\\n * @notice Check if a Node is meeting the minimum stake proportion requirement.\\n * @param stakee The address of the staked Node.\\n * @return True if the Node is meeting minimum stake proportion requirement.\\n */\\n function checkMinimumStakeProportion(address stakee) public view returns (bool) {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n\\n Stake storage stake = stakes[stakee];\\n\\n uint256 currentlyOwnedStake = stake.stakeEntries[stakee].amount;\\n uint32 ownedStakeProportion = SyloUtils.asPerc(\\n SafeCast.toUint128(currentlyOwnedStake),\\n stake.totalManagedStake\\n );\\n\\n return ownedStakeProportion >= minimumStakeProportion;\\n }\\n\\n /**\\n * @notice Retrieve the current amount of SOLO staked against a Node by\\n * a specified staker.\\n * @param stakee The address of the staked Node.\\n * @param staker The address of the staker.\\n * @return The amount of staked SOLO.\\n */\\n function getCurrentStakerAmount(address stakee, address staker) public view returns (uint256) {\\n return stakes[stakee].stakeEntries[staker].amount;\\n }\\n}\\n\",\"keccak256\":\"0x039e692a4a3a670977e78ef7145a43d0bc00e48387fafd4f527b60fbb6966628\",\"license\":\"Apache-2.0\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50611b18806100206000396000f3fe608060405234801561001057600080fd5b50600436106101f05760003560e01c80638a1fcd601161010f578063c78702bb116100a2578063ed7434a211610071578063ed7434a214610478578063f1254db31461048b578063f2fde38b1461049e578063f731cb49146104b157600080fd5b8063c78702bb1461042e578063dd90076914610441578063e30c397814610454578063ecd0c0c31461046557600080fd5b8063bc298553116100de578063bc298553146103da578063c23a5cea146103ed578063c4ef18d614610400578063c6a46f521461040957600080fd5b80638a1fcd60146103715780638da5cb5b1461037a5780639341a5361461038b578063a859f172146103c757600080fd5b806332e97d9b1161018757806379ba50971161015657806379ba50971461033a5780637a6a9233146103425780637ddc62c1146103555780637ffdacd51461036857600080fd5b806332e97d9b146102f957806370116fe51461030c57806370a2867d1461031f578063715018a61461033257600080fd5b806319fba39b116101c357806319fba39b146102b657806323314c6c146102be5780632d49aa1c146102d3578063320d7950146102e657600080fd5b806301ffc9a7146101f55780630ab250221461022e57806313cdd31b1461025957806316934fc414610293575b600080fd5b6102196102033660046117b6565b6001600160e01b0319166303e0261b60e41b1490565b60405190151581526020015b60405180910390f35b609954610241906001600160a01b031681565b6040516001600160a01b039091168152602001610225565b6102856102673660046117f5565b6001600160a01b03166000908152609b602052604090206001015490565b604051908152602001610225565b6102856102a13660046117f5565b609b6020526000908152604090206001015481565b609c54610285565b6102d16102cc366004611812565b6104e6565b005b6102d16102e1366004611812565b610592565b6102d16102f436600461185b565b610600565b610285610307366004611876565b610657565b6102d161031a36600461188f565b61075c565b61021961032d3660046117f5565b6109cf565b6102d1610a4a565b6102d1610a5e565b6102856103503660046117f5565b610ad8565b609854610241906001600160a01b031681565b610285609c5481565b610285609e5481565b6033546001600160a01b0316610241565b6103b2610399366004611876565b609d602052600090815260409020805460019091015482565b60408051928352602083019190915201610225565b6102856103d5366004611812565b610b44565b6102856103e836600461190f565b610db5565b6102d16103fb3660046117f5565b610dff565b61028560a05481565b609f546104199063ffffffff1681565b60405163ffffffff9091168152602001610225565b61028561043c36600461190f565b610e96565b6102d161044f366004611876565b610ec1565b6065546001600160a01b0316610241565b609754610241906001600160a01b031681565b6102856104863660046117f5565b610f1f565b609a54610241906001600160a01b031681565b6102d16104ac3660046117f5565b610f8b565b6104c46104bf36600461190f565b610ffc565b6040805182518152602080840151908201529181015190820152606001610225565b6001600160a01b03811661050d57604051630381bf9b60e01b815260040160405180910390fd5b8160000361052e57604051632da5af4360e21b815260040160405180910390fd5b600061053a8233610db5565b6000818152609d6020526040902080549192509084106105725780546000838152609d60205260408120818155600101559350610582565b805461057f908590611953565b81555b61058c848461106f565b50505050565b6001600160a01b0381166105b957604051630381bf9b60e01b815260040160405180910390fd5b816000036105da57604051631e254a4360e11b815260040160405180910390fd5b6105e4828261106f565b6097546105fc906001600160a01b03163330856111f2565b5050565b61060861125d565b609f805463ffffffff191663ffffffff83169081179091556040519081527fbda4a86339260a4afde28d7f9514dae258351e562a836be92ed2fbdf28847e56906020015b60405180910390a150565b609a546040516319a8225960e21b81526004810183905260009182916001600160a01b03909116906366a0896490602401602060405180830381865afa1580156106a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c99190611966565b9050806000036106f4576040516389b512a160e01b8152600481018490526024015b60405180910390fd5b6b204fce5e3e25026110000000811061071b57506b204fce5e3e2502611000000092915050565b600060a0548261072b919061197f565b90506b204fce5e3e2502611000000081116107465780610754565b6b204fce5e3e250261100000005b949350505050565b600054610100900460ff161580801561077c5750600054600160ff909116105b806107965750303b158015610796575060005460ff166001145b6107f95760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016106eb565b6000805460ff19166001179055801561081c576000805461ff0019166101001790555b6001600160a01b03881661084357604051635f5d339960e01b815260040160405180910390fd5b61087b6040518060400160405280600e81526020016d2932bbb0b93239a6b0b730b3b2b960911b81525088631ed895ad60e11b6112b7565b6108b26040518060400160405280600d81526020016c22b837b1b439a6b0b730b3b2b960991b8152508763078a0a4b60e41b6112b7565b6108ed604051806040016040528060118152602001705365656b6572506f7765724f7261636c6560781b8152508663b83e19d760e01b6112b7565b8360000361090e57604051632d8ef94560e11b815260040160405180910390fd5b6109166113c0565b609780546001600160a01b03199081166001600160a01b038b8116919091179092556098805482168a8416179055609980548216898416179055609a8054909116918716919091179055609e849055609f805463ffffffff191663ffffffff851617905560a082905580156109c5576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050565b60006001600160a01b0382166109f857604051630381bf9b60e01b815260040160405180910390fd5b6001600160a01b0382166000908152609b60209081526040808320918290528220549091610a32610a28836113ef565b846001015461145c565b609f5463ffffffff9081169116101595945050505050565b610a5261125d565b610a5c600061148e565b565b60655433906001600160a01b03168114610acc5760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084016106eb565b610ad58161148e565b50565b600080610ae483610f1f565b6001600160a01b0384166000908152609b60205260409020600181015491925090821015610b3557600181015460405163132d456f60e11b81526106eb918491600401918252602082015260400190565b60018101546107549083611953565b60006001600160a01b038216610b6d57604051630381bf9b60e01b815260040160405180910390fd5b82600003610b8e576040516303d9f83560e21b815260040160405180910390fd5b6000610b9a8333610e96565b905080600003610bbd576040516317292f0f60e21b815260040160405180910390fd5b83811015610be857604051634ba88c7160e11b815260048101829052602481018590526044016106eb565b609854604051630bb7406560e31b81526001600160a01b03858116600483015233602483015290911690635dba032890604401600060405180830381600087803b158015610c3557600080fd5b505af1158015610c49573d6000803e3d6000fd5b505050506000609960009054906101000a90046001600160a01b03166001600160a01b03166388c6abf86040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ca2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc69190611966565b6001600160a01b0385166000908152609b60205260409081902081516060810190925291925080610cf78886611953565b815243602080830191909152604091820185905233600090815284825282902083518155908301516001808301919091559290910151600290910155810154610d41908790611953565b6001820155609c54610d54908790611953565b609c556000610d638633610db5565b6000818152609d60205260408120609e5492935091610d829043611996565b90508082600101541015610d9857600182018190555b8154610da5908a90611996565b9091559450505050505b92915050565b6040516bffffffffffffffffffffffff19606084811b8216602084015283901b16603482015260009060480160405160208183030381529060405280519060200120905092915050565b6001600160a01b038116610e2657604051630381bf9b60e01b815260040160405180910390fd5b6000610e328233610db5565b6000818152609d602052604090206001810154919250904311610e68576040516335b55d7b60e01b815260040160405180910390fd5b80546000838152609d602052604081208181556001015560975461058c906001600160a01b031633836114a7565b6001600160a01b039182166000908152609b6020908152604080832093909416825291909152205490565b610ec961125d565b80600003610eea57604051632d8ef94560e11b815260040160405180910390fd5b609e8190556040518181527fbf6423edafc706e6ae214d98c485a52f610ee2f23148b43d546af3f8834c21b39060200161064c565b60006001600160a01b038216610f4857604051630381bf9b60e01b815260040160405180910390fd5b6001600160a01b0382166000908152609b602090815260408083209182905290912054609f5463ffffffff16610f81620186a08361197f565b61075491906119a9565b610f9361125d565b606580546001600160a01b0383166001600160a01b03199091168117909155610fc46033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b61102060405180606001604052806000815260200160008152602001600081525090565b506001600160a01b039182166000908152609b60209081526040808320939094168252918252829020825160608101845281548152600182015492810192909252600201549181019190915290565b609854604051630bb7406560e31b81526001600160a01b03838116600483015233602483015290911690635dba032890604401600060405180830381600087803b1580156110bc57600080fd5b505af11580156110d0573d6000803e3d6000fd5b505050506000609960009054906101000a90046001600160a01b03166001600160a01b03166388c6abf86040518163ffffffff1660e01b8152600401602060405180830381865afa158015611129573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061114d9190611966565b6001600160a01b0383166000908152609b602052604081209192506111728433610e96565b90506040518060600160405280868361118b9190611996565b8152436020808301919091526040918201869052336000908152858252829020835181559083015160018083019190915592909101516002909101558201546111d5908690611996565b6001830155609c546111e8908690611996565b609c555050505050565b6040516001600160a01b038085166024830152831660448201526064810182905261058c9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526114d7565b6033546001600160a01b03163314610a5c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106eb565b82516000036112d95760405163d1fc12f760e01b815260040160405180910390fd5b6001600160a01b038216611300578260405161f56160eb1b81526004016106eb9190611a1b565b6001600160e01b031981166113285760405163308c995160e01b815260040160405180910390fd5b6040516301ffc9a760e01b81526001600160e01b0319821660048201526001600160a01b038316906301ffc9a790602401602060405180830381865afa158015611376573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061139a9190611a2e565b6113bb578281604051633f8ccd3b60e21b81526004016106eb929190611a50565b505050565b600054610100900460ff166113e75760405162461bcd60e51b81526004016106eb90611a7b565b610a5c6115ac565b60006001600160801b038211156114585760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663238206269747360c81b60648201526084016106eb565b5090565b600061148782611478620186a06001600160801b03871661197f565b61148291906119a9565b6115dc565b9392505050565b606580546001600160a01b0319169055610ad581611641565b6040516001600160a01b0383166024820152604481018290526113bb90849063a9059cbb60e01b90606401611226565b600061152c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166116939092919063ffffffff16565b905080516000148061154d57508080602001905181019061154d9190611a2e565b6113bb5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016106eb565b600054610100900460ff166115d35760405162461bcd60e51b81526004016106eb90611a7b565b610a5c3361148e565b600063ffffffff8211156114585760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201526532206269747360d01b60648201526084016106eb565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6060610754848460008585600080866001600160a01b031685876040516116ba9190611ac6565b60006040518083038185875af1925050503d80600081146116f7576040519150601f19603f3d011682016040523d82523d6000602084013e6116fc565b606091505b509150915061170d87838387611718565b979650505050505050565b60608315611787578251600003611780576001600160a01b0385163b6117805760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016106eb565b5081610754565b610754838381511561179c5781518083602001fd5b8060405162461bcd60e51b81526004016106eb9190611a1b565b6000602082840312156117c857600080fd5b81356001600160e01b03198116811461148757600080fd5b6001600160a01b0381168114610ad557600080fd5b60006020828403121561180757600080fd5b8135611487816117e0565b6000806040838503121561182557600080fd5b823591506020830135611837816117e0565b809150509250929050565b803563ffffffff8116811461185657600080fd5b919050565b60006020828403121561186d57600080fd5b61148782611842565b60006020828403121561188857600080fd5b5035919050565b600080600080600080600060e0888a0312156118aa57600080fd5b87356118b5816117e0565b965060208801356118c5816117e0565b955060408801356118d5816117e0565b945060608801356118e5816117e0565b9350608088013592506118fa60a08901611842565b915060c0880135905092959891949750929550565b6000806040838503121561192257600080fd5b823561192d816117e0565b91506020830135611837816117e0565b634e487b7160e01b600052601160045260246000fd5b81810381811115610daf57610daf61193d565b60006020828403121561197857600080fd5b5051919050565b8082028115828204841417610daf57610daf61193d565b80820180821115610daf57610daf61193d565b6000826119c657634e487b7160e01b600052601260045260246000fd5b500490565b60005b838110156119e65781810151838201526020016119ce565b50506000910152565b60008151808452611a078160208601602086016119cb565b601f01601f19169290920160200192915050565b60208152600061148760208301846119ef565b600060208284031215611a4057600080fd5b8151801515811461148757600080fd5b604081526000611a6360408301856119ef565b905063ffffffff60e01b831660208301529392505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60008251611ad88184602087016119cb565b919091019291505056fea2646970667358221220cd497c8969996395e0a293ab8be17852bbd02a606afab5af2a317beb31a3da1f64736f6c63430008120033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101f05760003560e01c80638a1fcd601161010f578063c78702bb116100a2578063ed7434a211610071578063ed7434a214610478578063f1254db31461048b578063f2fde38b1461049e578063f731cb49146104b157600080fd5b8063c78702bb1461042e578063dd90076914610441578063e30c397814610454578063ecd0c0c31461046557600080fd5b8063bc298553116100de578063bc298553146103da578063c23a5cea146103ed578063c4ef18d614610400578063c6a46f521461040957600080fd5b80638a1fcd60146103715780638da5cb5b1461037a5780639341a5361461038b578063a859f172146103c757600080fd5b806332e97d9b1161018757806379ba50971161015657806379ba50971461033a5780637a6a9233146103425780637ddc62c1146103555780637ffdacd51461036857600080fd5b806332e97d9b146102f957806370116fe51461030c57806370a2867d1461031f578063715018a61461033257600080fd5b806319fba39b116101c357806319fba39b146102b657806323314c6c146102be5780632d49aa1c146102d3578063320d7950146102e657600080fd5b806301ffc9a7146101f55780630ab250221461022e57806313cdd31b1461025957806316934fc414610293575b600080fd5b6102196102033660046117b6565b6001600160e01b0319166303e0261b60e41b1490565b60405190151581526020015b60405180910390f35b609954610241906001600160a01b031681565b6040516001600160a01b039091168152602001610225565b6102856102673660046117f5565b6001600160a01b03166000908152609b602052604090206001015490565b604051908152602001610225565b6102856102a13660046117f5565b609b6020526000908152604090206001015481565b609c54610285565b6102d16102cc366004611812565b6104e6565b005b6102d16102e1366004611812565b610592565b6102d16102f436600461185b565b610600565b610285610307366004611876565b610657565b6102d161031a36600461188f565b61075c565b61021961032d3660046117f5565b6109cf565b6102d1610a4a565b6102d1610a5e565b6102856103503660046117f5565b610ad8565b609854610241906001600160a01b031681565b610285609c5481565b610285609e5481565b6033546001600160a01b0316610241565b6103b2610399366004611876565b609d602052600090815260409020805460019091015482565b60408051928352602083019190915201610225565b6102856103d5366004611812565b610b44565b6102856103e836600461190f565b610db5565b6102d16103fb3660046117f5565b610dff565b61028560a05481565b609f546104199063ffffffff1681565b60405163ffffffff9091168152602001610225565b61028561043c36600461190f565b610e96565b6102d161044f366004611876565b610ec1565b6065546001600160a01b0316610241565b609754610241906001600160a01b031681565b6102856104863660046117f5565b610f1f565b609a54610241906001600160a01b031681565b6102d16104ac3660046117f5565b610f8b565b6104c46104bf36600461190f565b610ffc565b6040805182518152602080840151908201529181015190820152606001610225565b6001600160a01b03811661050d57604051630381bf9b60e01b815260040160405180910390fd5b8160000361052e57604051632da5af4360e21b815260040160405180910390fd5b600061053a8233610db5565b6000818152609d6020526040902080549192509084106105725780546000838152609d60205260408120818155600101559350610582565b805461057f908590611953565b81555b61058c848461106f565b50505050565b6001600160a01b0381166105b957604051630381bf9b60e01b815260040160405180910390fd5b816000036105da57604051631e254a4360e11b815260040160405180910390fd5b6105e4828261106f565b6097546105fc906001600160a01b03163330856111f2565b5050565b61060861125d565b609f805463ffffffff191663ffffffff83169081179091556040519081527fbda4a86339260a4afde28d7f9514dae258351e562a836be92ed2fbdf28847e56906020015b60405180910390a150565b609a546040516319a8225960e21b81526004810183905260009182916001600160a01b03909116906366a0896490602401602060405180830381865afa1580156106a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c99190611966565b9050806000036106f4576040516389b512a160e01b8152600481018490526024015b60405180910390fd5b6b204fce5e3e25026110000000811061071b57506b204fce5e3e2502611000000092915050565b600060a0548261072b919061197f565b90506b204fce5e3e2502611000000081116107465780610754565b6b204fce5e3e250261100000005b949350505050565b600054610100900460ff161580801561077c5750600054600160ff909116105b806107965750303b158015610796575060005460ff166001145b6107f95760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016106eb565b6000805460ff19166001179055801561081c576000805461ff0019166101001790555b6001600160a01b03881661084357604051635f5d339960e01b815260040160405180910390fd5b61087b6040518060400160405280600e81526020016d2932bbb0b93239a6b0b730b3b2b960911b81525088631ed895ad60e11b6112b7565b6108b26040518060400160405280600d81526020016c22b837b1b439a6b0b730b3b2b960991b8152508763078a0a4b60e41b6112b7565b6108ed604051806040016040528060118152602001705365656b6572506f7765724f7261636c6560781b8152508663b83e19d760e01b6112b7565b8360000361090e57604051632d8ef94560e11b815260040160405180910390fd5b6109166113c0565b609780546001600160a01b03199081166001600160a01b038b8116919091179092556098805482168a8416179055609980548216898416179055609a8054909116918716919091179055609e849055609f805463ffffffff191663ffffffff851617905560a082905580156109c5576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050565b60006001600160a01b0382166109f857604051630381bf9b60e01b815260040160405180910390fd5b6001600160a01b0382166000908152609b60209081526040808320918290528220549091610a32610a28836113ef565b846001015461145c565b609f5463ffffffff9081169116101595945050505050565b610a5261125d565b610a5c600061148e565b565b60655433906001600160a01b03168114610acc5760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084016106eb565b610ad58161148e565b50565b600080610ae483610f1f565b6001600160a01b0384166000908152609b60205260409020600181015491925090821015610b3557600181015460405163132d456f60e11b81526106eb918491600401918252602082015260400190565b60018101546107549083611953565b60006001600160a01b038216610b6d57604051630381bf9b60e01b815260040160405180910390fd5b82600003610b8e576040516303d9f83560e21b815260040160405180910390fd5b6000610b9a8333610e96565b905080600003610bbd576040516317292f0f60e21b815260040160405180910390fd5b83811015610be857604051634ba88c7160e11b815260048101829052602481018590526044016106eb565b609854604051630bb7406560e31b81526001600160a01b03858116600483015233602483015290911690635dba032890604401600060405180830381600087803b158015610c3557600080fd5b505af1158015610c49573d6000803e3d6000fd5b505050506000609960009054906101000a90046001600160a01b03166001600160a01b03166388c6abf86040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ca2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc69190611966565b6001600160a01b0385166000908152609b60205260409081902081516060810190925291925080610cf78886611953565b815243602080830191909152604091820185905233600090815284825282902083518155908301516001808301919091559290910151600290910155810154610d41908790611953565b6001820155609c54610d54908790611953565b609c556000610d638633610db5565b6000818152609d60205260408120609e5492935091610d829043611996565b90508082600101541015610d9857600182018190555b8154610da5908a90611996565b9091559450505050505b92915050565b6040516bffffffffffffffffffffffff19606084811b8216602084015283901b16603482015260009060480160405160208183030381529060405280519060200120905092915050565b6001600160a01b038116610e2657604051630381bf9b60e01b815260040160405180910390fd5b6000610e328233610db5565b6000818152609d602052604090206001810154919250904311610e68576040516335b55d7b60e01b815260040160405180910390fd5b80546000838152609d602052604081208181556001015560975461058c906001600160a01b031633836114a7565b6001600160a01b039182166000908152609b6020908152604080832093909416825291909152205490565b610ec961125d565b80600003610eea57604051632d8ef94560e11b815260040160405180910390fd5b609e8190556040518181527fbf6423edafc706e6ae214d98c485a52f610ee2f23148b43d546af3f8834c21b39060200161064c565b60006001600160a01b038216610f4857604051630381bf9b60e01b815260040160405180910390fd5b6001600160a01b0382166000908152609b602090815260408083209182905290912054609f5463ffffffff16610f81620186a08361197f565b61075491906119a9565b610f9361125d565b606580546001600160a01b0383166001600160a01b03199091168117909155610fc46033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b61102060405180606001604052806000815260200160008152602001600081525090565b506001600160a01b039182166000908152609b60209081526040808320939094168252918252829020825160608101845281548152600182015492810192909252600201549181019190915290565b609854604051630bb7406560e31b81526001600160a01b03838116600483015233602483015290911690635dba032890604401600060405180830381600087803b1580156110bc57600080fd5b505af11580156110d0573d6000803e3d6000fd5b505050506000609960009054906101000a90046001600160a01b03166001600160a01b03166388c6abf86040518163ffffffff1660e01b8152600401602060405180830381865afa158015611129573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061114d9190611966565b6001600160a01b0383166000908152609b602052604081209192506111728433610e96565b90506040518060600160405280868361118b9190611996565b8152436020808301919091526040918201869052336000908152858252829020835181559083015160018083019190915592909101516002909101558201546111d5908690611996565b6001830155609c546111e8908690611996565b609c555050505050565b6040516001600160a01b038085166024830152831660448201526064810182905261058c9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526114d7565b6033546001600160a01b03163314610a5c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106eb565b82516000036112d95760405163d1fc12f760e01b815260040160405180910390fd5b6001600160a01b038216611300578260405161f56160eb1b81526004016106eb9190611a1b565b6001600160e01b031981166113285760405163308c995160e01b815260040160405180910390fd5b6040516301ffc9a760e01b81526001600160e01b0319821660048201526001600160a01b038316906301ffc9a790602401602060405180830381865afa158015611376573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061139a9190611a2e565b6113bb578281604051633f8ccd3b60e21b81526004016106eb929190611a50565b505050565b600054610100900460ff166113e75760405162461bcd60e51b81526004016106eb90611a7b565b610a5c6115ac565b60006001600160801b038211156114585760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663238206269747360c81b60648201526084016106eb565b5090565b600061148782611478620186a06001600160801b03871661197f565b61148291906119a9565b6115dc565b9392505050565b606580546001600160a01b0319169055610ad581611641565b6040516001600160a01b0383166024820152604481018290526113bb90849063a9059cbb60e01b90606401611226565b600061152c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166116939092919063ffffffff16565b905080516000148061154d57508080602001905181019061154d9190611a2e565b6113bb5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016106eb565b600054610100900460ff166115d35760405162461bcd60e51b81526004016106eb90611a7b565b610a5c3361148e565b600063ffffffff8211156114585760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201526532206269747360d01b60648201526084016106eb565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6060610754848460008585600080866001600160a01b031685876040516116ba9190611ac6565b60006040518083038185875af1925050503d80600081146116f7576040519150601f19603f3d011682016040523d82523d6000602084013e6116fc565b606091505b509150915061170d87838387611718565b979650505050505050565b60608315611787578251600003611780576001600160a01b0385163b6117805760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016106eb565b5081610754565b610754838381511561179c5781518083602001fd5b8060405162461bcd60e51b81526004016106eb9190611a1b565b6000602082840312156117c857600080fd5b81356001600160e01b03198116811461148757600080fd5b6001600160a01b0381168114610ad557600080fd5b60006020828403121561180757600080fd5b8135611487816117e0565b6000806040838503121561182557600080fd5b823591506020830135611837816117e0565b809150509250929050565b803563ffffffff8116811461185657600080fd5b919050565b60006020828403121561186d57600080fd5b61148782611842565b60006020828403121561188857600080fd5b5035919050565b600080600080600080600060e0888a0312156118aa57600080fd5b87356118b5816117e0565b965060208801356118c5816117e0565b955060408801356118d5816117e0565b945060608801356118e5816117e0565b9350608088013592506118fa60a08901611842565b915060c0880135905092959891949750929550565b6000806040838503121561192257600080fd5b823561192d816117e0565b91506020830135611837816117e0565b634e487b7160e01b600052601160045260246000fd5b81810381811115610daf57610daf61193d565b60006020828403121561197857600080fd5b5051919050565b8082028115828204841417610daf57610daf61193d565b80820180821115610daf57610daf61193d565b6000826119c657634e487b7160e01b600052601260045260246000fd5b500490565b60005b838110156119e65781810151838201526020016119ce565b50506000910152565b60008151808452611a078160208601602086016119cb565b601f01601f19169290920160200192915050565b60208152600061148760208301846119ef565b600060208284031215611a4057600080fd5b8151801515811461148757600080fd5b604081526000611a6360408301856119ef565b905063ffffffff60e01b831660208301529392505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60008251611ad88184602087016119cb565b919091019291505056fea2646970667358221220cd497c8969996395e0a293ab8be17852bbd02a606afab5af2a317beb31a3da1f64736f6c63430008120033", + "devdoc": { + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "acceptOwnership()": { + "details": "The new owner accepts the ownership transfer." + }, + "addStake(uint256,address)": { + "params": { + "amount": "The amount of stake to add in SOLO.", + "stakee": "The address of the staked Node." + } + }, + "calculateCapacityFromMinStakingProportion(address)": { + "params": { + "stakee": "The address of the staked Node." + } + }, + "calculateMaxAdditionalDelegatedStake(address)": { + "params": { + "stakee": "The address of the staked Node." + } + }, + "cancelUnlocking(uint256,address)": { + "params": { + "amount": "The amount of unlocking stake to cancel in SOLO.", + "stakee": "The address of the staked Node." + } + }, + "checkMinimumStakeProportion(address)": { + "params": { + "stakee": "The address of the staked Node." + }, + "returns": { + "_0": "True if the Node is meeting minimum stake proportion requirement." + } + }, + "getCurrentStakerAmount(address,address)": { + "params": { + "stakee": "The address of the staked Node.", + "staker": "The address of the staker." + }, + "returns": { + "_0": "The amount of staked SOLO." + } + }, + "getKey(address,address)": { + "params": { + "stakee": "The address of the staked Node.", + "staker": "The address of the staker." + }, + "returns": { + "_0": "A byte-array representing the key." + } + }, + "getStakeEntry(address,address)": { + "params": { + "stakee": "The address of the staked Node.", + "staker": "The address of the staker." + }, + "returns": { + "_0": "The stake entry." + } + }, + "getStakeeTotalManagedStake(address)": { + "params": { + "stakee": "The address of the staked Node." + }, + "returns": { + "_0": "The amount of staked SOLO." + } + }, + "getTotalManagedStake()": { + "returns": { + "_0": "The total amount of managed stake in SOLO." + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pendingOwner()": { + "details": "Returns the address of the pending owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "setMinimumStakeProportion(uint32)": { + "params": { + "_minimumStakeProportion": "The minimum stake proportion in SOLO." + } + }, + "setUnlockDuration(uint256)": { + "params": { + "_unlockDuration": "The unlock duration in number of blocks." + } + }, + "transferOwnership(address)": { + "details": "Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner." + }, + "unlockStake(uint256,address)": { + "params": { + "amount": "The amount of stake to unlock in SOLO.", + "stakee": "The address of the staked Node." + } + }, + "withdrawStake(address)": { + "params": { + "stakee": "The address of the staked Node." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "_rewardsManager()": { + "notice": "Rewards Manager contract. Any changes to stake will automatically trigger a claim to any outstanding rewards." + }, + "_token()": { + "notice": "ERC 20 compatible token we are dealing with " + }, + "addStake(uint256,address)": { + "notice": "Called by Nodes and delegated stakers to add stake. This function will fail under the following conditions: - If the Node address is invalid - If the specified stake value is zero - If the additional stake causes the Node to fail to meet the minimum stake proportion requirement." + }, + "calculateCapacityFromMinStakingProportion(address)": { + "notice": "This function can be used to a determine a Node's staking capacity, based on the minimum stake proportion constant." + }, + "calculateCapacityFromSeekerPower(uint256)": { + "notice": "This function determines the staking capacity of a Seeker based on its power level. The method will revert if the Seeker's power level has not been registered with the oracle. Currently the algorithm is as follows: staking_capacity = seeker_power * seeker_power_multiplier;" + }, + "calculateMaxAdditionalDelegatedStake(address)": { + "notice": "This function should be called by clients to determine how much additional delegated stake can be allocated to a Node via an addStake or cancelUnlocking call. This is useful to avoid a revert due to the minimum stake proportion requirement not being met from the additional stake." + }, + "cancelUnlocking(uint256,address)": { + "notice": "Call this function to cancel any stake that is in the process of unlocking. As this essentially adds back stake to the Node, this will trigger an automatic claim of any outstanding staking rewards. If the specified amount to cancel is greater than the stake that is currently being unlocked, it will cancel the maximum stake possible." + }, + "checkMinimumStakeProportion(address)": { + "notice": "Check if a Node is meeting the minimum stake proportion requirement." + }, + "getCurrentStakerAmount(address,address)": { + "notice": "Retrieve the current amount of SOLO staked against a Node by a specified staker." + }, + "getKey(address,address)": { + "notice": "Retrieve the key used to index a stake entry. The key is a hash which takes both address of the Node and the staker as input." + }, + "getStakeEntry(address,address)": { + "notice": "Retrieve a stake entry." + }, + "getStakeeTotalManagedStake(address)": { + "notice": "Retrieve the total amount of SOLO staked against a Node." + }, + "getTotalManagedStake()": { + "notice": "Retrieve the total stake being managed by this contract." + }, + "minimumStakeProportion()": { + "notice": "Minimum amount of stake that a Node needs to stake against itself in order to participate in the network. This is represented as a percentage of the Node's total stake, where the value is a ratio of 10000." + }, + "seekerPowerMultiplier()": { + "notice": "The multiplier used in determining a Seeker's staking capacity based on its power level." + }, + "setMinimumStakeProportion(uint32)": { + "notice": "Sets the minimum stake proportion for Nodes. Only callable by the owner." + }, + "setUnlockDuration(uint256)": { + "notice": "Sets the unlock duration for stakes. Only callable by the owner." + }, + "stakes(address)": { + "notice": "Tracks the managed stake for every Node." + }, + "supportsInterface(bytes4)": { + "notice": "Returns true if the contract implements the interface defined by `interfaceId` from ERC165." + }, + "totalManagedStake()": { + "notice": "Tracks overall total stake held by this contract " + }, + "unlockDuration()": { + "notice": "The number of blocks a user must wait after calling \"unlock\" before they can withdraw their stake" + }, + "unlockStake(uint256,address)": { + "notice": "Call this function to begin the unlocking process. Calling this will trigger an automatic claim of any outstanding staking rewards. Any stake that was already in the unlocking phase will have the specified amount added to it, and its duration refreshed. This function will fail under the following conditions: - If no stake exists for the caller - If the unlock amount is zero - If the unlock amount is more than what is staked Note: If calling as a Node, this function will *not* revert if it causes the Node to fail to meet the minimum stake proportion. However it will still prevent the Node from participating in the network until the minimum is met again." + }, + "unlockings(bytes32)": { + "notice": "Tracks funds that are in the process of being unlocked. This is indexed by a key that hashes both the address of the staked Node and the address of the staker." + }, + "withdrawStake(address)": { + "notice": "Call this function to withdraw stake that has finished unlocking. This will fail if the stake has not yet unlocked." + } + }, + "notice": "Manages stakes and delegated stakes for Nodes. Holding staked Sylo is necessary for a Node to participate in the Sylo Network. The stake is used in stake-weighted scan function, and delegated stakers are rewarded on a pro-rata basis.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 244, + "contract": "contracts/staking/StakingManager.sol:StakingManager", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 247, + "contract": "contracts/staking/StakingManager.sol:StakingManager", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 777, + "contract": "contracts/staking/StakingManager.sol:StakingManager", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 116, + "contract": "contracts/staking/StakingManager.sol:StakingManager", + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address" + }, + { + "astId": 236, + "contract": "contracts/staking/StakingManager.sol:StakingManager", + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 25, + "contract": "contracts/staking/StakingManager.sol:StakingManager", + "label": "_pendingOwner", + "offset": 0, + "slot": "101", + "type": "t_address" + }, + { + "astId": 104, + "contract": "contracts/staking/StakingManager.sol:StakingManager", + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 15001, + "contract": "contracts/staking/StakingManager.sol:StakingManager", + "label": "_token", + "offset": 0, + "slot": "151", + "type": "t_contract(IERC20)1443" + }, + { + "astId": 15005, + "contract": "contracts/staking/StakingManager.sol:StakingManager", + "label": "_rewardsManager", + "offset": 0, + "slot": "152", + "type": "t_contract(RewardsManager)14142" + }, + { + "astId": 15008, + "contract": "contracts/staking/StakingManager.sol:StakingManager", + "label": "_epochsManager", + "offset": 0, + "slot": "153", + "type": "t_contract(EpochsManager)10429" + }, + { + "astId": 15011, + "contract": "contracts/staking/StakingManager.sol:StakingManager", + "label": "_seekerPowerOracle", + "offset": 0, + "slot": "154", + "type": "t_contract(SeekerPowerOracle)9876" + }, + { + "astId": 15017, + "contract": "contracts/staking/StakingManager.sol:StakingManager", + "label": "stakes", + "offset": 0, + "slot": "155", + "type": "t_mapping(t_address,t_struct(Stake)11036_storage)" + }, + { + "astId": 15020, + "contract": "contracts/staking/StakingManager.sol:StakingManager", + "label": "totalManagedStake", + "offset": 0, + "slot": "156", + "type": "t_uint256" + }, + { + "astId": 15026, + "contract": "contracts/staking/StakingManager.sol:StakingManager", + "label": "unlockings", + "offset": 0, + "slot": "157", + "type": "t_mapping(t_bytes32,t_struct(Unlock)11041_storage)" + }, + { + "astId": 15029, + "contract": "contracts/staking/StakingManager.sol:StakingManager", + "label": "unlockDuration", + "offset": 0, + "slot": "158", + "type": "t_uint256" + }, + { + "astId": 15032, + "contract": "contracts/staking/StakingManager.sol:StakingManager", + "label": "minimumStakeProportion", + "offset": 0, + "slot": "159", + "type": "t_uint32" + }, + { + "astId": 15035, + "contract": "contracts/staking/StakingManager.sol:StakingManager", + "label": "seekerPowerMultiplier", + "offset": 0, + "slot": "160", + "type": "t_uint256" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(EpochsManager)10429": { + "encoding": "inplace", + "label": "contract EpochsManager", + "numberOfBytes": "20" + }, + "t_contract(IERC20)1443": { + "encoding": "inplace", + "label": "contract IERC20", + "numberOfBytes": "20" + }, + "t_contract(RewardsManager)14142": { + "encoding": "inplace", + "label": "contract RewardsManager", + "numberOfBytes": "20" + }, + "t_contract(SeekerPowerOracle)9876": { + "encoding": "inplace", + "label": "contract SeekerPowerOracle", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_struct(Stake)11036_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct IStakingManager.Stake)", + "numberOfBytes": "32", + "value": "t_struct(Stake)11036_storage" + }, + "t_mapping(t_address,t_struct(StakeEntry)11028_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct IStakingManager.StakeEntry)", + "numberOfBytes": "32", + "value": "t_struct(StakeEntry)11028_storage" + }, + "t_mapping(t_bytes32,t_struct(Unlock)11041_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct IStakingManager.Unlock)", + "numberOfBytes": "32", + "value": "t_struct(Unlock)11041_storage" + }, + "t_struct(Stake)11036_storage": { + "encoding": "inplace", + "label": "struct IStakingManager.Stake", + "members": [ + { + "astId": 11033, + "contract": "contracts/staking/StakingManager.sol:StakingManager", + "label": "stakeEntries", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_address,t_struct(StakeEntry)11028_storage)" + }, + { + "astId": 11035, + "contract": "contracts/staking/StakingManager.sol:StakingManager", + "label": "totalManagedStake", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_struct(StakeEntry)11028_storage": { + "encoding": "inplace", + "label": "struct IStakingManager.StakeEntry", + "members": [ + { + "astId": 11023, + "contract": "contracts/staking/StakingManager.sol:StakingManager", + "label": "amount", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 11025, + "contract": "contracts/staking/StakingManager.sol:StakingManager", + "label": "updatedAt", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 11027, + "contract": "contracts/staking/StakingManager.sol:StakingManager", + "label": "epochId", + "offset": 0, + "slot": "2", + "type": "t_uint256" + } + ], + "numberOfBytes": "96" + }, + "t_struct(Unlock)11041_storage": { + "encoding": "inplace", + "label": "struct IStakingManager.Unlock", + "members": [ + { + "astId": 11038, + "contract": "contracts/staking/StakingManager.sol:StakingManager", + "label": "amount", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 11040, + "contract": "contracts/staking/StakingManager.sol:StakingManager", + "label": "unlockAt", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint32": { + "encoding": "inplace", + "label": "uint32", + "numberOfBytes": "4" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/deployments/porcini-dev/StakingManager_Proxy.json b/deployments/porcini-dev/StakingManager_Proxy.json new file mode 100644 index 00000000..2de3f650 --- /dev/null +++ b/deployments/porcini-dev/StakingManager_Proxy.json @@ -0,0 +1,235 @@ +{ + "address": "0x9DBdad1AF4c0ab8065A2AD0e55172590d6655cFf", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x509239272057bc4c557b4cddba9c932f662c0ae5a7a7abff67277a3db7bd2bd6", + "receipt": { + "to": null, + "from": "0x448c8e9e1816300Dd052e77D2A44c990A2807D15", + "contractAddress": "0x9DBdad1AF4c0ab8065A2AD0e55172590d6655cFf", + "transactionIndex": 0, + "gasUsed": "720430", + "logsBloom": "0x00000000000000000000000000000000400000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000400000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000002000000000002000000000000000c00000000000400000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x935857de77b32a472c7e5a89dd3d7ef8eb15a5da4d32ab571acc25b636e0afa5", + "transactionHash": "0x509239272057bc4c557b4cddba9c932f662c0ae5a7a7abff67277a3db7bd2bd6", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 10978373, + "transactionHash": "0x509239272057bc4c557b4cddba9c932f662c0ae5a7a7abff67277a3db7bd2bd6", + "address": "0x9DBdad1AF4c0ab8065A2AD0e55172590d6655cFf", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000b90b73e736112efa0cf9efa8614254c5e1a5b52c" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0x935857de77b32a472c7e5a89dd3d7ef8eb15a5da4d32ab571acc25b636e0afa5" + }, + { + "transactionIndex": 0, + "blockNumber": 10978373, + "transactionHash": "0x509239272057bc4c557b4cddba9c932f662c0ae5a7a7abff67277a3db7bd2bd6", + "address": "0x9DBdad1AF4c0ab8065A2AD0e55172590d6655cFf", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f06d5edb04f4995fff2c362a14826107f7cccbcc", + "logIndex": 1, + "blockHash": "0x935857de77b32a472c7e5a89dd3d7ef8eb15a5da4d32ab571acc25b636e0afa5" + } + ], + "blockNumber": 10978373, + "cumulativeGasUsed": "720430", + "status": 1, + "byzantium": true + }, + "args": [ + "0xb90b73e736112eFa0Cf9eFA8614254C5e1a5b52c", + "0xf06d5Edb04F4995FFF2c362a14826107F7CCCBCc", + "0x" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\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\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.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 *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\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 Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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 Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual 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 Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\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(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\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(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) 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\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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 overriden 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 internall 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 overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/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\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\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 * ```\\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`, and `uint256`._\\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 /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\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 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 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 assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/porcini-dev/SyloTicketing.json b/deployments/porcini-dev/SyloTicketing.json new file mode 100644 index 00000000..829f3df5 --- /dev/null +++ b/deployments/porcini-dev/SyloTicketing.json @@ -0,0 +1,1525 @@ +{ + "address": "0x62D39eB18f77143aA3B847FDB54F95db896fC28f", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "inputs": [], + "name": "AccountCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "ContractNameCannotBeEmpty", + "type": "error" + }, + { + "inputs": [], + "name": "EscrowAmountCannotBeZero", + "type": "error" + }, + { + "inputs": [], + "name": "InterfaceIdCannotBeZeroBytes", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReceiverSignature", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReceiverSigningPermission", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidSenderSignature", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidSenderSigningPermission", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "MissingFuturepassAccount", + "type": "error" + }, + { + "inputs": [], + "name": "NoEsrowAndPenalty", + "type": "error" + }, + { + "inputs": [], + "name": "PenaltyAmountCannotBeZero", + "type": "error" + }, + { + "inputs": [], + "name": "RedeemerCommitMismatch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + } + ], + "name": "RedeemerMustHaveJoinedEpoch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "TargetContractCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "TargetNotSupportInterface", + "type": "error" + }, + { + "inputs": [], + "name": "TicketAlreadyRedeemed", + "type": "error" + }, + { + "inputs": [], + "name": "TicketAlreadyUsed", + "type": "error" + }, + { + "inputs": [], + "name": "TicketCannotBeFromFutureBlock", + "type": "error" + }, + { + "inputs": [], + "name": "TicketEpochNotFound", + "type": "error" + }, + { + "inputs": [], + "name": "TicketNotCreatedInTheEpoch", + "type": "error" + }, + { + "inputs": [], + "name": "TicketNotWinning", + "type": "error" + }, + { + "inputs": [], + "name": "TicketReceiverCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "TicketRedeemerCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "TicketSenderCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "TokenCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "UnlockDurationCannotBeZero", + "type": "error" + }, + { + "inputs": [], + "name": "UnlockingInProcess", + "type": "error" + }, + { + "inputs": [], + "name": "UnlockingNotCompleted", + "type": "error" + }, + { + "inputs": [], + "name": "UnlockingNotInProcess", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "generationBlock", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "MultiReceiverRedemption", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "generationBlock", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Redemption", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "SenderPenaltyBurnt", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "unlockDuration", + "type": "uint256" + } + ], + "name": "UnlockDurationUpdated", + "type": "event" + }, + { + "inputs": [], + "name": "_authorizedAccounts", + "outputs": [ + { + "internalType": "contract AuthorizedAccounts", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_directory", + "outputs": [ + { + "internalType": "contract Directory", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_epochsManager", + "outputs": [ + { + "internalType": "contract EpochsManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_futurepassRegistrar", + "outputs": [ + { + "internalType": "contract IFuturePassRegistrar", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_registries", + "outputs": [ + { + "internalType": "contract Registries", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_rewardsManager", + "outputs": [ + { + "internalType": "contract RewardsManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_stakingManager", + "outputs": [ + { + "internalType": "contract StakingManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_token", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "generationBlock", + "type": "uint256" + } + ], + "name": "calculateWinningProbability", + "outputs": [ + { + "internalType": "uint128", + "name": "", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "generationBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rand", + "type": "uint256" + } + ], + "name": "createCommit", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "depositEscrow", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "depositPenalty", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "deposits", + "outputs": [ + { + "internalType": "uint256", + "name": "escrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "penalty", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "unlockAt", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "main", + "type": "address" + }, + { + "internalType": "address", + "name": "delegated", + "type": "address" + } + ], + "internalType": "struct ISyloTicketing.User", + "name": "sender", + "type": "tuple" + }, + { + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "generationBlock", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "redeemerCommit", + "type": "bytes32" + } + ], + "internalType": "struct ISyloTicketing.MultiReceiverTicket", + "name": "ticket", + "type": "tuple" + } + ], + "name": "getMultiReceiverTicketHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "main", + "type": "address" + }, + { + "internalType": "address", + "name": "delegated", + "type": "address" + } + ], + "internalType": "struct ISyloTicketing.User", + "name": "sender", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "main", + "type": "address" + }, + { + "internalType": "address", + "name": "delegated", + "type": "address" + } + ], + "internalType": "struct ISyloTicketing.User", + "name": "receiver", + "type": "tuple" + }, + { + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "generationBlock", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "redeemerCommit", + "type": "bytes32" + } + ], + "internalType": "struct ISyloTicketing.Ticket", + "name": "ticket", + "type": "tuple" + } + ], + "name": "getTicketHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "internalType": "contract Registries", + "name": "registries", + "type": "address" + }, + { + "internalType": "contract StakingManager", + "name": "stakingManager", + "type": "address" + }, + { + "internalType": "contract Directory", + "name": "directory", + "type": "address" + }, + { + "internalType": "contract EpochsManager", + "name": "epochsManager", + "type": "address" + }, + { + "internalType": "contract RewardsManager", + "name": "rewardsManager", + "type": "address" + }, + { + "internalType": "contract AuthorizedAccounts", + "name": "authorizedAccounts", + "type": "address" + }, + { + "internalType": "contract IFuturePassRegistrar", + "name": "futurepassRegistrar", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_unlockDuration", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "senderSig", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "receiverSig", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "generationBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "redeemerRand", + "type": "uint256" + } + ], + "name": "isWinningTicket", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lockDeposits", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "main", + "type": "address" + }, + { + "internalType": "address", + "name": "delegated", + "type": "address" + } + ], + "internalType": "struct ISyloTicketing.User", + "name": "sender", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "main", + "type": "address" + }, + { + "internalType": "address", + "name": "delegated", + "type": "address" + } + ], + "internalType": "struct ISyloTicketing.User", + "name": "receiver", + "type": "tuple" + }, + { + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "generationBlock", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "redeemerCommit", + "type": "bytes32" + } + ], + "internalType": "struct ISyloTicketing.Ticket", + "name": "ticket", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "redeemerRand", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "senderSig", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "receiverSig", + "type": "bytes" + } + ], + "name": "redeem", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "main", + "type": "address" + }, + { + "internalType": "address", + "name": "delegated", + "type": "address" + } + ], + "internalType": "struct ISyloTicketing.User", + "name": "sender", + "type": "tuple" + }, + { + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "generationBlock", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "redeemerCommit", + "type": "bytes32" + } + ], + "internalType": "struct ISyloTicketing.MultiReceiverTicket", + "name": "ticket", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "redeemerRand", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "main", + "type": "address" + }, + { + "internalType": "address", + "name": "delegated", + "type": "address" + } + ], + "internalType": "struct ISyloTicketing.User", + "name": "receiver", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "senderSig", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "receiverSig", + "type": "bytes" + } + ], + "name": "redeemMultiReceiver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "main", + "type": "address" + }, + { + "internalType": "address", + "name": "delegated", + "type": "address" + } + ], + "internalType": "struct ISyloTicketing.User", + "name": "sender", + "type": "tuple" + }, + { + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "generationBlock", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "redeemerCommit", + "type": "bytes32" + } + ], + "internalType": "struct ISyloTicketing.MultiReceiverTicket", + "name": "ticket", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "main", + "type": "address" + }, + { + "internalType": "address", + "name": "delegated", + "type": "address" + } + ], + "internalType": "struct ISyloTicketing.User", + "name": "receiver", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "redeemerRand", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "senderSig", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "receiverSig", + "type": "bytes" + } + ], + "name": "requireValidWinningMultiReceiverTicket", + "outputs": [ + { + "internalType": "bytes32", + "name": "ticketHash", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "ticketReceiverHash", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "main", + "type": "address" + }, + { + "internalType": "address", + "name": "delegated", + "type": "address" + } + ], + "internalType": "struct ISyloTicketing.User", + "name": "sender", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "main", + "type": "address" + }, + { + "internalType": "address", + "name": "delegated", + "type": "address" + } + ], + "internalType": "struct ISyloTicketing.User", + "name": "receiver", + "type": "tuple" + }, + { + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "generationBlock", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "redeemerCommit", + "type": "bytes32" + } + ], + "internalType": "struct ISyloTicketing.Ticket", + "name": "ticket", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "redeemerRand", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "senderSig", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "receiverSig", + "type": "bytes" + } + ], + "name": "requireValidWinningTicket", + "outputs": [ + { + "internalType": "bytes32", + "name": "ticketHash", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_unlockDuration", + "type": "uint256" + } + ], + "name": "setUnlockDuration", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unlockDeposits", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unlockDuration", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "usedTickets", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "withdrawTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0x1c416ffb3d5ec546ca4c4da793c21b0206f13a97d2081f55ccaebd5905589ec4", + "receipt": { + "to": null, + "from": "0x448c8e9e1816300Dd052e77D2A44c990A2807D15", + "contractAddress": "0x62D39eB18f77143aA3B847FDB54F95db896fC28f", + "transactionIndex": 0, + "gasUsed": "720418", + "logsBloom": "0x00000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000002080000000000000000000000000000000000000000000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000200000000800000800000000000000000008000000000000000000000000000000000000000000000000020000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x53419b6afa1236d1e551aa63657eda5253dfc09ab34c5b78132f0465f85c9648", + "transactionHash": "0x1c416ffb3d5ec546ca4c4da793c21b0206f13a97d2081f55ccaebd5905589ec4", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 10978382, + "transactionHash": "0x1c416ffb3d5ec546ca4c4da793c21b0206f13a97d2081f55ccaebd5905589ec4", + "address": "0x62D39eB18f77143aA3B847FDB54F95db896fC28f", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x0000000000000000000000008185e90e424116c67d8429be71006941679e08bb" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0x53419b6afa1236d1e551aa63657eda5253dfc09ab34c5b78132f0465f85c9648" + }, + { + "transactionIndex": 0, + "blockNumber": 10978382, + "transactionHash": "0x1c416ffb3d5ec546ca4c4da793c21b0206f13a97d2081f55ccaebd5905589ec4", + "address": "0x62D39eB18f77143aA3B847FDB54F95db896fC28f", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f06d5edb04f4995fff2c362a14826107f7cccbcc", + "logIndex": 1, + "blockHash": "0x53419b6afa1236d1e551aa63657eda5253dfc09ab34c5b78132f0465f85c9648" + } + ], + "blockNumber": 10978382, + "cumulativeGasUsed": "720418", + "status": 1, + "byzantium": true + }, + "args": [ + "0x8185e90E424116c67D8429Be71006941679E08bB", + "0xf06d5Edb04F4995FFF2c362a14826107F7CCCBCc", + "0x" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\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\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.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 *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\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 Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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 Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual 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 Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\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(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\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(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) 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\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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 overriden 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 internall 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 overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/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\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\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 * ```\\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`, and `uint256`._\\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 /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\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 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 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 assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "implementation": "0x8185e90E424116c67D8429Be71006941679E08bB", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/porcini-dev/SyloTicketing_Implementation.json b/deployments/porcini-dev/SyloTicketing_Implementation.json new file mode 100644 index 00000000..c30159ad --- /dev/null +++ b/deployments/porcini-dev/SyloTicketing_Implementation.json @@ -0,0 +1,1794 @@ +{ + "address": "0x8185e90E424116c67D8429Be71006941679E08bB", + "abi": [ + { + "inputs": [], + "name": "AccountCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "ContractNameCannotBeEmpty", + "type": "error" + }, + { + "inputs": [], + "name": "EscrowAmountCannotBeZero", + "type": "error" + }, + { + "inputs": [], + "name": "InterfaceIdCannotBeZeroBytes", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReceiverSignature", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReceiverSigningPermission", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidSenderSignature", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidSenderSigningPermission", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "MissingFuturepassAccount", + "type": "error" + }, + { + "inputs": [], + "name": "NoEsrowAndPenalty", + "type": "error" + }, + { + "inputs": [], + "name": "PenaltyAmountCannotBeZero", + "type": "error" + }, + { + "inputs": [], + "name": "RedeemerCommitMismatch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + } + ], + "name": "RedeemerMustHaveJoinedEpoch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "TargetContractCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "TargetNotSupportInterface", + "type": "error" + }, + { + "inputs": [], + "name": "TicketAlreadyRedeemed", + "type": "error" + }, + { + "inputs": [], + "name": "TicketAlreadyUsed", + "type": "error" + }, + { + "inputs": [], + "name": "TicketCannotBeFromFutureBlock", + "type": "error" + }, + { + "inputs": [], + "name": "TicketEpochNotFound", + "type": "error" + }, + { + "inputs": [], + "name": "TicketNotCreatedInTheEpoch", + "type": "error" + }, + { + "inputs": [], + "name": "TicketNotWinning", + "type": "error" + }, + { + "inputs": [], + "name": "TicketReceiverCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "TicketRedeemerCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "TicketSenderCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "TokenCannotBeZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "UnlockDurationCannotBeZero", + "type": "error" + }, + { + "inputs": [], + "name": "UnlockingInProcess", + "type": "error" + }, + { + "inputs": [], + "name": "UnlockingNotCompleted", + "type": "error" + }, + { + "inputs": [], + "name": "UnlockingNotInProcess", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "generationBlock", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "MultiReceiverRedemption", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "generationBlock", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Redemption", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "SenderPenaltyBurnt", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "unlockDuration", + "type": "uint256" + } + ], + "name": "UnlockDurationUpdated", + "type": "event" + }, + { + "inputs": [], + "name": "_authorizedAccounts", + "outputs": [ + { + "internalType": "contract AuthorizedAccounts", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_directory", + "outputs": [ + { + "internalType": "contract Directory", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_epochsManager", + "outputs": [ + { + "internalType": "contract EpochsManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_futurepassRegistrar", + "outputs": [ + { + "internalType": "contract IFuturePassRegistrar", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_registries", + "outputs": [ + { + "internalType": "contract Registries", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_rewardsManager", + "outputs": [ + { + "internalType": "contract RewardsManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_stakingManager", + "outputs": [ + { + "internalType": "contract StakingManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_token", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "generationBlock", + "type": "uint256" + } + ], + "name": "calculateWinningProbability", + "outputs": [ + { + "internalType": "uint128", + "name": "", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "generationBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rand", + "type": "uint256" + } + ], + "name": "createCommit", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "depositEscrow", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "depositPenalty", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "deposits", + "outputs": [ + { + "internalType": "uint256", + "name": "escrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "penalty", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "unlockAt", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "main", + "type": "address" + }, + { + "internalType": "address", + "name": "delegated", + "type": "address" + } + ], + "internalType": "struct ISyloTicketing.User", + "name": "sender", + "type": "tuple" + }, + { + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "generationBlock", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "redeemerCommit", + "type": "bytes32" + } + ], + "internalType": "struct ISyloTicketing.MultiReceiverTicket", + "name": "ticket", + "type": "tuple" + } + ], + "name": "getMultiReceiverTicketHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "main", + "type": "address" + }, + { + "internalType": "address", + "name": "delegated", + "type": "address" + } + ], + "internalType": "struct ISyloTicketing.User", + "name": "sender", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "main", + "type": "address" + }, + { + "internalType": "address", + "name": "delegated", + "type": "address" + } + ], + "internalType": "struct ISyloTicketing.User", + "name": "receiver", + "type": "tuple" + }, + { + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "generationBlock", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "redeemerCommit", + "type": "bytes32" + } + ], + "internalType": "struct ISyloTicketing.Ticket", + "name": "ticket", + "type": "tuple" + } + ], + "name": "getTicketHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "internalType": "contract Registries", + "name": "registries", + "type": "address" + }, + { + "internalType": "contract StakingManager", + "name": "stakingManager", + "type": "address" + }, + { + "internalType": "contract Directory", + "name": "directory", + "type": "address" + }, + { + "internalType": "contract EpochsManager", + "name": "epochsManager", + "type": "address" + }, + { + "internalType": "contract RewardsManager", + "name": "rewardsManager", + "type": "address" + }, + { + "internalType": "contract AuthorizedAccounts", + "name": "authorizedAccounts", + "type": "address" + }, + { + "internalType": "contract IFuturePassRegistrar", + "name": "futurepassRegistrar", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_unlockDuration", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "senderSig", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "receiverSig", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "generationBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "redeemerRand", + "type": "uint256" + } + ], + "name": "isWinningTicket", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lockDeposits", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "main", + "type": "address" + }, + { + "internalType": "address", + "name": "delegated", + "type": "address" + } + ], + "internalType": "struct ISyloTicketing.User", + "name": "sender", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "main", + "type": "address" + }, + { + "internalType": "address", + "name": "delegated", + "type": "address" + } + ], + "internalType": "struct ISyloTicketing.User", + "name": "receiver", + "type": "tuple" + }, + { + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "generationBlock", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "redeemerCommit", + "type": "bytes32" + } + ], + "internalType": "struct ISyloTicketing.Ticket", + "name": "ticket", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "redeemerRand", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "senderSig", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "receiverSig", + "type": "bytes" + } + ], + "name": "redeem", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "main", + "type": "address" + }, + { + "internalType": "address", + "name": "delegated", + "type": "address" + } + ], + "internalType": "struct ISyloTicketing.User", + "name": "sender", + "type": "tuple" + }, + { + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "generationBlock", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "redeemerCommit", + "type": "bytes32" + } + ], + "internalType": "struct ISyloTicketing.MultiReceiverTicket", + "name": "ticket", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "redeemerRand", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "main", + "type": "address" + }, + { + "internalType": "address", + "name": "delegated", + "type": "address" + } + ], + "internalType": "struct ISyloTicketing.User", + "name": "receiver", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "senderSig", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "receiverSig", + "type": "bytes" + } + ], + "name": "redeemMultiReceiver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "main", + "type": "address" + }, + { + "internalType": "address", + "name": "delegated", + "type": "address" + } + ], + "internalType": "struct ISyloTicketing.User", + "name": "sender", + "type": "tuple" + }, + { + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "generationBlock", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "redeemerCommit", + "type": "bytes32" + } + ], + "internalType": "struct ISyloTicketing.MultiReceiverTicket", + "name": "ticket", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "main", + "type": "address" + }, + { + "internalType": "address", + "name": "delegated", + "type": "address" + } + ], + "internalType": "struct ISyloTicketing.User", + "name": "receiver", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "redeemerRand", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "senderSig", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "receiverSig", + "type": "bytes" + } + ], + "name": "requireValidWinningMultiReceiverTicket", + "outputs": [ + { + "internalType": "bytes32", + "name": "ticketHash", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "ticketReceiverHash", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "main", + "type": "address" + }, + { + "internalType": "address", + "name": "delegated", + "type": "address" + } + ], + "internalType": "struct ISyloTicketing.User", + "name": "sender", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "main", + "type": "address" + }, + { + "internalType": "address", + "name": "delegated", + "type": "address" + } + ], + "internalType": "struct ISyloTicketing.User", + "name": "receiver", + "type": "tuple" + }, + { + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "generationBlock", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "redeemerCommit", + "type": "bytes32" + } + ], + "internalType": "struct ISyloTicketing.Ticket", + "name": "ticket", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "redeemerRand", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "senderSig", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "receiverSig", + "type": "bytes" + } + ], + "name": "requireValidWinningTicket", + "outputs": [ + { + "internalType": "bytes32", + "name": "ticketHash", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_unlockDuration", + "type": "uint256" + } + ], + "name": "setUnlockDuration", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unlockDeposits", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unlockDuration", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "usedTickets", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "withdrawTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x4ddfa0a931e5d92a7b37ba275747c2fb753d2dfd84681de938574fc1cc7d1936", + "receipt": { + "to": null, + "from": "0x448c8e9e1816300Dd052e77D2A44c990A2807D15", + "contractAddress": "0x8185e90E424116c67D8429Be71006941679E08bB", + "transactionIndex": 0, + "gasUsed": "2694323", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x50aff69108f52d6c6ca8db81c393b889df25d78bac8f9c02fd63d59f9786ed25", + "transactionHash": "0x4ddfa0a931e5d92a7b37ba275747c2fb753d2dfd84681de938574fc1cc7d1936", + "logs": [], + "blockNumber": 10978380, + "cumulativeGasUsed": "2694323", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "76c1e1f3445d6d518cb33f614f9922c9", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"AccountCannotBeZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ContractNameCannotBeEmpty\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"EscrowAmountCannotBeZero\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InterfaceIdCannotBeZeroBytes\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidReceiverSignature\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidReceiverSigningPermission\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSenderSignature\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSenderSigningPermission\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"MissingFuturepassAccount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoEsrowAndPenalty\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PenaltyAmountCannotBeZero\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RedeemerCommitMismatch\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"}],\"name\":\"RedeemerMustHaveJoinedEpoch\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"TargetContractCannotBeZeroAddress\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"TargetNotSupportInterface\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TicketAlreadyRedeemed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TicketAlreadyUsed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TicketCannotBeFromFutureBlock\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TicketEpochNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TicketNotCreatedInTheEpoch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TicketNotWinning\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TicketReceiverCannotBeZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TicketRedeemerCannotBeZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TicketSenderCannotBeZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TokenCannotBeZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnlockDurationCannotBeZero\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnlockingInProcess\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnlockingNotCompleted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnlockingNotInProcess\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"redeemer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"generationBlock\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"MultiReceiverRedemption\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"redeemer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"generationBlock\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Redemption\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"SenderPenaltyBurnt\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unlockDuration\",\"type\":\"uint256\"}],\"name\":\"UnlockDurationUpdated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"_authorizedAccounts\",\"outputs\":[{\"internalType\":\"contract AuthorizedAccounts\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_directory\",\"outputs\":[{\"internalType\":\"contract Directory\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_epochsManager\",\"outputs\":[{\"internalType\":\"contract EpochsManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_futurepassRegistrar\",\"outputs\":[{\"internalType\":\"contract IFuturePassRegistrar\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_registries\",\"outputs\":[{\"internalType\":\"contract Registries\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_rewardsManager\",\"outputs\":[{\"internalType\":\"contract RewardsManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_stakingManager\",\"outputs\":[{\"internalType\":\"contract StakingManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_token\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"generationBlock\",\"type\":\"uint256\"}],\"name\":\"calculateWinningProbability\",\"outputs\":[{\"internalType\":\"uint128\",\"name\":\"\",\"type\":\"uint128\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"generationBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"rand\",\"type\":\"uint256\"}],\"name\":\"createCommit\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"depositEscrow\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"depositPenalty\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"deposits\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"escrow\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"penalty\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unlockAt\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"main\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"delegated\",\"type\":\"address\"}],\"internalType\":\"struct ISyloTicketing.User\",\"name\":\"sender\",\"type\":\"tuple\"},{\"internalType\":\"address\",\"name\":\"redeemer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"generationBlock\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"redeemerCommit\",\"type\":\"bytes32\"}],\"internalType\":\"struct ISyloTicketing.MultiReceiverTicket\",\"name\":\"ticket\",\"type\":\"tuple\"}],\"name\":\"getMultiReceiverTicketHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"main\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"delegated\",\"type\":\"address\"}],\"internalType\":\"struct ISyloTicketing.User\",\"name\":\"sender\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"main\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"delegated\",\"type\":\"address\"}],\"internalType\":\"struct ISyloTicketing.User\",\"name\":\"receiver\",\"type\":\"tuple\"},{\"internalType\":\"address\",\"name\":\"redeemer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"generationBlock\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"redeemerCommit\",\"type\":\"bytes32\"}],\"internalType\":\"struct ISyloTicketing.Ticket\",\"name\":\"ticket\",\"type\":\"tuple\"}],\"name\":\"getTicketHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"contract Registries\",\"name\":\"registries\",\"type\":\"address\"},{\"internalType\":\"contract StakingManager\",\"name\":\"stakingManager\",\"type\":\"address\"},{\"internalType\":\"contract Directory\",\"name\":\"directory\",\"type\":\"address\"},{\"internalType\":\"contract EpochsManager\",\"name\":\"epochsManager\",\"type\":\"address\"},{\"internalType\":\"contract RewardsManager\",\"name\":\"rewardsManager\",\"type\":\"address\"},{\"internalType\":\"contract AuthorizedAccounts\",\"name\":\"authorizedAccounts\",\"type\":\"address\"},{\"internalType\":\"contract IFuturePassRegistrar\",\"name\":\"futurepassRegistrar\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_unlockDuration\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"senderSig\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"receiverSig\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"generationBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"redeemerRand\",\"type\":\"uint256\"}],\"name\":\"isWinningTicket\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lockDeposits\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"main\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"delegated\",\"type\":\"address\"}],\"internalType\":\"struct ISyloTicketing.User\",\"name\":\"sender\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"main\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"delegated\",\"type\":\"address\"}],\"internalType\":\"struct ISyloTicketing.User\",\"name\":\"receiver\",\"type\":\"tuple\"},{\"internalType\":\"address\",\"name\":\"redeemer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"generationBlock\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"redeemerCommit\",\"type\":\"bytes32\"}],\"internalType\":\"struct ISyloTicketing.Ticket\",\"name\":\"ticket\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"redeemerRand\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"senderSig\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"receiverSig\",\"type\":\"bytes\"}],\"name\":\"redeem\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"main\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"delegated\",\"type\":\"address\"}],\"internalType\":\"struct ISyloTicketing.User\",\"name\":\"sender\",\"type\":\"tuple\"},{\"internalType\":\"address\",\"name\":\"redeemer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"generationBlock\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"redeemerCommit\",\"type\":\"bytes32\"}],\"internalType\":\"struct ISyloTicketing.MultiReceiverTicket\",\"name\":\"ticket\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"redeemerRand\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"main\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"delegated\",\"type\":\"address\"}],\"internalType\":\"struct ISyloTicketing.User\",\"name\":\"receiver\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"senderSig\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"receiverSig\",\"type\":\"bytes\"}],\"name\":\"redeemMultiReceiver\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"main\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"delegated\",\"type\":\"address\"}],\"internalType\":\"struct ISyloTicketing.User\",\"name\":\"sender\",\"type\":\"tuple\"},{\"internalType\":\"address\",\"name\":\"redeemer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"generationBlock\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"redeemerCommit\",\"type\":\"bytes32\"}],\"internalType\":\"struct ISyloTicketing.MultiReceiverTicket\",\"name\":\"ticket\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"main\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"delegated\",\"type\":\"address\"}],\"internalType\":\"struct ISyloTicketing.User\",\"name\":\"receiver\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"redeemerRand\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"senderSig\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"receiverSig\",\"type\":\"bytes\"}],\"name\":\"requireValidWinningMultiReceiverTicket\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"ticketHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"ticketReceiverHash\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"main\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"delegated\",\"type\":\"address\"}],\"internalType\":\"struct ISyloTicketing.User\",\"name\":\"sender\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"main\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"delegated\",\"type\":\"address\"}],\"internalType\":\"struct ISyloTicketing.User\",\"name\":\"receiver\",\"type\":\"tuple\"},{\"internalType\":\"address\",\"name\":\"redeemer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"generationBlock\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"redeemerCommit\",\"type\":\"bytes32\"}],\"internalType\":\"struct ISyloTicketing.Ticket\",\"name\":\"ticket\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"redeemerRand\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"senderSig\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"receiverSig\",\"type\":\"bytes\"}],\"name\":\"requireValidWinningTicket\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"ticketHash\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_unlockDuration\",\"type\":\"uint256\"}],\"name\":\"setUnlockDuration\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unlockDeposits\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unlockDuration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"usedTickets\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"withdrawTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"calculateWinningProbability(uint256,uint256)\":{\"params\":{\"epochId\":\"The epochId of the ticket.\",\"generationBlock\":\"The generationBlock of the ticket.\"}},\"depositEscrow(uint256,address)\":{\"params\":{\"account\":\"The address of the account holding the escrow.\",\"amount\":\"The amount in SOLO to add to the escrow.\"}},\"depositPenalty(uint256,address)\":{\"params\":{\"account\":\"The address of the account holding the penalty.\",\"amount\":\"The amount in SOLO to add to the escrow.\"}},\"getMultiReceiverTicketHash((uint256,(address,address),address,uint256,bytes32))\":{\"returns\":{\"_0\":\"A byte-array representing the hash.\"}},\"getTicketHash((uint256,(address,address),(address,address),address,uint256,bytes32))\":{\"returns\":{\"_0\":\"A byte-array representing the hash.\"}},\"isWinningTicket(bytes,bytes,uint256,uint256,uint256)\":{\"params\":{\"epochId\":\"The epochId of the ticket.\",\"generationBlock\":\"The generationBlock of the ticket.\",\"receiverSig\":\"The signature of the receiver of the ticket.\",\"redeemerRand\":\"The redeemer random value, generated by the Node prior to performing the event relay.\",\"senderSig\":\"The signature of the sender of the ticket.\"},\"returns\":{\"_0\":\"True if a ticket is a winner.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"redeem((uint256,(address,address),(address,address),address,uint256,bytes32),uint256,bytes,bytes)\":{\"params\":{\"receiverSig\":\"The signature of the redeemer of the ticket.\",\"redeemerRand\":\"The redeemer random value, generated by the Node prior to performing the event relay.\",\"senderSig\":\"The signature of the sender of the ticket.\",\"ticket\":\"The ticket issued by the sender.\"}},\"redeemMultiReceiver((uint256,(address,address),address,uint256,bytes32),uint256,(address,address),bytes,bytes)\":{\"params\":{\"receiver\":\"A valid receiver of the the relay.\",\"receiverSig\":\"The signature of the redeemer of the ticket.\",\"redeemerRand\":\"The redeemer random value, generated by the Node prior to performing the event relay.\",\"senderSig\":\"The signature of the sender of the ticket.\",\"ticket\":\"The ticket issued by the sender.\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"requireValidWinningMultiReceiverTicket((uint256,(address,address),address,uint256,bytes32),(address,address),uint256,bytes,bytes)\":{\"params\":{\"receiver\":\"The receiver associated with the ticket.\",\"receiverSig\":\"The signature of the redeemer of the ticket.\",\"redeemerRand\":\"The redeemer random value, generated by the Node prior to performing the event relay.\",\"senderSig\":\"The signature of the sender of the ticket.\",\"ticket\":\"The ticket issued by the sender.\"}},\"requireValidWinningTicket((uint256,(address,address),(address,address),address,uint256,bytes32),uint256,bytes,bytes)\":{\"params\":{\"receiverSig\":\"The signature of the redeemer of the ticket.\",\"redeemerRand\":\"The redeemer random value, generated by the Node prior to performing the event relay.\",\"senderSig\":\"The signature of the sender of the ticket.\",\"ticket\":\"The ticket issued by the sender.\"},\"returns\":{\"ticketHash\":\"The hash of the ticket. Should match the hash generated by `getTicketHash`.\"}},\"setUnlockDuration(uint256)\":{\"params\":{\"_unlockDuration\":\"The unlock duration in blocks.\"}},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"},\"withdrawTo(address)\":{\"params\":{\"account\":\"The address of the account the tokens should be transferred to.\"}}},\"stateVariables\":{\"_epochsManager\":{\"details\":\"The ticketing parameters used when redeeming tickets will be read from this contract.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"_authorizedAccounts()\":{\"notice\":\"Sylo Authorized Accounts.\"},\"_directory()\":{\"notice\":\"Sylo Directory contract \"},\"_epochsManager()\":{\"notice\":\"Sylo Epochs Manager.\"},\"_futurepassRegistrar()\":{\"notice\":\"Futurepass Registrar Pre-compile.\"},\"_registries()\":{\"notice\":\"Sylo Registries contract \"},\"_rewardsManager()\":{\"notice\":\"Rewards Manager contract \"},\"_stakingManager()\":{\"notice\":\"Sylo Staking Manager contract \"},\"_token()\":{\"notice\":\"ERC20 Sylo token contract.\"},\"calculateWinningProbability(uint256,uint256)\":{\"notice\":\"This function calculates the probability of a ticket winning at the block that this function was called. A ticket's winning probability will decay every block since its issuance. The amount of decay will depend on the decay rate parameter of the epoch the ticket was generated in.\"},\"depositEscrow(uint256,address)\":{\"notice\":\"Use this function to deposit funds into the escrow. This will fail if the deposit is currently being unlocked.\"},\"depositPenalty(uint256,address)\":{\"notice\":\"Use this function to deposit funds into the penalty. This will fail if the deposit is currently being unlocked.\"},\"deposits(address)\":{\"notice\":\"Mapping of user deposits \"},\"getMultiReceiverTicketHash((uint256,(address,address),address,uint256,bytes32))\":{\"notice\":\"Returns the hash of a multi receiver ticket. Takes all fields in a ticket as inputs to the hash, as well as a specific receiver.\"},\"getTicketHash((uint256,(address,address),(address,address),address,uint256,bytes32))\":{\"notice\":\"Returns the hash of the ticket. Takes all fields in a ticket as inputs to the hash.\"},\"isWinningTicket(bytes,bytes,uint256,uint256,uint256)\":{\"notice\":\"Use this function to check if a ticket is winning.\"},\"lockDeposits()\":{\"notice\":\"Call this function to cancel any deposit that is in the unlocking process.\"},\"redeem((uint256,(address,address),(address,address),address,uint256,bytes32),uint256,bytes,bytes)\":{\"notice\":\"Nodes should call this function on completing an event delivery. This function will fail if the ticket is invalid or if the ticket is not a winner. Clients should calculate if the ticket is a winner locally, but can also use the public view functions: `requireValidWinningTicket` and `isWinningTicket` to check that a ticket is winning.\"},\"redeemMultiReceiver((uint256,(address,address),address,uint256,bytes32),uint256,(address,address),bytes,bytes)\":{\"notice\":\"Nodes should call this function on completing a one-to-many event delivery. This function will fail if the ticket is invalid or if the ticket is not a winner. Additionally, the specified receiver must have a valid futurepass account associated with it. Clients should calculate if the ticket is a winner locally, but can also use the public view functions: `requireValidWinningMultiReceiverTicket` and `isWinningTicket` to check that a ticket is winning.\"},\"requireValidWinningMultiReceiverTicket((uint256,(address,address),address,uint256,bytes32),(address,address),uint256,bytes,bytes)\":{\"notice\":\"Call this function to check if a multi receiver ticket is valid and is a winning ticket. It will fail if the ticket is invalid or is not a winner. A ticket is invalid if: - The sender, receiver or redeemer addresses are null - The receiver does not have a valid futurepass account - The ticket has already been redeemed. - The secret random value of the redeemer does not match the commit in the ticket. - The signatures are invalid.\"},\"requireValidWinningTicket((uint256,(address,address),(address,address),address,uint256,bytes32),uint256,bytes,bytes)\":{\"notice\":\"Call this function to check if a ticket is valid and is a winning ticket. It will fail if the ticket is invalid or is not a winner. A ticket is invalid if: - The sender or redeemer addresses are null - The ticket has already been redeemed. - The secret random value of the sender does not match the commit in the ticket. - The signatures are invalid.\"},\"setUnlockDuration(uint256)\":{\"notice\":\"Set the unlock duration for deposits. Only callable by the owner.\"},\"supportsInterface(bytes4)\":{\"notice\":\"Returns true if the contract implements the interface defined by `interfaceId` from ERC165.\"},\"unlockDeposits()\":{\"notice\":\"Call this function to begin unlocking deposits. This function will fail if no deposit exists, or if the unlock process has already begun.\"},\"unlockDuration()\":{\"notice\":\"The number of blocks a user must wait after calling \\\"unlock\\\" before they can withdraw their funds.\"},\"usedTickets(bytes32)\":{\"notice\":\"Mapping of ticket hashes, used to check if a ticket has been redeemed \"},\"withdraw()\":{\"notice\":\"Call this function once the unlock duration has elapsed in order to transfer the unlocked tokens to the caller's account.\"},\"withdrawTo(address)\":{\"notice\":\"Call this function once the unlock duration has elapsed in order to transfer the unlocked tokens to the specified account.\"}},\"notice\":\"The SyloTicketing contract manages the Probabilistic Micro-Payment Ticketing system that pays Nodes for providing the Event Relay service.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/payments/SyloTicketing.sol\":\"SyloTicketing\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./OwnableUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership} and {acceptOwnership}.\\n *\\n * This module is used through inheritance. It will make available all functions\\n * from parent (Ownable).\\n */\\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\\n function __Ownable2Step_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable2Step_init_unchained() internal onlyInitializing {\\n }\\n address private _pendingOwner;\\n\\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Returns the address of the pending owner.\\n */\\n function pendingOwner() public view virtual returns (address) {\\n return _pendingOwner;\\n }\\n\\n /**\\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual override onlyOwner {\\n _pendingOwner = newOwner;\\n emit OwnershipTransferStarted(owner(), newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual override {\\n delete _pendingOwner;\\n super._transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev The new owner accepts the ownership transfer.\\n */\\n function acceptOwnership() public virtual {\\n address sender = _msgSender();\\n require(pendingOwner() == sender, \\\"Ownable2Step: caller is not the new owner\\\");\\n _transferOwnership(sender);\\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\":\"0x84efb8889801b0ac817324aff6acc691d07bbee816b671817132911d287a8c63\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n\\n /**\\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\":\"0x4075622496acc77fd6d4de4cc30a8577a744d5c75afad33fdeacf1704d6eda98\",\"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/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/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/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\",\"keccak256\":\"0xa56ca923f70c1748830700250b19c61b70db9a683516dc5e216694a50445d99c\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.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 IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xec63854014a5b4f2b3290ab9103a21bdf902a508d0f41a8573fea49e98bf571a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.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 \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n /**\\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.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(IERC20 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(IERC20 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(IERC20 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(IERC20 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(IERC20 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 IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n 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(IERC20 token, bytes memory data) private returns (bool) {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\\n // and not revert is the subcall reverts.\\n\\n (bool success, bytes memory returndata) = address(token).call(data);\\n return\\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\\n }\\n}\\n\",\"keccak256\":\"0x909d608c2db6eb165ca178c81289a07ed2e118e444d0025b2a85c97d0b44a4fa\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"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/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\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.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/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\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 = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _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(SignedMath.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n 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\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.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 \\\"../Strings.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 ECDSA {\\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\\\", Strings.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\":\"0x809bc3edb4bcbef8263fa616c1b60ee0004b50a8a1bfa164d8f57fd31f520c58\",\"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/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\"},\"@openzeppelin/contracts/utils/math/Math.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 Math {\\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\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)\\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\\n * checks.\\n *\\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\\n * easily result in undesired exploitation or bugs, since developers usually\\n * assume that overflows raise errors. `SafeCast` restores this intuition by\\n * reverting the transaction when such an operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n *\\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\\n * all math on `uint256` and `int256` and then downcasting.\\n */\\nlibrary SafeCast {\\n /**\\n * @dev Returns the downcasted uint248 from uint256, reverting on\\n * overflow (when the input is greater than largest uint248).\\n *\\n * Counterpart to Solidity's `uint248` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 248 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint248(uint256 value) internal pure returns (uint248) {\\n require(value <= type(uint248).max, \\\"SafeCast: value doesn't fit in 248 bits\\\");\\n return uint248(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint240 from uint256, reverting on\\n * overflow (when the input is greater than largest uint240).\\n *\\n * Counterpart to Solidity's `uint240` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 240 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint240(uint256 value) internal pure returns (uint240) {\\n require(value <= type(uint240).max, \\\"SafeCast: value doesn't fit in 240 bits\\\");\\n return uint240(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint232 from uint256, reverting on\\n * overflow (when the input is greater than largest uint232).\\n *\\n * Counterpart to Solidity's `uint232` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 232 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint232(uint256 value) internal pure returns (uint232) {\\n require(value <= type(uint232).max, \\\"SafeCast: value doesn't fit in 232 bits\\\");\\n return uint232(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint224 from uint256, reverting on\\n * overflow (when the input is greater than largest uint224).\\n *\\n * Counterpart to Solidity's `uint224` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 224 bits\\n *\\n * _Available since v4.2._\\n */\\n function toUint224(uint256 value) internal pure returns (uint224) {\\n require(value <= type(uint224).max, \\\"SafeCast: value doesn't fit in 224 bits\\\");\\n return uint224(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint216 from uint256, reverting on\\n * overflow (when the input is greater than largest uint216).\\n *\\n * Counterpart to Solidity's `uint216` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 216 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint216(uint256 value) internal pure returns (uint216) {\\n require(value <= type(uint216).max, \\\"SafeCast: value doesn't fit in 216 bits\\\");\\n return uint216(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint208 from uint256, reverting on\\n * overflow (when the input is greater than largest uint208).\\n *\\n * Counterpart to Solidity's `uint208` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 208 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint208(uint256 value) internal pure returns (uint208) {\\n require(value <= type(uint208).max, \\\"SafeCast: value doesn't fit in 208 bits\\\");\\n return uint208(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint200 from uint256, reverting on\\n * overflow (when the input is greater than largest uint200).\\n *\\n * Counterpart to Solidity's `uint200` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 200 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint200(uint256 value) internal pure returns (uint200) {\\n require(value <= type(uint200).max, \\\"SafeCast: value doesn't fit in 200 bits\\\");\\n return uint200(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint192 from uint256, reverting on\\n * overflow (when the input is greater than largest uint192).\\n *\\n * Counterpart to Solidity's `uint192` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 192 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint192(uint256 value) internal pure returns (uint192) {\\n require(value <= type(uint192).max, \\\"SafeCast: value doesn't fit in 192 bits\\\");\\n return uint192(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint184 from uint256, reverting on\\n * overflow (when the input is greater than largest uint184).\\n *\\n * Counterpart to Solidity's `uint184` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 184 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint184(uint256 value) internal pure returns (uint184) {\\n require(value <= type(uint184).max, \\\"SafeCast: value doesn't fit in 184 bits\\\");\\n return uint184(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint176 from uint256, reverting on\\n * overflow (when the input is greater than largest uint176).\\n *\\n * Counterpart to Solidity's `uint176` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 176 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint176(uint256 value) internal pure returns (uint176) {\\n require(value <= type(uint176).max, \\\"SafeCast: value doesn't fit in 176 bits\\\");\\n return uint176(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint168 from uint256, reverting on\\n * overflow (when the input is greater than largest uint168).\\n *\\n * Counterpart to Solidity's `uint168` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 168 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint168(uint256 value) internal pure returns (uint168) {\\n require(value <= type(uint168).max, \\\"SafeCast: value doesn't fit in 168 bits\\\");\\n return uint168(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint160 from uint256, reverting on\\n * overflow (when the input is greater than largest uint160).\\n *\\n * Counterpart to Solidity's `uint160` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 160 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint160(uint256 value) internal pure returns (uint160) {\\n require(value <= type(uint160).max, \\\"SafeCast: value doesn't fit in 160 bits\\\");\\n return uint160(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint152 from uint256, reverting on\\n * overflow (when the input is greater than largest uint152).\\n *\\n * Counterpart to Solidity's `uint152` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 152 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint152(uint256 value) internal pure returns (uint152) {\\n require(value <= type(uint152).max, \\\"SafeCast: value doesn't fit in 152 bits\\\");\\n return uint152(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint144 from uint256, reverting on\\n * overflow (when the input is greater than largest uint144).\\n *\\n * Counterpart to Solidity's `uint144` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 144 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint144(uint256 value) internal pure returns (uint144) {\\n require(value <= type(uint144).max, \\\"SafeCast: value doesn't fit in 144 bits\\\");\\n return uint144(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint136 from uint256, reverting on\\n * overflow (when the input is greater than largest uint136).\\n *\\n * Counterpart to Solidity's `uint136` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 136 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint136(uint256 value) internal pure returns (uint136) {\\n require(value <= type(uint136).max, \\\"SafeCast: value doesn't fit in 136 bits\\\");\\n return uint136(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint128 from uint256, reverting on\\n * overflow (when the input is greater than largest uint128).\\n *\\n * Counterpart to Solidity's `uint128` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 128 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint128(uint256 value) internal pure returns (uint128) {\\n require(value <= type(uint128).max, \\\"SafeCast: value doesn't fit in 128 bits\\\");\\n return uint128(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint120 from uint256, reverting on\\n * overflow (when the input is greater than largest uint120).\\n *\\n * Counterpart to Solidity's `uint120` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 120 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint120(uint256 value) internal pure returns (uint120) {\\n require(value <= type(uint120).max, \\\"SafeCast: value doesn't fit in 120 bits\\\");\\n return uint120(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint112 from uint256, reverting on\\n * overflow (when the input is greater than largest uint112).\\n *\\n * Counterpart to Solidity's `uint112` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 112 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint112(uint256 value) internal pure returns (uint112) {\\n require(value <= type(uint112).max, \\\"SafeCast: value doesn't fit in 112 bits\\\");\\n return uint112(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint104 from uint256, reverting on\\n * overflow (when the input is greater than largest uint104).\\n *\\n * Counterpart to Solidity's `uint104` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 104 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint104(uint256 value) internal pure returns (uint104) {\\n require(value <= type(uint104).max, \\\"SafeCast: value doesn't fit in 104 bits\\\");\\n return uint104(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint96 from uint256, reverting on\\n * overflow (when the input is greater than largest uint96).\\n *\\n * Counterpart to Solidity's `uint96` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 96 bits\\n *\\n * _Available since v4.2._\\n */\\n function toUint96(uint256 value) internal pure returns (uint96) {\\n require(value <= type(uint96).max, \\\"SafeCast: value doesn't fit in 96 bits\\\");\\n return uint96(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint88 from uint256, reverting on\\n * overflow (when the input is greater than largest uint88).\\n *\\n * Counterpart to Solidity's `uint88` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 88 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint88(uint256 value) internal pure returns (uint88) {\\n require(value <= type(uint88).max, \\\"SafeCast: value doesn't fit in 88 bits\\\");\\n return uint88(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint80 from uint256, reverting on\\n * overflow (when the input is greater than largest uint80).\\n *\\n * Counterpart to Solidity's `uint80` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 80 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint80(uint256 value) internal pure returns (uint80) {\\n require(value <= type(uint80).max, \\\"SafeCast: value doesn't fit in 80 bits\\\");\\n return uint80(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint72 from uint256, reverting on\\n * overflow (when the input is greater than largest uint72).\\n *\\n * Counterpart to Solidity's `uint72` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 72 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint72(uint256 value) internal pure returns (uint72) {\\n require(value <= type(uint72).max, \\\"SafeCast: value doesn't fit in 72 bits\\\");\\n return uint72(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint64 from uint256, reverting on\\n * overflow (when the input is greater than largest uint64).\\n *\\n * Counterpart to Solidity's `uint64` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 64 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint64(uint256 value) internal pure returns (uint64) {\\n require(value <= type(uint64).max, \\\"SafeCast: value doesn't fit in 64 bits\\\");\\n return uint64(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint56 from uint256, reverting on\\n * overflow (when the input is greater than largest uint56).\\n *\\n * Counterpart to Solidity's `uint56` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 56 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint56(uint256 value) internal pure returns (uint56) {\\n require(value <= type(uint56).max, \\\"SafeCast: value doesn't fit in 56 bits\\\");\\n return uint56(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint48 from uint256, reverting on\\n * overflow (when the input is greater than largest uint48).\\n *\\n * Counterpart to Solidity's `uint48` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 48 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint48(uint256 value) internal pure returns (uint48) {\\n require(value <= type(uint48).max, \\\"SafeCast: value doesn't fit in 48 bits\\\");\\n return uint48(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint40 from uint256, reverting on\\n * overflow (when the input is greater than largest uint40).\\n *\\n * Counterpart to Solidity's `uint40` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 40 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint40(uint256 value) internal pure returns (uint40) {\\n require(value <= type(uint40).max, \\\"SafeCast: value doesn't fit in 40 bits\\\");\\n return uint40(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint32 from uint256, reverting on\\n * overflow (when the input is greater than largest uint32).\\n *\\n * Counterpart to Solidity's `uint32` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 32 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint32(uint256 value) internal pure returns (uint32) {\\n require(value <= type(uint32).max, \\\"SafeCast: value doesn't fit in 32 bits\\\");\\n return uint32(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint24 from uint256, reverting on\\n * overflow (when the input is greater than largest uint24).\\n *\\n * Counterpart to Solidity's `uint24` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 24 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint24(uint256 value) internal pure returns (uint24) {\\n require(value <= type(uint24).max, \\\"SafeCast: value doesn't fit in 24 bits\\\");\\n return uint24(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint16 from uint256, reverting on\\n * overflow (when the input is greater than largest uint16).\\n *\\n * Counterpart to Solidity's `uint16` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 16 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint16(uint256 value) internal pure returns (uint16) {\\n require(value <= type(uint16).max, \\\"SafeCast: value doesn't fit in 16 bits\\\");\\n return uint16(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint8 from uint256, reverting on\\n * overflow (when the input is greater than largest uint8).\\n *\\n * Counterpart to Solidity's `uint8` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 8 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint8(uint256 value) internal pure returns (uint8) {\\n require(value <= type(uint8).max, \\\"SafeCast: value doesn't fit in 8 bits\\\");\\n return uint8(value);\\n }\\n\\n /**\\n * @dev Converts a signed int256 into an unsigned uint256.\\n *\\n * Requirements:\\n *\\n * - input must be greater than or equal to 0.\\n *\\n * _Available since v3.0._\\n */\\n function toUint256(int256 value) internal pure returns (uint256) {\\n require(value >= 0, \\\"SafeCast: value must be positive\\\");\\n return uint256(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int248 from int256, reverting on\\n * overflow (when the input is less than smallest int248 or\\n * greater than largest int248).\\n *\\n * Counterpart to Solidity's `int248` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 248 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\\n downcasted = int248(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 248 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int240 from int256, reverting on\\n * overflow (when the input is less than smallest int240 or\\n * greater than largest int240).\\n *\\n * Counterpart to Solidity's `int240` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 240 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\\n downcasted = int240(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 240 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int232 from int256, reverting on\\n * overflow (when the input is less than smallest int232 or\\n * greater than largest int232).\\n *\\n * Counterpart to Solidity's `int232` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 232 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\\n downcasted = int232(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 232 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int224 from int256, reverting on\\n * overflow (when the input is less than smallest int224 or\\n * greater than largest int224).\\n *\\n * Counterpart to Solidity's `int224` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 224 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\\n downcasted = int224(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 224 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int216 from int256, reverting on\\n * overflow (when the input is less than smallest int216 or\\n * greater than largest int216).\\n *\\n * Counterpart to Solidity's `int216` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 216 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\\n downcasted = int216(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 216 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int208 from int256, reverting on\\n * overflow (when the input is less than smallest int208 or\\n * greater than largest int208).\\n *\\n * Counterpart to Solidity's `int208` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 208 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\\n downcasted = int208(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 208 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int200 from int256, reverting on\\n * overflow (when the input is less than smallest int200 or\\n * greater than largest int200).\\n *\\n * Counterpart to Solidity's `int200` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 200 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\\n downcasted = int200(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 200 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int192 from int256, reverting on\\n * overflow (when the input is less than smallest int192 or\\n * greater than largest int192).\\n *\\n * Counterpart to Solidity's `int192` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 192 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\\n downcasted = int192(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 192 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int184 from int256, reverting on\\n * overflow (when the input is less than smallest int184 or\\n * greater than largest int184).\\n *\\n * Counterpart to Solidity's `int184` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 184 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\\n downcasted = int184(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 184 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int176 from int256, reverting on\\n * overflow (when the input is less than smallest int176 or\\n * greater than largest int176).\\n *\\n * Counterpart to Solidity's `int176` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 176 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\\n downcasted = int176(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 176 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int168 from int256, reverting on\\n * overflow (when the input is less than smallest int168 or\\n * greater than largest int168).\\n *\\n * Counterpart to Solidity's `int168` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 168 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\\n downcasted = int168(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 168 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int160 from int256, reverting on\\n * overflow (when the input is less than smallest int160 or\\n * greater than largest int160).\\n *\\n * Counterpart to Solidity's `int160` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 160 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\\n downcasted = int160(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 160 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int152 from int256, reverting on\\n * overflow (when the input is less than smallest int152 or\\n * greater than largest int152).\\n *\\n * Counterpart to Solidity's `int152` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 152 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\\n downcasted = int152(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 152 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int144 from int256, reverting on\\n * overflow (when the input is less than smallest int144 or\\n * greater than largest int144).\\n *\\n * Counterpart to Solidity's `int144` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 144 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\\n downcasted = int144(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 144 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int136 from int256, reverting on\\n * overflow (when the input is less than smallest int136 or\\n * greater than largest int136).\\n *\\n * Counterpart to Solidity's `int136` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 136 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\\n downcasted = int136(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 136 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int128 from int256, reverting on\\n * overflow (when the input is less than smallest int128 or\\n * greater than largest int128).\\n *\\n * Counterpart to Solidity's `int128` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 128 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\\n downcasted = int128(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 128 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int120 from int256, reverting on\\n * overflow (when the input is less than smallest int120 or\\n * greater than largest int120).\\n *\\n * Counterpart to Solidity's `int120` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 120 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\\n downcasted = int120(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 120 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int112 from int256, reverting on\\n * overflow (when the input is less than smallest int112 or\\n * greater than largest int112).\\n *\\n * Counterpart to Solidity's `int112` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 112 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\\n downcasted = int112(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 112 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int104 from int256, reverting on\\n * overflow (when the input is less than smallest int104 or\\n * greater than largest int104).\\n *\\n * Counterpart to Solidity's `int104` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 104 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\\n downcasted = int104(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 104 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int96 from int256, reverting on\\n * overflow (when the input is less than smallest int96 or\\n * greater than largest int96).\\n *\\n * Counterpart to Solidity's `int96` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 96 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\\n downcasted = int96(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 96 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int88 from int256, reverting on\\n * overflow (when the input is less than smallest int88 or\\n * greater than largest int88).\\n *\\n * Counterpart to Solidity's `int88` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 88 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\\n downcasted = int88(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 88 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int80 from int256, reverting on\\n * overflow (when the input is less than smallest int80 or\\n * greater than largest int80).\\n *\\n * Counterpart to Solidity's `int80` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 80 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\\n downcasted = int80(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 80 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int72 from int256, reverting on\\n * overflow (when the input is less than smallest int72 or\\n * greater than largest int72).\\n *\\n * Counterpart to Solidity's `int72` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 72 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\\n downcasted = int72(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 72 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int64 from int256, reverting on\\n * overflow (when the input is less than smallest int64 or\\n * greater than largest int64).\\n *\\n * Counterpart to Solidity's `int64` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 64 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\\n downcasted = int64(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 64 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int56 from int256, reverting on\\n * overflow (when the input is less than smallest int56 or\\n * greater than largest int56).\\n *\\n * Counterpart to Solidity's `int56` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 56 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\\n downcasted = int56(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 56 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int48 from int256, reverting on\\n * overflow (when the input is less than smallest int48 or\\n * greater than largest int48).\\n *\\n * Counterpart to Solidity's `int48` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 48 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\\n downcasted = int48(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 48 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int40 from int256, reverting on\\n * overflow (when the input is less than smallest int40 or\\n * greater than largest int40).\\n *\\n * Counterpart to Solidity's `int40` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 40 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\\n downcasted = int40(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 40 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int32 from int256, reverting on\\n * overflow (when the input is less than smallest int32 or\\n * greater than largest int32).\\n *\\n * Counterpart to Solidity's `int32` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 32 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\\n downcasted = int32(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 32 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int24 from int256, reverting on\\n * overflow (when the input is less than smallest int24 or\\n * greater than largest int24).\\n *\\n * Counterpart to Solidity's `int24` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 24 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\\n downcasted = int24(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 24 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int16 from int256, reverting on\\n * overflow (when the input is less than smallest int16 or\\n * greater than largest int16).\\n *\\n * Counterpart to Solidity's `int16` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 16 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\\n downcasted = int16(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 16 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int8 from int256, reverting on\\n * overflow (when the input is less than smallest int8 or\\n * greater than largest int8).\\n *\\n * Counterpart to Solidity's `int8` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 8 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\\n downcasted = int8(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 8 bits\\\");\\n }\\n\\n /**\\n * @dev Converts an unsigned uint256 into a signed int256.\\n *\\n * Requirements:\\n *\\n * - input must be less than or equal to maxInt256.\\n *\\n * _Available since v3.0._\\n */\\n function toInt256(uint256 value) internal pure returns (int256) {\\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\\n require(value <= uint256(type(int256).max), \\\"SafeCast: value doesn't fit in an int256\\\");\\n return int256(value);\\n }\\n}\\n\",\"keccak256\":\"0x52a8cfb0f5239d11b457dcdd1b326992ef672714ca8da71a157255bddd13f3ad\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.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 SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"abdk-libraries-solidity/ABDKMath64x64.sol\":{\"content\":\"// SPDX-License-Identifier: BSD-4-Clause\\n/*\\n * ABDK Math 64.64 Smart Contract Library. Copyright \\u00a9 2019 by ABDK Consulting.\\n * Author: Mikhail Vladimirov \\n */\\npragma solidity ^0.8.0;\\n\\n/**\\n * Smart contract library of mathematical functions operating with signed\\n * 64.64-bit fixed point numbers. Signed 64.64-bit fixed point number is\\n * basically a simple fraction whose numerator is signed 128-bit integer and\\n * denominator is 2^64. As long as denominator is always the same, there is no\\n * need to store it, thus in Solidity signed 64.64-bit fixed point numbers are\\n * represented by int128 type holding only the numerator.\\n */\\nlibrary ABDKMath64x64 {\\n /*\\n * Minimum value signed 64.64-bit fixed point number may have. \\n */\\n int128 private constant MIN_64x64 = -0x80000000000000000000000000000000;\\n\\n /*\\n * Maximum value signed 64.64-bit fixed point number may have. \\n */\\n int128 private constant MAX_64x64 = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;\\n\\n /**\\n * Convert signed 256-bit integer number into signed 64.64-bit fixed point\\n * number. Revert on overflow.\\n *\\n * @param x signed 256-bit integer number\\n * @return signed 64.64-bit fixed point number\\n */\\n function fromInt (int256 x) internal pure returns (int128) {\\n unchecked {\\n require (x >= -0x8000000000000000 && x <= 0x7FFFFFFFFFFFFFFF);\\n return int128 (x << 64);\\n }\\n }\\n\\n /**\\n * Convert signed 64.64 fixed point number into signed 64-bit integer number\\n * rounding down.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64-bit integer number\\n */\\n function toInt (int128 x) internal pure returns (int64) {\\n unchecked {\\n return int64 (x >> 64);\\n }\\n }\\n\\n /**\\n * Convert unsigned 256-bit integer number into signed 64.64-bit fixed point\\n * number. Revert on overflow.\\n *\\n * @param x unsigned 256-bit integer number\\n * @return signed 64.64-bit fixed point number\\n */\\n function fromUInt (uint256 x) internal pure returns (int128) {\\n unchecked {\\n require (x <= 0x7FFFFFFFFFFFFFFF);\\n return int128 (int256 (x << 64));\\n }\\n }\\n\\n /**\\n * Convert signed 64.64 fixed point number into unsigned 64-bit integer\\n * number rounding down. Revert on underflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return unsigned 64-bit integer number\\n */\\n function toUInt (int128 x) internal pure returns (uint64) {\\n unchecked {\\n require (x >= 0);\\n return uint64 (uint128 (x >> 64));\\n }\\n }\\n\\n /**\\n * Convert signed 128.128 fixed point number into signed 64.64-bit fixed point\\n * number rounding down. Revert on overflow.\\n *\\n * @param x signed 128.128-bin fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function from128x128 (int256 x) internal pure returns (int128) {\\n unchecked {\\n int256 result = x >> 64;\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Convert signed 64.64 fixed point number into signed 128.128 fixed point\\n * number.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 128.128 fixed point number\\n */\\n function to128x128 (int128 x) internal pure returns (int256) {\\n unchecked {\\n return int256 (x) << 64;\\n }\\n }\\n\\n /**\\n * Calculate x + y. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function add (int128 x, int128 y) internal pure returns (int128) {\\n unchecked {\\n int256 result = int256(x) + y;\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate x - y. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function sub (int128 x, int128 y) internal pure returns (int128) {\\n unchecked {\\n int256 result = int256(x) - y;\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate x * y rounding down. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function mul (int128 x, int128 y) internal pure returns (int128) {\\n unchecked {\\n int256 result = int256(x) * y >> 64;\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate x * y rounding towards zero, where x is signed 64.64 fixed point\\n * number and y is signed 256-bit integer number. Revert on overflow.\\n *\\n * @param x signed 64.64 fixed point number\\n * @param y signed 256-bit integer number\\n * @return signed 256-bit integer number\\n */\\n function muli (int128 x, int256 y) internal pure returns (int256) {\\n unchecked {\\n if (x == MIN_64x64) {\\n require (y >= -0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF &&\\n y <= 0x1000000000000000000000000000000000000000000000000);\\n return -y << 63;\\n } else {\\n bool negativeResult = false;\\n if (x < 0) {\\n x = -x;\\n negativeResult = true;\\n }\\n if (y < 0) {\\n y = -y; // We rely on overflow behavior here\\n negativeResult = !negativeResult;\\n }\\n uint256 absoluteResult = mulu (x, uint256 (y));\\n if (negativeResult) {\\n require (absoluteResult <=\\n 0x8000000000000000000000000000000000000000000000000000000000000000);\\n return -int256 (absoluteResult); // We rely on overflow behavior here\\n } else {\\n require (absoluteResult <=\\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\\n return int256 (absoluteResult);\\n }\\n }\\n }\\n }\\n\\n /**\\n * Calculate x * y rounding down, where x is signed 64.64 fixed point number\\n * and y is unsigned 256-bit integer number. Revert on overflow.\\n *\\n * @param x signed 64.64 fixed point number\\n * @param y unsigned 256-bit integer number\\n * @return unsigned 256-bit integer number\\n */\\n function mulu (int128 x, uint256 y) internal pure returns (uint256) {\\n unchecked {\\n if (y == 0) return 0;\\n\\n require (x >= 0);\\n\\n uint256 lo = (uint256 (int256 (x)) * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) >> 64;\\n uint256 hi = uint256 (int256 (x)) * (y >> 128);\\n\\n require (hi <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\\n hi <<= 64;\\n\\n require (hi <=\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - lo);\\n return hi + lo;\\n }\\n }\\n\\n /**\\n * Calculate x / y rounding towards zero. Revert on overflow or when y is\\n * zero.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function div (int128 x, int128 y) internal pure returns (int128) {\\n unchecked {\\n require (y != 0);\\n int256 result = (int256 (x) << 64) / y;\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate x / y rounding towards zero, where x and y are signed 256-bit\\n * integer numbers. Revert on overflow or when y is zero.\\n *\\n * @param x signed 256-bit integer number\\n * @param y signed 256-bit integer number\\n * @return signed 64.64-bit fixed point number\\n */\\n function divi (int256 x, int256 y) internal pure returns (int128) {\\n unchecked {\\n require (y != 0);\\n\\n bool negativeResult = false;\\n if (x < 0) {\\n x = -x; // We rely on overflow behavior here\\n negativeResult = true;\\n }\\n if (y < 0) {\\n y = -y; // We rely on overflow behavior here\\n negativeResult = !negativeResult;\\n }\\n uint128 absoluteResult = divuu (uint256 (x), uint256 (y));\\n if (negativeResult) {\\n require (absoluteResult <= 0x80000000000000000000000000000000);\\n return -int128 (absoluteResult); // We rely on overflow behavior here\\n } else {\\n require (absoluteResult <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\\n return int128 (absoluteResult); // We rely on overflow behavior here\\n }\\n }\\n }\\n\\n /**\\n * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit\\n * integer numbers. Revert on overflow or when y is zero.\\n *\\n * @param x unsigned 256-bit integer number\\n * @param y unsigned 256-bit integer number\\n * @return signed 64.64-bit fixed point number\\n */\\n function divu (uint256 x, uint256 y) internal pure returns (int128) {\\n unchecked {\\n require (y != 0);\\n uint128 result = divuu (x, y);\\n require (result <= uint128 (MAX_64x64));\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate -x. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function neg (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x != MIN_64x64);\\n return -x;\\n }\\n }\\n\\n /**\\n * Calculate |x|. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function abs (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x != MIN_64x64);\\n return x < 0 ? -x : x;\\n }\\n }\\n\\n /**\\n * Calculate 1 / x rounding towards zero. Revert on overflow or when x is\\n * zero.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function inv (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x != 0);\\n int256 result = int256 (0x100000000000000000000000000000000) / x;\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate arithmetics average of x and y, i.e. (x + y) / 2 rounding down.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function avg (int128 x, int128 y) internal pure returns (int128) {\\n unchecked {\\n return int128 ((int256 (x) + int256 (y)) >> 1);\\n }\\n }\\n\\n /**\\n * Calculate geometric average of x and y, i.e. sqrt (x * y) rounding down.\\n * Revert on overflow or in case x * y is negative.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function gavg (int128 x, int128 y) internal pure returns (int128) {\\n unchecked {\\n int256 m = int256 (x) * int256 (y);\\n require (m >= 0);\\n require (m <\\n 0x4000000000000000000000000000000000000000000000000000000000000000);\\n return int128 (sqrtu (uint256 (m)));\\n }\\n }\\n\\n /**\\n * Calculate x^y assuming 0^0 is 1, where x is signed 64.64 fixed point number\\n * and y is unsigned 256-bit integer number. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @param y uint256 value\\n * @return signed 64.64-bit fixed point number\\n */\\n function pow (int128 x, uint256 y) internal pure returns (int128) {\\n unchecked {\\n bool negative = x < 0 && y & 1 == 1;\\n\\n uint256 absX = uint128 (x < 0 ? -x : x);\\n uint256 absResult;\\n absResult = 0x100000000000000000000000000000000;\\n\\n if (absX <= 0x10000000000000000) {\\n absX <<= 63;\\n while (y != 0) {\\n if (y & 0x1 != 0) {\\n absResult = absResult * absX >> 127;\\n }\\n absX = absX * absX >> 127;\\n\\n if (y & 0x2 != 0) {\\n absResult = absResult * absX >> 127;\\n }\\n absX = absX * absX >> 127;\\n\\n if (y & 0x4 != 0) {\\n absResult = absResult * absX >> 127;\\n }\\n absX = absX * absX >> 127;\\n\\n if (y & 0x8 != 0) {\\n absResult = absResult * absX >> 127;\\n }\\n absX = absX * absX >> 127;\\n\\n y >>= 4;\\n }\\n\\n absResult >>= 64;\\n } else {\\n uint256 absXShift = 63;\\n if (absX < 0x1000000000000000000000000) { absX <<= 32; absXShift -= 32; }\\n if (absX < 0x10000000000000000000000000000) { absX <<= 16; absXShift -= 16; }\\n if (absX < 0x1000000000000000000000000000000) { absX <<= 8; absXShift -= 8; }\\n if (absX < 0x10000000000000000000000000000000) { absX <<= 4; absXShift -= 4; }\\n if (absX < 0x40000000000000000000000000000000) { absX <<= 2; absXShift -= 2; }\\n if (absX < 0x80000000000000000000000000000000) { absX <<= 1; absXShift -= 1; }\\n\\n uint256 resultShift = 0;\\n while (y != 0) {\\n require (absXShift < 64);\\n\\n if (y & 0x1 != 0) {\\n absResult = absResult * absX >> 127;\\n resultShift += absXShift;\\n if (absResult > 0x100000000000000000000000000000000) {\\n absResult >>= 1;\\n resultShift += 1;\\n }\\n }\\n absX = absX * absX >> 127;\\n absXShift <<= 1;\\n if (absX >= 0x100000000000000000000000000000000) {\\n absX >>= 1;\\n absXShift += 1;\\n }\\n\\n y >>= 1;\\n }\\n\\n require (resultShift < 64);\\n absResult >>= 64 - resultShift;\\n }\\n int256 result = negative ? -int256 (absResult) : int256 (absResult);\\n require (result >= MIN_64x64 && result <= MAX_64x64);\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate sqrt (x) rounding down. Revert if x < 0.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function sqrt (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x >= 0);\\n return int128 (sqrtu (uint256 (int256 (x)) << 64));\\n }\\n }\\n\\n /**\\n * Calculate binary logarithm of x. Revert if x <= 0.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function log_2 (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x > 0);\\n\\n int256 msb = 0;\\n int256 xc = x;\\n if (xc >= 0x10000000000000000) { xc >>= 64; msb += 64; }\\n if (xc >= 0x100000000) { xc >>= 32; msb += 32; }\\n if (xc >= 0x10000) { xc >>= 16; msb += 16; }\\n if (xc >= 0x100) { xc >>= 8; msb += 8; }\\n if (xc >= 0x10) { xc >>= 4; msb += 4; }\\n if (xc >= 0x4) { xc >>= 2; msb += 2; }\\n if (xc >= 0x2) msb += 1; // No need to shift xc anymore\\n\\n int256 result = msb - 64 << 64;\\n uint256 ux = uint256 (int256 (x)) << uint256 (127 - msb);\\n for (int256 bit = 0x8000000000000000; bit > 0; bit >>= 1) {\\n ux *= ux;\\n uint256 b = ux >> 255;\\n ux >>= 127 + b;\\n result += bit * int256 (b);\\n }\\n\\n return int128 (result);\\n }\\n }\\n\\n /**\\n * Calculate natural logarithm of x. Revert if x <= 0.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function ln (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x > 0);\\n\\n return int128 (int256 (\\n uint256 (int256 (log_2 (x))) * 0xB17217F7D1CF79ABC9E3B39803F2F6AF >> 128));\\n }\\n }\\n\\n /**\\n * Calculate binary exponent of x. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function exp_2 (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x < 0x400000000000000000); // Overflow\\n\\n if (x < -0x400000000000000000) return 0; // Underflow\\n\\n uint256 result = 0x80000000000000000000000000000000;\\n\\n if (x & 0x8000000000000000 > 0)\\n result = result * 0x16A09E667F3BCC908B2FB1366EA957D3E >> 128;\\n if (x & 0x4000000000000000 > 0)\\n result = result * 0x1306FE0A31B7152DE8D5A46305C85EDEC >> 128;\\n if (x & 0x2000000000000000 > 0)\\n result = result * 0x1172B83C7D517ADCDF7C8C50EB14A791F >> 128;\\n if (x & 0x1000000000000000 > 0)\\n result = result * 0x10B5586CF9890F6298B92B71842A98363 >> 128;\\n if (x & 0x800000000000000 > 0)\\n result = result * 0x1059B0D31585743AE7C548EB68CA417FD >> 128;\\n if (x & 0x400000000000000 > 0)\\n result = result * 0x102C9A3E778060EE6F7CACA4F7A29BDE8 >> 128;\\n if (x & 0x200000000000000 > 0)\\n result = result * 0x10163DA9FB33356D84A66AE336DCDFA3F >> 128;\\n if (x & 0x100000000000000 > 0)\\n result = result * 0x100B1AFA5ABCBED6129AB13EC11DC9543 >> 128;\\n if (x & 0x80000000000000 > 0)\\n result = result * 0x10058C86DA1C09EA1FF19D294CF2F679B >> 128;\\n if (x & 0x40000000000000 > 0)\\n result = result * 0x1002C605E2E8CEC506D21BFC89A23A00F >> 128;\\n if (x & 0x20000000000000 > 0)\\n result = result * 0x100162F3904051FA128BCA9C55C31E5DF >> 128;\\n if (x & 0x10000000000000 > 0)\\n result = result * 0x1000B175EFFDC76BA38E31671CA939725 >> 128;\\n if (x & 0x8000000000000 > 0)\\n result = result * 0x100058BA01FB9F96D6CACD4B180917C3D >> 128;\\n if (x & 0x4000000000000 > 0)\\n result = result * 0x10002C5CC37DA9491D0985C348C68E7B3 >> 128;\\n if (x & 0x2000000000000 > 0)\\n result = result * 0x1000162E525EE054754457D5995292026 >> 128;\\n if (x & 0x1000000000000 > 0)\\n result = result * 0x10000B17255775C040618BF4A4ADE83FC >> 128;\\n if (x & 0x800000000000 > 0)\\n result = result * 0x1000058B91B5BC9AE2EED81E9B7D4CFAB >> 128;\\n if (x & 0x400000000000 > 0)\\n result = result * 0x100002C5C89D5EC6CA4D7C8ACC017B7C9 >> 128;\\n if (x & 0x200000000000 > 0)\\n result = result * 0x10000162E43F4F831060E02D839A9D16D >> 128;\\n if (x & 0x100000000000 > 0)\\n result = result * 0x100000B1721BCFC99D9F890EA06911763 >> 128;\\n if (x & 0x80000000000 > 0)\\n result = result * 0x10000058B90CF1E6D97F9CA14DBCC1628 >> 128;\\n if (x & 0x40000000000 > 0)\\n result = result * 0x1000002C5C863B73F016468F6BAC5CA2B >> 128;\\n if (x & 0x20000000000 > 0)\\n result = result * 0x100000162E430E5A18F6119E3C02282A5 >> 128;\\n if (x & 0x10000000000 > 0)\\n result = result * 0x1000000B1721835514B86E6D96EFD1BFE >> 128;\\n if (x & 0x8000000000 > 0)\\n result = result * 0x100000058B90C0B48C6BE5DF846C5B2EF >> 128;\\n if (x & 0x4000000000 > 0)\\n result = result * 0x10000002C5C8601CC6B9E94213C72737A >> 128;\\n if (x & 0x2000000000 > 0)\\n result = result * 0x1000000162E42FFF037DF38AA2B219F06 >> 128;\\n if (x & 0x1000000000 > 0)\\n result = result * 0x10000000B17217FBA9C739AA5819F44F9 >> 128;\\n if (x & 0x800000000 > 0)\\n result = result * 0x1000000058B90BFCDEE5ACD3C1CEDC823 >> 128;\\n if (x & 0x400000000 > 0)\\n result = result * 0x100000002C5C85FE31F35A6A30DA1BE50 >> 128;\\n if (x & 0x200000000 > 0)\\n result = result * 0x10000000162E42FF0999CE3541B9FFFCF >> 128;\\n if (x & 0x100000000 > 0)\\n result = result * 0x100000000B17217F80F4EF5AADDA45554 >> 128;\\n if (x & 0x80000000 > 0)\\n result = result * 0x10000000058B90BFBF8479BD5A81B51AD >> 128;\\n if (x & 0x40000000 > 0)\\n result = result * 0x1000000002C5C85FDF84BD62AE30A74CC >> 128;\\n if (x & 0x20000000 > 0)\\n result = result * 0x100000000162E42FEFB2FED257559BDAA >> 128;\\n if (x & 0x10000000 > 0)\\n result = result * 0x1000000000B17217F7D5A7716BBA4A9AE >> 128;\\n if (x & 0x8000000 > 0)\\n result = result * 0x100000000058B90BFBE9DDBAC5E109CCE >> 128;\\n if (x & 0x4000000 > 0)\\n result = result * 0x10000000002C5C85FDF4B15DE6F17EB0D >> 128;\\n if (x & 0x2000000 > 0)\\n result = result * 0x1000000000162E42FEFA494F1478FDE05 >> 128;\\n if (x & 0x1000000 > 0)\\n result = result * 0x10000000000B17217F7D20CF927C8E94C >> 128;\\n if (x & 0x800000 > 0)\\n result = result * 0x1000000000058B90BFBE8F71CB4E4B33D >> 128;\\n if (x & 0x400000 > 0)\\n result = result * 0x100000000002C5C85FDF477B662B26945 >> 128;\\n if (x & 0x200000 > 0)\\n result = result * 0x10000000000162E42FEFA3AE53369388C >> 128;\\n if (x & 0x100000 > 0)\\n result = result * 0x100000000000B17217F7D1D351A389D40 >> 128;\\n if (x & 0x80000 > 0)\\n result = result * 0x10000000000058B90BFBE8E8B2D3D4EDE >> 128;\\n if (x & 0x40000 > 0)\\n result = result * 0x1000000000002C5C85FDF4741BEA6E77E >> 128;\\n if (x & 0x20000 > 0)\\n result = result * 0x100000000000162E42FEFA39FE95583C2 >> 128;\\n if (x & 0x10000 > 0)\\n result = result * 0x1000000000000B17217F7D1CFB72B45E1 >> 128;\\n if (x & 0x8000 > 0)\\n result = result * 0x100000000000058B90BFBE8E7CC35C3F0 >> 128;\\n if (x & 0x4000 > 0)\\n result = result * 0x10000000000002C5C85FDF473E242EA38 >> 128;\\n if (x & 0x2000 > 0)\\n result = result * 0x1000000000000162E42FEFA39F02B772C >> 128;\\n if (x & 0x1000 > 0)\\n result = result * 0x10000000000000B17217F7D1CF7D83C1A >> 128;\\n if (x & 0x800 > 0)\\n result = result * 0x1000000000000058B90BFBE8E7BDCBE2E >> 128;\\n if (x & 0x400 > 0)\\n result = result * 0x100000000000002C5C85FDF473DEA871F >> 128;\\n if (x & 0x200 > 0)\\n result = result * 0x10000000000000162E42FEFA39EF44D91 >> 128;\\n if (x & 0x100 > 0)\\n result = result * 0x100000000000000B17217F7D1CF79E949 >> 128;\\n if (x & 0x80 > 0)\\n result = result * 0x10000000000000058B90BFBE8E7BCE544 >> 128;\\n if (x & 0x40 > 0)\\n result = result * 0x1000000000000002C5C85FDF473DE6ECA >> 128;\\n if (x & 0x20 > 0)\\n result = result * 0x100000000000000162E42FEFA39EF366F >> 128;\\n if (x & 0x10 > 0)\\n result = result * 0x1000000000000000B17217F7D1CF79AFA >> 128;\\n if (x & 0x8 > 0)\\n result = result * 0x100000000000000058B90BFBE8E7BCD6D >> 128;\\n if (x & 0x4 > 0)\\n result = result * 0x10000000000000002C5C85FDF473DE6B2 >> 128;\\n if (x & 0x2 > 0)\\n result = result * 0x1000000000000000162E42FEFA39EF358 >> 128;\\n if (x & 0x1 > 0)\\n result = result * 0x10000000000000000B17217F7D1CF79AB >> 128;\\n\\n result >>= uint256 (int256 (63 - (x >> 64)));\\n require (result <= uint256 (int256 (MAX_64x64)));\\n\\n return int128 (int256 (result));\\n }\\n }\\n\\n /**\\n * Calculate natural exponent of x. Revert on overflow.\\n *\\n * @param x signed 64.64-bit fixed point number\\n * @return signed 64.64-bit fixed point number\\n */\\n function exp (int128 x) internal pure returns (int128) {\\n unchecked {\\n require (x < 0x400000000000000000); // Overflow\\n\\n if (x < -0x400000000000000000) return 0; // Underflow\\n\\n return exp_2 (\\n int128 (int256 (x) * 0x171547652B82FE1777D0FFDA0D23A7D12 >> 128));\\n }\\n }\\n\\n /**\\n * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit\\n * integer numbers. Revert on overflow or when y is zero.\\n *\\n * @param x unsigned 256-bit integer number\\n * @param y unsigned 256-bit integer number\\n * @return unsigned 64.64-bit fixed point number\\n */\\n function divuu (uint256 x, uint256 y) private pure returns (uint128) {\\n unchecked {\\n require (y != 0);\\n\\n uint256 result;\\n\\n if (x <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)\\n result = (x << 64) / y;\\n else {\\n uint256 msb = 192;\\n uint256 xc = x >> 192;\\n if (xc >= 0x100000000) { xc >>= 32; msb += 32; }\\n if (xc >= 0x10000) { xc >>= 16; msb += 16; }\\n if (xc >= 0x100) { xc >>= 8; msb += 8; }\\n if (xc >= 0x10) { xc >>= 4; msb += 4; }\\n if (xc >= 0x4) { xc >>= 2; msb += 2; }\\n if (xc >= 0x2) msb += 1; // No need to shift xc anymore\\n\\n result = (x << 255 - msb) / ((y - 1 >> msb - 191) + 1);\\n require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\\n\\n uint256 hi = result * (y >> 128);\\n uint256 lo = result * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\\n\\n uint256 xh = x >> 192;\\n uint256 xl = x << 64;\\n\\n if (xl < lo) xh -= 1;\\n xl -= lo; // We rely on overflow behavior here\\n lo = hi << 128;\\n if (xl < lo) xh -= 1;\\n xl -= lo; // We rely on overflow behavior here\\n\\n result += xh == hi >> 128 ? xl / y : 1;\\n }\\n\\n require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\\n return uint128 (result);\\n }\\n }\\n\\n /**\\n * Calculate sqrt (x) rounding down, where x is unsigned 256-bit integer\\n * number.\\n *\\n * @param x unsigned 256-bit integer number\\n * @return unsigned 128-bit integer number\\n */\\n function sqrtu (uint256 x) private pure returns (uint128) {\\n unchecked {\\n if (x == 0) return 0;\\n else {\\n uint256 xx = x;\\n uint256 r = 1;\\n if (xx >= 0x100000000000000000000000000000000) { xx >>= 128; r <<= 64; }\\n if (xx >= 0x10000000000000000) { xx >>= 64; r <<= 32; }\\n if (xx >= 0x100000000) { xx >>= 32; r <<= 16; }\\n if (xx >= 0x10000) { xx >>= 16; r <<= 8; }\\n if (xx >= 0x100) { xx >>= 8; r <<= 4; }\\n if (xx >= 0x10) { xx >>= 4; r <<= 2; }\\n if (xx >= 0x4) { r <<= 1; }\\n r = (r + x / r) >> 1;\\n r = (r + x / r) >> 1;\\n r = (r + x / r) >> 1;\\n r = (r + x / r) >> 1;\\n r = (r + x / r) >> 1;\\n r = (r + x / r) >> 1;\\n r = (r + x / r) >> 1; // Seven iterations should be enough\\n uint256 r1 = x / r;\\n return uint128 (r < r1 ? r : r1);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x1364fdc24192b982f647c7fc68dcb2f6fc1b5e201843e773144bd23a76cb3b97\",\"license\":\"BSD-4-Clause\"},\"contracts/AuthorizedAccounts.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\n\\nimport \\\"./interfaces/IAuthorizedAccounts.sol\\\";\\n\\n/**\\n * @notice Manages authorized accounts with limited permissions on behalf of main account\\n * these authorized accounts are allowed to perform some certain actions in the Sylo network\\n * in order to reduce the works for main account\\n */\\ncontract AuthorizedAccounts is\\n IAuthorizedAccounts,\\n Initializable,\\n Ownable2StepUpgradeable,\\n ERC165\\n{\\n /**\\n * @notice Tracks authorized accounts for every main account\\n */\\n mapping(address => AuthorizedAccount[]) public authorizedAccounts;\\n\\n event PermissionsAdded(\\n address indexed main,\\n address indexed authorized,\\n Permission[] permissions\\n );\\n\\n event PermissionsRemoved(\\n address indexed main,\\n address indexed authorized,\\n Permission[] permissions\\n );\\n\\n error AuthorizedAccountCannotBeZeroAddress();\\n error MainAccountCannotBeZeroAddress();\\n error AtBlockNumberCannotBeZero();\\n error AccountAlreadyAuthorized();\\n error AccountDoesNotExist();\\n\\n function initialize() external initializer {\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAuthorizedAccounts).interfaceId;\\n }\\n\\n /**\\n * @notice Adds new authorized accounts with certain permissions.\\n * This will revert if the account has already existed.\\n * @param authorized The address that the main account wants to authorize\\n * @param permissions The list of permissions that the authorized account\\n * can perform within the Sylo network.\\n */\\n function authorizeAccount(address authorized, Permission[] calldata permissions) external {\\n if (authorized == address(0)) {\\n revert AuthorizedAccountCannotBeZeroAddress();\\n }\\n\\n // check if account has already been authorized\\n AuthorizedAccount[] storage authAccounts = authorizedAccounts[msg.sender];\\n for (uint i; i < authAccounts.length; ++i) {\\n if (authAccounts[i].account == authorized) {\\n if (authAccounts[i].authorizedAt != 0) {\\n revert AccountAlreadyAuthorized();\\n }\\n\\n authAccounts[i].authorizedAt = block.number;\\n return _addPermissions(authorized, authAccounts[i], permissions);\\n }\\n }\\n\\n // add new authorized account to the list\\n authAccounts.push();\\n AuthorizedAccount storage newAccount = authAccounts[authAccounts.length - 1];\\n newAccount.account = authorized;\\n newAccount.authorizedAt = block.number;\\n\\n _addPermissions(authorized, newAccount, permissions);\\n }\\n\\n /**\\n * @notice Removes all permissions of a specific authorized account\\n * associated with the msg.sender, and sets the account's authorizedAt to 0.\\n * Note: It does not remove the authorized account from the list.\\n * This will revert if the account does not exist.\\n * @param authorized The address of the authorized account\\n */\\n function unauthorizeAccount(address authorized) external {\\n if (authorized == address(0)) {\\n revert AuthorizedAccountCannotBeZeroAddress();\\n }\\n\\n AuthorizedAccount[] storage authAccounts = authorizedAccounts[msg.sender];\\n for (uint i; i < authAccounts.length; ++i) {\\n if (authAccounts[i].account == authorized) {\\n delete authAccounts[i].authorizedAt;\\n return _removePermissions(authorized, authAccounts[i], getAllPermissions());\\n }\\n }\\n\\n revert AccountDoesNotExist();\\n }\\n\\n /**\\n * @notice Adds new permissions to a specific authorized account.\\n * - Adding permissions that don't exist in the Permission enum will return\\n * with panic code 0x21 (convert a value that is too big or negative into an enum type).\\n * - Adding duplicate permissions will update the permissions' authorizedAt value.\\n * - Adding permissions that were previously unauthorized will update\\n * the authorizedAt and unauthorizedAt values (refer to the comment in\\n * IAuthorizedAccount -> AuthorizedPermission struct).\\n * This will revert if the account does not exist.\\n * @param authorized The authorized account address\\n * @param permissions The new permissions will be added to the authorized account\\n */\\n function addPermissions(address authorized, Permission[] calldata permissions) external {\\n if (authorized == address(0)) {\\n revert AuthorizedAccountCannotBeZeroAddress();\\n }\\n\\n AuthorizedAccount[] storage authAccounts = authorizedAccounts[msg.sender];\\n for (uint i; i < authAccounts.length; ++i) {\\n if (authAccounts[i].account == authorized) {\\n return _addPermissions(authorized, authAccounts[i], permissions);\\n }\\n }\\n\\n revert AccountDoesNotExist();\\n }\\n\\n function _addPermissions(\\n address authorized,\\n AuthorizedAccount storage authAccount,\\n Permission[] memory permissions\\n ) private {\\n for (uint i; i < permissions.length; ++i) {\\n bool exists;\\n for (uint j; j < authAccount.permissions.length; ++j) {\\n AuthorizedPermission storage authPermission = authAccount.permissions[j];\\n if (permissions[i] == authPermission.permission) {\\n exists = true;\\n authPermission.authorizedAt = block.number;\\n\\n // make sure unauthorizedAt is not greater than authorizedAt\\n // (refer to the comment in IAuthorizedAccount -> AuthorizedPermission struct)\\n if (authPermission.unauthorizedAt > authPermission.authorizedAt) {\\n authPermission.unauthorizedAt = authPermission.authorizedAt;\\n }\\n break;\\n }\\n }\\n if (!exists) {\\n authAccount.permissions.push(\\n AuthorizedPermission({\\n permission: permissions[i],\\n authorizedAt: block.number,\\n unauthorizedAt: 0\\n })\\n );\\n }\\n }\\n\\n emit PermissionsAdded(msg.sender, authorized, permissions);\\n }\\n\\n /**\\n * @notice Removes permissions of specific authorized account.\\n * - Removing permissions that don't exist in the Permission enum will return\\n * with panic code 0x21 (convert a value that is too big or negative into an enum type).\\n * - Removing duplicate/authorized permissions will update the permissions'\\n * unauthorizedAt value.\\n * This will revert if the account does not exist.\\n * @param authorized The address of authorized account\\n * @param permissions The list of permissions will be removed\\n */\\n function removePermissions(address authorized, Permission[] calldata permissions) external {\\n if (authorized == address(0)) {\\n revert AuthorizedAccountCannotBeZeroAddress();\\n }\\n\\n AuthorizedAccount[] storage authAccounts = authorizedAccounts[msg.sender];\\n for (uint i; i < authAccounts.length; ++i) {\\n if (authAccounts[i].account == authorized) {\\n return _removePermissions(authorized, authAccounts[i], permissions);\\n }\\n }\\n\\n revert AccountDoesNotExist();\\n }\\n\\n function _removePermissions(\\n address authorized,\\n AuthorizedAccount storage authAccount,\\n Permission[] memory permissions\\n ) private {\\n for (uint i; i < permissions.length; ++i) {\\n for (uint j; j < authAccount.permissions.length; ++j) {\\n if (permissions[i] == authAccount.permissions[j].permission) {\\n // only update unauthorizedAt if the permission is authorized\\n if (\\n authAccount.permissions[j].authorizedAt >=\\n authAccount.permissions[j].unauthorizedAt\\n ) {\\n authAccount.permissions[j].unauthorizedAt = block.number + 1;\\n }\\n break;\\n }\\n }\\n }\\n\\n emit PermissionsRemoved(msg.sender, authorized, permissions);\\n }\\n\\n /**\\n * @notice Validates permission of an authorized account associated with the main account.\\n *\\n * @param main The address of main account\\n * @param authorized The address of authorized account\\n * @param permission The permission needs to be verified with the authorized account\\n * @param atBlock The block number to check if the permission is valid between\\n * the permission's authorizedAt and unauthorizedAt period. It is added later to prevent\\n * the timing attack. E.g. If the main account authorizes the PersonalSign permission at\\n * block 1, creates a ticket at block 2, then unauthorizes the permission at block 3, the\\n * ticket will be invalid and cannot be redeemed. To avoid this, the `atBlock` param is\\n * needed to check if the permission is authorized between its authorizedAt and unauthorizedAt\\n * duration.\\n *\\n * @return boolean value\\n */\\n function validatePermission(\\n address main,\\n address authorized,\\n Permission permission,\\n uint256 atBlock\\n ) external view returns (bool) {\\n if (main == address(0)) {\\n revert MainAccountCannotBeZeroAddress();\\n }\\n\\n if (authorized == address(0)) {\\n revert AuthorizedAccountCannotBeZeroAddress();\\n }\\n\\n if (atBlock == 0) {\\n revert AtBlockNumberCannotBeZero();\\n }\\n\\n AuthorizedAccount[] storage authAccounts = authorizedAccounts[main];\\n\\n for (uint i = 0; i < authAccounts.length; ++i) {\\n if (authAccounts[i].account == authorized) {\\n for (uint j = 0; j < authAccounts[i].permissions.length; ++j) {\\n if (authAccounts[i].permissions[j].permission == permission) {\\n uint256 authorizedAt = authAccounts[i].permissions[j].authorizedAt;\\n uint256 unauthorizedAt = authAccounts[i].permissions[j].unauthorizedAt;\\n\\n bool isPermissionUnauthorized = authorizedAt > 0 &&\\n authorizedAt < unauthorizedAt;\\n if (isPermissionUnauthorized) {\\n // the permission was previously valid, so we check that\\n // the `atBlock` is referencing a time when the permission was valid\\n return authorizedAt <= atBlock && atBlock < unauthorizedAt;\\n }\\n\\n // otherwise just check if the permission was authorized before the\\n // atBlock\\n return authorizedAt > 0 && authorizedAt <= atBlock;\\n }\\n }\\n }\\n }\\n\\n return false;\\n }\\n\\n /**\\n * @notice Get all authorized accounts associated with a given account\\n * @param main The address of main account\\n * @return An array of authorized accounts\\n */\\n function getAuthorizedAccounts(\\n address main\\n ) external view returns (AuthorizedAccount[] memory) {\\n if (main == address(0)) {\\n revert MainAccountCannotBeZeroAddress();\\n }\\n\\n return authorizedAccounts[main];\\n }\\n\\n function getAllPermissions() internal pure returns (Permission[] memory) {\\n Permission[] memory permissions = new Permission[](1);\\n permissions[0] = Permission.PersonalSign;\\n return permissions;\\n }\\n}\\n\",\"keccak256\":\"0x9e248094e7c8256f520ffa7eee09af4715fafa6fe94de35a8532752932fa0bdd\",\"license\":\"Apache-2.0\"},\"contracts/Registries.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\n\\nimport \\\"./libraries/SyloUtils.sol\\\";\\nimport \\\"./interfaces/IRegistries.sol\\\";\\n\\n/**\\n * @notice This contract manages Registries for Nodes. A Registry is a\\n * set of parameters configured by the Node itself. A Node is required\\n * to have a valid Registry to be able to participate in the network.\\n */\\ncontract Registries is IRegistries, Initializable, Ownable2StepUpgradeable, IERC165 {\\n using ECDSA for bytes32;\\n\\n /**\\n * @notice ERC721 contract for bridged Seekers. Used for verifying ownership\\n * of a seeker.\\n */\\n IERC721 public _rootSeekers;\\n\\n /**\\n * @notice Tracks each Node's registry.\\n */\\n mapping(address => IRegistries.Registry) public registries;\\n\\n /**\\n * @notice Tracks the node address that each seeker id is registered with\\n */\\n mapping(uint256 => address) public seekerRegistration;\\n\\n /**\\n * @notice Tracks the address of every registered node.\\n */\\n address[] public nodes;\\n\\n /**\\n * @notice Tracks nonces used when registering the seeker account\\n * to prevent signature re-use.\\n */\\n mapping(bytes32 => address) private signatureNonces;\\n\\n /**\\n * @notice Payout percentage refers to the portion of a tickets reward\\n * that will be allocated to the Node's stakers. This is global, and is\\n * currently set for all Nodes.\\n */\\n uint32 public defaultPayoutPercentage;\\n\\n event DefaultPayoutPercentageUpdated(uint32 defaultPayoutPercentage);\\n\\n error NonceCannotBeReused();\\n error EndMustBeGreaterThanStart();\\n error PercentageCannotExceed100000();\\n error PublicEndpointCannotBeEmpty();\\n error SeekerAccountMustOwnSeekerId();\\n error SeekerAccountMustBeMsgSender();\\n error ProofNotSignedBySeekerAccount();\\n error RootSeekersCannotBeZeroAddress();\\n error SeekerAccountCannotBeZeroAddress();\\n error EndCannotExceedNumberOfNodes(uint256 nodeLength);\\n\\n function initialize(\\n IERC721 rootSeekers,\\n uint32 _defaultPayoutPercentage\\n ) external initializer {\\n if (address(rootSeekers) == address(0)) {\\n revert RootSeekersCannotBeZeroAddress();\\n }\\n if (_defaultPayoutPercentage > 100000) {\\n revert PercentageCannotExceed100000();\\n }\\n\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n _rootSeekers = rootSeekers;\\n defaultPayoutPercentage = _defaultPayoutPercentage;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IRegistries).interfaceId;\\n }\\n\\n /**\\n * @notice Set the global default payout percentage value. Only callable\\n * by the owner.\\n * @param _defaultPayoutPercentage The payout percentage as a value where the\\n * denominator is 10000.\\n */\\n function setDefaultPayoutPercentage(uint32 _defaultPayoutPercentage) external onlyOwner {\\n if (_defaultPayoutPercentage > 100000) {\\n revert PercentageCannotExceed100000();\\n }\\n\\n defaultPayoutPercentage = _defaultPayoutPercentage;\\n emit DefaultPayoutPercentageUpdated(_defaultPayoutPercentage);\\n }\\n\\n /**\\n * @notice Call this as a Node to set or update your Registry entry.\\n * @param publicEndpoint The public endpoint of your Node. Essential for\\n * clients to be able to retrieve additional information, such as\\n * an address to establish a p2p connection.\\n */\\n function register(string calldata publicEndpoint) external {\\n if (bytes(publicEndpoint).length == 0) {\\n revert PublicEndpointCannotBeEmpty();\\n }\\n\\n // This is the nodes first registration\\n if (bytes(registries[msg.sender].publicEndpoint).length == 0) {\\n nodes.push(msg.sender);\\n }\\n\\n registries[msg.sender].publicEndpoint = publicEndpoint;\\n }\\n\\n function setSeekerAccount(\\n address seekerAccount,\\n uint256 seekerId,\\n bytes32 nonce,\\n bytes calldata signature\\n ) external {\\n if (seekerAccount == address(0)) {\\n revert SeekerAccountCannotBeZeroAddress();\\n }\\n if (signatureNonces[nonce] != address(0)) {\\n revert NonceCannotBeReused();\\n }\\n\\n bytes memory proofMessage = getProofMessage(seekerId, msg.sender, nonce);\\n bytes32 ethProof = ECDSA.toEthSignedMessageHash(proofMessage);\\n\\n if (ECDSA.recover(ethProof, signature) != seekerAccount) {\\n revert ProofNotSignedBySeekerAccount();\\n }\\n\\n // Now verify the seeker account actually owns the seeker\\n address owner = _rootSeekers.ownerOf(seekerId);\\n\\n if (seekerAccount != owner) {\\n revert SeekerAccountMustOwnSeekerId();\\n }\\n\\n delete registries[seekerRegistration[seekerId]].seekerId;\\n delete registries[seekerRegistration[seekerId]].seekerAccount;\\n\\n registries[msg.sender].seekerAccount = seekerAccount;\\n registries[msg.sender].seekerId = seekerId;\\n\\n seekerRegistration[seekerId] = msg.sender;\\n\\n signatureNonces[nonce] = seekerAccount;\\n }\\n\\n function revokeSeekerAccount(address node) external {\\n Registry storage registry = registries[node];\\n\\n if (registry.seekerAccount != msg.sender) {\\n revert SeekerAccountMustBeMsgSender();\\n }\\n\\n delete registry.seekerAccount;\\n delete seekerRegistration[registry.seekerId];\\n delete registry.seekerId;\\n }\\n\\n /**\\n * @notice Retrieve the registry associated with a Node.\\n * @param account The address of the Node.\\n * @return The Node's Registry.\\n */\\n function getRegistry(address account) external view returns (Registry memory) {\\n return registries[account];\\n }\\n\\n /**\\n * @notice Retrieve all registered nodes.\\n * @return An array of node addresses.\\n */\\n function getNodes() external view returns (address[] memory) {\\n return nodes;\\n }\\n\\n /**\\n * @notice Retrieves a list of registries. Takes in a\\n * a start and end indices to allow pagination.\\n * @param start The start index which is inclusive.\\n * @param end The end index which is exclusive.\\n * @return An array of Registries.\\n */\\n function getRegistries(\\n uint256 start,\\n uint256 end\\n ) external view returns (address[] memory, Registry[] memory) {\\n uint256 nodesLength = nodes.length;\\n\\n if (end <= start) {\\n revert EndMustBeGreaterThanStart();\\n }\\n if (end > nodesLength) {\\n revert EndCannotExceedNumberOfNodes(nodesLength);\\n }\\n\\n address[] memory _nodes = new address[](end - start);\\n Registry[] memory _registries = new Registry[](_nodes.length);\\n\\n for (uint256 i = start; i < end; ++i) {\\n _nodes[i - start] = nodes[i];\\n _registries[i - start] = registries[nodes[i]];\\n }\\n\\n return (_nodes, _registries);\\n }\\n\\n /**\\n * @notice Returns the total number of registered nodes.\\n * @return The number of registered nodes.\\n */\\n function getTotalNodes() external view returns (uint256) {\\n return nodes.length;\\n }\\n\\n /**\\n * @notice Helper function for deriving the proof message used to\\n * validate seeker ownership.\\n * @param seekerId The tokenId of the seeker used for operation.\\n * @param node The address of the node which that will be operated\\n * by the specified seeker.\\n * @param nonce The nonce used for this message.\\n */\\n function getProofMessage(\\n uint256 seekerId,\\n address node,\\n bytes32 nonce\\n ) public pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n unicode\\\"\\ud83e\\udd16 Hi frend! \\ud83e\\udd16\\\\n\\\\n\\ud83d\\udcdc Signing this message proves that you're the owner of this Seeker NFT and allows your Seeker to be used to operate your Seeker's Node. It's a simple but important step to ensure smooth operation.\\\\n\\\\nThis request will not trigger a blockchain transaction or cost any gas fees.\\\\n\\\\n\\ud83d\\udd25 Your node's address: \\\",\\n Strings.toHexString(uint256(uint160(node)), 20),\\n unicode\\\"\\\\n\\\\n\\ud83c\\udd94 Your seeker id: \\\",\\n Strings.toString(seekerId),\\n unicode\\\"\\\\n\\\\n\\ud83d\\udce6 A unique random value which secures this message: \\\",\\n Strings.toHexString(uint256(nonce), 32)\\n );\\n }\\n}\\n\",\"keccak256\":\"0x492be9b17a6624c5aa9de7b7d93f2ab1d7e6ee6443e60d4f036f7a7c670c343b\",\"license\":\"Apache-2.0\"},\"contracts/SeekerPowerOracle.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\n\\nimport \\\"./interfaces/ISeekerPowerOracle.sol\\\";\\n\\n/**\\n * @notice Acts as a source of information for Seeker Powers. Allows setting\\n * a Seeker's power level via a restricted oracle account call. Seeker Power can also\\n * be set by any account if the correct Oracle signature proof is provided.\\n */\\ncontract SeekerPowerOracle is ISeekerPowerOracle, Initializable, Ownable2StepUpgradeable, ERC165 {\\n /**\\n * @notice The oracle account. This contract accepts any attestations of\\n * Seeker power that have been signed by this account.\\n */\\n address public oracle;\\n\\n /**\\n * @notice Tracks nonce used when register the Seeker power to\\n * prevent signature re-use.\\n */\\n mapping(bytes32 => address) private proofNonces;\\n\\n /**\\n * @notice Tracks the set of Seeker Power levels.\\n */\\n mapping(uint256 => uint256) public seekerPowers;\\n\\n event SeekerPowerUpdated(uint256 indexed seekerId, uint256 indexed power);\\n\\n error UnauthorizedRegisterSeekerPowerCall();\\n error NonceCannotBeReused();\\n\\n function initialize(address _oracle) external initializer {\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n oracle = _oracle;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(ISeekerPowerOracle).interfaceId;\\n }\\n\\n /**\\n * @notice Sets the oracle account.\\n * @param _oracle The oracle account.\\n */\\n function setOracle(address _oracle) external onlyOwner {\\n oracle = _oracle;\\n }\\n\\n /**\\n * @notice Registers a Seeker's power level. Only callable by the\\n * owner or the oracle account.\\n * @param seekerId The id of the Seeker.\\n * @param power The power level of the Seeker.\\n */\\n function registerSeekerPowerRestricted(uint256 seekerId, uint256 power) external {\\n if (msg.sender != oracle) {\\n revert UnauthorizedRegisterSeekerPowerCall();\\n }\\n\\n seekerPowers[seekerId] = power;\\n emit SeekerPowerUpdated(seekerId, power);\\n }\\n\\n /**\\n * @notice Registers a Seeker's power level. Callable by any account\\n * but requires a proof signed by the oracle.\\n * @param seekerId The id of the Seeker.\\n * @param power The power level of the Seeker.\\n */\\n function registerSeekerPower(\\n uint256 seekerId,\\n uint256 power,\\n bytes32 nonce,\\n bytes calldata proof\\n ) external {\\n if (proofNonces[nonce] != address(0)) {\\n revert NonceCannotBeReused();\\n }\\n\\n bytes memory proofMessage = getProofMessage(seekerId, power, nonce);\\n bytes32 ecdsaHash = ECDSA.toEthSignedMessageHash(proofMessage);\\n\\n if (ECDSA.recover(ecdsaHash, proof) != oracle) {\\n revert UnauthorizedRegisterSeekerPowerCall();\\n }\\n\\n seekerPowers[seekerId] = power;\\n proofNonces[nonce] = oracle;\\n\\n emit SeekerPowerUpdated(seekerId, power);\\n }\\n\\n /**\\n * @notice Retrieves a Seeker's stored power level.\\n * @param seekerId The id of the Seeker.\\n */\\n function getSeekerPower(uint256 seekerId) external view returns (uint256) {\\n return seekerPowers[seekerId];\\n }\\n\\n /**\\n * @notice Constructs a proof message for the oracle to sign.\\n * @param seekerId The id of the Seeker.\\n * @param power The power level of the Seeker.\\n */\\n function getProofMessage(\\n uint256 seekerId,\\n uint256 power,\\n bytes32 nonce\\n ) public pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n Strings.toString(seekerId),\\n \\\":\\\",\\n Strings.toString(power),\\n \\\":\\\",\\n Strings.toHexString(uint256(nonce), 32)\\n );\\n }\\n}\\n\",\"keccak256\":\"0xbd652d364b9b0742083dc6dcce34b58aefddda5335afdcb3f8d42358cb89b18a\",\"license\":\"Apache-2.0\"},\"contracts/SyloToken.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/ERC20.sol\\\";\\n\\ncontract SyloToken is ERC20 {\\n constructor() ERC20(\\\"Sylo\\\", \\\"SYLO\\\") {\\n _mint(msg.sender, 10_000_000_000 ether);\\n }\\n}\\n\",\"keccak256\":\"0x75fda7d129e02669cd691691c14fccd1cdac23b833d7a25e899801865d58ef26\",\"license\":\"Apache-2.0\"},\"contracts/epochs/EpochsManager.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\n\\nimport \\\"../Registries.sol\\\";\\nimport \\\"../staking/Directory.sol\\\";\\nimport \\\"../interfaces/epochs/IEpochsManager.sol\\\";\\nimport \\\"../payments/ticketing/TicketingParameters.sol\\\";\\n\\ncontract EpochsManager is IEpochsManager, Initializable, Ownable2StepUpgradeable, ERC165 {\\n Directory public _directory;\\n\\n Registries public _registries;\\n\\n IERC721 public _rootSeekers;\\n\\n TicketingParameters public _ticketingParameters;\\n\\n /**\\n * @notice Track seekers that have joined for a specific epoch.\\n */\\n mapping(uint256 => mapping(uint256 => address)) public activeSeekers;\\n\\n // Define all Epoch specific parameters here.\\n // When initializing an epoch, these parameters are read,\\n // along with parameters from the other contracts to create the\\n // new epoch.\\n\\n /**\\n * @notice A mapping of all epochs that have been initialized.\\n */\\n mapping(uint256 => Epoch) public epochs;\\n\\n /**\\n * @notice The block number since the first epoch can be initialized.\\n */\\n uint256 public initialEpoch;\\n\\n /**\\n * @notice The duration in blocks an epoch will last for.\\n */\\n uint256 public epochDuration;\\n\\n /**\\n * @notice The value of the integer used as the current\\n * epoch's identifier. This value is incremented as each epoch\\n * is initialized.\\n */\\n uint256 public currentIteration;\\n\\n event NewEpoch(uint256 indexed epochId);\\n event EpochJoined(uint256 indexed epochId, address indexed node, uint256 indexed seekerId);\\n event InitialEpochUpdated(uint256 initialEpoch);\\n event EpochDurationUpdated(uint256 epochDuration);\\n\\n error SeekerOwnerMismatch();\\n error InitialEpochCannotBeZero();\\n error EpochDurationCannotBeZero();\\n error DirectoryCannotBeZeroAddress();\\n error RegistriesCannotBeZeroAddress();\\n error RootSeekerCannotBeZeroAddress();\\n error EpochHasNotEnded(uint256 epochId);\\n error SeekerAccountCannotBeZeroAddress();\\n error TicketingParametersCannotBeZeroAddress();\\n error SeekerAlreadyJoinedEpoch(uint256 epochId, uint256 seekerId);\\n error InitialEpochNotYetReady(uint256 expectedBlock, uint256 currentBlock);\\n\\n function initialize(\\n IERC721 rootSeekers,\\n Directory directory,\\n Registries registries,\\n TicketingParameters ticketingParameters,\\n uint256 _initialEpoch,\\n uint256 _epochDuration\\n ) external initializer {\\n if (address(rootSeekers) == address(0)) {\\n revert RootSeekerCannotBeZeroAddress();\\n }\\n\\n SyloUtils.validateContractInterface(\\n \\\"Directory\\\",\\n address(directory),\\n type(IDirectory).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"Registries\\\",\\n address(registries),\\n type(IRegistries).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"TicketingParameters\\\",\\n address(ticketingParameters),\\n type(ITicketingParameters).interfaceId\\n );\\n\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n _rootSeekers = rootSeekers;\\n _directory = directory;\\n _registries = registries;\\n _ticketingParameters = ticketingParameters;\\n\\n initialEpoch = _initialEpoch;\\n epochDuration = _epochDuration;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IEpochsManager).interfaceId;\\n }\\n\\n /**\\n * @notice Call this to initialize the next epoch. On success, a `NewEpoch` event\\n * will be emitted.\\n * @dev The function will read the current set of network parameters, and store\\n * the parameters in a new Epoch struct. The end block of the current epoch\\n * will also be set to a non-zero value.\\n */\\n function initializeEpoch() external returns (uint256) {\\n if (currentIteration == 0 && initialEpoch > block.number) {\\n revert InitialEpochNotYetReady(initialEpoch, block.number);\\n }\\n\\n Epoch storage current = epochs[currentIteration];\\n\\n uint256 end = current.startBlock + current.duration;\\n if (end > block.number) {\\n revert EpochHasNotEnded(currentIteration);\\n }\\n\\n (\\n uint256 faceValue,\\n uint128 baseLiveWinProb,\\n uint128 expiredWinProb,\\n uint256 ticketDuration,\\n uint32 decayRate\\n ) = _ticketingParameters.getTicketingParameters();\\n\\n uint256 nextEpochId = getNextEpochId();\\n\\n epochs[nextEpochId] = Epoch(\\n block.number,\\n epochDuration,\\n 0,\\n _registries.defaultPayoutPercentage(),\\n decayRate,\\n faceValue,\\n baseLiveWinProb,\\n expiredWinProb,\\n ticketDuration\\n );\\n\\n current.endBlock = block.number;\\n\\n currentIteration = nextEpochId;\\n\\n _directory.setCurrentDirectory(nextEpochId);\\n\\n emit NewEpoch(nextEpochId);\\n\\n return nextEpochId;\\n }\\n\\n /**\\n * @notice Set the first epoch starting block. Only callable by the owner.\\n * @param _initialEpoch The block number when the first epoch can be initialized.\\n */\\n function setInitialEpoch(uint256 _initialEpoch) external onlyOwner {\\n if (_initialEpoch == 0) {\\n revert InitialEpochCannotBeZero();\\n }\\n initialEpoch = _initialEpoch;\\n emit InitialEpochUpdated(_initialEpoch);\\n }\\n\\n /**\\n * @notice Set the epoch duration. Will take effect in the next epoch. Only\\n * callable by the owner.\\n * @param _epochDuration The epoch duration in number of blocks.\\n */\\n function setEpochDuration(uint256 _epochDuration) external onlyOwner {\\n if (_epochDuration == 0) {\\n revert EpochDurationCannotBeZero();\\n }\\n epochDuration = _epochDuration;\\n emit EpochDurationUpdated(epochDuration);\\n }\\n\\n /**\\n * @notice Retrieve the parameters for the current epoch.\\n * @return The current Epoch parameters.\\n */\\n function getCurrentActiveEpoch() external view returns (uint256, Epoch memory) {\\n return (currentIteration, epochs[currentIteration]);\\n }\\n\\n /**\\n * @notice Nodes should call this to join the next epoch. It will\\n * initialize the next reward pool and set the stake for the next directory.\\n * @dev This is a proxy function for `initalizeNextRewardPool` and\\n * `joinNextDirectory`.\\n */\\n function joinNextEpoch() external {\\n Registries.Registry memory registry = _registries.getRegistry(msg.sender);\\n\\n // validate the node's seeker ownership\\n if (registry.seekerAccount == address(0)) {\\n revert SeekerAccountCannotBeZeroAddress();\\n }\\n\\n uint256 seekerId = registry.seekerId;\\n\\n address owner = _rootSeekers.ownerOf(seekerId);\\n if (registry.seekerAccount != owner) {\\n revert SeekerOwnerMismatch();\\n }\\n\\n uint256 nextEpoch = getNextEpochId();\\n if (activeSeekers[nextEpoch][seekerId] != address(0)) {\\n revert SeekerAlreadyJoinedEpoch(nextEpoch, seekerId);\\n }\\n\\n activeSeekers[nextEpoch][seekerId] = msg.sender;\\n\\n _directory._rewardsManager().initializeNextRewardPool(msg.sender);\\n _directory.joinNextDirectory(msg.sender, seekerId);\\n\\n emit EpochJoined(nextEpoch, msg.sender, seekerId);\\n }\\n\\n /**\\n * @notice Retrieve the epoch parameter for the given id.\\n * @param epochId The id of the epoch to retrieve.\\n * @return The epoch parameters associated with the id.\\n */\\n function getEpoch(uint256 epochId) external view returns (Epoch memory) {\\n return epochs[epochId];\\n }\\n\\n /**\\n * @notice Retrieve the integer value that will be used for the\\n * next epoch id.\\n * @return The next epoch id identifier.\\n */\\n function getNextEpochId() public view returns (uint256) {\\n return currentIteration + 1;\\n }\\n}\\n\",\"keccak256\":\"0xc759afdc6022b1490447d2c3c3b4454c59cc86f59fe62cece92764b787a87030\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/IAuthorizedAccounts.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface IAuthorizedAccounts {\\n enum Permission {\\n // PersonalSign permission allows the authorized account to\\n // sign on behalf of the sending account.\\n PersonalSign\\n }\\n\\n /**\\n * @dev This type will hold the permission type and the block number from\\n * which the permission was set to be authorized and unauthorized.\\n * The permission is authorized when authorizedAt >= unauthorizedAt.\\n *\\n * Note: authorizedAt and unauthorizedAt won't be set to 0 when the permission\\n * is updated, because they are both needed when validating the permission.\\n */\\n struct AuthorizedPermission {\\n // Permission type\\n Permission permission;\\n // Block number from which the permission was set to be authorized.\\n // If the transaction is called in block 1, the permission is\\n // authorized from block 1 (authorizedAt = block.number).\\n uint256 authorizedAt;\\n // Block number from which the permission was set to be unauthorized.\\n // If the transaction is called in block 1, the permission is\\n // unauthorized from block 2 (unauthorizedAt = block.number + 1)\\n // unauthorizedAt is set that way to avoid the case where the\\n // permission is authorized and unauthorized in the same block:\\n // E.g. addPermission is called => authorizedAt = 1\\n // removePermission is called => unauthorizedAt = 1\\n // => We cannot tell if the permission is authorized or not.\\n // E.g. addPermission is called => authorizedAt = 1\\n // removePermission is called => unauthorizedAt = 2\\n // addPermission is called => authorizedAt = 1 AND update unauthorizedAt = authorizedAt = 1\\n // => The permission is authorized when authorizedAt >= unauthorizedAt\\n uint256 unauthorizedAt;\\n }\\n\\n struct AuthorizedAccount {\\n // The authorized account\\n address account;\\n // Block number at which the account was authorized.\\n // If the transaction is called in block 1, the account is\\n // authorized at block 1 (authorizedAt = block.number).\\n // If the account is unauthorized, authorizedAt will be set to 0.\\n uint256 authorizedAt;\\n // Permission list\\n AuthorizedPermission[] permissions;\\n }\\n\\n function authorizeAccount(address authorized, Permission[] calldata permissions) external;\\n\\n function unauthorizeAccount(address authorized) external;\\n\\n function addPermissions(address authorized, Permission[] calldata permissions) external;\\n\\n function removePermissions(\\n address authorized,\\n Permission[] calldata permissionsToRemove\\n ) external;\\n\\n function validatePermission(\\n address main,\\n address authorized,\\n Permission permission,\\n uint256 atBlock\\n ) external returns (bool);\\n\\n function getAuthorizedAccounts(\\n address main\\n ) external view returns (AuthorizedAccount[] memory);\\n}\\n\",\"keccak256\":\"0xebc98a4d5ed21face8bf0ef8ba07693b82ca89c81d52eb4f2adc5e99c94d7b30\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/IFuturePassRegistrar.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface IFuturePassRegistrar {\\n function futurepassOf(address owner) external view returns (address);\\n\\n function create(address owner) external returns (address);\\n}\\n\",\"keccak256\":\"0x6f671c6d5d9e078eadea1b38ab2b05ca5b565cb8484fd1d6b46247505285c91f\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/IRegistries.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface IRegistries {\\n struct Registry {\\n // Percentage of a tickets value that will be rewarded to\\n // delegated stakers expressed as a fraction of 100000.\\n // This value is currently locked to the default payout percentage\\n // until epochs are implemented.\\n uint32 payoutPercentage;\\n // Public http/s endpoint to retrieve additional metadata\\n // about the node.\\n // The current metadata schema is as follows:\\n // { name: string, multiaddrs: string[] }\\n string publicEndpoint;\\n // The account which owns a seeker that will be used to\\n // operate the Node for this registry.\\n address seekerAccount;\\n // The id of the seeker used to operate the node. The owner\\n // of this id should be the seeker account.\\n uint256 seekerId;\\n }\\n\\n function register(string calldata publicEndpoint) external;\\n\\n function setDefaultPayoutPercentage(uint32 _defaultPayoutPercentage) external;\\n\\n function setSeekerAccount(\\n address seekerAccount,\\n uint256 seekerId,\\n bytes32 nonce,\\n bytes calldata signature\\n ) external;\\n\\n function revokeSeekerAccount(address node) external;\\n\\n function getRegistry(address account) external view returns (Registry memory);\\n\\n function getNodes() external view returns (address[] memory);\\n\\n function getRegistries(\\n uint256 start,\\n uint256 end\\n ) external view returns (address[] memory, Registry[] memory);\\n\\n function getTotalNodes() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x524252752fd14eb66b047848eaaffbc138c6b049f99f2c2f0a5c6a7a4d6e6e36\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/ISeekerPowerOracle.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface ISeekerPowerOracle {\\n function setOracle(address oracle) external;\\n\\n function registerSeekerPowerRestricted(uint256 seekerId, uint256 power) external;\\n\\n function registerSeekerPower(\\n uint256 seekerId,\\n uint256 power,\\n bytes32 nonce,\\n bytes calldata proof\\n ) external;\\n\\n function getSeekerPower(uint256 seekerId) external view returns (uint256);\\n\\n function getProofMessage(\\n uint256 seekerId,\\n uint256 power,\\n bytes32 nonce\\n ) external pure returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x26fb3e81dabde31b8730d4c601c51c881e018b540f19f7c599a8a7f9b8c05523\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/epochs/IEpochsManager.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface IEpochsManager {\\n /**\\n * @dev This struct will hold all network parameters that will be static\\n * for the entire epoch. This value will be stored in a mapping, where the\\n * key is the current epoch id.\\n */\\n struct Epoch {\\n // time related variables\\n uint256 startBlock; // Block the epoch was initialized\\n uint256 duration; // Minimum time epoch will be alive measured in number of blocks\\n uint256 endBlock; // Block the epoch ended (and when the next epoch was initialized)\\n // Zero here represents the epoch has not yet ended.\\n\\n // registry variables\\n uint32 defaultPayoutPercentage;\\n // ticketing variables\\n uint32 decayRate;\\n uint256 faceValue;\\n uint128 baseLiveWinProb;\\n uint128 expiredWinProb;\\n uint256 ticketDuration;\\n }\\n\\n function initializeEpoch() external returns (uint256);\\n\\n function setEpochDuration(uint256 _epochDuration) external;\\n\\n function getCurrentActiveEpoch() external view returns (uint256, Epoch memory);\\n\\n function joinNextEpoch() external;\\n\\n function getEpoch(uint256 epochId) external view returns (Epoch memory);\\n\\n function getNextEpochId() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xeef359833a448742f4eca45ac04eeea0c3e74eb21d3a36bfdae3a1bb7f81e0b5\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/payments/ISyloTicketing.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface ISyloTicketing {\\n struct Deposit {\\n uint256 escrow; // Balance of users escrow\\n uint256 penalty; // Balance of users penalty\\n uint256 unlockAt; // Block number a user can withdraw their balances\\n }\\n\\n struct User {\\n address main; // Main address of the ticket sender or receiver\\n address delegated; // Delegated address used to sign and redeem tickets\\n }\\n\\n struct Ticket {\\n uint256 epochId; // The epoch this ticket is associated with\\n User sender; // Ticket sender's main and delegated addresses\\n User receiver; // Ticket receiver's main and delegated addresses\\n address redeemer; // Address of the intended recipient\\n uint256 generationBlock; // Block number the ticket was generated\\n bytes32 redeemerCommit; // Hash of the secret random number of the redeemer\\n }\\n\\n // A type of ticket that does not explicit state the receiver address.\\n struct MultiReceiverTicket {\\n uint256 epochId; // The epoch this ticket is associated with\\n User sender; // Ticket sender's main and delegated addresses\\n address redeemer; // Address of the intended recipient\\n uint256 generationBlock; // Block number the ticket was generated\\n bytes32 redeemerCommit; // Hash of the secret random number of the redeemer\\n }\\n\\n function setUnlockDuration(uint256 _unlockDuration) external;\\n\\n function depositEscrow(uint256 amount, address account) external;\\n\\n function depositPenalty(uint256 amount, address account) external;\\n\\n function unlockDeposits() external returns (uint256);\\n\\n function lockDeposits() external;\\n\\n function withdraw() external;\\n\\n function redeem(\\n Ticket calldata ticket,\\n uint256 redeemerRand,\\n bytes calldata senderSig,\\n bytes calldata receiverSig\\n ) external;\\n\\n function redeemMultiReceiver(\\n MultiReceiverTicket calldata ticket,\\n uint256 redeemerRand,\\n User calldata receiver,\\n bytes calldata senderSig,\\n bytes calldata receiverSig\\n ) external;\\n}\\n\",\"keccak256\":\"0xb700a2d362f6a52195adf5c6e32668cbe0023aca2fa3e2562ebb94fa9c1ac0e0\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/payments/ticketing/IRewardsManager.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface IRewardsManager {\\n /**\\n * @dev This type will hold the necessary information for delegated stakers\\n * to make reward claims against their Node. Every Node will initialize\\n * and store a new Reward Pool for each epoch they participate in.\\n */\\n struct RewardPool {\\n // Tracks the balance of the reward pool owed to the stakers\\n uint256 stakersRewardTotal;\\n // Tracks the block number this reward pool was initialized\\n uint256 initializedAt;\\n // The total active stake for the node for will be the sum of the\\n // stakes owned by its delegators and the node's own stake.\\n uint256 totalActiveStake;\\n // track the cumulative reward factor as of the time the first ticket\\n // for this pool was redeemed\\n int128 initialCumulativeRewardFactor;\\n }\\n\\n struct LastClaim {\\n // The epoch the claim was made.\\n uint256 claimedAt;\\n // The stake at the time the claim was made. This is tracked as\\n // rewards can only be claimed after an epoch has ended, but the\\n // user's stake may have changed by then. This field tracks the\\n // staking value before the change so the reward for that epoch\\n // can be manually calculated.\\n uint256 stake;\\n }\\n\\n function getRewardPool(\\n uint256 epochId,\\n address stakee\\n ) external view returns (RewardPool memory);\\n\\n function getRewardPoolKey(uint256 epochId, address stakee) external pure returns (bytes32);\\n\\n function getRewardPoolStakersTotal(\\n uint256 epochId,\\n address stakee\\n ) external view returns (uint256);\\n\\n function getRewardPoolActiveStake(\\n uint256 epochId,\\n address stakee\\n ) external view returns (uint256);\\n\\n function getPendingRewards(address stakee) external view returns (uint256);\\n\\n function getLastClaim(address stakee, address staker) external view returns (LastClaim memory);\\n\\n function getTotalEpochRewards(uint256 epochId) external view returns (uint256);\\n\\n function getTotalEpochStakingRewards(uint256 epochId) external view returns (uint256);\\n\\n function initializeNextRewardPool(address stakee) external;\\n\\n function incrementRewardPool(address stakee, uint256 amount) external;\\n\\n function claimStakingRewards(address stakee) external returns (uint256);\\n\\n function updatePendingRewards(address stakee, address staker) external;\\n}\\n\",\"keccak256\":\"0x21b8d7f96073802ef4ec87fa15da5fcfd2c1d5e2bf9d6e17583406028e7b31d1\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/payments/ticketing/ITicketingParameters.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface ITicketingParameters {\\n function setFaceValue(uint256 _faceValue) external;\\n\\n function setBaseLiveWinProb(uint128 _baseLiveWinProb) external;\\n\\n function setExpiredWinProb(uint128 _expiredWinProb) external;\\n\\n function setDecayRate(uint32 _decayRate) external;\\n\\n function setTicketDuration(uint256 _ticketDuration) external;\\n\\n function getTicketingParameters()\\n external\\n view\\n returns (uint256, uint128, uint128, uint256, uint32);\\n}\\n\",\"keccak256\":\"0x6fa269d73176bd6543c190b070597fde50b91efdaa724b567bad29c9fbfa908a\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/staking/IDirectory.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface IDirectory {\\n /**\\n * @dev A DirectoryEntry will be stored for every node that joins the\\n * network in a specific epoch. The entry will contain the stakee's\\n * address, and a boundary value which is a sum of the current directory's\\n * total stake, and the current stakee's total stake.\\n */\\n struct DirectoryEntry {\\n address stakee;\\n uint256 boundary;\\n }\\n\\n /**\\n * @dev An EpochDirectory will be stored for every epoch. The\\n * directory will be constructed piece by piece as Nodes join,\\n * each adding their own directory entry based on their current\\n * stake value.\\n */\\n struct EpochDirectory {\\n DirectoryEntry[] entries;\\n mapping(address => uint256) stakes;\\n uint256 totalStake;\\n }\\n\\n function setCurrentDirectory(uint256 epochId) external;\\n\\n function joinNextDirectory(address stakee, uint256 seekerId) external;\\n\\n function scan(uint128 point) external view returns (address stakee);\\n\\n function scanWithEpochId(\\n uint128 point,\\n uint256 epochId\\n ) external view returns (address stakee);\\n\\n function getTotalStakeForStakee(\\n uint256 epochId,\\n address stakee\\n ) external view returns (uint256);\\n\\n function getTotalStake(uint256 epochId) external view returns (uint256);\\n\\n function getEntries(\\n uint256 epochId\\n ) external view returns (address[] memory, uint256[] memory);\\n}\\n\",\"keccak256\":\"0xfacfde1140082a99e6096222a0714bf9e532224a04c594096211c115ab4927f6\",\"license\":\"Apache-2.0\"},\"contracts/interfaces/staking/IStakingManager.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface IStakingManager {\\n /**\\n * For every Node, there will be a mapping of the staker to a\\n * StakeEntry. The stake entry tracks the amount of stake in SOLO,\\n * and also when the stake was updated.\\n */\\n struct StakeEntry {\\n uint256 amount;\\n // Block number this entry was updated at\\n uint256 updatedAt;\\n // Epoch this entry was updated. The stake will become active\\n // in the following epoch\\n uint256 epochId;\\n }\\n\\n /**\\n * Every Node must have stake in order to participate in the Epoch.\\n * Stake can be provided by the Node itself or by other accounts in\\n * the network.\\n */\\n struct Stake {\\n // Track each stake entry associated to a node\\n mapping(address => StakeEntry) stakeEntries;\\n // The total stake held by this contract for a node,\\n // which will be the sum of all addStake and unlockStake calls\\n uint256 totalManagedStake;\\n }\\n\\n /**\\n * This struct will track stake that is in the process of unlocking.\\n */\\n struct Unlock {\\n uint256 amount; // Amount of stake unlocking\\n uint256 unlockAt; // Block number the stake becomes withdrawable\\n }\\n\\n function setUnlockDuration(uint256 _unlockDuration) external;\\n\\n function setMinimumStakeProportion(uint32 _minimumStakeProportion) external;\\n\\n function addStake(uint256 amount, address stakee) external;\\n\\n function unlockStake(uint256 amount, address stakee) external returns (uint256);\\n\\n function withdrawStake(address stakee) external;\\n\\n function cancelUnlocking(uint256 amount, address stakee) external;\\n\\n function calculateCapacityFromSeekerPower(uint256 seekerId) external view returns (uint256);\\n\\n function calculateMaxAdditionalDelegatedStake(address stakee) external view returns (uint256);\\n\\n function getTotalManagedStake() external view returns (uint256);\\n\\n function getStakeEntry(\\n address stakee,\\n address staker\\n ) external view returns (StakeEntry memory);\\n\\n function getStakeeTotalManagedStake(address stakee) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xb3c89c77822db30a1382ec7d11902db579cd48acc36aef965a92b47f8e1164a3\",\"license\":\"Apache-2.0\"},\"contracts/libraries/Manageable.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an list of public managers who may be added or removed.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyManager`, which can be applied to your functions to restrict their use to\\n * other contracts which have explicitly been added.\\n */\\nabstract contract Manageable is Ownable2StepUpgradeable {\\n /**\\n * @dev Tracks the managers added to this contract, where they key is the\\n * address of the managing contract, and the value is the block the manager was added in.\\n * We use this mapping to restrict access to those functions in a similar\\n * fashion to the onlyOwner construct.\\n */\\n mapping(address => uint256) public managers;\\n\\n error OnlyManagers();\\n error ManagerCannotBeZeroAddress();\\n\\n /**\\n * @notice Adds a manager to this contract. Only callable by the owner.\\n * @param manager The address of the manager contract.\\n */\\n function addManager(address manager) external onlyOwner {\\n if (manager == address(0)) {\\n revert ManagerCannotBeZeroAddress();\\n }\\n managers[manager] = block.number;\\n }\\n\\n /**\\n * @notice Removes a manager from this contract. Only callable by the owner.\\n * @param manager The address of the manager contract.\\n */\\n function removeManager(address manager) external onlyOwner {\\n delete managers[manager];\\n }\\n\\n /**\\n * @dev This modifier allows us to specify that certain contracts have\\n * special privileges to call restricted functions.\\n */\\n modifier onlyManager() {\\n if (managers[msg.sender] == 0) {\\n revert OnlyManagers();\\n }\\n _;\\n }\\n\\n // Reserve storage slots for future variables\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xeaf4d3bf238df7e61eaf6903ba7ed54af58a17090fe6197aae3f62d025027db2\",\"license\":\"Apache-2.0\"},\"contracts/libraries/SyloUtils.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/utils/math/SafeCast.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\n\\nerror ContractNameCannotBeEmpty();\\nerror InterfaceIdCannotBeZeroBytes();\\nerror TargetContractCannotBeZeroAddress(string name);\\nerror TargetNotSupportInterface(string name, bytes4 interfaceId);\\n\\nlibrary SyloUtils {\\n /**\\n * @dev The maximum possible SYLO that exists in the network.\\n */\\n uint256 public constant MAX_SYLO = 10_000_000_000 ether;\\n\\n /**\\n * @dev Percentages are expressed as a ratio where 100000 is the denominator.\\n * A large denominator allows for more precision, e.g representing 12.5%\\n * can be done as 12500 / 100000\\n */\\n uint32 public constant PERCENTAGE_DENOMINATOR = 100000;\\n\\n /**\\n * @dev Multiply a value by a given percentage. Converts the provided\\n * uint128 value to uint256 to avoid any reverts on overflow.\\n * @param value The value to multiply.\\n * @param percentage The percentage, as a ratio of 10000.\\n */\\n function percOf(uint128 value, uint32 percentage) internal pure returns (uint256) {\\n return (uint256(value) * percentage) / PERCENTAGE_DENOMINATOR;\\n }\\n\\n /**\\n * @dev Return a fraction as a percentage.\\n * @param numerator The numerator limited to a uint128 value to prevent\\n * phantom overflow.\\n * @param denominator The denominator.\\n * @return The percentage, as a ratio of 10000.\\n */\\n function asPerc(uint128 numerator, uint256 denominator) internal pure returns (uint32) {\\n return SafeCast.toUint32((uint256(numerator) * PERCENTAGE_DENOMINATOR) / denominator);\\n }\\n\\n /**\\n * @dev Validate that a contract implements a given interface.\\n * @param name The name of the contract, used in error messages.\\n * @param target The address of the contract.\\n * @param interfaceId The interface ID to check.\\n */\\n function validateContractInterface(\\n string memory name,\\n address target,\\n bytes4 interfaceId\\n ) internal view {\\n if (bytes(name).length == 0) {\\n revert ContractNameCannotBeEmpty();\\n }\\n if (target == address(0)) {\\n revert TargetContractCannotBeZeroAddress(name);\\n }\\n if (interfaceId == bytes4(0)) {\\n revert InterfaceIdCannotBeZeroBytes();\\n }\\n if (!ERC165(target).supportsInterface(interfaceId)) {\\n revert TargetNotSupportInterface(name, interfaceId);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa5bb1a5b9f8135b5fec1dfa183fab8f6685a4eb6d9daba23864a7d49d01dc8a3\",\"license\":\"Apache-2.0\"},\"contracts/payments/SyloTicketing.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/math/SafeCast.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\n\\nimport \\\"../Registries.sol\\\";\\nimport \\\"../staking/Directory.sol\\\";\\nimport \\\"../libraries/SyloUtils.sol\\\";\\nimport \\\"../epochs/EpochsManager.sol\\\";\\nimport \\\"../staking/StakingManager.sol\\\";\\nimport \\\"./ticketing/RewardsManager.sol\\\";\\nimport \\\"../AuthorizedAccounts.sol\\\";\\nimport \\\"../interfaces/payments/ISyloTicketing.sol\\\";\\nimport \\\"../interfaces/IFuturePassRegistrar.sol\\\";\\n\\n/**\\n * @notice The SyloTicketing contract manages the Probabilistic\\n * Micro-Payment Ticketing system that pays Nodes for providing the\\n * Event Relay service.\\n */\\ncontract SyloTicketing is ISyloTicketing, Initializable, Ownable2StepUpgradeable, ERC165 {\\n /** ERC20 Sylo token contract.*/\\n IERC20 public _token;\\n\\n /** Sylo Registries contract */\\n Registries public _registries;\\n\\n /** Sylo Staking Manager contract */\\n StakingManager public _stakingManager;\\n\\n /** Sylo Directory contract */\\n Directory public _directory;\\n\\n /** Rewards Manager contract */\\n RewardsManager public _rewardsManager;\\n\\n /**\\n * @notice Sylo Epochs Manager.\\n * @dev The ticketing parameters used when redeeming tickets\\n * will be read from this contract.\\n */\\n EpochsManager public _epochsManager;\\n\\n /**\\n * @notice Sylo Authorized Accounts.\\n */\\n AuthorizedAccounts public _authorizedAccounts;\\n\\n /**\\n * @notice Futurepass Registrar Pre-compile.\\n */\\n IFuturePassRegistrar public _futurepassRegistrar;\\n\\n /**\\n * @notice The number of blocks a user must wait after calling \\\"unlock\\\"\\n * before they can withdraw their funds.\\n */\\n uint256 public unlockDuration;\\n\\n /** @notice Mapping of user deposits */\\n mapping(address => Deposit) public deposits;\\n\\n /** @notice Mapping of ticket hashes, used to check if a ticket has been redeemed */\\n mapping(bytes32 => bool) public usedTickets;\\n\\n event UnlockDurationUpdated(uint256 unlockDuration);\\n event SenderPenaltyBurnt(address sender);\\n event Redemption(\\n uint256 indexed epochId,\\n address indexed redeemer,\\n address indexed sender,\\n address receiver,\\n uint256 generationBlock,\\n uint256 amount\\n );\\n event MultiReceiverRedemption(\\n uint256 indexed epochId,\\n address indexed redeemer,\\n address indexed sender,\\n address receiver,\\n uint256 generationBlock,\\n uint256 amount\\n );\\n\\n error NoEsrowAndPenalty();\\n error UnlockingInProcess();\\n error UnlockingNotInProcess();\\n error UnlockingNotCompleted();\\n error EscrowAmountCannotBeZero();\\n error PenaltyAmountCannotBeZero();\\n error UnlockDurationCannotBeZero();\\n error AccountCannotBeZeroAddress();\\n error InvalidSenderSigningPermission();\\n error InvalidReceiverSigningPermission();\\n\\n error TicketNotWinning();\\n error MissingFuturepassAccount(address receiver);\\n error TicketAlreadyUsed();\\n error TicketEpochNotFound();\\n error TicketAlreadyRedeemed();\\n error RedeemerCommitMismatch();\\n error InvalidSenderSignature();\\n error InvalidReceiverSignature();\\n error TokenCannotBeZeroAddress();\\n error TicketNotCreatedInTheEpoch();\\n error TicketCannotBeFromFutureBlock();\\n error TicketSenderCannotBeZeroAddress();\\n error TicketReceiverCannotBeZeroAddress();\\n error TicketRedeemerCannotBeZeroAddress();\\n error RedeemerMustHaveJoinedEpoch(uint256 epochId);\\n\\n function initialize(\\n IERC20 token,\\n Registries registries,\\n StakingManager stakingManager,\\n Directory directory,\\n EpochsManager epochsManager,\\n RewardsManager rewardsManager,\\n AuthorizedAccounts authorizedAccounts,\\n IFuturePassRegistrar futurepassRegistrar,\\n uint256 _unlockDuration\\n ) external initializer {\\n if (address(token) == address(0)) {\\n revert TokenCannotBeZeroAddress();\\n }\\n\\n SyloUtils.validateContractInterface(\\n \\\"Registries\\\",\\n address(registries),\\n type(IRegistries).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"StakingManager\\\",\\n address(stakingManager),\\n type(IStakingManager).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"Directory\\\",\\n address(directory),\\n type(IDirectory).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"EpochsManager\\\",\\n address(epochsManager),\\n type(IEpochsManager).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"RewardsManager\\\",\\n address(rewardsManager),\\n type(IRewardsManager).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"AuthorizedAccounts\\\",\\n address(authorizedAccounts),\\n type(IAuthorizedAccounts).interfaceId\\n );\\n\\n if (_unlockDuration == 0) {\\n revert UnlockDurationCannotBeZero();\\n }\\n\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n _token = token;\\n _registries = registries;\\n _stakingManager = stakingManager;\\n _directory = directory;\\n _epochsManager = epochsManager;\\n _rewardsManager = rewardsManager;\\n _authorizedAccounts = authorizedAccounts;\\n _futurepassRegistrar = futurepassRegistrar;\\n\\n unlockDuration = _unlockDuration;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(ISyloTicketing).interfaceId;\\n }\\n\\n /**\\n * @notice Set the unlock duration for deposits. Only callable\\n * by the owner.\\n * @param _unlockDuration The unlock duration in blocks.\\n */\\n function setUnlockDuration(uint256 _unlockDuration) external onlyOwner {\\n if (_unlockDuration == 0) {\\n revert UnlockDurationCannotBeZero();\\n }\\n\\n unlockDuration = _unlockDuration;\\n emit UnlockDurationUpdated(_unlockDuration);\\n }\\n\\n /**\\n * @notice Use this function to deposit funds into the\\n * escrow. This will fail if the deposit is currently being\\n * unlocked.\\n * @param amount The amount in SOLO to add to the escrow.\\n * @param account The address of the account holding the escrow.\\n */\\n function depositEscrow(uint256 amount, address account) external {\\n if (amount == 0) {\\n revert EscrowAmountCannotBeZero();\\n }\\n if (account == address(0)) {\\n revert AccountCannotBeZeroAddress();\\n }\\n\\n Deposit storage deposit = getDeposit(account);\\n if (deposit.unlockAt != 0) {\\n revert UnlockingInProcess();\\n }\\n\\n deposit.escrow = deposit.escrow + amount;\\n\\n SafeERC20.safeTransferFrom(_token, msg.sender, address(this), amount);\\n }\\n\\n /**\\n * @notice Use this function to deposit funds into the\\n * penalty. This will fail if the deposit is currently being\\n * unlocked.\\n * @param amount The amount in SOLO to add to the escrow.\\n * @param account The address of the account holding the penalty.\\n */\\n function depositPenalty(uint256 amount, address account) external {\\n if (amount == 0) {\\n revert PenaltyAmountCannotBeZero();\\n }\\n if (account == address(0)) {\\n revert AccountCannotBeZeroAddress();\\n }\\n\\n Deposit storage deposit = getDeposit(account);\\n if (deposit.unlockAt != 0) {\\n revert UnlockingInProcess();\\n }\\n\\n deposit.penalty = deposit.penalty + amount;\\n\\n SafeERC20.safeTransferFrom(_token, msg.sender, address(this), amount);\\n }\\n\\n /**\\n * @notice Call this function to begin unlocking deposits. This function\\n * will fail if no deposit exists, or if the unlock process has\\n * already begun.\\n */\\n function unlockDeposits() external returns (uint256) {\\n Deposit storage deposit = getDeposit(msg.sender);\\n\\n if (deposit.escrow == 0 && deposit.penalty == 0) {\\n revert NoEsrowAndPenalty();\\n }\\n if (deposit.unlockAt != 0) {\\n revert UnlockingInProcess();\\n }\\n\\n deposit.unlockAt = block.number + unlockDuration;\\n\\n return deposit.unlockAt;\\n }\\n\\n /**\\n * @notice Call this function to cancel any deposit that is in the\\n * unlocking process.\\n */\\n function lockDeposits() external {\\n Deposit storage deposit = getDeposit(msg.sender);\\n if (deposit.unlockAt == 0) {\\n revert UnlockingNotInProcess();\\n }\\n\\n delete deposit.unlockAt;\\n }\\n\\n /**\\n * @notice Call this function once the unlock duration has\\n * elapsed in order to transfer the unlocked tokens to the caller's account.\\n */\\n function withdraw() external {\\n return withdrawTo(msg.sender);\\n }\\n\\n /**\\n * @notice Call this function once the unlock duration has\\n * elapsed in order to transfer the unlocked tokens to the specified\\n * account.\\n * @param account The address of the account the tokens should be\\n * transferred to.\\n */\\n function withdrawTo(address account) public {\\n Deposit memory deposit = getDeposit(msg.sender);\\n if (deposit.unlockAt == 0) {\\n revert UnlockingNotInProcess();\\n }\\n if (deposit.unlockAt >= block.number) {\\n revert UnlockingNotCompleted();\\n }\\n\\n uint256 amount = deposit.escrow + deposit.penalty;\\n\\n // Reset deposit values to 0\\n delete deposits[msg.sender];\\n\\n SafeERC20.safeTransfer(_token, account, amount);\\n }\\n\\n /**\\n * @notice Nodes should call this function on completing an event\\n * delivery. This function will fail if the ticket is invalid or if the\\n * ticket is not a winner. Clients should calculate if the ticket is a\\n * winner locally, but can also use the public view functions:\\n * `requireValidWinningTicket` and `isWinningTicket` to check that a ticket\\n * is winning.\\n * @param ticket The ticket issued by the sender.\\n * @param redeemerRand The redeemer random value, generated by the Node prior\\n * to performing the event relay.\\n * @param senderSig The signature of the sender of the ticket.\\n * @param receiverSig The signature of the redeemer of the ticket.\\n */\\n function redeem(\\n Ticket calldata ticket,\\n uint256 redeemerRand,\\n bytes calldata senderSig,\\n bytes calldata receiverSig\\n ) external {\\n EpochsManager.Epoch memory epoch = _epochsManager.getEpoch(ticket.epochId);\\n if (ticket.generationBlock > block.number) {\\n revert TicketCannotBeFromFutureBlock();\\n }\\n\\n bytes32 ticketHash = requireValidWinningTicket(\\n ticket,\\n redeemerRand,\\n senderSig,\\n receiverSig\\n );\\n\\n usedTickets[ticketHash] = true;\\n\\n uint256 directoryStake = _directory.getTotalStakeForStakee(\\n ticket.epochId,\\n ticket.redeemer\\n );\\n if (directoryStake == 0) {\\n revert RedeemerMustHaveJoinedEpoch(ticket.epochId);\\n }\\n\\n _redeem(epoch, ticket);\\n }\\n\\n /**\\n * @notice Nodes should call this function on completing a one-to-many event\\n * delivery. This function will fail if the ticket is invalid or if the\\n * ticket is not a winner. Additionally, the specified receiver must have\\n * a valid futurepass account associated with it. Clients should calculate\\n * if the ticket is a winner locally, but can also use the public view\\n * functions:\\n * `requireValidWinningMultiReceiverTicket` and `isWinningTicket` to check\\n * that a ticket is winning.\\n * @param ticket The ticket issued by the sender.\\n * @param redeemerRand The redeemer random value, generated by the Node prior\\n * to performing the event relay.\\n * @param receiver A valid receiver of the the relay.\\n * @param senderSig The signature of the sender of the ticket.\\n * @param receiverSig The signature of the redeemer of the ticket.\\n */\\n function redeemMultiReceiver(\\n MultiReceiverTicket calldata ticket,\\n uint256 redeemerRand,\\n User calldata receiver,\\n bytes calldata senderSig,\\n bytes calldata receiverSig\\n ) external {\\n EpochsManager.Epoch memory epoch = _epochsManager.getEpoch(ticket.epochId);\\n if (ticket.generationBlock > block.number) {\\n revert TicketCannotBeFromFutureBlock();\\n }\\n\\n (, bytes32 ticketReceiverHash) = requireValidWinningMultiReceiverTicket(\\n ticket,\\n receiver,\\n redeemerRand,\\n senderSig,\\n receiverSig\\n );\\n\\n usedTickets[ticketReceiverHash] = true;\\n\\n uint256 directoryStake = _directory.getTotalStakeForStakee(\\n ticket.epochId,\\n ticket.redeemer\\n );\\n if (directoryStake == 0) {\\n revert RedeemerMustHaveJoinedEpoch(ticket.epochId);\\n }\\n\\n _redeemMultiReceiver(epoch, ticket, receiver.main);\\n }\\n\\n function _redeem(EpochsManager.Epoch memory epoch, Ticket calldata ticket) internal {\\n uint256 rewardAmount = rewardRedeemer(epoch, ticket.sender, ticket.redeemer);\\n\\n emit Redemption(\\n ticket.epochId,\\n ticket.redeemer,\\n ticket.sender.main,\\n ticket.receiver.main,\\n ticket.generationBlock,\\n rewardAmount\\n );\\n }\\n\\n function _redeemMultiReceiver(\\n EpochsManager.Epoch memory epoch,\\n MultiReceiverTicket calldata ticket,\\n address receiver\\n ) internal {\\n uint256 rewardAmount = rewardRedeemer(epoch, ticket.sender, ticket.redeemer);\\n\\n emit MultiReceiverRedemption(\\n ticket.epochId,\\n ticket.redeemer,\\n ticket.sender.main,\\n receiver,\\n ticket.generationBlock,\\n rewardAmount\\n );\\n }\\n\\n function rewardRedeemer(\\n EpochsManager.Epoch memory epoch,\\n User calldata sender,\\n address redeemer\\n ) internal returns (uint256) {\\n Deposit storage deposit = getDeposit(sender.main);\\n\\n uint256 amount;\\n\\n if (epoch.faceValue > deposit.escrow) {\\n amount = deposit.escrow;\\n incrementRewardPool(redeemer, deposit, amount);\\n SafeERC20.safeTransfer(\\n _token,\\n address(0x000000000000000000000000000000000000dEaD),\\n deposit.penalty\\n );\\n\\n delete deposit.penalty;\\n emit SenderPenaltyBurnt(sender.main);\\n } else {\\n amount = epoch.faceValue;\\n incrementRewardPool(redeemer, deposit, amount);\\n }\\n\\n return amount;\\n }\\n\\n /**\\n * @notice Call this function to check if a ticket is valid and is\\n * a winning ticket. It will fail if the ticket is invalid or is not\\n * a winner. A ticket is invalid if:\\n * - The sender or redeemer addresses are null\\n * - The ticket has already been redeemed.\\n * - The secret random value of the sender does not match the commit\\n * in the ticket.\\n * - The signatures are invalid.\\n * @param ticket The ticket issued by the sender.\\n * @param redeemerRand The redeemer random value, generated by the Node prior\\n * to performing the event relay.\\n * @param senderSig The signature of the sender of the ticket.\\n * @param receiverSig The signature of the redeemer of the ticket.\\n * @return ticketHash The hash of the ticket. Should match the hash generated\\n * by `getTicketHash`.\\n */\\n function requireValidWinningTicket(\\n Ticket memory ticket,\\n uint256 redeemerRand,\\n bytes calldata senderSig,\\n bytes calldata receiverSig\\n ) public view returns (bytes32 ticketHash) {\\n if (ticket.sender.main == address(0)) {\\n revert TicketSenderCannotBeZeroAddress();\\n }\\n if (ticket.receiver.main == address(0)) {\\n revert TicketReceiverCannotBeZeroAddress();\\n }\\n if (ticket.redeemer == address(0)) {\\n revert TicketRedeemerCannotBeZeroAddress();\\n }\\n\\n ticketHash = getTicketHash(ticket);\\n if (usedTickets[ticketHash]) {\\n revert TicketAlreadyRedeemed();\\n }\\n\\n // validate the redeemer has knowledge of the redeemer rand\\n if (createCommit(ticket.generationBlock, redeemerRand) != ticket.redeemerCommit) {\\n revert RedeemerCommitMismatch();\\n }\\n\\n if (!hasSigningPermission(ticket.sender, ticket.generationBlock)) {\\n revert InvalidSenderSigningPermission();\\n }\\n if (!hasSigningPermission(ticket.receiver, ticket.generationBlock)) {\\n revert InvalidReceiverSigningPermission();\\n }\\n\\n if (!isValidTicketSig(ticket.sender, senderSig, ticketHash)) {\\n revert InvalidSenderSignature();\\n }\\n if (!isValidTicketSig(ticket.receiver, receiverSig, ticketHash)) {\\n revert InvalidReceiverSignature();\\n }\\n\\n if (\\n !isWinningTicket(\\n senderSig,\\n receiverSig,\\n ticket.epochId,\\n ticket.generationBlock,\\n redeemerRand\\n )\\n ) {\\n revert TicketNotWinning();\\n }\\n }\\n\\n /**\\n * @notice Call this function to check if a multi receiver ticket is valid and is\\n * a winning ticket. It will fail if the ticket is invalid or is not\\n * a winner. A ticket is invalid if:\\n * - The sender, receiver or redeemer addresses are null\\n * - The receiver does not have a valid futurepass account\\n * - The ticket has already been redeemed.\\n * - The secret random value of the redeemer does not match the commit\\n * in the ticket.\\n * - The signatures are invalid.\\n * @param ticket The ticket issued by the sender.\\n * @param receiver The receiver associated with the ticket.\\n * @param redeemerRand The redeemer random value, generated by the Node prior\\n * to performing the event relay.\\n * @param senderSig The signature of the sender of the ticket.\\n * @param receiverSig The signature of the redeemer of the ticket.\\n */\\n function requireValidWinningMultiReceiverTicket(\\n MultiReceiverTicket memory ticket,\\n User calldata receiver,\\n uint256 redeemerRand,\\n bytes calldata senderSig,\\n bytes calldata receiverSig\\n ) public view returns (bytes32 ticketHash, bytes32 ticketReceiverHash) {\\n if (ticket.sender.main == address(0)) {\\n revert TicketSenderCannotBeZeroAddress();\\n }\\n if (receiver.main == address(0)) {\\n revert TicketReceiverCannotBeZeroAddress();\\n }\\n if (ticket.redeemer == address(0)) {\\n revert TicketRedeemerCannotBeZeroAddress();\\n }\\n\\n address futurepassAccount = _futurepassRegistrar.futurepassOf(receiver.main);\\n if (futurepassAccount == address(0)) {\\n revert MissingFuturepassAccount(receiver.main);\\n }\\n\\n // There are two hashes create. The first hash is signed by the\\n // sender and receiver, and is primarily used to validate these actors\\n // agreed on the contents of the ticket.\\n // The second hash is to prevent re-use. In a multi-receiver context,\\n // the same ticket can be re-used amongst many receiver, but should\\n // only be used ONCE per futurepass account. Thus the second hash\\n // additionally appends the futurepass address as well.\\n ticketHash = getMultiReceiverTicketHash(ticket);\\n ticketReceiverHash = keccak256(abi.encodePacked(ticketHash, futurepassAccount));\\n if (usedTickets[ticketReceiverHash]) {\\n revert TicketAlreadyRedeemed();\\n }\\n\\n // validate the redeemer has knowledge of the redeemer rand\\n if (createCommit(ticket.generationBlock, redeemerRand) != ticket.redeemerCommit) {\\n revert RedeemerCommitMismatch();\\n }\\n\\n if (!hasSigningPermission(ticket.sender, ticket.generationBlock)) {\\n revert InvalidSenderSigningPermission();\\n }\\n if (!hasSigningPermission(receiver, ticket.generationBlock)) {\\n revert InvalidReceiverSigningPermission();\\n }\\n\\n if (!isValidTicketSig(ticket.sender, senderSig, ticketHash)) {\\n revert InvalidSenderSignature();\\n }\\n if (!isValidTicketSig(receiver, receiverSig, ticketHash)) {\\n revert InvalidReceiverSignature();\\n }\\n\\n if (\\n !isWinningTicket(\\n senderSig,\\n receiverSig,\\n ticket.epochId,\\n ticket.generationBlock,\\n redeemerRand\\n )\\n ) {\\n revert TicketNotWinning();\\n }\\n\\n return (ticketHash, ticketReceiverHash);\\n }\\n\\n function hasSigningPermission(\\n User memory user,\\n uint256 generationBlock\\n ) internal view returns (bool) {\\n if (user.delegated == address(0)) {\\n return true;\\n }\\n\\n IAuthorizedAccounts.Permission permission = IAuthorizedAccounts.Permission.PersonalSign;\\n return\\n _authorizedAccounts.validatePermission(\\n user.main,\\n user.delegated,\\n permission,\\n generationBlock\\n );\\n }\\n\\n function createCommit(uint256 generationBlock, uint256 rand) public pure returns (bytes32) {\\n return keccak256(abi.encodePacked(keccak256(abi.encodePacked(generationBlock, rand))));\\n }\\n\\n function getDeposit(address account) private view returns (Deposit storage) {\\n return deposits[account];\\n }\\n\\n function isValidTicketSig(\\n User memory user,\\n bytes memory sig,\\n bytes32 ticketHash\\n ) internal pure returns (bool) {\\n address signer = address(0);\\n if (user.delegated != address(0)) {\\n signer = user.delegated;\\n } else {\\n signer = user.main;\\n }\\n bytes32 ethHash = ECDSA.toEthSignedMessageHash(ticketHash);\\n return ECDSA.recover(ethHash, sig) == signer;\\n }\\n\\n /**\\n * @notice Use this function to check if a ticket is winning.\\n * @param senderSig The signature of the sender of the ticket.\\n * @param receiverSig The signature of the receiver of the ticket.\\n * @param epochId The epochId of the ticket.\\n * @param generationBlock The generationBlock of the ticket.\\n * @param redeemerRand The redeemer random value, generated by the Node prior\\n * to performing the event relay.\\n * @return True if a ticket is a winner.\\n */\\n function isWinningTicket(\\n bytes memory senderSig,\\n bytes memory receiverSig,\\n uint256 epochId,\\n uint256 generationBlock,\\n uint256 redeemerRand\\n ) public view returns (bool) {\\n uint256 winProb = calculateWinningProbability(epochId, generationBlock);\\n // bitshift the winProb to a 256 bit value to allow comparison to a 32 byte hash\\n uint256 prob = (uint256(winProb) << 128) | uint256(winProb);\\n return uint256(keccak256(abi.encodePacked(senderSig, receiverSig, redeemerRand))) < prob;\\n }\\n\\n /**\\n * @notice This function calculates the probability of a ticket winning at\\n * the block that this function was called. A ticket's winning probability\\n * will decay every block since its issuance. The amount of decay will depend\\n * on the decay rate parameter of the epoch the ticket was generated in.\\n * @param epochId The epochId of the ticket.\\n * @param generationBlock The generationBlock of the ticket.\\n */\\n function calculateWinningProbability(\\n uint256 epochId,\\n uint256 generationBlock\\n ) public view returns (uint128) {\\n EpochsManager.Epoch memory epoch = _epochsManager.getEpoch(epochId);\\n if (epoch.startBlock == 0) {\\n revert TicketEpochNotFound();\\n }\\n\\n if (\\n generationBlock < epoch.startBlock ||\\n (epoch.endBlock > 0 && generationBlock >= epoch.endBlock)\\n ) {\\n revert TicketNotCreatedInTheEpoch();\\n }\\n\\n uint256 elapsedDuration = block.number - generationBlock;\\n\\n // Ticket has completely expired\\n if (elapsedDuration >= epoch.ticketDuration) {\\n return 0;\\n }\\n\\n uint256 maxDecayValue = SyloUtils.percOf(epoch.baseLiveWinProb, epoch.decayRate);\\n\\n // determine the amount of probability that has actually decayed\\n // by multiplying the maximum decay value against ratio of the tickets elapsed duration\\n // vs the actual ticket duration. The max decay value is calculated from a fraction of a\\n // uint128 value so we cannot phantom overflow here\\n uint256 decayedProbability = (maxDecayValue * elapsedDuration) / epoch.ticketDuration;\\n\\n // calculate the remaining probability by subtracting the decayed probability\\n // from the base\\n return epoch.baseLiveWinProb - SafeCast.toUint128(decayedProbability);\\n }\\n\\n /**\\n * @notice Returns the hash of the ticket. Takes all fields in a ticket\\n * as inputs to the hash.\\n * @return A byte-array representing the hash.\\n */\\n function getTicketHash(Ticket memory ticket) public pure returns (bytes32) {\\n return\\n keccak256(\\n abi.encodePacked(\\n ticket.epochId,\\n ticket.sender.main,\\n ticket.receiver.main,\\n ticket.redeemer,\\n ticket.generationBlock,\\n ticket.redeemerCommit\\n )\\n );\\n }\\n\\n /**\\n * @notice Returns the hash of a multi receiver ticket. Takes all fields in\\n * a ticket as inputs to the hash, as well as a specific receiver.\\n * @return A byte-array representing the hash.\\n */\\n function getMultiReceiverTicketHash(\\n MultiReceiverTicket memory ticket\\n ) public pure returns (bytes32) {\\n return\\n keccak256(\\n abi.encodePacked(\\n ticket.epochId,\\n ticket.sender.main,\\n ticket.redeemer,\\n ticket.generationBlock,\\n ticket.redeemerCommit\\n )\\n );\\n }\\n\\n function incrementRewardPool(\\n address stakee,\\n Deposit storage deposit,\\n uint256 amount\\n ) internal {\\n deposit.escrow = deposit.escrow - amount;\\n\\n SafeERC20.safeTransfer(_token, address(_rewardsManager), amount);\\n _rewardsManager.incrementRewardPool(stakee, amount);\\n }\\n}\\n\",\"keccak256\":\"0xd00ea66ee67159b1007b95285b5fb2904ccea3a90afb2650ce08fb626b10256f\",\"license\":\"Apache-2.0\"},\"contracts/payments/ticketing/RewardsManager.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"abdk-libraries-solidity/ABDKMath64x64.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/math/SafeCast.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\n\\nimport \\\"../../libraries/SyloUtils.sol\\\";\\nimport \\\"../../libraries/Manageable.sol\\\";\\nimport \\\"../../epochs/EpochsManager.sol\\\";\\nimport \\\"../../staking/StakingManager.sol\\\";\\nimport \\\"../../interfaces/epochs/IEpochsManager.sol\\\";\\nimport \\\"../../interfaces/staking/IStakingManager.sol\\\";\\nimport \\\"../../interfaces/payments/ticketing/IRewardsManager.sol\\\";\\n\\n/**\\n * @notice Handles epoch based reward pools that are incremented from redeeming tickets.\\n * Nodes use this contract to set up their reward pool for the next epoch,\\n * and stakers use this contract to track and claim staking rewards.\\n * @dev After deployment, the SyloTicketing contract should be\\n * set up as a manager to be able to call certain restricted functions.\\n */\\ncontract RewardsManager is IRewardsManager, Initializable, Manageable, ERC165 {\\n uint256 internal constant ONE_SYLO = 1 ether;\\n\\n // 64x64 Fixed point representation of 1 SYLO (10**18 >> 64)\\n int128 internal constant ONE_SYLO_FIXED = 18446744073709551616000000000000000000;\\n\\n uint256 internal constant MAX_INT64 = 9223372036854775807;\\n\\n /** ERC20 Sylo token contract. */\\n IERC20 public _token;\\n\\n /** Sylo Staking Manager contract. */\\n StakingManager public _stakingManager;\\n\\n /** Sylo Epochs Manager. */\\n EpochsManager public _epochsManager;\\n\\n /**\\n * @dev Each node will manage a cumulative reward factor (CRF) that is incremented\\n * whenever a ticket is redeemed. This factor acts as a single value\\n * that can be used to calculate any particular staker's reward share. This\\n * prevents the need to individually track each staker's proportion, and also allows\\n * a claim calculation to be performed without iterating through every epoch.\\n *\\n * The CRF is calculated as CRF = CRF + Reward / TotalStake.\\n */\\n mapping(address => int128) private cumulativeRewardFactors;\\n\\n /**\\n * @notice Tracks the last epoch a delegated staker made a reward claim in.\\n * The key to this mapping is a hash of the Node's address and the delegated\\n * stakers address.\\n */\\n mapping(bytes32 => LastClaim) public lastClaims;\\n\\n /**\\n * @notice Tracks each Nodes total pending rewards in SOLOs. This\\n * value is accumulated as Node's redeem tickets. Rewards are pending if the\\n * distribution amongst the stakers has not been accounted for yet. Pending rewards\\n * are transferred to unclaimed rewards once the the staker's share has been\\n * calculated.\\n */\\n mapping(address => uint256) public pendingRewards;\\n\\n /**\\n * @notice Tracks rewards for stakers after the stakers share has been calculated,\\n * but has not actually been claimed by the staker.\\n * The node fee reward is also added to the node's unclaimedStakingRewards.\\n */\\n mapping(bytes32 => uint256) public unclaimedStakingRewards;\\n\\n /**\\n * @notice Tracks each Node's most recently active reward pool\\n */\\n mapping(address => uint256) public latestActiveRewardPools;\\n\\n /**\\n * @notice Tracks total accumulated rewards in each epoch\\n */\\n mapping(uint256 => uint256) public totalEpochRewards;\\n\\n /**\\n * @notice Tracks total accumulated staking rewards in each epoch\\n */\\n mapping(uint256 => uint256) public totalEpochStakingRewards;\\n\\n /**\\n * @notice Tracks each reward pool initialized by a Node. The key to this map\\n * is derived from the epochId and the Node's address.\\n */\\n mapping(bytes32 => RewardPool) public rewardPools;\\n\\n error NoRewardToClaim();\\n error AmountCannotBeZero();\\n error RewardPoolNotExist();\\n error RewardPoolAlreadyExist();\\n error DoNotAllowZeroAddress();\\n error TokenCannotBeZeroAddress();\\n error NoStakeToCreateRewardPool();\\n error StakeeCannotBeZeroAddress();\\n error StakerCannotBeZeroAddress();\\n error StakerKeyCannotBeZeroBytes();\\n error InvalidFixedPointResult();\\n\\n function initialize(\\n IERC20 token,\\n StakingManager stakingManager,\\n EpochsManager epochsManager\\n ) external initializer {\\n if (address(token) == address(0)) {\\n revert TokenCannotBeZeroAddress();\\n }\\n\\n SyloUtils.validateContractInterface(\\n \\\"StakingManager\\\",\\n address(stakingManager),\\n type(IStakingManager).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"EpochsManager\\\",\\n address(epochsManager),\\n type(IEpochsManager).interfaceId\\n );\\n\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n _token = token;\\n _epochsManager = epochsManager;\\n _stakingManager = stakingManager;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IRewardsManager).interfaceId;\\n }\\n\\n /**\\n * @notice Returns the key used to index a reward pool. The key is a hash of\\n * the epochId and Node's address.\\n * @param epochId The epoch ID the reward pool was created in.\\n * @param stakee The address of the Node.\\n * @return A byte-array representing the reward pool key.\\n */\\n function getRewardPoolKey(uint256 epochId, address stakee) public pure returns (bytes32) {\\n return keccak256(abi.encodePacked(epochId, stakee));\\n }\\n\\n /**\\n * @notice Returns the key used to index staking claims. The key is a hash of\\n * the Node's address and the staker's address.\\n * @param stakee The address of the Node.\\n * @param staker The address of the stake.\\n * @return A byte-array representing the key.\\n */\\n function getStakerKey(address stakee, address staker) public pure returns (bytes32) {\\n return keccak256(abi.encodePacked(stakee, staker));\\n }\\n\\n /**\\n * @notice Retrieve the reward pool initialized by the given node, at the specified\\n * epoch.\\n * @param epochId The ID of the epoch the reward pool was initialized in.\\n * @param stakee The address of the Node.\\n * @return The reward pool.\\n */\\n function getRewardPool(\\n uint256 epochId,\\n address stakee\\n ) external view returns (RewardPool memory) {\\n return rewardPools[getRewardPoolKey(epochId, stakee)];\\n }\\n\\n /**\\n * @notice Retrieve the total accumulated reward that will be distributed to a Node's\\n * delegated stakers for a given epoch.\\n * @param epochId The ID of the epoch the reward pool was initialized in.\\n * @param stakee The address of the Node.\\n * @return The total accumulated staker reward in SOLO.\\n */\\n function getRewardPoolStakersTotal(\\n uint256 epochId,\\n address stakee\\n ) external view returns (uint256) {\\n return rewardPools[getRewardPoolKey(epochId, stakee)].stakersRewardTotal;\\n }\\n\\n /**\\n * @notice Retrieve the total active stake that will be used for a Node's reward\\n * pool in a given epoch.\\n * @param epochId The ID of the epoch the reward pool was initialized in.\\n * @param stakee The address of the Node.\\n * @return The total active stake for that reward pool in SOLO.\\n */\\n function getRewardPoolActiveStake(\\n uint256 epochId,\\n address stakee\\n ) external view returns (uint256) {\\n return rewardPools[getRewardPoolKey(epochId, stakee)].totalActiveStake;\\n }\\n\\n /**\\n * @notice Retrieve the total pending staking reward allocated to a Node's\\n * stakers.\\n * @param stakee The address of the Node.\\n * @return The total pending staking reward in SOLO.\\n */\\n function getPendingRewards(address stakee) external view returns (uint256) {\\n return pendingRewards[stakee];\\n }\\n\\n /**\\n * @notice Retrieves the ID of the epoch in which a staker last made their\\n * staking claim.\\n * @param stakee The address of the Node.\\n * @param staker The address of the staker.\\n * @return The ID of the epoch.\\n */\\n function getLastClaim(\\n address stakee,\\n address staker\\n ) external view returns (LastClaim memory) {\\n return lastClaims[getStakerKey(stakee, staker)];\\n }\\n\\n /**\\n * @notice Retrieves the total accumulated rewards for a specific epoch.\\n * @param epochId The epoch id.\\n * @return The total reward in that epoch, including staking rewards and fee\\n * reward.\\n */\\n function getTotalEpochRewards(uint256 epochId) external view returns (uint256) {\\n return totalEpochRewards[epochId];\\n }\\n\\n /**\\n * @notice Retrieves the total accumulated rewards for stakers in a specific epoch.\\n * @param epochId The epoch id.\\n * @return The total staking reward in that epoch.\\n */\\n function getTotalEpochStakingRewards(uint256 epochId) external view returns (uint256) {\\n return totalEpochStakingRewards[epochId];\\n }\\n\\n /**\\n * @notice This is used by Nodes to initialize their reward pool for\\n * the next epoch. This function will revert if the caller has no stake, or\\n * if the reward pool has already been initialized. The total active stake\\n * for the next reward pool is calculated by summing up the total managed\\n * stake held by the RewardsManager contract.\\n */\\n function initializeNextRewardPool(address stakee) external onlyManager {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n\\n uint256 nextEpochId = _epochsManager.getNextEpochId();\\n\\n RewardPool storage nextRewardPool = rewardPools[getRewardPoolKey(nextEpochId, stakee)];\\n if (nextRewardPool.initializedAt != 0) {\\n revert RewardPoolAlreadyExist();\\n }\\n\\n uint256 totalStake = _stakingManager.getStakeeTotalManagedStake(stakee);\\n if (totalStake == 0) {\\n revert NoStakeToCreateRewardPool();\\n }\\n\\n nextRewardPool.totalActiveStake = totalStake;\\n\\n nextRewardPool.initializedAt = block.number;\\n }\\n\\n /**\\n * @dev This function should be called by the Ticketing contract when a\\n * ticket is successfully redeemed. The face value of the ticket\\n * should be split between incrementing the node's reward balance,\\n * and the reward balance for the node's delegated stakers. The face value\\n * will be added to the current reward pool's balance. This function will\\n * fail if the Ticketing contract has not been set as a manager.\\n * @param stakee The address of the Node.\\n * @param amount The face value of the ticket in SOLO.\\n */\\n function incrementRewardPool(address stakee, uint256 amount) external onlyManager {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n if (amount == 0) {\\n revert AmountCannotBeZero();\\n }\\n\\n (uint256 epochId, IEpochsManager.Epoch memory currentEpoch) = _epochsManager\\n .getCurrentActiveEpoch();\\n\\n RewardPool storage rewardPool = rewardPools[getRewardPoolKey(epochId, stakee)];\\n if (rewardPool.initializedAt == 0) {\\n revert RewardPoolNotExist();\\n }\\n\\n // Update the latest active reward pool for the node to be this pool\\n if (latestActiveRewardPools[stakee] < epochId) {\\n latestActiveRewardPools[stakee] = epochId;\\n }\\n\\n uint256 stakersReward = SyloUtils.percOf(\\n SafeCast.toUint128(amount),\\n currentEpoch.defaultPayoutPercentage\\n );\\n\\n // transfer the node's fee reward to it's unclaimed reward value\\n unclaimedStakingRewards[getStakerKey(stakee, stakee)] =\\n unclaimedStakingRewards[getStakerKey(stakee, stakee)] +\\n (amount - stakersReward);\\n\\n // update the value of the reward owed to the stakers\\n pendingRewards[stakee] = pendingRewards[stakee] + stakersReward;\\n\\n // if this is the first ticket redeemed for this reward, set the initial\\n // CRF value for this pool\\n if (rewardPool.stakersRewardTotal == 0) {\\n rewardPool.initialCumulativeRewardFactor = cumulativeRewardFactors[stakee];\\n }\\n\\n rewardPool.stakersRewardTotal = rewardPool.stakersRewardTotal + stakersReward;\\n\\n // We preemptively prevent an overflow revert with the abdk library.\\n // Dividing the stakers reward with the pool's total active\\n // stake may produce a value that is greater than the maximum possible\\n // 64.64 fixed point value.\\n // This error is incredibly niche and unlikely to happen, so we just\\n // revert here as well (with a named error) and remediation involves\\n // just increasing the amount of stake a node has.\\n if (rewardPool.totalActiveStake * MAX_INT64 < stakersReward) {\\n revert InvalidFixedPointResult();\\n }\\n\\n cumulativeRewardFactors[stakee] = ABDKMath64x64.add(\\n cumulativeRewardFactors[stakee],\\n ABDKMath64x64.div(\\n toFixedPointSYLO(stakersReward),\\n toFixedPointSYLO(rewardPool.totalActiveStake)\\n )\\n );\\n\\n totalEpochRewards[epochId] = totalEpochRewards[epochId] + amount;\\n totalEpochStakingRewards[epochId] = totalEpochStakingRewards[epochId] + stakersReward;\\n }\\n\\n /**\\n * @dev This function utilizes the cumulative reward factors, and the staker's\\n * value in stake to calculate the staker's share of the pending reward.\\n */\\n function calculatePendingClaim(\\n bytes32 stakerKey,\\n address stakee,\\n address staker\\n ) internal view returns (uint256) {\\n uint256 claim = calculateInitialClaim(stakerKey, stakee);\\n\\n // find the first reward pool where their stake was active and had\\n // generated rewards\\n uint256 activeAt;\\n RewardPool memory initialActivePool;\\n\\n uint256 currentEpochId = _epochsManager.currentIteration();\\n\\n for (uint256 i = lastClaims[stakerKey].claimedAt + 1; i < currentEpochId; ++i) {\\n initialActivePool = rewardPools[getRewardPoolKey(i, stakee)];\\n // check if node initialized a reward pool for this epoch and\\n // gained rewards\\n if (initialActivePool.initializedAt > 0 && initialActivePool.stakersRewardTotal > 0) {\\n activeAt = i;\\n break;\\n }\\n }\\n\\n if (activeAt == 0) {\\n return claim;\\n }\\n\\n IStakingManager.StakeEntry memory stakeEntry = _stakingManager.getStakeEntry(\\n stakee,\\n staker\\n );\\n\\n // We convert the staker amount to SYLO as the maximum uint256 value that\\n // can be used for the fixed point representation is 2^64-1.\\n int128 initialStake = toFixedPointSYLO(stakeEntry.amount);\\n\\n int128 initialCumulativeRewardFactor = initialActivePool.initialCumulativeRewardFactor;\\n\\n int128 finalCumulativeRewardFactor = getFinalCumulativeRewardFactor(\\n stakee,\\n currentEpochId\\n );\\n\\n return\\n claim +\\n fromFixedPointSYLO(\\n ABDKMath64x64.mul(\\n initialStake,\\n ABDKMath64x64.sub(finalCumulativeRewardFactor, initialCumulativeRewardFactor)\\n )\\n );\\n }\\n\\n /**\\n * Manually calculates the reward claim for the first epoch the claim is being\\n * made for. This manual calculation is necessary as claims are only made up\\n * to the previous epoch.\\n */\\n function calculateInitialClaim(\\n bytes32 stakerKey,\\n address stakee\\n ) internal view returns (uint256) {\\n LastClaim memory lastClaim = lastClaims[stakerKey];\\n\\n // if we have already made a claim up to the previous epoch, then\\n // there is no need to calculate the initial claim\\n if (_epochsManager.currentIteration() == lastClaim.claimedAt) {\\n return 0;\\n }\\n\\n RewardPool memory firstRewardPool = rewardPools[\\n getRewardPoolKey(lastClaim.claimedAt, stakee)\\n ];\\n\\n // if there was no reward pool initialized for the first epoch,\\n // then there is no need to calculate the initial claim\\n if (firstRewardPool.totalActiveStake == 0) {\\n return 0;\\n }\\n\\n return\\n (firstRewardPool.stakersRewardTotal * lastClaim.stake) /\\n firstRewardPool.totalActiveStake;\\n }\\n\\n /**\\n * Determines the cumulative reward factor to use for claim calculations. The\\n * CRF will depend on when the Node last initialized a reward pool, and also when\\n * the staker last made their claim.\\n */\\n function getFinalCumulativeRewardFactor(\\n address stakee,\\n uint256 currentEpochId\\n ) internal view returns (int128) {\\n int128 finalCumulativeRewardFactor;\\n\\n // Get the cumulative reward factor for the Node\\n // for the start of this epoch, since we only perform\\n // calculations up to the end of the previous epoch.\\n if (latestActiveRewardPools[stakee] < currentEpochId) {\\n // If the Node has not been active, then the final\\n // cumulative reward factor will just be the current one.\\n finalCumulativeRewardFactor = cumulativeRewardFactors[stakee];\\n } else {\\n // We are calculating the claim for an active epoch, the\\n // final cumulative reward factor will be taken from the start of this\\n // epoch (end of previous epoch).\\n RewardPool storage latestRewardPool = rewardPools[\\n getRewardPoolKey(latestActiveRewardPools[stakee], stakee)\\n ];\\n finalCumulativeRewardFactor = latestRewardPool.initialCumulativeRewardFactor;\\n }\\n\\n return finalCumulativeRewardFactor;\\n }\\n\\n /**\\n * @notice Call this function to calculate the total reward owed to a staker.\\n * This value will include all epochs since the last claim was made up to\\n * the previous epoch. This will also add any pending rewards to the\\n * final value as well.\\n * @dev This function will utilize the cumulative reward factor to perform the\\n * calculation, keeping the gas cost scaling of this function to a constant value.\\n * @param stakee The address of the Node.\\n * @param staker The address of the staker.\\n * @return The value of the reward owed to the staker in SOLO.\\n */\\n function calculateStakerClaim(address stakee, address staker) public view returns (uint256) {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n if (staker == address(0)) {\\n revert StakerCannotBeZeroAddress();\\n }\\n\\n bytes32 stakerKey = getStakerKey(stakee, staker);\\n uint256 pendingClaim = calculatePendingClaim(stakerKey, stakee, staker);\\n\\n return pendingClaim + unclaimedStakingRewards[stakerKey];\\n }\\n\\n /**\\n * Helper function to convert a uint256 value in SOLOs to a 64.64 fixed point\\n * representation in SYLOs while avoiding any possibility of overflow.\\n * Any remainders from converting SOLO to SYLO is explicitly handled to mitigate\\n * precision loss. The error when using this function is [-1/2^64, 0].\\n */\\n function toFixedPointSYLO(uint256 amount) internal pure returns (int128) {\\n int128 fullSylos = ABDKMath64x64.fromUInt(amount / ONE_SYLO);\\n int128 fracSylos = ABDKMath64x64.fromUInt(amount % ONE_SYLO); // remainder\\n\\n return ABDKMath64x64.add(fullSylos, ABDKMath64x64.div(fracSylos, ONE_SYLO_FIXED));\\n }\\n\\n /**\\n * Helper function to convert a 64.64 fixed point value in SYLOs to a uint256\\n * representation in SOLOs while avoiding any possibility of overflow.\\n */\\n function fromFixedPointSYLO(int128 amount) internal pure returns (uint256) {\\n uint256 fullSylos = ABDKMath64x64.toUInt(amount);\\n uint256 fullSolos = fullSylos * ONE_SYLO;\\n\\n // calculate the value lost when converting the fixed point amount to a uint\\n int128 fracSylos = ABDKMath64x64.sub(amount, ABDKMath64x64.fromUInt(fullSylos));\\n uint256 fracSolos = ABDKMath64x64.toUInt(ABDKMath64x64.mul(fracSylos, ONE_SYLO_FIXED));\\n\\n return fullSolos + fracSolos;\\n }\\n\\n /**\\n * @notice Call this function to claim rewards as a staker. The\\n * SYLO tokens will be transferred to the caller's account. This function will\\n * fail if there exists no reward to claim. Note: Calling this will remove\\n * the current unclaimed reward from being used as stake in the next round.\\n * @param stakee The address of the Node to claim against.\\n */\\n function claimStakingRewards(address stakee) external returns (uint256) {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n\\n bytes32 stakerKey = getStakerKey(stakee, msg.sender);\\n uint256 pendingReward = calculatePendingClaim(stakerKey, stakee, msg.sender);\\n\\n uint256 totalClaim = pendingReward + unclaimedStakingRewards[stakerKey];\\n if (totalClaim == 0) {\\n revert NoRewardToClaim();\\n }\\n\\n delete unclaimedStakingRewards[stakerKey];\\n pendingRewards[stakee] = pendingRewards[stakee] - pendingReward;\\n\\n updateLastClaim(stakee, msg.sender);\\n\\n SafeERC20.safeTransfer(_token, msg.sender, totalClaim);\\n\\n return totalClaim;\\n }\\n\\n /**\\n * @notice This is called by the staking manager to transfer pending rewards\\n * to unclaimed rewards for a staker. This is required as the last used CRF\\n * needs to be updated whenever stake changes.\\n */\\n function updatePendingRewards(address stakee, address staker) external onlyManager {\\n bytes32 stakerKey = getStakerKey(stakee, staker);\\n uint256 pendingReward = calculatePendingClaim(stakerKey, stakee, staker);\\n\\n pendingRewards[stakee] = pendingRewards[stakee] - pendingReward;\\n\\n unclaimedStakingRewards[stakerKey] = unclaimedStakingRewards[stakerKey] + pendingReward;\\n\\n updateLastClaim(stakee, staker);\\n }\\n\\n function updateLastClaim(address stakee, address staker) internal {\\n IStakingManager.StakeEntry memory stakeEntry = _stakingManager.getStakeEntry(\\n stakee,\\n staker\\n );\\n lastClaims[getStakerKey(stakee, staker)] = LastClaim(\\n _epochsManager.currentIteration(),\\n stakeEntry.amount\\n );\\n }\\n}\\n\",\"keccak256\":\"0x906af015c975637b6a99d70795b0652f6e28aaa66e5c64a4bae34bff14c99551\",\"license\":\"Apache-2.0\"},\"contracts/payments/ticketing/TicketingParameters.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\n\\nimport \\\"../../libraries/SyloUtils.sol\\\";\\nimport \\\"../../interfaces/payments/ticketing/ITicketingParameters.sol\\\";\\n\\n/**\\n * @dev Persists the parameters for the ticketing mechanism. This contract is\\n * read by the EpochManager. Extracting the parameters into another\\n * contract is necessary to avoid a cyclic dependency between the ticketing\\n * and epoch contracts.\\n */\\ncontract TicketingParameters is\\n ITicketingParameters,\\n Initializable,\\n Ownable2StepUpgradeable,\\n ERC165\\n{\\n /** @notice The value of a winning ticket in SOLO. */\\n uint256 public faceValue;\\n\\n /**\\n * @notice The probability of a ticket winning during the start of its lifetime.\\n * This is a uint128 value representing the numerator in the probability\\n * ratio where 2^128 - 1 is the denominator.\\n */\\n uint128 public baseLiveWinProb;\\n\\n /**\\n * @notice The probability of a ticket winning after it has expired.\\n * This is a uint128 value representing the numerator in the probability\\n * ratio where 2^128 - 1 is the denominator. Note: Redeeming expired\\n * tickets is currently not supported.\\n */\\n uint128 public expiredWinProb;\\n\\n /**\\n * @notice The length in blocks before a ticket is considered expired.\\n * The default initialization value is 80,000. This equates\\n * to roughly two weeks (15s per block).\\n */\\n uint256 public ticketDuration;\\n\\n /**\\n * @notice A percentage value representing the proportion of the base win\\n * probability that will be decayed once a ticket has expired.\\n * Example: 80% decayRate indicates that a ticket will decay down to 20% of its\\n * base win probability upon reaching the block before its expiry.\\n * The value is expressed as a fraction of 100000.\\n */\\n uint32 public decayRate;\\n\\n event FaceValueUpdated(uint256 faceValue);\\n event BaseLiveWinProbUpdated(uint128 baseLiveWinprob);\\n event ExpiredWinProbUpdated(uint128 expiredWinProb);\\n event TicketDurationUpdated(uint256 ticketDuration);\\n event DecayRateUpdated(uint32 decayRate);\\n\\n error FaceValueCannotBeZero();\\n error TicketDurationCannotBeZero();\\n\\n function initialize(\\n uint256 _faceValue,\\n uint128 _baseLiveWinProb,\\n uint128 _expiredWinProb,\\n uint32 _decayRate,\\n uint256 _ticketDuration\\n ) external initializer {\\n if (_faceValue == 0) {\\n revert FaceValueCannotBeZero();\\n }\\n if (_ticketDuration == 0) {\\n revert TicketDurationCannotBeZero();\\n }\\n\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n faceValue = _faceValue;\\n baseLiveWinProb = _baseLiveWinProb;\\n expiredWinProb = _expiredWinProb;\\n decayRate = _decayRate;\\n ticketDuration = _ticketDuration;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(ITicketingParameters).interfaceId;\\n }\\n\\n /**\\n * @notice Set the face value for tickets in SOLO. Only callable by\\n * the contract owner.\\n * @param _faceValue The face value to set in SOLO.\\n */\\n function setFaceValue(uint256 _faceValue) external onlyOwner {\\n if (_faceValue == 0) {\\n revert FaceValueCannotBeZero();\\n }\\n\\n faceValue = _faceValue;\\n emit FaceValueUpdated(_faceValue);\\n }\\n\\n /**\\n * @notice Set the base live win probability of a ticket. Only callable by\\n * the contract owner.\\n * @param _baseLiveWinProb The probability represented as a value\\n * between 0 to 2**128 - 1.\\n */\\n function setBaseLiveWinProb(uint128 _baseLiveWinProb) external onlyOwner {\\n baseLiveWinProb = _baseLiveWinProb;\\n emit BaseLiveWinProbUpdated(_baseLiveWinProb);\\n }\\n\\n /**\\n * @notice Set the expired win probability of a ticket. Only callable by\\n * the contract owner.\\n * @param _expiredWinProb The probability represented as a value\\n * between 0 to 2**128 - 1.\\n */\\n function setExpiredWinProb(uint128 _expiredWinProb) external onlyOwner {\\n expiredWinProb = _expiredWinProb;\\n emit ExpiredWinProbUpdated(_expiredWinProb);\\n }\\n\\n /**\\n * @notice Set the decay rate of a ticket. Only callable by the\\n * the contract owner.\\n * @param _decayRate The decay rate as a percentage, where the\\n * denominator is 10000.\\n */\\n function setDecayRate(uint32 _decayRate) external onlyOwner {\\n decayRate = _decayRate;\\n emit DecayRateUpdated(_decayRate);\\n }\\n\\n /**\\n * @notice Set the ticket duration of a ticket. Only callable by the\\n * contract owner.\\n * @param _ticketDuration The duration of a ticket in number of blocks.\\n */\\n function setTicketDuration(uint256 _ticketDuration) external onlyOwner {\\n if (_ticketDuration == 0) {\\n revert TicketDurationCannotBeZero();\\n }\\n\\n ticketDuration = _ticketDuration;\\n emit TicketDurationUpdated(_ticketDuration);\\n }\\n\\n /**\\n * @notice Retrieve the current ticketing parameters.\\n * @return faceValue The face value of a ticket in SOLO.\\n * @return baseLiveWinProb The base live win probability of a ticket.\\n * @return expiredWinProb The expired win probability of a ticket.\\n * @return ticketDuration The duration of a ticket in number of blocks.\\n * @return decayRate The decay rate of a ticket.\\n */\\n function getTicketingParameters()\\n external\\n view\\n returns (uint256, uint128, uint128, uint256, uint32)\\n {\\n return (faceValue, baseLiveWinProb, expiredWinProb, ticketDuration, decayRate);\\n }\\n}\\n\",\"keccak256\":\"0x44b4c2eb70c0583f888ff8fca7ad21b084b6c58a453b7dd914275ccabed98ec0\",\"license\":\"Apache-2.0\"},\"contracts/staking/Directory.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/utils/math/Math.sol\\\";\\n\\nimport \\\"./StakingManager.sol\\\";\\nimport \\\"../libraries/SyloUtils.sol\\\";\\nimport \\\"../libraries/Manageable.sol\\\";\\nimport \\\"../interfaces/staking/IDirectory.sol\\\";\\nimport \\\"../payments/ticketing/RewardsManager.sol\\\";\\n\\n/**\\n * @notice The Directory contract constructs and manages a structure holding the current stakes,\\n * which is queried against using the scan function. The scan function allows submitting\\n * random points which will return a staked node's address in proportion to the stake it has.\\n */\\ncontract Directory is IDirectory, Initializable, Manageable, IERC165 {\\n /** Sylo Staking Manager contract */\\n StakingManager public _stakingManager;\\n\\n /** Sylo Rewards Manager contract */\\n RewardsManager public _rewardsManager;\\n\\n /**\\n * @notice The epoch ID of the current directory.\\n */\\n uint256 public currentDirectory;\\n\\n /**\\n * @notice Tracks every directory, which will be indexed by an epoch ID\\n */\\n mapping(uint256 => EpochDirectory) public directories;\\n\\n event CurrentDirectoryUpdated(uint256 indexed currentDirectory);\\n\\n error NoStakeToJoinEpoch();\\n error StakeeAlreadyJoinedEpoch();\\n error StakeeCannotBeZeroAddress();\\n error NoJoiningStakeToJoinEpoch();\\n\\n function initialize(\\n StakingManager stakingManager,\\n RewardsManager rewardsManager\\n ) external initializer {\\n SyloUtils.validateContractInterface(\\n \\\"StakingManager\\\",\\n address(stakingManager),\\n type(IStakingManager).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"RewardsManager\\\",\\n address(rewardsManager),\\n type(IRewardsManager).interfaceId\\n );\\n\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n _stakingManager = stakingManager;\\n _rewardsManager = rewardsManager;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IDirectory).interfaceId;\\n }\\n\\n /**\\n * @notice This function should be called when a new epoch is initialized.\\n * This will set the current directory to the specified epoch. This is only\\n * callable by the owner of this contract, which should be the EpochsManager\\n * contract.\\n * @dev After deployment, the EpochsManager should immediately be set as\\n * the owner.\\n * @param epochId The ID of the specified epoch.\\n */\\n function setCurrentDirectory(uint256 epochId) external onlyManager {\\n currentDirectory = epochId;\\n emit CurrentDirectoryUpdated(epochId);\\n }\\n\\n /**\\n * @notice This function is called by the epochs manager as a prerequisite to when the node joins the next epoch.\\n * @param stakee The address of the node.\\n * @param seekerId The seekerId of the Seeker that the node is\\n * registered with when joining the epoch. It is used to determine the nodes\\n * staking capacity based on its seeker power.\\n *\\n * @dev This will construct the directory as nodes join. The directory is constructed\\n * by creating a boundary value which is a sum of the current directory's total stake, and\\n * the current stakee's total stake, and pushing the new boundary into the entries array.\\n * The previous boundary and the current boundary essentially create a range, where if a\\n * random point were to fall within that range, it would belong to the respective stakee.\\n * The boundary value grows in size as each stakee joins, thus the directory array\\n * always remains sorted. This allows us to perform a binary search on the directory.\\n *\\n * Example\\n *\\n * Stakes: [ Alice/20, Bob/10, Carl/40, Dave/25 ]\\n * TotalStake: 95\\n *\\n * EpochDirectory:\\n *\\n * |-----------|------|----------------|--------|\\n * Alice/20 Bob/30 Carl/70 Dave/95\\n *\\n * The amount of stake that a node will join a directory with is dependent on its\\n * different capacity values. There are two distinct capacity values, one\\n * calculated from the seeker power, and another from the minimum stake\\n * proportion. The final staking amount will not exceed either capacities,\\n * and in the case that the current total stake exceeds both, then the final\\n * will be the minimum of the two values.\\n */\\n function joinNextDirectory(address stakee, uint256 seekerId) external onlyManager {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n\\n uint256 nextEpochId = currentDirectory + 1;\\n\\n uint256 totalStake = _stakingManager.getStakeeTotalManagedStake(stakee);\\n if (totalStake == 0) {\\n revert NoStakeToJoinEpoch();\\n }\\n\\n // staking capacity based on seeker power\\n uint256 seekerStakingCapacity = _stakingManager.calculateCapacityFromSeekerPower(seekerId);\\n\\n // staking capacity based on the min staking proportion constant\\n uint256 minProportionStakingCapacity = _stakingManager.calculateCapacityFromMinStakingProportion(stakee);\\n\\n uint256 joiningStake;\\n if (totalStake > seekerStakingCapacity && totalStake > minProportionStakingCapacity) {\\n joiningStake = Math.min(seekerStakingCapacity, minProportionStakingCapacity);\\n } else if (totalStake > seekerStakingCapacity) {\\n joiningStake = seekerStakingCapacity;\\n } else if (totalStake > minProportionStakingCapacity) {\\n joiningStake = minProportionStakingCapacity;\\n } else { // uncapped\\n joiningStake = totalStake;\\n }\\n\\n if (joiningStake == 0) {\\n revert NoJoiningStakeToJoinEpoch();\\n }\\n\\n if (directories[nextEpochId].stakes[stakee] > 0) {\\n revert StakeeAlreadyJoinedEpoch();\\n }\\n\\n uint256 nextBoundary = directories[nextEpochId].totalStake + joiningStake;\\n\\n directories[nextEpochId].entries.push(DirectoryEntry(stakee, nextBoundary));\\n directories[nextEpochId].stakes[stakee] = joiningStake;\\n directories[nextEpochId].totalStake = nextBoundary;\\n }\\n\\n /**\\n * @notice Call this to perform a stake-weighted scan to find the Node assigned\\n * to the given point of the current directory.\\n * @param point The point, which will usually be a hash of a public key.\\n */\\n function scan(uint128 point) external view returns (address stakee) {\\n return _scan(point, currentDirectory);\\n }\\n\\n /**\\n * @notice Call this to perform a stake-weighted scan to find the Node assigned\\n * to the given point of the requested directory.\\n * @param point The point, which will usually be a hash of a public key.\\n * @param epochId The epoch id associated with the directory to scan.\\n */\\n function scanWithEpochId(\\n uint128 point,\\n uint256 epochId\\n ) external view returns (address stakee) {\\n return _scan(point, epochId);\\n }\\n\\n /**\\n * @notice Call this to perform a stake-weighted scan to find the Node assigned\\n * to the given point of the requested directory (internal).\\n * @dev The current implementation will perform a binary search through\\n * the directory. This can allow gas costs to be low if this needs to be\\n * used in a transaction.\\n * @param point The point, which will usually be a hash of a public key.\\n * @param epochId The epoch id associated with the directory to scan.\\n */\\n function _scan(uint128 point, uint256 epochId) internal view returns (address stakee) {\\n uint256 entryLength = directories[epochId].entries.length;\\n\\n if (entryLength == 0) {\\n return address(0);\\n }\\n\\n // Staking all the Sylo would only be 94 bits, so multiplying this with\\n // a uint128 cannot overflow a uint256.\\n uint256 expectedVal = (directories[epochId].totalStake * uint256(point)) >> 128;\\n\\n uint256 left;\\n uint256 right = entryLength - 1;\\n\\n // perform a binary search through the directory\\n uint256 lower;\\n uint256 upper;\\n uint256 index;\\n\\n while (left <= right) {\\n index = (left + right) >> 1;\\n\\n lower = index == 0 ? 0 : directories[epochId].entries[index - 1].boundary;\\n upper = directories[epochId].entries[index].boundary;\\n\\n if (expectedVal >= lower && expectedVal < upper) {\\n return directories[epochId].entries[index].stakee;\\n } else if (expectedVal < lower) {\\n right = index - 1;\\n } else {\\n // expectedVal >= upper\\n left = index + 1;\\n }\\n }\\n }\\n\\n /**\\n * @notice Retrieve the total stake a Node has for the directory in the\\n * specified epoch.\\n * @param epochId The ID of the epoch.\\n * @param stakee The address of the Node.\\n * @return The amount of stake the Node has for the given directory in SOLO.\\n */\\n function getTotalStakeForStakee(\\n uint256 epochId,\\n address stakee\\n ) external view returns (uint256) {\\n return directories[epochId].stakes[stakee];\\n }\\n\\n /**\\n * @notice Retrieve the total stake for a directory in the specified epoch, which\\n * will be the sum of the stakes for all Nodes participating in that epoch.\\n * @param epochId The ID of the epoch.\\n * @return The total amount of stake in SOLO.\\n */\\n function getTotalStake(uint256 epochId) external view returns (uint256) {\\n return directories[epochId].totalStake;\\n }\\n\\n /**\\n * @notice Retrieve all entries for a directory in a specified epoch.\\n * @return An array of all the directory entries.\\n */\\n function getEntries(\\n uint256 epochId\\n ) external view returns (address[] memory, uint256[] memory) {\\n uint256 entryLength = directories[epochId].entries.length;\\n\\n address[] memory stakees = new address[](entryLength);\\n uint256[] memory boundaries = new uint256[](entryLength);\\n\\n DirectoryEntry memory entry;\\n DirectoryEntry[] memory entries = directories[epochId].entries;\\n\\n for (uint256 i; i < entryLength; ++i) {\\n entry = entries[i];\\n stakees[i] = entry.stakee;\\n boundaries[i] = entry.boundary;\\n }\\n return (stakees, boundaries);\\n }\\n}\\n\",\"keccak256\":\"0x98a344ba0403e7c5e92fe89a67799ec6583767bfa82a76e66c3b6e84ce519e59\",\"license\":\"Apache-2.0\"},\"contracts/staking/StakingManager.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\n\\nimport \\\"../SyloToken.sol\\\";\\nimport \\\"../libraries/SyloUtils.sol\\\";\\nimport \\\"../SeekerPowerOracle.sol\\\";\\nimport \\\"../epochs/EpochsManager.sol\\\";\\nimport \\\"../payments/ticketing/RewardsManager.sol\\\";\\nimport \\\"../interfaces/staking/IStakingManager.sol\\\";\\n\\n/**\\n * @notice Manages stakes and delegated stakes for Nodes. Holding\\n * staked Sylo is necessary for a Node to participate in the\\n * Sylo Network. The stake is used in stake-weighted scan function,\\n * and delegated stakers are rewarded on a pro-rata basis.\\n */\\ncontract StakingManager is IStakingManager, Initializable, Ownable2StepUpgradeable, ERC165 {\\n /** ERC 20 compatible token we are dealing with */\\n IERC20 public _token;\\n\\n /**\\n * @notice Rewards Manager contract. Any changes to stake will automatically\\n * trigger a claim to any outstanding rewards.\\n */\\n RewardsManager public _rewardsManager;\\n\\n EpochsManager public _epochsManager;\\n\\n SeekerPowerOracle public _seekerPowerOracle;\\n\\n /**\\n * @notice Tracks the managed stake for every Node.\\n */\\n mapping(address => Stake) public stakes;\\n\\n /** @notice Tracks overall total stake held by this contract */\\n uint256 public totalManagedStake;\\n\\n /**\\n * @notice Tracks funds that are in the process of being unlocked. This\\n * is indexed by a key that hashes both the address of the staked Node and\\n * the address of the staker.\\n */\\n mapping(bytes32 => Unlock) public unlockings;\\n\\n /**\\n * @notice The number of blocks a user must wait after calling \\\"unlock\\\"\\n * before they can withdraw their stake\\n */\\n uint256 public unlockDuration;\\n\\n /**\\n * @notice Minimum amount of stake that a Node needs to stake\\n * against itself in order to participate in the network. This is\\n * represented as a percentage of the Node's total stake, where\\n * the value is a ratio of 10000.\\n */\\n uint32 public minimumStakeProportion;\\n\\n /**\\n * @notice The multiplier used in determining a Seeker's staking\\n * capacity based on its power level.\\n */\\n uint256 public seekerPowerMultiplier;\\n\\n event UnlockDurationUpdated(uint256 unlockDuration);\\n event MinimumStakeProportionUpdated(uint256 minimumStakeProportion);\\n\\n error NoStakeToUnlock();\\n error StakeNotYetUnlocked();\\n error CannotStakeZeroAmount();\\n error CannotUnlockZeroAmount();\\n error TokenCannotBeZeroAddress();\\n error StakeeCannotBeZeroAddress();\\n error UnlockDurationCannotBeZero();\\n error CannotCancelUnlockZeroAmount();\\n error CannotUnlockMoreThanStaked(uint256 stakeAmount, uint256 unlockAmount);\\n error StakeCapacityReached(uint256 maxCapacity, uint256 currentCapacity);\\n error SeekerPowerNotRegistered(uint256 seekerId);\\n\\n function initialize(\\n IERC20 token,\\n RewardsManager rewardsManager,\\n EpochsManager epochsManager,\\n SeekerPowerOracle seekerPowerOracle,\\n uint256 _unlockDuration,\\n uint32 _minimumStakeProportion,\\n uint256 _seekerPowerMultiplier\\n ) external initializer {\\n if (address(token) == address(0)) {\\n revert TokenCannotBeZeroAddress();\\n }\\n\\n SyloUtils.validateContractInterface(\\n \\\"RewardsManager\\\",\\n address(rewardsManager),\\n type(IRewardsManager).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"EpochsManager\\\",\\n address(epochsManager),\\n type(IEpochsManager).interfaceId\\n );\\n\\n SyloUtils.validateContractInterface(\\n \\\"SeekerPowerOracle\\\",\\n address(seekerPowerOracle),\\n type(ISeekerPowerOracle).interfaceId\\n );\\n\\n if (_unlockDuration == 0) {\\n revert UnlockDurationCannotBeZero();\\n }\\n\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n _token = token;\\n _rewardsManager = rewardsManager;\\n _epochsManager = epochsManager;\\n _seekerPowerOracle = seekerPowerOracle;\\n unlockDuration = _unlockDuration;\\n minimumStakeProportion = _minimumStakeProportion;\\n seekerPowerMultiplier = _seekerPowerMultiplier;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IStakingManager).interfaceId;\\n }\\n\\n /**\\n * @notice Sets the unlock duration for stakes. Only callable by\\n * the owner.\\n * @param _unlockDuration The unlock duration in number of blocks.\\n */\\n function setUnlockDuration(uint256 _unlockDuration) external onlyOwner {\\n if (_unlockDuration == 0) {\\n revert UnlockDurationCannotBeZero();\\n }\\n\\n unlockDuration = _unlockDuration;\\n emit UnlockDurationUpdated(_unlockDuration);\\n }\\n\\n /**\\n * @notice Sets the minimum stake proportion for Nodes. Only callable by\\n * the owner.\\n * @param _minimumStakeProportion The minimum stake proportion in SOLO.\\n */\\n function setMinimumStakeProportion(uint32 _minimumStakeProportion) external onlyOwner {\\n minimumStakeProportion = _minimumStakeProportion;\\n emit MinimumStakeProportionUpdated(_minimumStakeProportion);\\n }\\n\\n /**\\n * @notice Called by Nodes and delegated stakers to add stake.\\n * This function will fail under the following conditions:\\n * - If the Node address is invalid\\n * - If the specified stake value is zero\\n * - If the additional stake causes the Node to fail to meet the\\n * minimum stake proportion requirement.\\n * @param amount The amount of stake to add in SOLO.\\n * @param stakee The address of the staked Node.\\n */\\n function addStake(uint256 amount, address stakee) external {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n if (amount == 0) {\\n revert CannotStakeZeroAmount();\\n }\\n\\n _addStake(amount, stakee);\\n SafeERC20.safeTransferFrom(_token, msg.sender, address(this), amount);\\n }\\n\\n function _addStake(uint256 amount, address stakee) internal {\\n // automatically move any pending rewards generated by their existing stake\\n _rewardsManager.updatePendingRewards(stakee, msg.sender);\\n\\n uint256 currentEpochId = _epochsManager.currentIteration();\\n\\n Stake storage stake = stakes[stakee];\\n\\n uint256 currentStake = getCurrentStakerAmount(stakee, msg.sender);\\n\\n stake.stakeEntries[msg.sender] = StakeEntry(\\n currentStake + amount,\\n block.number,\\n currentEpochId\\n );\\n\\n stake.totalManagedStake = stake.totalManagedStake + amount;\\n totalManagedStake = totalManagedStake + amount;\\n }\\n\\n /**\\n * @notice Call this function to begin the unlocking process. Calling this\\n * will trigger an automatic claim of any outstanding staking rewards. Any\\n * stake that was already in the unlocking phase will have the specified\\n * amount added to it, and its duration refreshed. This function will fail\\n * under the following conditions:\\n * - If no stake exists for the caller\\n * - If the unlock amount is zero\\n * - If the unlock amount is more than what is staked\\n * Note: If calling as a Node, this function will *not* revert if it causes\\n * the Node to fail to meet the minimum stake proportion. However it will still\\n * prevent the Node from participating in the network until the minimum is met\\n * again.\\n * @param amount The amount of stake to unlock in SOLO.\\n * @param stakee The address of the staked Node.\\n */\\n function unlockStake(uint256 amount, address stakee) external returns (uint256) {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n if (amount == 0) {\\n revert CannotUnlockZeroAmount();\\n }\\n\\n uint256 currentStake = getCurrentStakerAmount(stakee, msg.sender);\\n\\n if (currentStake == 0) {\\n revert NoStakeToUnlock();\\n }\\n if (currentStake < amount) {\\n revert CannotUnlockMoreThanStaked(currentStake, amount);\\n }\\n\\n // automatically move any pending rewards generated by their existing stake\\n _rewardsManager.updatePendingRewards(stakee, msg.sender);\\n\\n uint256 currentEpochId = _epochsManager.currentIteration();\\n\\n Stake storage stake = stakes[stakee];\\n\\n stake.stakeEntries[msg.sender] = StakeEntry(\\n currentStake - amount,\\n block.number,\\n currentEpochId\\n );\\n\\n stake.totalManagedStake = stake.totalManagedStake - amount;\\n totalManagedStake = totalManagedStake - amount;\\n\\n bytes32 key = getKey(stakee, msg.sender);\\n\\n // Keep track of when the stake can be withdrawn\\n Unlock storage unlock = unlockings[key];\\n\\n uint256 unlockAt = block.number + unlockDuration;\\n if (unlock.unlockAt < unlockAt) {\\n unlock.unlockAt = unlockAt;\\n }\\n\\n unlock.amount = unlock.amount + amount;\\n\\n return unlockAt;\\n }\\n\\n /**\\n * @notice Call this function to withdraw stake that has finished unlocking.\\n * This will fail if the stake has not yet unlocked.\\n * @param stakee The address of the staked Node.\\n */\\n function withdrawStake(address stakee) external {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n\\n bytes32 key = getKey(stakee, msg.sender);\\n\\n Unlock storage unlock = unlockings[key];\\n\\n if (unlock.unlockAt >= block.number) {\\n revert StakeNotYetUnlocked();\\n }\\n\\n uint256 amount = unlock.amount;\\n\\n delete unlockings[key];\\n\\n SafeERC20.safeTransfer(_token, msg.sender, amount);\\n }\\n\\n /**\\n * @notice Call this function to cancel any stake that is in the process\\n * of unlocking. As this essentially adds back stake to the Node, this\\n * will trigger an automatic claim of any outstanding staking rewards.\\n * If the specified amount to cancel is greater than the stake that is\\n * currently being unlocked, it will cancel the maximum stake possible.\\n * @param amount The amount of unlocking stake to cancel in SOLO.\\n * @param stakee The address of the staked Node.\\n */\\n function cancelUnlocking(uint256 amount, address stakee) external {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n if (amount == 0) {\\n revert CannotCancelUnlockZeroAmount();\\n }\\n\\n bytes32 key = getKey(stakee, msg.sender);\\n\\n Unlock storage unlock = unlockings[key];\\n\\n if (amount >= unlock.amount) {\\n amount = unlock.amount;\\n delete unlockings[key];\\n } else {\\n unlock.amount = unlock.amount - amount;\\n }\\n\\n _addStake(amount, stakee);\\n }\\n\\n /**\\n * @notice This function determines the staking capacity of\\n * a Seeker based on its power level. The method will revert if\\n * the Seeker's power level has not been registered with the oracle.\\n *\\n * Currently the algorithm is as follows:\\n * staking_capacity = seeker_power * seeker_power_multiplier;\\n */\\n function calculateCapacityFromSeekerPower(uint256 seekerId) external view returns (uint256) {\\n uint256 seekerPower = _seekerPowerOracle.getSeekerPower(seekerId);\\n if (seekerPower == 0) {\\n revert SeekerPowerNotRegistered(seekerId);\\n }\\n\\n // If the Seeker Power is already\\n // at the maximum sylo, then we just return the max sylo value directly.\\n if (seekerPower >= SyloUtils.MAX_SYLO) {\\n return SyloUtils.MAX_SYLO;\\n }\\n\\n uint256 capacity = seekerPower * seekerPowerMultiplier;\\n\\n return capacity > SyloUtils.MAX_SYLO ? SyloUtils.MAX_SYLO : capacity;\\n }\\n\\n /**\\n * @notice This function can be used to a determine a Node's staking capacity,\\n * based on the minimum stake proportion constant.\\n * @param stakee The address of the staked Node.\\n */\\n function calculateCapacityFromMinStakingProportion(address stakee) public view returns (uint256) {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n\\n Stake storage stake = stakes[stakee];\\n\\n uint256 currentlyOwnedStake = stake.stakeEntries[stakee].amount;\\n return (currentlyOwnedStake * SyloUtils.PERCENTAGE_DENOMINATOR) /\\n minimumStakeProportion;\\n }\\n\\n /**\\n * @notice This function should be called by clients to determine how much\\n * additional delegated stake can be allocated to a Node via an addStake or\\n * cancelUnlocking call. This is useful to avoid a revert due to\\n * the minimum stake proportion requirement not being met from the additional stake.\\n * @param stakee The address of the staked Node.\\n */\\n function calculateMaxAdditionalDelegatedStake(address stakee) external view returns (uint256) {\\n uint256 totalMaxStake = calculateCapacityFromMinStakingProportion(stakee);\\n\\n Stake storage stake = stakes[stakee];\\n\\n if (totalMaxStake < stake.totalManagedStake) {\\n revert StakeCapacityReached(totalMaxStake, stake.totalManagedStake);\\n }\\n\\n return totalMaxStake - stake.totalManagedStake;\\n }\\n\\n /**\\n * @notice Retrieve the key used to index a stake entry. The key is a hash\\n * which takes both address of the Node and the staker as input.\\n * @param stakee The address of the staked Node.\\n * @param staker The address of the staker.\\n * @return A byte-array representing the key.\\n */\\n function getKey(address stakee, address staker) public pure returns (bytes32) {\\n return keccak256(abi.encodePacked(stakee, staker));\\n }\\n\\n /**\\n * @notice Retrieve the total stake being managed by this contract.\\n * @return The total amount of managed stake in SOLO.\\n */\\n function getTotalManagedStake() external view returns (uint256) {\\n return totalManagedStake;\\n }\\n\\n /**\\n * @notice Retrieve a stake entry.\\n * @param stakee The address of the staked Node.\\n * @param staker The address of the staker.\\n * @return The stake entry.\\n */\\n function getStakeEntry(\\n address stakee,\\n address staker\\n ) external view returns (StakeEntry memory) {\\n return stakes[stakee].stakeEntries[staker];\\n }\\n\\n /**\\n * @notice Retrieve the total amount of SOLO staked against a Node.\\n * @param stakee The address of the staked Node.\\n * @return The amount of staked SOLO.\\n */\\n function getStakeeTotalManagedStake(address stakee) external view returns (uint256) {\\n return stakes[stakee].totalManagedStake;\\n }\\n\\n /**\\n * @notice Check if a Node is meeting the minimum stake proportion requirement.\\n * @param stakee The address of the staked Node.\\n * @return True if the Node is meeting minimum stake proportion requirement.\\n */\\n function checkMinimumStakeProportion(address stakee) public view returns (bool) {\\n if (stakee == address(0)) {\\n revert StakeeCannotBeZeroAddress();\\n }\\n\\n Stake storage stake = stakes[stakee];\\n\\n uint256 currentlyOwnedStake = stake.stakeEntries[stakee].amount;\\n uint32 ownedStakeProportion = SyloUtils.asPerc(\\n SafeCast.toUint128(currentlyOwnedStake),\\n stake.totalManagedStake\\n );\\n\\n return ownedStakeProportion >= minimumStakeProportion;\\n }\\n\\n /**\\n * @notice Retrieve the current amount of SOLO staked against a Node by\\n * a specified staker.\\n * @param stakee The address of the staked Node.\\n * @param staker The address of the staker.\\n * @return The amount of staked SOLO.\\n */\\n function getCurrentStakerAmount(address stakee, address staker) public view returns (uint256) {\\n return stakes[stakee].stakeEntries[staker].amount;\\n }\\n}\\n\",\"keccak256\":\"0x039e692a4a3a670977e78ef7145a43d0bc00e48387fafd4f527b60fbb6966628\",\"license\":\"Apache-2.0\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50612fc5806100206000396000f3fe608060405234801561001057600080fd5b50600436106102065760003560e01c80638a1fcd601161011a578063cdba7342116100ad578063eb6d17891161007c578063eb6d178914610478578063ebd807861461048b578063ecd0c0c31461049e578063f2fde38b146104b1578063fc7e286d146104c457600080fd5b8063cdba734214610439578063d088a2311461044c578063dd90076914610454578063e30c39781461046757600080fd5b8063b24651c4116100e9578063b24651c4146103ed578063c3b6f72614610400578063c70f1a8c14610413578063caf3b7fd1461042657600080fd5b80638a1fcd60146103ad5780638da5cb5b146103b6578063a40b209f146103c7578063ac908b6e146103da57600080fd5b806343c8d8a21161019d57806372b0d90c1161016c57806372b0d90c1461036457806378a9c63d1461037757806379ba50971461038a5780637d6babb4146103925780637ddc62c11461039a57600080fd5b806343c8d8a2146102fe57806359a515ba1461031157806367653e5514610334578063715018a61461035c57600080fd5b8063295ca02d116101d9578063295ca02d146102975780632c4ab445146102b8578063344dd6e4146102e35780633ccfd60b146102f657600080fd5b806301ffc9a71461020b5780630ab2502214610244578063169e1ca81461026f5780631f4c747e14610284575b600080fd5b61022f610219366004612580565b6001600160e01b03191663567cd4c960e11b1490565b60405190151581526020015b60405180910390f35b609c54610257906001600160a01b031681565b6040516001600160a01b03909116815260200161023b565b61028261027d3660046125bf565b61050e565b005b609e54610257906001600160a01b031681565b6102aa6102a5366004612713565b6105bd565b60405190815260200161023b565b6102cb6102c636600461272f565b61062e565b6040516001600160801b03909116815260200161023b565b6102826102f1366004612751565b610786565b610282610ab6565b61028261030c36600461285e565b610ac1565b61022f61031f366004612905565b60a16020526000908152604090205460ff1681565b61034761034236600461291e565b610c65565b6040805192835260208301919091520161023b565b61028261105e565b610282610372366004612979565b611070565b610282610385366004612996565b611134565b6102826112d4565b6102aa61134e565b609b54610257906001600160a01b031681565b6102aa609f5481565b6033546001600160a01b0316610257565b6102aa6103d5366004612abf565b6113c9565b6102aa6103e8366004612b09565b611684565b609854610257906001600160a01b031681565b609954610257906001600160a01b031681565b609a54610257906001600160a01b031681565b609d54610257906001600160a01b031681565b6102826104473660046125bf565b6116ec565b61028261179c565b610282610462366004612905565b6117da565b6065546001600160a01b0316610257565b6102aa61048636600461272f565b61183e565b61022f610499366004612bb3565b611890565b609754610257906001600160a01b031681565b6102826104bf366004612979565b6118ee565b6104f36104d2366004612979565b60a06020526000908152604090208054600182015460029092015490919083565b6040805193845260208401929092529082015260600161023b565b8160000361052f5760405163adfd6eb360e01b815260040160405180910390fd5b6001600160a01b03811661055657604051633423ddb360e11b815260040160405180910390fd5b6001600160a01b038116600090815260a06020526040902060028101541561059157604051631c98f45d60e01b815260040160405180910390fd5b805461059e908490612c48565b81556097546105b8906001600160a01b031633308661195f565b505050565b805160208083015151604080850151606080870151608088015184519687019790975293811b6001600160601b0319908116938601939093521b1660548301526068820152608881019190915260009060a8015b604051602081830303815290604052805190602001209050919050565b609c54604051635e05e35d60e11b81526004810184905260009182916001600160a01b039091169063bc0bc6ba9060240161012060405180830381865afa15801561067d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106a19190612c8b565b80519091506000036106c65760405163a756193360e01b815260040160405180910390fd5b80518310806106e85750600081604001511180156106e8575080604001518310155b15610706576040516339e9ad8d60e11b815260040160405180910390fd5b60006107128443612d20565b9050816101000151811061072b57600092505050610780565b600061073f8360c0015184608001516119d0565b9050600083610100015183836107559190612d33565b61075f9190612d4a565b905061076a81611a00565b8460c001516107799190612d6c565b9450505050505b92915050565b600054610100900460ff16158080156107a65750600054600160ff909116105b806107c05750303b1580156107c0575060005460ff166001145b6108285760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff19166001179055801561084b576000805461ff0019166101001790555b6001600160a01b038a1661087257604051635f5d339960e01b815260040160405180910390fd5b6108a66040518060400160405280600a8152602001695265676973747269657360b01b8152508a637ccc541d60e11b611a6d565b6108de6040518060400160405280600e81526020016d29ba30b5b4b733a6b0b730b3b2b960911b815250896303e0261b60e41b611a6d565b610911604051806040016040528060098152602001684469726563746f727960b81b81525088638a5d64cd60e01b611a6d565b6109486040518060400160405280600d81526020016c22b837b1b439a6b0b730b3b2b960991b8152508763078a0a4b60e41b611a6d565b6109806040518060400160405280600e81526020016d2932bbb0b93239a6b0b730b3b2b960911b81525086631ed895ad60e11b611a6d565b6109bc60405180604001604052806012815260200171417574686f72697a65644163636f756e747360701b815250856337e592f160e21b611a6d565b816000036109dd57604051632d8ef94560e11b815260040160405180910390fd5b6109e5611b71565b609780546001600160a01b03199081166001600160a01b038d8116919091179092556098805482168c84161790556099805482168b8416179055609a805482168a8416179055609c80548216898416179055609b80548216888416179055609d80548216878416179055609e8054909116918516919091179055609f8290558015610aaa576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050505050565b610abf33611070565b565b609c54604051635e05e35d60e11b8152883560048201526000916001600160a01b03169063bc0bc6ba9060240161012060405180830381865afa158015610b0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b309190612c8b565b90504388608001351115610b5a576040516001623a160d60e21b0319815260040160405180910390fd5b6000610b79610b6e368b90038b018b612713565b888a89898989610c65565b600081815260a160205260408120805460ff19166001179055609a5491935091506001600160a01b0316631bdcc9ad8b35610bba60808e0160608f01612979565b6040516001600160e01b031960e085901b16815260048101929092526001600160a01b03166024820152604401602060405180830381865afa158015610c04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c289190612d93565b905080600003610c4e57604051637f6cbf1960e11b81528a35600482015260240161081f565b610aaa838b610c6060208c018c612979565b611ba0565b60208701515160009081906001600160a01b0316610c965760405163091e31fd60e31b815260040160405180910390fd5b6000610ca560208a018a612979565b6001600160a01b031603610ccc57604051635ff51db760e11b815260040160405180910390fd5b60408901516001600160a01b0316610cf75760405163cab78a2360e01b815260040160405180910390fd5b609e546000906001600160a01b0316634dde5a44610d1860208c018c612979565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015610d5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d809190612dac565b90506001600160a01b038116610dc257610d9d60208a018a612979565b60405163149948a160e31b81526001600160a01b03909116600482015260240161081f565b610dcb8a6105bd565b92508281604051602001610df692919091825260601b6001600160601b031916602082015260340190565b60408051601f198184030181529181528151602092830120600081815260a190935291205490925060ff1615610e3f576040516301faedd760e61b815260040160405180910390fd5b8960800151610e528b606001518a61183e565b14610e705760405163bfec4b7960e01b815260040160405180910390fd5b610e828a602001518b60600151611c44565b610e9f57604051632616fe7d60e11b815260040160405180910390fd5b610ebb610eb1368b90038b018b612dc9565b8b60600151611c44565b610ed8576040516354c4763f60e01b815260040160405180910390fd5b610f1e8a6020015188888080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250889250611ce4915050565b610f3b576040516319ad5a6d60e21b815260040160405180910390fd5b610f8b610f4d368b90038b018b612dc9565b86868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250889250611ce4915050565b610fa857604051639bce429160e01b815260040160405180910390fd5b61103487878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8b018190048102820181019092528981529250899150889081908401838280828437600081840152601f19601f820116905080830192505050505050508c600001518d606001518c611890565b61105157604051630554a83160e31b815260040160405180910390fd5b5097509795505050505050565b611066611d62565b610abf6000611dbc565b33600090815260a0602052604081206040805160608101825282548152600183015460208201526002909201549082018190529091506000036110c65760405163065bea4960e21b815260040160405180910390fd5b438160400151106110ea576040516366af725560e01b815260040160405180910390fd5b602081015181516000916110fd91612c48565b33600090815260a06020526040812081815560018101829055600201556097549091506105b8906001600160a01b03168483611dd5565b609c54604051635e05e35d60e11b8152873560048201526000916001600160a01b03169063bc0bc6ba9060240161012060405180830381865afa15801561117f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a39190612c8b565b9050438760c0013511156111cd576040516001623a160d60e21b0319815260040160405180910390fd5b60006111eb6111e1368a90038a018a612b09565b88888888886113c9565b600081815260a160205260408120805460ff19166001179055609a54919250906001600160a01b0316631bdcc9ad8a3561122b60c08d0160a08e01612979565b6040516001600160e01b031960e085901b16815260048101929092526001600160a01b03166024820152604401602060405180830381865afa158015611275573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112999190612d93565b9050806000036112bf57604051637f6cbf1960e11b81528935600482015260240161081f565b6112c9838a611e05565b505050505050505050565b60655433906001600160a01b031681146113425760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b606482015260840161081f565b61134b81611dbc565b50565b33600090815260a060205260408120805415801561136e57506001810154155b1561138c57604051639c4e744360e01b815260040160405180910390fd5b6002810154156113af57604051631c98f45d60e01b815260040160405180910390fd5b609f546113bc9043612c48565b6002909101819055919050565b6020860151516000906001600160a01b03166113f85760405163091e31fd60e31b815260040160405180910390fd5b6040870151516001600160a01b031661142457604051635ff51db760e11b815260040160405180910390fd5b60608701516001600160a01b031661144f5760405163cab78a2360e01b815260040160405180910390fd5b61145887611684565b600081815260a1602052604090205490915060ff161561148b576040516301faedd760e61b815260040160405180910390fd5b8660a0015161149e88608001518861183e565b146114bc5760405163bfec4b7960e01b815260040160405180910390fd5b6114ce87602001518860800151611c44565b6114eb57604051632616fe7d60e11b815260040160405180910390fd5b6114fd87604001518860800151611c44565b61151a576040516354c4763f60e01b815260040160405180910390fd5b611560876020015186868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250869250611ce4915050565b61157d576040516319ad5a6d60e21b815260040160405180910390fd5b6115c3876040015184848080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250869250611ce4915050565b6115e057604051639bce429160e01b815260040160405180910390fd5b61165d85858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f89018190048102820181019092528781529250879150869081908401838280828437600092019190915250508b5160808d015190925090508a611890565b61167a57604051630554a83160e31b815260040160405180910390fd5b9695505050505050565b80516020808301515160408085015151606080870151608088015160a089015185519788019890985294821b6001600160601b03199081169487019490945291811b831660548601521b166068830152607c820152609c81019190915260009060bc01610611565b8160000361170d5760405163ea50132f60e01b815260040160405180910390fd5b6001600160a01b03811661173457604051633423ddb360e11b815260040160405180910390fd5b6001600160a01b038116600090815260a06020526040902060028101541561176f57604051631c98f45d60e01b815260040160405180910390fd5b82816001015461177f9190612c48565b60018201556097546105b8906001600160a01b031633308661195f565b33600090815260a06020526040812060028101549091036117d05760405163065bea4960e21b815260040160405180910390fd5b6000600290910155565b6117e2611d62565b8060000361180357604051632d8ef94560e11b815260040160405180910390fd5b609f8190556040518181527fbf6423edafc706e6ae214d98c485a52f610ee2f23148b43d546af3f8834c21b39060200160405180910390a150565b604080516020810184905290810182905260009060600160408051601f198184030181528282528051602091820120908301520160405160208183030381529060405280519060200120905092915050565b60008061189d858561062e565b6001600160801b03169050600081608083901b179050808888866040516020016118c993929190612e09565b60408051601f1981840301815291905280516020909101201098975050505050505050565b6118f6611d62565b606580546001600160a01b0383166001600160a01b031990911681179091556119276033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6040516001600160a01b03808516602483015283166044820152606481018290526119ca9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611eb6565b50505050565b6000620186a06119ef63ffffffff84166001600160801b038616612d33565b6119f99190612d4a565b9392505050565b60006001600160801b03821115611a695760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663238206269747360c81b606482015260840161081f565b5090565b8251600003611a8f5760405163d1fc12f760e01b815260040160405180910390fd5b6001600160a01b038216611ab6578260405161f56160eb1b815260040161081f9190612e6a565b6001600160e01b03198116611ade5760405163308c995160e01b815260040160405180910390fd5b6040516301ffc9a760e01b81526001600160e01b0319821660048201526001600160a01b038316906301ffc9a790602401602060405180830381865afa158015611b2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b509190612e7d565b6105b8578281604051633f8ccd3b60e21b815260040161081f929190612e9f565b600054610100900460ff16611b985760405162461bcd60e51b815260040161081f90612eca565b610abf611f8b565b6000611bbf8460208501611bba6080870160608801612979565b611fbb565b9050611bd16040840160208501612979565b6001600160a01b0316611bea6080850160608601612979565b604080516001600160a01b038681168252608088013560208301529181018590529116908535907f04562f4c0ee54b401e8fcaafa7daa175963d9bb7a07297633221dc08b1d57b0f9060600160405180910390a450505050565b60208201516000906001600160a01b0316611c6157506001610780565b609d548351602085015160405163c346893b60e01b81526000936001600160a01b03169263c346893b92611c9b9286908990600401612f2b565b602060405180830381865afa158015611cb8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cdc9190612e7d565b949350505050565b602083015160009081906001600160a01b031615611d0757506020840151611d0b565b5083515b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000006000908152601c849052603c90206001600160a01b038216611d4e8287612098565b6001600160a01b0316149695505050505050565b6033546001600160a01b03163314610abf5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161081f565b606580546001600160a01b031916905561134b816120bc565b6040516001600160a01b0383166024820152604481018290526105b890849063a9059cbb60e01b90606401611993565b6000611e1f8360208401611bba60c0860160a08701612979565b9050611e316040830160208401612979565b6001600160a01b0316611e4a60c0840160a08501612979565b6001600160a01b031683357f7d274bdf94856b1ec309b530c7bf991ea808eb7782afef762e28cce446178907611e866080870160608801612979565b604080516001600160a01b03909216825260c08801356020830152810186905260600160405180910390a4505050565b6000611f0b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661210e9092919063ffffffff16565b9050805160001480611f2c575080806020019051810190611f2c9190612e7d565b6105b85760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161081f565b600054610100900460ff16611fb25760405162461bcd60e51b815260040161081f90612eca565b610abf33611dbc565b600080611fe8611fce6020860186612979565b6001600160a01b0316600090815260a06020526040902090565b9050600081600001548660a00151111561207e5750805461200a84838361211d565b6097546001830154612029916001600160a01b03169061dead90611dd5565b600060018301557f2ec87e1ff3f5b311fa539eb48a387afc2e82e11ac9919086426f16c1b35cfe8561205e6020870187612979565b6040516001600160a01b03909116815260200160405180910390a161208f565b5060a085015161208f84838361211d565b95945050505050565b60008060006120a785856121b4565b915091506120b4816121f9565b509392505050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6060611cdc8484600085612343565b815461212a908290612d20565b8255609754609b54612149916001600160a01b03908116911683611dd5565b609b546040516340768fd360e01b81526001600160a01b03858116600483015260248201849052909116906340768fd390604401600060405180830381600087803b15801561219757600080fd5b505af11580156121ab573d6000803e3d6000fd5b50505050505050565b60008082516041036121ea5760208301516040840151606085015160001a6121de8782858561241e565b945094505050506121f2565b506000905060025b9250929050565b600081600481111561220d5761220d612f15565b036122155750565b600181600481111561222957612229612f15565b036122765760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161081f565b600281600481111561228a5761228a612f15565b036122d75760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161081f565b60038160048111156122eb576122eb612f15565b0361134b5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161081f565b6060824710156123a45760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161081f565b600080866001600160a01b031685876040516123c09190612f73565b60006040518083038185875af1925050503d80600081146123fd576040519150601f19603f3d011682016040523d82523d6000602084013e612402565b606091505b5091509150612413878383876124e2565b979650505050505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561245557506000905060036124d9565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156124a9573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166124d2576000600192509250506124d9565b9150600090505b94509492505050565b6060831561255157825160000361254a576001600160a01b0385163b61254a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161081f565b5081611cdc565b611cdc83838151156125665781518083602001fd5b8060405162461bcd60e51b815260040161081f9190612e6a565b60006020828403121561259257600080fd5b81356001600160e01b0319811681146119f957600080fd5b6001600160a01b038116811461134b57600080fd5b600080604083850312156125d257600080fd5b8235915060208301356125e4816125aa565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b604051610120810167ffffffffffffffff81118282101715612629576126296125ef565b60405290565b60006040828403121561264157600080fd5b6040516040810181811067ffffffffffffffff82111715612664576126646125ef565b6040529050808235612675816125aa565b81526020830135612685816125aa565b6020919091015292915050565b600060c082840312156126a457600080fd5b60405160a0810181811067ffffffffffffffff821117156126c7576126c76125ef565b604052823581529050806126de846020850161262f565b602082015260608301356126f1816125aa565b806040830152506080830135606082015260a083013560808201525092915050565b600060c0828403121561272557600080fd5b6119f98383612692565b6000806040838503121561274257600080fd5b50508035926020909101359150565b60008060008060008060008060006101208a8c03121561277057600080fd5b893561277b816125aa565b985060208a013561278b816125aa565b975060408a013561279b816125aa565b965060608a01356127ab816125aa565b955060808a01356127bb816125aa565b945060a08a01356127cb816125aa565b935060c08a01356127db816125aa565b925060e08a01356127eb816125aa565b809250506101008a013590509295985092959850929598565b60006040828403121561281657600080fd5b50919050565b60008083601f84011261282e57600080fd5b50813567ffffffffffffffff81111561284657600080fd5b6020830191508360208285010111156121f257600080fd5b600080600080600080600087890361016081121561287b57600080fd5b60c081121561288957600080fd5b5087965060c088013595506128a18960e08a01612804565b945061012088013567ffffffffffffffff808211156128bf57600080fd5b6128cb8b838c0161281c565b90965094506101408a01359150808211156128e557600080fd5b506128f28a828b0161281c565b989b979a50959850939692959293505050565b60006020828403121561291757600080fd5b5035919050565b6000806000806000806000610160888a03121561293a57600080fd5b6129448989612692565b96506129538960c08a01612804565b9550610100880135945061012088013567ffffffffffffffff808211156128bf57600080fd5b60006020828403121561298b57600080fd5b81356119f9816125aa565b6000806000806000808688036101608112156129b157600080fd5b610100808212156129c157600080fd5b88975087013595505061012086013567ffffffffffffffff808211156129e657600080fd5b6129f28a838b0161281c565b9096509450610140890135915080821115612a0c57600080fd5b50612a1989828a0161281c565b979a9699509497509295939492505050565b60006101008284031215612a3e57600080fd5b60405160c0810181811067ffffffffffffffff82111715612a6157612a616125ef565b60405282358152905080612a78846020850161262f565b6020820152612a8a846060850161262f565b604082015260a0830135612a9d816125aa565b8060608301525060c0830135608082015260e083013560a08201525092915050565b6000806000806000806101608789031215612ad957600080fd5b612ae38888612a2b565b9550610100870135945061012087013567ffffffffffffffff808211156129e657600080fd5b60006101008284031215612b1c57600080fd5b6119f98383612a2b565b600082601f830112612b3757600080fd5b813567ffffffffffffffff80821115612b5257612b526125ef565b604051601f8301601f19908116603f01168101908282118183101715612b7a57612b7a6125ef565b81604052838152866020858801011115612b9357600080fd5b836020870160208301376000602085830101528094505050505092915050565b600080600080600060a08688031215612bcb57600080fd5b853567ffffffffffffffff80821115612be357600080fd5b612bef89838a01612b26565b96506020880135915080821115612c0557600080fd5b50612c1288828901612b26565b959895975050505060408401359360608101359360809091013592509050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561078057610780612c32565b805163ffffffff81168114612c6f57600080fd5b919050565b80516001600160801b0381168114612c6f57600080fd5b60006101208284031215612c9e57600080fd5b612ca6612605565b825181526020830151602082015260408301516040820152612cca60608401612c5b565b6060820152612cdb60808401612c5b565b608082015260a083015160a0820152612cf660c08401612c74565b60c0820152612d0760e08401612c74565b60e0820152610100928301519281019290925250919050565b8181038181111561078057610780612c32565b808202811582820484141761078057610780612c32565b600082612d6757634e487b7160e01b600052601260045260246000fd5b500490565b6001600160801b03828116828216039080821115612d8c57612d8c612c32565b5092915050565b600060208284031215612da557600080fd5b5051919050565b600060208284031215612dbe57600080fd5b81516119f9816125aa565b600060408284031215612ddb57600080fd5b6119f9838361262f565b60005b83811015612e00578181015183820152602001612de8565b50506000910152565b60008451612e1b818460208901612de5565b845190830190612e2f818360208901612de5565b01928352505060200192915050565b60008151808452612e56816020860160208601612de5565b601f01601f19169290920160200192915050565b6020815260006119f96020830184612e3e565b600060208284031215612e8f57600080fd5b815180151581146119f957600080fd5b604081526000612eb26040830185612e3e565b905063ffffffff60e01b831660208301529392505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b634e487b7160e01b600052602160045260246000fd5b6001600160a01b038581168252841660208201526080810160018410612f6157634e487b7160e01b600052602160045260246000fd5b60408201939093526060015292915050565b60008251612f85818460208701612de5565b919091019291505056fea2646970667358221220df15c9ce639d482fafc3d321375e7ebc8cd7cfc4ec1c8617ea0c1d536d6c317e64736f6c63430008120033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106102065760003560e01c80638a1fcd601161011a578063cdba7342116100ad578063eb6d17891161007c578063eb6d178914610478578063ebd807861461048b578063ecd0c0c31461049e578063f2fde38b146104b1578063fc7e286d146104c457600080fd5b8063cdba734214610439578063d088a2311461044c578063dd90076914610454578063e30c39781461046757600080fd5b8063b24651c4116100e9578063b24651c4146103ed578063c3b6f72614610400578063c70f1a8c14610413578063caf3b7fd1461042657600080fd5b80638a1fcd60146103ad5780638da5cb5b146103b6578063a40b209f146103c7578063ac908b6e146103da57600080fd5b806343c8d8a21161019d57806372b0d90c1161016c57806372b0d90c1461036457806378a9c63d1461037757806379ba50971461038a5780637d6babb4146103925780637ddc62c11461039a57600080fd5b806343c8d8a2146102fe57806359a515ba1461031157806367653e5514610334578063715018a61461035c57600080fd5b8063295ca02d116101d9578063295ca02d146102975780632c4ab445146102b8578063344dd6e4146102e35780633ccfd60b146102f657600080fd5b806301ffc9a71461020b5780630ab2502214610244578063169e1ca81461026f5780631f4c747e14610284575b600080fd5b61022f610219366004612580565b6001600160e01b03191663567cd4c960e11b1490565b60405190151581526020015b60405180910390f35b609c54610257906001600160a01b031681565b6040516001600160a01b03909116815260200161023b565b61028261027d3660046125bf565b61050e565b005b609e54610257906001600160a01b031681565b6102aa6102a5366004612713565b6105bd565b60405190815260200161023b565b6102cb6102c636600461272f565b61062e565b6040516001600160801b03909116815260200161023b565b6102826102f1366004612751565b610786565b610282610ab6565b61028261030c36600461285e565b610ac1565b61022f61031f366004612905565b60a16020526000908152604090205460ff1681565b61034761034236600461291e565b610c65565b6040805192835260208301919091520161023b565b61028261105e565b610282610372366004612979565b611070565b610282610385366004612996565b611134565b6102826112d4565b6102aa61134e565b609b54610257906001600160a01b031681565b6102aa609f5481565b6033546001600160a01b0316610257565b6102aa6103d5366004612abf565b6113c9565b6102aa6103e8366004612b09565b611684565b609854610257906001600160a01b031681565b609954610257906001600160a01b031681565b609a54610257906001600160a01b031681565b609d54610257906001600160a01b031681565b6102826104473660046125bf565b6116ec565b61028261179c565b610282610462366004612905565b6117da565b6065546001600160a01b0316610257565b6102aa61048636600461272f565b61183e565b61022f610499366004612bb3565b611890565b609754610257906001600160a01b031681565b6102826104bf366004612979565b6118ee565b6104f36104d2366004612979565b60a06020526000908152604090208054600182015460029092015490919083565b6040805193845260208401929092529082015260600161023b565b8160000361052f5760405163adfd6eb360e01b815260040160405180910390fd5b6001600160a01b03811661055657604051633423ddb360e11b815260040160405180910390fd5b6001600160a01b038116600090815260a06020526040902060028101541561059157604051631c98f45d60e01b815260040160405180910390fd5b805461059e908490612c48565b81556097546105b8906001600160a01b031633308661195f565b505050565b805160208083015151604080850151606080870151608088015184519687019790975293811b6001600160601b0319908116938601939093521b1660548301526068820152608881019190915260009060a8015b604051602081830303815290604052805190602001209050919050565b609c54604051635e05e35d60e11b81526004810184905260009182916001600160a01b039091169063bc0bc6ba9060240161012060405180830381865afa15801561067d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106a19190612c8b565b80519091506000036106c65760405163a756193360e01b815260040160405180910390fd5b80518310806106e85750600081604001511180156106e8575080604001518310155b15610706576040516339e9ad8d60e11b815260040160405180910390fd5b60006107128443612d20565b9050816101000151811061072b57600092505050610780565b600061073f8360c0015184608001516119d0565b9050600083610100015183836107559190612d33565b61075f9190612d4a565b905061076a81611a00565b8460c001516107799190612d6c565b9450505050505b92915050565b600054610100900460ff16158080156107a65750600054600160ff909116105b806107c05750303b1580156107c0575060005460ff166001145b6108285760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff19166001179055801561084b576000805461ff0019166101001790555b6001600160a01b038a1661087257604051635f5d339960e01b815260040160405180910390fd5b6108a66040518060400160405280600a8152602001695265676973747269657360b01b8152508a637ccc541d60e11b611a6d565b6108de6040518060400160405280600e81526020016d29ba30b5b4b733a6b0b730b3b2b960911b815250896303e0261b60e41b611a6d565b610911604051806040016040528060098152602001684469726563746f727960b81b81525088638a5d64cd60e01b611a6d565b6109486040518060400160405280600d81526020016c22b837b1b439a6b0b730b3b2b960991b8152508763078a0a4b60e41b611a6d565b6109806040518060400160405280600e81526020016d2932bbb0b93239a6b0b730b3b2b960911b81525086631ed895ad60e11b611a6d565b6109bc60405180604001604052806012815260200171417574686f72697a65644163636f756e747360701b815250856337e592f160e21b611a6d565b816000036109dd57604051632d8ef94560e11b815260040160405180910390fd5b6109e5611b71565b609780546001600160a01b03199081166001600160a01b038d8116919091179092556098805482168c84161790556099805482168b8416179055609a805482168a8416179055609c80548216898416179055609b80548216888416179055609d80548216878416179055609e8054909116918516919091179055609f8290558015610aaa576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050505050565b610abf33611070565b565b609c54604051635e05e35d60e11b8152883560048201526000916001600160a01b03169063bc0bc6ba9060240161012060405180830381865afa158015610b0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b309190612c8b565b90504388608001351115610b5a576040516001623a160d60e21b0319815260040160405180910390fd5b6000610b79610b6e368b90038b018b612713565b888a89898989610c65565b600081815260a160205260408120805460ff19166001179055609a5491935091506001600160a01b0316631bdcc9ad8b35610bba60808e0160608f01612979565b6040516001600160e01b031960e085901b16815260048101929092526001600160a01b03166024820152604401602060405180830381865afa158015610c04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c289190612d93565b905080600003610c4e57604051637f6cbf1960e11b81528a35600482015260240161081f565b610aaa838b610c6060208c018c612979565b611ba0565b60208701515160009081906001600160a01b0316610c965760405163091e31fd60e31b815260040160405180910390fd5b6000610ca560208a018a612979565b6001600160a01b031603610ccc57604051635ff51db760e11b815260040160405180910390fd5b60408901516001600160a01b0316610cf75760405163cab78a2360e01b815260040160405180910390fd5b609e546000906001600160a01b0316634dde5a44610d1860208c018c612979565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015610d5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d809190612dac565b90506001600160a01b038116610dc257610d9d60208a018a612979565b60405163149948a160e31b81526001600160a01b03909116600482015260240161081f565b610dcb8a6105bd565b92508281604051602001610df692919091825260601b6001600160601b031916602082015260340190565b60408051601f198184030181529181528151602092830120600081815260a190935291205490925060ff1615610e3f576040516301faedd760e61b815260040160405180910390fd5b8960800151610e528b606001518a61183e565b14610e705760405163bfec4b7960e01b815260040160405180910390fd5b610e828a602001518b60600151611c44565b610e9f57604051632616fe7d60e11b815260040160405180910390fd5b610ebb610eb1368b90038b018b612dc9565b8b60600151611c44565b610ed8576040516354c4763f60e01b815260040160405180910390fd5b610f1e8a6020015188888080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250889250611ce4915050565b610f3b576040516319ad5a6d60e21b815260040160405180910390fd5b610f8b610f4d368b90038b018b612dc9565b86868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250889250611ce4915050565b610fa857604051639bce429160e01b815260040160405180910390fd5b61103487878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8b018190048102820181019092528981529250899150889081908401838280828437600081840152601f19601f820116905080830192505050505050508c600001518d606001518c611890565b61105157604051630554a83160e31b815260040160405180910390fd5b5097509795505050505050565b611066611d62565b610abf6000611dbc565b33600090815260a0602052604081206040805160608101825282548152600183015460208201526002909201549082018190529091506000036110c65760405163065bea4960e21b815260040160405180910390fd5b438160400151106110ea576040516366af725560e01b815260040160405180910390fd5b602081015181516000916110fd91612c48565b33600090815260a06020526040812081815560018101829055600201556097549091506105b8906001600160a01b03168483611dd5565b609c54604051635e05e35d60e11b8152873560048201526000916001600160a01b03169063bc0bc6ba9060240161012060405180830381865afa15801561117f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a39190612c8b565b9050438760c0013511156111cd576040516001623a160d60e21b0319815260040160405180910390fd5b60006111eb6111e1368a90038a018a612b09565b88888888886113c9565b600081815260a160205260408120805460ff19166001179055609a54919250906001600160a01b0316631bdcc9ad8a3561122b60c08d0160a08e01612979565b6040516001600160e01b031960e085901b16815260048101929092526001600160a01b03166024820152604401602060405180830381865afa158015611275573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112999190612d93565b9050806000036112bf57604051637f6cbf1960e11b81528935600482015260240161081f565b6112c9838a611e05565b505050505050505050565b60655433906001600160a01b031681146113425760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b606482015260840161081f565b61134b81611dbc565b50565b33600090815260a060205260408120805415801561136e57506001810154155b1561138c57604051639c4e744360e01b815260040160405180910390fd5b6002810154156113af57604051631c98f45d60e01b815260040160405180910390fd5b609f546113bc9043612c48565b6002909101819055919050565b6020860151516000906001600160a01b03166113f85760405163091e31fd60e31b815260040160405180910390fd5b6040870151516001600160a01b031661142457604051635ff51db760e11b815260040160405180910390fd5b60608701516001600160a01b031661144f5760405163cab78a2360e01b815260040160405180910390fd5b61145887611684565b600081815260a1602052604090205490915060ff161561148b576040516301faedd760e61b815260040160405180910390fd5b8660a0015161149e88608001518861183e565b146114bc5760405163bfec4b7960e01b815260040160405180910390fd5b6114ce87602001518860800151611c44565b6114eb57604051632616fe7d60e11b815260040160405180910390fd5b6114fd87604001518860800151611c44565b61151a576040516354c4763f60e01b815260040160405180910390fd5b611560876020015186868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250869250611ce4915050565b61157d576040516319ad5a6d60e21b815260040160405180910390fd5b6115c3876040015184848080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250869250611ce4915050565b6115e057604051639bce429160e01b815260040160405180910390fd5b61165d85858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f89018190048102820181019092528781529250879150869081908401838280828437600092019190915250508b5160808d015190925090508a611890565b61167a57604051630554a83160e31b815260040160405180910390fd5b9695505050505050565b80516020808301515160408085015151606080870151608088015160a089015185519788019890985294821b6001600160601b03199081169487019490945291811b831660548601521b166068830152607c820152609c81019190915260009060bc01610611565b8160000361170d5760405163ea50132f60e01b815260040160405180910390fd5b6001600160a01b03811661173457604051633423ddb360e11b815260040160405180910390fd5b6001600160a01b038116600090815260a06020526040902060028101541561176f57604051631c98f45d60e01b815260040160405180910390fd5b82816001015461177f9190612c48565b60018201556097546105b8906001600160a01b031633308661195f565b33600090815260a06020526040812060028101549091036117d05760405163065bea4960e21b815260040160405180910390fd5b6000600290910155565b6117e2611d62565b8060000361180357604051632d8ef94560e11b815260040160405180910390fd5b609f8190556040518181527fbf6423edafc706e6ae214d98c485a52f610ee2f23148b43d546af3f8834c21b39060200160405180910390a150565b604080516020810184905290810182905260009060600160408051601f198184030181528282528051602091820120908301520160405160208183030381529060405280519060200120905092915050565b60008061189d858561062e565b6001600160801b03169050600081608083901b179050808888866040516020016118c993929190612e09565b60408051601f1981840301815291905280516020909101201098975050505050505050565b6118f6611d62565b606580546001600160a01b0383166001600160a01b031990911681179091556119276033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6040516001600160a01b03808516602483015283166044820152606481018290526119ca9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611eb6565b50505050565b6000620186a06119ef63ffffffff84166001600160801b038616612d33565b6119f99190612d4a565b9392505050565b60006001600160801b03821115611a695760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663238206269747360c81b606482015260840161081f565b5090565b8251600003611a8f5760405163d1fc12f760e01b815260040160405180910390fd5b6001600160a01b038216611ab6578260405161f56160eb1b815260040161081f9190612e6a565b6001600160e01b03198116611ade5760405163308c995160e01b815260040160405180910390fd5b6040516301ffc9a760e01b81526001600160e01b0319821660048201526001600160a01b038316906301ffc9a790602401602060405180830381865afa158015611b2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b509190612e7d565b6105b8578281604051633f8ccd3b60e21b815260040161081f929190612e9f565b600054610100900460ff16611b985760405162461bcd60e51b815260040161081f90612eca565b610abf611f8b565b6000611bbf8460208501611bba6080870160608801612979565b611fbb565b9050611bd16040840160208501612979565b6001600160a01b0316611bea6080850160608601612979565b604080516001600160a01b038681168252608088013560208301529181018590529116908535907f04562f4c0ee54b401e8fcaafa7daa175963d9bb7a07297633221dc08b1d57b0f9060600160405180910390a450505050565b60208201516000906001600160a01b0316611c6157506001610780565b609d548351602085015160405163c346893b60e01b81526000936001600160a01b03169263c346893b92611c9b9286908990600401612f2b565b602060405180830381865afa158015611cb8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cdc9190612e7d565b949350505050565b602083015160009081906001600160a01b031615611d0757506020840151611d0b565b5083515b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000006000908152601c849052603c90206001600160a01b038216611d4e8287612098565b6001600160a01b0316149695505050505050565b6033546001600160a01b03163314610abf5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161081f565b606580546001600160a01b031916905561134b816120bc565b6040516001600160a01b0383166024820152604481018290526105b890849063a9059cbb60e01b90606401611993565b6000611e1f8360208401611bba60c0860160a08701612979565b9050611e316040830160208401612979565b6001600160a01b0316611e4a60c0840160a08501612979565b6001600160a01b031683357f7d274bdf94856b1ec309b530c7bf991ea808eb7782afef762e28cce446178907611e866080870160608801612979565b604080516001600160a01b03909216825260c08801356020830152810186905260600160405180910390a4505050565b6000611f0b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661210e9092919063ffffffff16565b9050805160001480611f2c575080806020019051810190611f2c9190612e7d565b6105b85760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161081f565b600054610100900460ff16611fb25760405162461bcd60e51b815260040161081f90612eca565b610abf33611dbc565b600080611fe8611fce6020860186612979565b6001600160a01b0316600090815260a06020526040902090565b9050600081600001548660a00151111561207e5750805461200a84838361211d565b6097546001830154612029916001600160a01b03169061dead90611dd5565b600060018301557f2ec87e1ff3f5b311fa539eb48a387afc2e82e11ac9919086426f16c1b35cfe8561205e6020870187612979565b6040516001600160a01b03909116815260200160405180910390a161208f565b5060a085015161208f84838361211d565b95945050505050565b60008060006120a785856121b4565b915091506120b4816121f9565b509392505050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6060611cdc8484600085612343565b815461212a908290612d20565b8255609754609b54612149916001600160a01b03908116911683611dd5565b609b546040516340768fd360e01b81526001600160a01b03858116600483015260248201849052909116906340768fd390604401600060405180830381600087803b15801561219757600080fd5b505af11580156121ab573d6000803e3d6000fd5b50505050505050565b60008082516041036121ea5760208301516040840151606085015160001a6121de8782858561241e565b945094505050506121f2565b506000905060025b9250929050565b600081600481111561220d5761220d612f15565b036122155750565b600181600481111561222957612229612f15565b036122765760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161081f565b600281600481111561228a5761228a612f15565b036122d75760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161081f565b60038160048111156122eb576122eb612f15565b0361134b5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161081f565b6060824710156123a45760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161081f565b600080866001600160a01b031685876040516123c09190612f73565b60006040518083038185875af1925050503d80600081146123fd576040519150601f19603f3d011682016040523d82523d6000602084013e612402565b606091505b5091509150612413878383876124e2565b979650505050505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561245557506000905060036124d9565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156124a9573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166124d2576000600192509250506124d9565b9150600090505b94509492505050565b6060831561255157825160000361254a576001600160a01b0385163b61254a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161081f565b5081611cdc565b611cdc83838151156125665781518083602001fd5b8060405162461bcd60e51b815260040161081f9190612e6a565b60006020828403121561259257600080fd5b81356001600160e01b0319811681146119f957600080fd5b6001600160a01b038116811461134b57600080fd5b600080604083850312156125d257600080fd5b8235915060208301356125e4816125aa565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b604051610120810167ffffffffffffffff81118282101715612629576126296125ef565b60405290565b60006040828403121561264157600080fd5b6040516040810181811067ffffffffffffffff82111715612664576126646125ef565b6040529050808235612675816125aa565b81526020830135612685816125aa565b6020919091015292915050565b600060c082840312156126a457600080fd5b60405160a0810181811067ffffffffffffffff821117156126c7576126c76125ef565b604052823581529050806126de846020850161262f565b602082015260608301356126f1816125aa565b806040830152506080830135606082015260a083013560808201525092915050565b600060c0828403121561272557600080fd5b6119f98383612692565b6000806040838503121561274257600080fd5b50508035926020909101359150565b60008060008060008060008060006101208a8c03121561277057600080fd5b893561277b816125aa565b985060208a013561278b816125aa565b975060408a013561279b816125aa565b965060608a01356127ab816125aa565b955060808a01356127bb816125aa565b945060a08a01356127cb816125aa565b935060c08a01356127db816125aa565b925060e08a01356127eb816125aa565b809250506101008a013590509295985092959850929598565b60006040828403121561281657600080fd5b50919050565b60008083601f84011261282e57600080fd5b50813567ffffffffffffffff81111561284657600080fd5b6020830191508360208285010111156121f257600080fd5b600080600080600080600087890361016081121561287b57600080fd5b60c081121561288957600080fd5b5087965060c088013595506128a18960e08a01612804565b945061012088013567ffffffffffffffff808211156128bf57600080fd5b6128cb8b838c0161281c565b90965094506101408a01359150808211156128e557600080fd5b506128f28a828b0161281c565b989b979a50959850939692959293505050565b60006020828403121561291757600080fd5b5035919050565b6000806000806000806000610160888a03121561293a57600080fd5b6129448989612692565b96506129538960c08a01612804565b9550610100880135945061012088013567ffffffffffffffff808211156128bf57600080fd5b60006020828403121561298b57600080fd5b81356119f9816125aa565b6000806000806000808688036101608112156129b157600080fd5b610100808212156129c157600080fd5b88975087013595505061012086013567ffffffffffffffff808211156129e657600080fd5b6129f28a838b0161281c565b9096509450610140890135915080821115612a0c57600080fd5b50612a1989828a0161281c565b979a9699509497509295939492505050565b60006101008284031215612a3e57600080fd5b60405160c0810181811067ffffffffffffffff82111715612a6157612a616125ef565b60405282358152905080612a78846020850161262f565b6020820152612a8a846060850161262f565b604082015260a0830135612a9d816125aa565b8060608301525060c0830135608082015260e083013560a08201525092915050565b6000806000806000806101608789031215612ad957600080fd5b612ae38888612a2b565b9550610100870135945061012087013567ffffffffffffffff808211156129e657600080fd5b60006101008284031215612b1c57600080fd5b6119f98383612a2b565b600082601f830112612b3757600080fd5b813567ffffffffffffffff80821115612b5257612b526125ef565b604051601f8301601f19908116603f01168101908282118183101715612b7a57612b7a6125ef565b81604052838152866020858801011115612b9357600080fd5b836020870160208301376000602085830101528094505050505092915050565b600080600080600060a08688031215612bcb57600080fd5b853567ffffffffffffffff80821115612be357600080fd5b612bef89838a01612b26565b96506020880135915080821115612c0557600080fd5b50612c1288828901612b26565b959895975050505060408401359360608101359360809091013592509050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561078057610780612c32565b805163ffffffff81168114612c6f57600080fd5b919050565b80516001600160801b0381168114612c6f57600080fd5b60006101208284031215612c9e57600080fd5b612ca6612605565b825181526020830151602082015260408301516040820152612cca60608401612c5b565b6060820152612cdb60808401612c5b565b608082015260a083015160a0820152612cf660c08401612c74565b60c0820152612d0760e08401612c74565b60e0820152610100928301519281019290925250919050565b8181038181111561078057610780612c32565b808202811582820484141761078057610780612c32565b600082612d6757634e487b7160e01b600052601260045260246000fd5b500490565b6001600160801b03828116828216039080821115612d8c57612d8c612c32565b5092915050565b600060208284031215612da557600080fd5b5051919050565b600060208284031215612dbe57600080fd5b81516119f9816125aa565b600060408284031215612ddb57600080fd5b6119f9838361262f565b60005b83811015612e00578181015183820152602001612de8565b50506000910152565b60008451612e1b818460208901612de5565b845190830190612e2f818360208901612de5565b01928352505060200192915050565b60008151808452612e56816020860160208601612de5565b601f01601f19169290920160200192915050565b6020815260006119f96020830184612e3e565b600060208284031215612e8f57600080fd5b815180151581146119f957600080fd5b604081526000612eb26040830185612e3e565b905063ffffffff60e01b831660208301529392505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b634e487b7160e01b600052602160045260246000fd5b6001600160a01b038581168252841660208201526080810160018410612f6157634e487b7160e01b600052602160045260246000fd5b60408201939093526060015292915050565b60008251612f85818460208701612de5565b919091019291505056fea2646970667358221220df15c9ce639d482fafc3d321375e7ebc8cd7cfc4ec1c8617ea0c1d536d6c317e64736f6c63430008120033", + "devdoc": { + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "acceptOwnership()": { + "details": "The new owner accepts the ownership transfer." + }, + "calculateWinningProbability(uint256,uint256)": { + "params": { + "epochId": "The epochId of the ticket.", + "generationBlock": "The generationBlock of the ticket." + } + }, + "depositEscrow(uint256,address)": { + "params": { + "account": "The address of the account holding the escrow.", + "amount": "The amount in SOLO to add to the escrow." + } + }, + "depositPenalty(uint256,address)": { + "params": { + "account": "The address of the account holding the penalty.", + "amount": "The amount in SOLO to add to the escrow." + } + }, + "getMultiReceiverTicketHash((uint256,(address,address),address,uint256,bytes32))": { + "returns": { + "_0": "A byte-array representing the hash." + } + }, + "getTicketHash((uint256,(address,address),(address,address),address,uint256,bytes32))": { + "returns": { + "_0": "A byte-array representing the hash." + } + }, + "isWinningTicket(bytes,bytes,uint256,uint256,uint256)": { + "params": { + "epochId": "The epochId of the ticket.", + "generationBlock": "The generationBlock of the ticket.", + "receiverSig": "The signature of the receiver of the ticket.", + "redeemerRand": "The redeemer random value, generated by the Node prior to performing the event relay.", + "senderSig": "The signature of the sender of the ticket." + }, + "returns": { + "_0": "True if a ticket is a winner." + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pendingOwner()": { + "details": "Returns the address of the pending owner." + }, + "redeem((uint256,(address,address),(address,address),address,uint256,bytes32),uint256,bytes,bytes)": { + "params": { + "receiverSig": "The signature of the redeemer of the ticket.", + "redeemerRand": "The redeemer random value, generated by the Node prior to performing the event relay.", + "senderSig": "The signature of the sender of the ticket.", + "ticket": "The ticket issued by the sender." + } + }, + "redeemMultiReceiver((uint256,(address,address),address,uint256,bytes32),uint256,(address,address),bytes,bytes)": { + "params": { + "receiver": "A valid receiver of the the relay.", + "receiverSig": "The signature of the redeemer of the ticket.", + "redeemerRand": "The redeemer random value, generated by the Node prior to performing the event relay.", + "senderSig": "The signature of the sender of the ticket.", + "ticket": "The ticket issued by the sender." + } + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "requireValidWinningMultiReceiverTicket((uint256,(address,address),address,uint256,bytes32),(address,address),uint256,bytes,bytes)": { + "params": { + "receiver": "The receiver associated with the ticket.", + "receiverSig": "The signature of the redeemer of the ticket.", + "redeemerRand": "The redeemer random value, generated by the Node prior to performing the event relay.", + "senderSig": "The signature of the sender of the ticket.", + "ticket": "The ticket issued by the sender." + } + }, + "requireValidWinningTicket((uint256,(address,address),(address,address),address,uint256,bytes32),uint256,bytes,bytes)": { + "params": { + "receiverSig": "The signature of the redeemer of the ticket.", + "redeemerRand": "The redeemer random value, generated by the Node prior to performing the event relay.", + "senderSig": "The signature of the sender of the ticket.", + "ticket": "The ticket issued by the sender." + }, + "returns": { + "ticketHash": "The hash of the ticket. Should match the hash generated by `getTicketHash`." + } + }, + "setUnlockDuration(uint256)": { + "params": { + "_unlockDuration": "The unlock duration in blocks." + } + }, + "transferOwnership(address)": { + "details": "Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner." + }, + "withdrawTo(address)": { + "params": { + "account": "The address of the account the tokens should be transferred to." + } + } + }, + "stateVariables": { + "_epochsManager": { + "details": "The ticketing parameters used when redeeming tickets will be read from this contract." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "_authorizedAccounts()": { + "notice": "Sylo Authorized Accounts." + }, + "_directory()": { + "notice": "Sylo Directory contract " + }, + "_epochsManager()": { + "notice": "Sylo Epochs Manager." + }, + "_futurepassRegistrar()": { + "notice": "Futurepass Registrar Pre-compile." + }, + "_registries()": { + "notice": "Sylo Registries contract " + }, + "_rewardsManager()": { + "notice": "Rewards Manager contract " + }, + "_stakingManager()": { + "notice": "Sylo Staking Manager contract " + }, + "_token()": { + "notice": "ERC20 Sylo token contract." + }, + "calculateWinningProbability(uint256,uint256)": { + "notice": "This function calculates the probability of a ticket winning at the block that this function was called. A ticket's winning probability will decay every block since its issuance. The amount of decay will depend on the decay rate parameter of the epoch the ticket was generated in." + }, + "depositEscrow(uint256,address)": { + "notice": "Use this function to deposit funds into the escrow. This will fail if the deposit is currently being unlocked." + }, + "depositPenalty(uint256,address)": { + "notice": "Use this function to deposit funds into the penalty. This will fail if the deposit is currently being unlocked." + }, + "deposits(address)": { + "notice": "Mapping of user deposits " + }, + "getMultiReceiverTicketHash((uint256,(address,address),address,uint256,bytes32))": { + "notice": "Returns the hash of a multi receiver ticket. Takes all fields in a ticket as inputs to the hash, as well as a specific receiver." + }, + "getTicketHash((uint256,(address,address),(address,address),address,uint256,bytes32))": { + "notice": "Returns the hash of the ticket. Takes all fields in a ticket as inputs to the hash." + }, + "isWinningTicket(bytes,bytes,uint256,uint256,uint256)": { + "notice": "Use this function to check if a ticket is winning." + }, + "lockDeposits()": { + "notice": "Call this function to cancel any deposit that is in the unlocking process." + }, + "redeem((uint256,(address,address),(address,address),address,uint256,bytes32),uint256,bytes,bytes)": { + "notice": "Nodes should call this function on completing an event delivery. This function will fail if the ticket is invalid or if the ticket is not a winner. Clients should calculate if the ticket is a winner locally, but can also use the public view functions: `requireValidWinningTicket` and `isWinningTicket` to check that a ticket is winning." + }, + "redeemMultiReceiver((uint256,(address,address),address,uint256,bytes32),uint256,(address,address),bytes,bytes)": { + "notice": "Nodes should call this function on completing a one-to-many event delivery. This function will fail if the ticket is invalid or if the ticket is not a winner. Additionally, the specified receiver must have a valid futurepass account associated with it. Clients should calculate if the ticket is a winner locally, but can also use the public view functions: `requireValidWinningMultiReceiverTicket` and `isWinningTicket` to check that a ticket is winning." + }, + "requireValidWinningMultiReceiverTicket((uint256,(address,address),address,uint256,bytes32),(address,address),uint256,bytes,bytes)": { + "notice": "Call this function to check if a multi receiver ticket is valid and is a winning ticket. It will fail if the ticket is invalid or is not a winner. A ticket is invalid if: - The sender, receiver or redeemer addresses are null - The receiver does not have a valid futurepass account - The ticket has already been redeemed. - The secret random value of the redeemer does not match the commit in the ticket. - The signatures are invalid." + }, + "requireValidWinningTicket((uint256,(address,address),(address,address),address,uint256,bytes32),uint256,bytes,bytes)": { + "notice": "Call this function to check if a ticket is valid and is a winning ticket. It will fail if the ticket is invalid or is not a winner. A ticket is invalid if: - The sender or redeemer addresses are null - The ticket has already been redeemed. - The secret random value of the sender does not match the commit in the ticket. - The signatures are invalid." + }, + "setUnlockDuration(uint256)": { + "notice": "Set the unlock duration for deposits. Only callable by the owner." + }, + "supportsInterface(bytes4)": { + "notice": "Returns true if the contract implements the interface defined by `interfaceId` from ERC165." + }, + "unlockDeposits()": { + "notice": "Call this function to begin unlocking deposits. This function will fail if no deposit exists, or if the unlock process has already begun." + }, + "unlockDuration()": { + "notice": "The number of blocks a user must wait after calling \"unlock\" before they can withdraw their funds." + }, + "usedTickets(bytes32)": { + "notice": "Mapping of ticket hashes, used to check if a ticket has been redeemed " + }, + "withdraw()": { + "notice": "Call this function once the unlock duration has elapsed in order to transfer the unlocked tokens to the caller's account." + }, + "withdrawTo(address)": { + "notice": "Call this function once the unlock duration has elapsed in order to transfer the unlocked tokens to the specified account." + } + }, + "notice": "The SyloTicketing contract manages the Probabilistic Micro-Payment Ticketing system that pays Nodes for providing the Event Relay service.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 244, + "contract": "contracts/payments/SyloTicketing.sol:SyloTicketing", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 247, + "contract": "contracts/payments/SyloTicketing.sol:SyloTicketing", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 777, + "contract": "contracts/payments/SyloTicketing.sol:SyloTicketing", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 116, + "contract": "contracts/payments/SyloTicketing.sol:SyloTicketing", + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address" + }, + { + "astId": 236, + "contract": "contracts/payments/SyloTicketing.sol:SyloTicketing", + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 25, + "contract": "contracts/payments/SyloTicketing.sol:SyloTicketing", + "label": "_pendingOwner", + "offset": 0, + "slot": "101", + "type": "t_address" + }, + { + "astId": 104, + "contract": "contracts/payments/SyloTicketing.sol:SyloTicketing", + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 11356, + "contract": "contracts/payments/SyloTicketing.sol:SyloTicketing", + "label": "_token", + "offset": 0, + "slot": "151", + "type": "t_contract(IERC20)1443" + }, + { + "astId": 11360, + "contract": "contracts/payments/SyloTicketing.sol:SyloTicketing", + "label": "_registries", + "offset": 0, + "slot": "152", + "type": "t_contract(Registries)9641" + }, + { + "astId": 11364, + "contract": "contracts/payments/SyloTicketing.sol:SyloTicketing", + "label": "_stakingManager", + "offset": 0, + "slot": "153", + "type": "t_contract(StakingManager)15921" + }, + { + "astId": 11368, + "contract": "contracts/payments/SyloTicketing.sol:SyloTicketing", + "label": "_directory", + "offset": 0, + "slot": "154", + "type": "t_contract(Directory)14978" + }, + { + "astId": 11372, + "contract": "contracts/payments/SyloTicketing.sol:SyloTicketing", + "label": "_rewardsManager", + "offset": 0, + "slot": "155", + "type": "t_contract(RewardsManager)14142" + }, + { + "astId": 11376, + "contract": "contracts/payments/SyloTicketing.sol:SyloTicketing", + "label": "_epochsManager", + "offset": 0, + "slot": "156", + "type": "t_contract(EpochsManager)10429" + }, + { + "astId": 11380, + "contract": "contracts/payments/SyloTicketing.sol:SyloTicketing", + "label": "_authorizedAccounts", + "offset": 0, + "slot": "157", + "type": "t_contract(AuthorizedAccounts)9090" + }, + { + "astId": 11384, + "contract": "contracts/payments/SyloTicketing.sol:SyloTicketing", + "label": "_futurepassRegistrar", + "offset": 0, + "slot": "158", + "type": "t_contract(IFuturePassRegistrar)10523" + }, + { + "astId": 11387, + "contract": "contracts/payments/SyloTicketing.sol:SyloTicketing", + "label": "unlockDuration", + "offset": 0, + "slot": "159", + "type": "t_uint256" + }, + { + "astId": 11393, + "contract": "contracts/payments/SyloTicketing.sol:SyloTicketing", + "label": "deposits", + "offset": 0, + "slot": "160", + "type": "t_mapping(t_address,t_struct(Deposit)10703_storage)" + }, + { + "astId": 11398, + "contract": "contracts/payments/SyloTicketing.sol:SyloTicketing", + "label": "usedTickets", + "offset": 0, + "slot": "161", + "type": "t_mapping(t_bytes32,t_bool)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(AuthorizedAccounts)9090": { + "encoding": "inplace", + "label": "contract AuthorizedAccounts", + "numberOfBytes": "20" + }, + "t_contract(Directory)14978": { + "encoding": "inplace", + "label": "contract Directory", + "numberOfBytes": "20" + }, + "t_contract(EpochsManager)10429": { + "encoding": "inplace", + "label": "contract EpochsManager", + "numberOfBytes": "20" + }, + "t_contract(IERC20)1443": { + "encoding": "inplace", + "label": "contract IERC20", + "numberOfBytes": "20" + }, + "t_contract(IFuturePassRegistrar)10523": { + "encoding": "inplace", + "label": "contract IFuturePassRegistrar", + "numberOfBytes": "20" + }, + "t_contract(Registries)9641": { + "encoding": "inplace", + "label": "contract Registries", + "numberOfBytes": "20" + }, + "t_contract(RewardsManager)14142": { + "encoding": "inplace", + "label": "contract RewardsManager", + "numberOfBytes": "20" + }, + "t_contract(StakingManager)15921": { + "encoding": "inplace", + "label": "contract StakingManager", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_struct(Deposit)10703_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct ISyloTicketing.Deposit)", + "numberOfBytes": "32", + "value": "t_struct(Deposit)10703_storage" + }, + "t_mapping(t_bytes32,t_bool)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_struct(Deposit)10703_storage": { + "encoding": "inplace", + "label": "struct ISyloTicketing.Deposit", + "members": [ + { + "astId": 10698, + "contract": "contracts/payments/SyloTicketing.sol:SyloTicketing", + "label": "escrow", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 10700, + "contract": "contracts/payments/SyloTicketing.sol:SyloTicketing", + "label": "penalty", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 10702, + "contract": "contracts/payments/SyloTicketing.sol:SyloTicketing", + "label": "unlockAt", + "offset": 0, + "slot": "2", + "type": "t_uint256" + } + ], + "numberOfBytes": "96" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/deployments/porcini-dev/SyloTicketing_Proxy.json b/deployments/porcini-dev/SyloTicketing_Proxy.json new file mode 100644 index 00000000..798d31da --- /dev/null +++ b/deployments/porcini-dev/SyloTicketing_Proxy.json @@ -0,0 +1,235 @@ +{ + "address": "0x62D39eB18f77143aA3B847FDB54F95db896fC28f", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x1c416ffb3d5ec546ca4c4da793c21b0206f13a97d2081f55ccaebd5905589ec4", + "receipt": { + "to": null, + "from": "0x448c8e9e1816300Dd052e77D2A44c990A2807D15", + "contractAddress": "0x62D39eB18f77143aA3B847FDB54F95db896fC28f", + "transactionIndex": 0, + "gasUsed": "720418", + "logsBloom": "0x00000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000002080000000000000000000000000000000000000000000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000200000000800000800000000000000000008000000000000000000000000000000000000000000000000020000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x53419b6afa1236d1e551aa63657eda5253dfc09ab34c5b78132f0465f85c9648", + "transactionHash": "0x1c416ffb3d5ec546ca4c4da793c21b0206f13a97d2081f55ccaebd5905589ec4", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 10978382, + "transactionHash": "0x1c416ffb3d5ec546ca4c4da793c21b0206f13a97d2081f55ccaebd5905589ec4", + "address": "0x62D39eB18f77143aA3B847FDB54F95db896fC28f", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x0000000000000000000000008185e90e424116c67d8429be71006941679e08bb" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0x53419b6afa1236d1e551aa63657eda5253dfc09ab34c5b78132f0465f85c9648" + }, + { + "transactionIndex": 0, + "blockNumber": 10978382, + "transactionHash": "0x1c416ffb3d5ec546ca4c4da793c21b0206f13a97d2081f55ccaebd5905589ec4", + "address": "0x62D39eB18f77143aA3B847FDB54F95db896fC28f", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f06d5edb04f4995fff2c362a14826107f7cccbcc", + "logIndex": 1, + "blockHash": "0x53419b6afa1236d1e551aa63657eda5253dfc09ab34c5b78132f0465f85c9648" + } + ], + "blockNumber": 10978382, + "cumulativeGasUsed": "720418", + "status": 1, + "byzantium": true + }, + "args": [ + "0x8185e90E424116c67D8429Be71006941679E08bB", + "0xf06d5Edb04F4995FFF2c362a14826107F7CCCBCc", + "0x" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\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\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.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 *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\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 Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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 Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual 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 Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\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(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\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(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) 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\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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 overriden 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 internall 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 overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/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\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\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 * ```\\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`, and `uint256`._\\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 /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\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 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 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 assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/porcini-dev/TicketingParameters.json b/deployments/porcini-dev/TicketingParameters.json new file mode 100644 index 00000000..0b3f8cd8 --- /dev/null +++ b/deployments/porcini-dev/TicketingParameters.json @@ -0,0 +1,630 @@ +{ + "address": "0xCE1BAd6FaC2eDab78C607bfA50a9BfC29A172214", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "inputs": [], + "name": "FaceValueCannotBeZero", + "type": "error" + }, + { + "inputs": [], + "name": "TicketDurationCannotBeZero", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint128", + "name": "baseLiveWinprob", + "type": "uint128" + } + ], + "name": "BaseLiveWinProbUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint32", + "name": "decayRate", + "type": "uint32" + } + ], + "name": "DecayRateUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint128", + "name": "expiredWinProb", + "type": "uint128" + } + ], + "name": "ExpiredWinProbUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "faceValue", + "type": "uint256" + } + ], + "name": "FaceValueUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "ticketDuration", + "type": "uint256" + } + ], + "name": "TicketDurationUpdated", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "baseLiveWinProb", + "outputs": [ + { + "internalType": "uint128", + "name": "", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decayRate", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "expiredWinProb", + "outputs": [ + { + "internalType": "uint128", + "name": "", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "faceValue", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTicketingParameters", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint128", + "name": "", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_faceValue", + "type": "uint256" + }, + { + "internalType": "uint128", + "name": "_baseLiveWinProb", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "_expiredWinProb", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "_decayRate", + "type": "uint32" + }, + { + "internalType": "uint256", + "name": "_ticketDuration", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint128", + "name": "_baseLiveWinProb", + "type": "uint128" + } + ], + "name": "setBaseLiveWinProb", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_decayRate", + "type": "uint32" + } + ], + "name": "setDecayRate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint128", + "name": "_expiredWinProb", + "type": "uint128" + } + ], + "name": "setExpiredWinProb", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_faceValue", + "type": "uint256" + } + ], + "name": "setFaceValue", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_ticketDuration", + "type": "uint256" + } + ], + "name": "setTicketDuration", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ticketDuration", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0xa286b4823cf45f7911819cb7f14e629601fb750b2d1fa2ce93c3ebe310a32b91", + "receipt": { + "to": null, + "from": "0x448c8e9e1816300Dd052e77D2A44c990A2807D15", + "contractAddress": "0xCE1BAd6FaC2eDab78C607bfA50a9BfC29A172214", + "transactionIndex": 0, + "gasUsed": "720430", + "logsBloom": "0x00000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000800000020000000800000010000000000000000000000000000000000000000080000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000200000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xcf8081fd55dbe42508dcf09914d65ecb90305ed009c3e6bb56f87d1369a64762", + "transactionHash": "0xa286b4823cf45f7911819cb7f14e629601fb750b2d1fa2ce93c3ebe310a32b91", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 10978369, + "transactionHash": "0xa286b4823cf45f7911819cb7f14e629601fb750b2d1fa2ce93c3ebe310a32b91", + "address": "0xCE1BAd6FaC2eDab78C607bfA50a9BfC29A172214", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000f635d6a59eeffdcdce76422a81a1542d6f99949f" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0xcf8081fd55dbe42508dcf09914d65ecb90305ed009c3e6bb56f87d1369a64762" + }, + { + "transactionIndex": 0, + "blockNumber": 10978369, + "transactionHash": "0xa286b4823cf45f7911819cb7f14e629601fb750b2d1fa2ce93c3ebe310a32b91", + "address": "0xCE1BAd6FaC2eDab78C607bfA50a9BfC29A172214", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f06d5edb04f4995fff2c362a14826107f7cccbcc", + "logIndex": 1, + "blockHash": "0xcf8081fd55dbe42508dcf09914d65ecb90305ed009c3e6bb56f87d1369a64762" + } + ], + "blockNumber": 10978369, + "cumulativeGasUsed": "720430", + "status": 1, + "byzantium": true + }, + "args": [ + "0xf635d6A59EeFfDcdcE76422a81A1542D6f99949f", + "0xf06d5Edb04F4995FFF2c362a14826107F7CCCBCc", + "0x" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\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\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.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 *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\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 Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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 Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual 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 Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\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(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\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(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) 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\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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 overriden 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 internall 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 overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/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\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\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 * ```\\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`, and `uint256`._\\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 /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\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 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 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 assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "implementation": "0xf635d6A59EeFfDcdcE76422a81A1542D6f99949f", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/porcini-dev/TicketingParameters_Implementation.json b/deployments/porcini-dev/TicketingParameters_Implementation.json new file mode 100644 index 00000000..6ac6eeb3 --- /dev/null +++ b/deployments/porcini-dev/TicketingParameters_Implementation.json @@ -0,0 +1,668 @@ +{ + "address": "0xf635d6A59EeFfDcdcE76422a81A1542D6f99949f", + "abi": [ + { + "inputs": [], + "name": "FaceValueCannotBeZero", + "type": "error" + }, + { + "inputs": [], + "name": "TicketDurationCannotBeZero", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint128", + "name": "baseLiveWinprob", + "type": "uint128" + } + ], + "name": "BaseLiveWinProbUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint32", + "name": "decayRate", + "type": "uint32" + } + ], + "name": "DecayRateUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint128", + "name": "expiredWinProb", + "type": "uint128" + } + ], + "name": "ExpiredWinProbUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "faceValue", + "type": "uint256" + } + ], + "name": "FaceValueUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "ticketDuration", + "type": "uint256" + } + ], + "name": "TicketDurationUpdated", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "baseLiveWinProb", + "outputs": [ + { + "internalType": "uint128", + "name": "", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decayRate", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "expiredWinProb", + "outputs": [ + { + "internalType": "uint128", + "name": "", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "faceValue", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTicketingParameters", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint128", + "name": "", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_faceValue", + "type": "uint256" + }, + { + "internalType": "uint128", + "name": "_baseLiveWinProb", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "_expiredWinProb", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "_decayRate", + "type": "uint32" + }, + { + "internalType": "uint256", + "name": "_ticketDuration", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint128", + "name": "_baseLiveWinProb", + "type": "uint128" + } + ], + "name": "setBaseLiveWinProb", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_decayRate", + "type": "uint32" + } + ], + "name": "setDecayRate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint128", + "name": "_expiredWinProb", + "type": "uint128" + } + ], + "name": "setExpiredWinProb", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_faceValue", + "type": "uint256" + } + ], + "name": "setFaceValue", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_ticketDuration", + "type": "uint256" + } + ], + "name": "setTicketDuration", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ticketDuration", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x11ac89a90f7f0b339e18884214d6ac7124a90004dda198dc5d9587db07765f76", + "receipt": { + "to": null, + "from": "0x448c8e9e1816300Dd052e77D2A44c990A2807D15", + "contractAddress": "0xf635d6A59EeFfDcdcE76422a81A1542D6f99949f", + "transactionIndex": 0, + "gasUsed": "614768", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x80ee5a8f1ce1006cd8fd8962604da05487d0d3d61dc3455812145b4952bb8917", + "transactionHash": "0x11ac89a90f7f0b339e18884214d6ac7124a90004dda198dc5d9587db07765f76", + "logs": [], + "blockNumber": 10978367, + "cumulativeGasUsed": "614768", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "4e3bc77852cb55aaa633eb254b5b5cf7", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"FaceValueCannotBeZero\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TicketDurationCannotBeZero\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint128\",\"name\":\"baseLiveWinprob\",\"type\":\"uint128\"}],\"name\":\"BaseLiveWinProbUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"decayRate\",\"type\":\"uint32\"}],\"name\":\"DecayRateUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint128\",\"name\":\"expiredWinProb\",\"type\":\"uint128\"}],\"name\":\"ExpiredWinProbUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"faceValue\",\"type\":\"uint256\"}],\"name\":\"FaceValueUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"ticketDuration\",\"type\":\"uint256\"}],\"name\":\"TicketDurationUpdated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"baseLiveWinProb\",\"outputs\":[{\"internalType\":\"uint128\",\"name\":\"\",\"type\":\"uint128\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decayRate\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"expiredWinProb\",\"outputs\":[{\"internalType\":\"uint128\",\"name\":\"\",\"type\":\"uint128\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"faceValue\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTicketingParameters\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint128\",\"name\":\"\",\"type\":\"uint128\"},{\"internalType\":\"uint128\",\"name\":\"\",\"type\":\"uint128\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_faceValue\",\"type\":\"uint256\"},{\"internalType\":\"uint128\",\"name\":\"_baseLiveWinProb\",\"type\":\"uint128\"},{\"internalType\":\"uint128\",\"name\":\"_expiredWinProb\",\"type\":\"uint128\"},{\"internalType\":\"uint32\",\"name\":\"_decayRate\",\"type\":\"uint32\"},{\"internalType\":\"uint256\",\"name\":\"_ticketDuration\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint128\",\"name\":\"_baseLiveWinProb\",\"type\":\"uint128\"}],\"name\":\"setBaseLiveWinProb\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"_decayRate\",\"type\":\"uint32\"}],\"name\":\"setDecayRate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint128\",\"name\":\"_expiredWinProb\",\"type\":\"uint128\"}],\"name\":\"setExpiredWinProb\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_faceValue\",\"type\":\"uint256\"}],\"name\":\"setFaceValue\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_ticketDuration\",\"type\":\"uint256\"}],\"name\":\"setTicketDuration\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ticketDuration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Persists the parameters for the ticketing mechanism. This contract is read by the EpochManager. Extracting the parameters into another contract is necessary to avoid a cyclic dependency between the ticketing and epoch contracts.\",\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"getTicketingParameters()\":{\"returns\":{\"_0\":\"faceValue The face value of a ticket in SOLO.\",\"_1\":\"baseLiveWinProb The base live win probability of a ticket.\",\"_2\":\"expiredWinProb The expired win probability of a ticket.\",\"_3\":\"ticketDuration The duration of a ticket in number of blocks.\",\"_4\":\"decayRate The decay rate of a ticket.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"setBaseLiveWinProb(uint128)\":{\"params\":{\"_baseLiveWinProb\":\"The probability represented as a value between 0 to 2**128 - 1.\"}},\"setDecayRate(uint32)\":{\"params\":{\"_decayRate\":\"The decay rate as a percentage, where the denominator is 10000.\"}},\"setExpiredWinProb(uint128)\":{\"params\":{\"_expiredWinProb\":\"The probability represented as a value between 0 to 2**128 - 1.\"}},\"setFaceValue(uint256)\":{\"params\":{\"_faceValue\":\"The face value to set in SOLO.\"}},\"setTicketDuration(uint256)\":{\"params\":{\"_ticketDuration\":\"The duration of a ticket in number of blocks.\"}},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"baseLiveWinProb()\":{\"notice\":\"The probability of a ticket winning during the start of its lifetime. This is a uint128 value representing the numerator in the probability ratio where 2^128 - 1 is the denominator.\"},\"decayRate()\":{\"notice\":\"A percentage value representing the proportion of the base win probability that will be decayed once a ticket has expired. Example: 80% decayRate indicates that a ticket will decay down to 20% of its base win probability upon reaching the block before its expiry. The value is expressed as a fraction of 100000.\"},\"expiredWinProb()\":{\"notice\":\"The probability of a ticket winning after it has expired. This is a uint128 value representing the numerator in the probability ratio where 2^128 - 1 is the denominator. Note: Redeeming expired tickets is currently not supported.\"},\"faceValue()\":{\"notice\":\"The value of a winning ticket in SOLO. \"},\"getTicketingParameters()\":{\"notice\":\"Retrieve the current ticketing parameters.\"},\"setBaseLiveWinProb(uint128)\":{\"notice\":\"Set the base live win probability of a ticket. Only callable by the contract owner.\"},\"setDecayRate(uint32)\":{\"notice\":\"Set the decay rate of a ticket. Only callable by the the contract owner.\"},\"setExpiredWinProb(uint128)\":{\"notice\":\"Set the expired win probability of a ticket. Only callable by the contract owner.\"},\"setFaceValue(uint256)\":{\"notice\":\"Set the face value for tickets in SOLO. Only callable by the contract owner.\"},\"setTicketDuration(uint256)\":{\"notice\":\"Set the ticket duration of a ticket. Only callable by the contract owner.\"},\"supportsInterface(bytes4)\":{\"notice\":\"Returns true if the contract implements the interface defined by `interfaceId` from ERC165.\"},\"ticketDuration()\":{\"notice\":\"The length in blocks before a ticket is considered expired. The default initialization value is 80,000. This equates to roughly two weeks (15s per block).\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/payments/ticketing/TicketingParameters.sol\":\"TicketingParameters\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./OwnableUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership} and {acceptOwnership}.\\n *\\n * This module is used through inheritance. It will make available all functions\\n * from parent (Ownable).\\n */\\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\\n function __Ownable2Step_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable2Step_init_unchained() internal onlyInitializing {\\n }\\n address private _pendingOwner;\\n\\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Returns the address of the pending owner.\\n */\\n function pendingOwner() public view virtual returns (address) {\\n return _pendingOwner;\\n }\\n\\n /**\\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual override onlyOwner {\\n _pendingOwner = newOwner;\\n emit OwnershipTransferStarted(owner(), newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual override {\\n delete _pendingOwner;\\n super._transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev The new owner accepts the ownership transfer.\\n */\\n function acceptOwnership() public virtual {\\n address sender = _msgSender();\\n require(pendingOwner() == sender, \\\"Ownable2Step: caller is not the new owner\\\");\\n _transferOwnership(sender);\\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\":\"0x84efb8889801b0ac817324aff6acc691d07bbee816b671817132911d287a8c63\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n\\n /**\\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\":\"0x4075622496acc77fd6d4de4cc30a8577a744d5c75afad33fdeacf1704d6eda98\",\"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/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/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/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/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\"},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)\\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\\n * checks.\\n *\\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\\n * easily result in undesired exploitation or bugs, since developers usually\\n * assume that overflows raise errors. `SafeCast` restores this intuition by\\n * reverting the transaction when such an operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n *\\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\\n * all math on `uint256` and `int256` and then downcasting.\\n */\\nlibrary SafeCast {\\n /**\\n * @dev Returns the downcasted uint248 from uint256, reverting on\\n * overflow (when the input is greater than largest uint248).\\n *\\n * Counterpart to Solidity's `uint248` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 248 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint248(uint256 value) internal pure returns (uint248) {\\n require(value <= type(uint248).max, \\\"SafeCast: value doesn't fit in 248 bits\\\");\\n return uint248(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint240 from uint256, reverting on\\n * overflow (when the input is greater than largest uint240).\\n *\\n * Counterpart to Solidity's `uint240` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 240 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint240(uint256 value) internal pure returns (uint240) {\\n require(value <= type(uint240).max, \\\"SafeCast: value doesn't fit in 240 bits\\\");\\n return uint240(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint232 from uint256, reverting on\\n * overflow (when the input is greater than largest uint232).\\n *\\n * Counterpart to Solidity's `uint232` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 232 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint232(uint256 value) internal pure returns (uint232) {\\n require(value <= type(uint232).max, \\\"SafeCast: value doesn't fit in 232 bits\\\");\\n return uint232(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint224 from uint256, reverting on\\n * overflow (when the input is greater than largest uint224).\\n *\\n * Counterpart to Solidity's `uint224` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 224 bits\\n *\\n * _Available since v4.2._\\n */\\n function toUint224(uint256 value) internal pure returns (uint224) {\\n require(value <= type(uint224).max, \\\"SafeCast: value doesn't fit in 224 bits\\\");\\n return uint224(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint216 from uint256, reverting on\\n * overflow (when the input is greater than largest uint216).\\n *\\n * Counterpart to Solidity's `uint216` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 216 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint216(uint256 value) internal pure returns (uint216) {\\n require(value <= type(uint216).max, \\\"SafeCast: value doesn't fit in 216 bits\\\");\\n return uint216(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint208 from uint256, reverting on\\n * overflow (when the input is greater than largest uint208).\\n *\\n * Counterpart to Solidity's `uint208` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 208 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint208(uint256 value) internal pure returns (uint208) {\\n require(value <= type(uint208).max, \\\"SafeCast: value doesn't fit in 208 bits\\\");\\n return uint208(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint200 from uint256, reverting on\\n * overflow (when the input is greater than largest uint200).\\n *\\n * Counterpart to Solidity's `uint200` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 200 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint200(uint256 value) internal pure returns (uint200) {\\n require(value <= type(uint200).max, \\\"SafeCast: value doesn't fit in 200 bits\\\");\\n return uint200(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint192 from uint256, reverting on\\n * overflow (when the input is greater than largest uint192).\\n *\\n * Counterpart to Solidity's `uint192` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 192 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint192(uint256 value) internal pure returns (uint192) {\\n require(value <= type(uint192).max, \\\"SafeCast: value doesn't fit in 192 bits\\\");\\n return uint192(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint184 from uint256, reverting on\\n * overflow (when the input is greater than largest uint184).\\n *\\n * Counterpart to Solidity's `uint184` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 184 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint184(uint256 value) internal pure returns (uint184) {\\n require(value <= type(uint184).max, \\\"SafeCast: value doesn't fit in 184 bits\\\");\\n return uint184(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint176 from uint256, reverting on\\n * overflow (when the input is greater than largest uint176).\\n *\\n * Counterpart to Solidity's `uint176` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 176 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint176(uint256 value) internal pure returns (uint176) {\\n require(value <= type(uint176).max, \\\"SafeCast: value doesn't fit in 176 bits\\\");\\n return uint176(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint168 from uint256, reverting on\\n * overflow (when the input is greater than largest uint168).\\n *\\n * Counterpart to Solidity's `uint168` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 168 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint168(uint256 value) internal pure returns (uint168) {\\n require(value <= type(uint168).max, \\\"SafeCast: value doesn't fit in 168 bits\\\");\\n return uint168(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint160 from uint256, reverting on\\n * overflow (when the input is greater than largest uint160).\\n *\\n * Counterpart to Solidity's `uint160` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 160 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint160(uint256 value) internal pure returns (uint160) {\\n require(value <= type(uint160).max, \\\"SafeCast: value doesn't fit in 160 bits\\\");\\n return uint160(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint152 from uint256, reverting on\\n * overflow (when the input is greater than largest uint152).\\n *\\n * Counterpart to Solidity's `uint152` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 152 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint152(uint256 value) internal pure returns (uint152) {\\n require(value <= type(uint152).max, \\\"SafeCast: value doesn't fit in 152 bits\\\");\\n return uint152(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint144 from uint256, reverting on\\n * overflow (when the input is greater than largest uint144).\\n *\\n * Counterpart to Solidity's `uint144` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 144 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint144(uint256 value) internal pure returns (uint144) {\\n require(value <= type(uint144).max, \\\"SafeCast: value doesn't fit in 144 bits\\\");\\n return uint144(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint136 from uint256, reverting on\\n * overflow (when the input is greater than largest uint136).\\n *\\n * Counterpart to Solidity's `uint136` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 136 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint136(uint256 value) internal pure returns (uint136) {\\n require(value <= type(uint136).max, \\\"SafeCast: value doesn't fit in 136 bits\\\");\\n return uint136(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint128 from uint256, reverting on\\n * overflow (when the input is greater than largest uint128).\\n *\\n * Counterpart to Solidity's `uint128` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 128 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint128(uint256 value) internal pure returns (uint128) {\\n require(value <= type(uint128).max, \\\"SafeCast: value doesn't fit in 128 bits\\\");\\n return uint128(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint120 from uint256, reverting on\\n * overflow (when the input is greater than largest uint120).\\n *\\n * Counterpart to Solidity's `uint120` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 120 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint120(uint256 value) internal pure returns (uint120) {\\n require(value <= type(uint120).max, \\\"SafeCast: value doesn't fit in 120 bits\\\");\\n return uint120(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint112 from uint256, reverting on\\n * overflow (when the input is greater than largest uint112).\\n *\\n * Counterpart to Solidity's `uint112` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 112 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint112(uint256 value) internal pure returns (uint112) {\\n require(value <= type(uint112).max, \\\"SafeCast: value doesn't fit in 112 bits\\\");\\n return uint112(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint104 from uint256, reverting on\\n * overflow (when the input is greater than largest uint104).\\n *\\n * Counterpart to Solidity's `uint104` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 104 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint104(uint256 value) internal pure returns (uint104) {\\n require(value <= type(uint104).max, \\\"SafeCast: value doesn't fit in 104 bits\\\");\\n return uint104(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint96 from uint256, reverting on\\n * overflow (when the input is greater than largest uint96).\\n *\\n * Counterpart to Solidity's `uint96` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 96 bits\\n *\\n * _Available since v4.2._\\n */\\n function toUint96(uint256 value) internal pure returns (uint96) {\\n require(value <= type(uint96).max, \\\"SafeCast: value doesn't fit in 96 bits\\\");\\n return uint96(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint88 from uint256, reverting on\\n * overflow (when the input is greater than largest uint88).\\n *\\n * Counterpart to Solidity's `uint88` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 88 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint88(uint256 value) internal pure returns (uint88) {\\n require(value <= type(uint88).max, \\\"SafeCast: value doesn't fit in 88 bits\\\");\\n return uint88(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint80 from uint256, reverting on\\n * overflow (when the input is greater than largest uint80).\\n *\\n * Counterpart to Solidity's `uint80` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 80 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint80(uint256 value) internal pure returns (uint80) {\\n require(value <= type(uint80).max, \\\"SafeCast: value doesn't fit in 80 bits\\\");\\n return uint80(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint72 from uint256, reverting on\\n * overflow (when the input is greater than largest uint72).\\n *\\n * Counterpart to Solidity's `uint72` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 72 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint72(uint256 value) internal pure returns (uint72) {\\n require(value <= type(uint72).max, \\\"SafeCast: value doesn't fit in 72 bits\\\");\\n return uint72(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint64 from uint256, reverting on\\n * overflow (when the input is greater than largest uint64).\\n *\\n * Counterpart to Solidity's `uint64` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 64 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint64(uint256 value) internal pure returns (uint64) {\\n require(value <= type(uint64).max, \\\"SafeCast: value doesn't fit in 64 bits\\\");\\n return uint64(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint56 from uint256, reverting on\\n * overflow (when the input is greater than largest uint56).\\n *\\n * Counterpart to Solidity's `uint56` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 56 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint56(uint256 value) internal pure returns (uint56) {\\n require(value <= type(uint56).max, \\\"SafeCast: value doesn't fit in 56 bits\\\");\\n return uint56(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint48 from uint256, reverting on\\n * overflow (when the input is greater than largest uint48).\\n *\\n * Counterpart to Solidity's `uint48` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 48 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint48(uint256 value) internal pure returns (uint48) {\\n require(value <= type(uint48).max, \\\"SafeCast: value doesn't fit in 48 bits\\\");\\n return uint48(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint40 from uint256, reverting on\\n * overflow (when the input is greater than largest uint40).\\n *\\n * Counterpart to Solidity's `uint40` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 40 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint40(uint256 value) internal pure returns (uint40) {\\n require(value <= type(uint40).max, \\\"SafeCast: value doesn't fit in 40 bits\\\");\\n return uint40(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint32 from uint256, reverting on\\n * overflow (when the input is greater than largest uint32).\\n *\\n * Counterpart to Solidity's `uint32` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 32 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint32(uint256 value) internal pure returns (uint32) {\\n require(value <= type(uint32).max, \\\"SafeCast: value doesn't fit in 32 bits\\\");\\n return uint32(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint24 from uint256, reverting on\\n * overflow (when the input is greater than largest uint24).\\n *\\n * Counterpart to Solidity's `uint24` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 24 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint24(uint256 value) internal pure returns (uint24) {\\n require(value <= type(uint24).max, \\\"SafeCast: value doesn't fit in 24 bits\\\");\\n return uint24(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint16 from uint256, reverting on\\n * overflow (when the input is greater than largest uint16).\\n *\\n * Counterpart to Solidity's `uint16` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 16 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint16(uint256 value) internal pure returns (uint16) {\\n require(value <= type(uint16).max, \\\"SafeCast: value doesn't fit in 16 bits\\\");\\n return uint16(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint8 from uint256, reverting on\\n * overflow (when the input is greater than largest uint8).\\n *\\n * Counterpart to Solidity's `uint8` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 8 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint8(uint256 value) internal pure returns (uint8) {\\n require(value <= type(uint8).max, \\\"SafeCast: value doesn't fit in 8 bits\\\");\\n return uint8(value);\\n }\\n\\n /**\\n * @dev Converts a signed int256 into an unsigned uint256.\\n *\\n * Requirements:\\n *\\n * - input must be greater than or equal to 0.\\n *\\n * _Available since v3.0._\\n */\\n function toUint256(int256 value) internal pure returns (uint256) {\\n require(value >= 0, \\\"SafeCast: value must be positive\\\");\\n return uint256(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int248 from int256, reverting on\\n * overflow (when the input is less than smallest int248 or\\n * greater than largest int248).\\n *\\n * Counterpart to Solidity's `int248` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 248 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\\n downcasted = int248(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 248 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int240 from int256, reverting on\\n * overflow (when the input is less than smallest int240 or\\n * greater than largest int240).\\n *\\n * Counterpart to Solidity's `int240` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 240 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\\n downcasted = int240(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 240 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int232 from int256, reverting on\\n * overflow (when the input is less than smallest int232 or\\n * greater than largest int232).\\n *\\n * Counterpart to Solidity's `int232` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 232 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\\n downcasted = int232(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 232 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int224 from int256, reverting on\\n * overflow (when the input is less than smallest int224 or\\n * greater than largest int224).\\n *\\n * Counterpart to Solidity's `int224` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 224 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\\n downcasted = int224(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 224 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int216 from int256, reverting on\\n * overflow (when the input is less than smallest int216 or\\n * greater than largest int216).\\n *\\n * Counterpart to Solidity's `int216` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 216 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\\n downcasted = int216(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 216 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int208 from int256, reverting on\\n * overflow (when the input is less than smallest int208 or\\n * greater than largest int208).\\n *\\n * Counterpart to Solidity's `int208` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 208 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\\n downcasted = int208(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 208 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int200 from int256, reverting on\\n * overflow (when the input is less than smallest int200 or\\n * greater than largest int200).\\n *\\n * Counterpart to Solidity's `int200` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 200 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\\n downcasted = int200(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 200 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int192 from int256, reverting on\\n * overflow (when the input is less than smallest int192 or\\n * greater than largest int192).\\n *\\n * Counterpart to Solidity's `int192` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 192 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\\n downcasted = int192(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 192 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int184 from int256, reverting on\\n * overflow (when the input is less than smallest int184 or\\n * greater than largest int184).\\n *\\n * Counterpart to Solidity's `int184` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 184 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\\n downcasted = int184(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 184 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int176 from int256, reverting on\\n * overflow (when the input is less than smallest int176 or\\n * greater than largest int176).\\n *\\n * Counterpart to Solidity's `int176` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 176 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\\n downcasted = int176(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 176 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int168 from int256, reverting on\\n * overflow (when the input is less than smallest int168 or\\n * greater than largest int168).\\n *\\n * Counterpart to Solidity's `int168` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 168 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\\n downcasted = int168(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 168 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int160 from int256, reverting on\\n * overflow (when the input is less than smallest int160 or\\n * greater than largest int160).\\n *\\n * Counterpart to Solidity's `int160` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 160 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\\n downcasted = int160(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 160 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int152 from int256, reverting on\\n * overflow (when the input is less than smallest int152 or\\n * greater than largest int152).\\n *\\n * Counterpart to Solidity's `int152` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 152 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\\n downcasted = int152(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 152 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int144 from int256, reverting on\\n * overflow (when the input is less than smallest int144 or\\n * greater than largest int144).\\n *\\n * Counterpart to Solidity's `int144` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 144 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\\n downcasted = int144(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 144 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int136 from int256, reverting on\\n * overflow (when the input is less than smallest int136 or\\n * greater than largest int136).\\n *\\n * Counterpart to Solidity's `int136` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 136 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\\n downcasted = int136(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 136 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int128 from int256, reverting on\\n * overflow (when the input is less than smallest int128 or\\n * greater than largest int128).\\n *\\n * Counterpart to Solidity's `int128` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 128 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\\n downcasted = int128(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 128 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int120 from int256, reverting on\\n * overflow (when the input is less than smallest int120 or\\n * greater than largest int120).\\n *\\n * Counterpart to Solidity's `int120` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 120 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\\n downcasted = int120(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 120 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int112 from int256, reverting on\\n * overflow (when the input is less than smallest int112 or\\n * greater than largest int112).\\n *\\n * Counterpart to Solidity's `int112` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 112 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\\n downcasted = int112(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 112 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int104 from int256, reverting on\\n * overflow (when the input is less than smallest int104 or\\n * greater than largest int104).\\n *\\n * Counterpart to Solidity's `int104` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 104 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\\n downcasted = int104(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 104 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int96 from int256, reverting on\\n * overflow (when the input is less than smallest int96 or\\n * greater than largest int96).\\n *\\n * Counterpart to Solidity's `int96` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 96 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\\n downcasted = int96(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 96 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int88 from int256, reverting on\\n * overflow (when the input is less than smallest int88 or\\n * greater than largest int88).\\n *\\n * Counterpart to Solidity's `int88` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 88 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\\n downcasted = int88(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 88 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int80 from int256, reverting on\\n * overflow (when the input is less than smallest int80 or\\n * greater than largest int80).\\n *\\n * Counterpart to Solidity's `int80` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 80 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\\n downcasted = int80(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 80 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int72 from int256, reverting on\\n * overflow (when the input is less than smallest int72 or\\n * greater than largest int72).\\n *\\n * Counterpart to Solidity's `int72` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 72 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\\n downcasted = int72(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 72 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int64 from int256, reverting on\\n * overflow (when the input is less than smallest int64 or\\n * greater than largest int64).\\n *\\n * Counterpart to Solidity's `int64` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 64 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\\n downcasted = int64(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 64 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int56 from int256, reverting on\\n * overflow (when the input is less than smallest int56 or\\n * greater than largest int56).\\n *\\n * Counterpart to Solidity's `int56` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 56 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\\n downcasted = int56(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 56 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int48 from int256, reverting on\\n * overflow (when the input is less than smallest int48 or\\n * greater than largest int48).\\n *\\n * Counterpart to Solidity's `int48` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 48 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\\n downcasted = int48(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 48 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int40 from int256, reverting on\\n * overflow (when the input is less than smallest int40 or\\n * greater than largest int40).\\n *\\n * Counterpart to Solidity's `int40` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 40 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\\n downcasted = int40(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 40 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int32 from int256, reverting on\\n * overflow (when the input is less than smallest int32 or\\n * greater than largest int32).\\n *\\n * Counterpart to Solidity's `int32` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 32 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\\n downcasted = int32(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 32 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int24 from int256, reverting on\\n * overflow (when the input is less than smallest int24 or\\n * greater than largest int24).\\n *\\n * Counterpart to Solidity's `int24` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 24 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\\n downcasted = int24(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 24 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int16 from int256, reverting on\\n * overflow (when the input is less than smallest int16 or\\n * greater than largest int16).\\n *\\n * Counterpart to Solidity's `int16` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 16 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\\n downcasted = int16(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 16 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int8 from int256, reverting on\\n * overflow (when the input is less than smallest int8 or\\n * greater than largest int8).\\n *\\n * Counterpart to Solidity's `int8` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 8 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\\n downcasted = int8(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 8 bits\\\");\\n }\\n\\n /**\\n * @dev Converts an unsigned uint256 into a signed int256.\\n *\\n * Requirements:\\n *\\n * - input must be less than or equal to maxInt256.\\n *\\n * _Available since v3.0._\\n */\\n function toInt256(uint256 value) internal pure returns (int256) {\\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\\n require(value <= uint256(type(int256).max), \\\"SafeCast: value doesn't fit in an int256\\\");\\n return int256(value);\\n }\\n}\\n\",\"keccak256\":\"0x52a8cfb0f5239d11b457dcdd1b326992ef672714ca8da71a157255bddd13f3ad\",\"license\":\"MIT\"},\"contracts/interfaces/payments/ticketing/ITicketingParameters.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\ninterface ITicketingParameters {\\n function setFaceValue(uint256 _faceValue) external;\\n\\n function setBaseLiveWinProb(uint128 _baseLiveWinProb) external;\\n\\n function setExpiredWinProb(uint128 _expiredWinProb) external;\\n\\n function setDecayRate(uint32 _decayRate) external;\\n\\n function setTicketDuration(uint256 _ticketDuration) external;\\n\\n function getTicketingParameters()\\n external\\n view\\n returns (uint256, uint128, uint128, uint256, uint32);\\n}\\n\",\"keccak256\":\"0x6fa269d73176bd6543c190b070597fde50b91efdaa724b567bad29c9fbfa908a\",\"license\":\"Apache-2.0\"},\"contracts/libraries/SyloUtils.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/utils/math/SafeCast.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\n\\nerror ContractNameCannotBeEmpty();\\nerror InterfaceIdCannotBeZeroBytes();\\nerror TargetContractCannotBeZeroAddress(string name);\\nerror TargetNotSupportInterface(string name, bytes4 interfaceId);\\n\\nlibrary SyloUtils {\\n /**\\n * @dev The maximum possible SYLO that exists in the network.\\n */\\n uint256 public constant MAX_SYLO = 10_000_000_000 ether;\\n\\n /**\\n * @dev Percentages are expressed as a ratio where 100000 is the denominator.\\n * A large denominator allows for more precision, e.g representing 12.5%\\n * can be done as 12500 / 100000\\n */\\n uint32 public constant PERCENTAGE_DENOMINATOR = 100000;\\n\\n /**\\n * @dev Multiply a value by a given percentage. Converts the provided\\n * uint128 value to uint256 to avoid any reverts on overflow.\\n * @param value The value to multiply.\\n * @param percentage The percentage, as a ratio of 10000.\\n */\\n function percOf(uint128 value, uint32 percentage) internal pure returns (uint256) {\\n return (uint256(value) * percentage) / PERCENTAGE_DENOMINATOR;\\n }\\n\\n /**\\n * @dev Return a fraction as a percentage.\\n * @param numerator The numerator limited to a uint128 value to prevent\\n * phantom overflow.\\n * @param denominator The denominator.\\n * @return The percentage, as a ratio of 10000.\\n */\\n function asPerc(uint128 numerator, uint256 denominator) internal pure returns (uint32) {\\n return SafeCast.toUint32((uint256(numerator) * PERCENTAGE_DENOMINATOR) / denominator);\\n }\\n\\n /**\\n * @dev Validate that a contract implements a given interface.\\n * @param name The name of the contract, used in error messages.\\n * @param target The address of the contract.\\n * @param interfaceId The interface ID to check.\\n */\\n function validateContractInterface(\\n string memory name,\\n address target,\\n bytes4 interfaceId\\n ) internal view {\\n if (bytes(name).length == 0) {\\n revert ContractNameCannotBeEmpty();\\n }\\n if (target == address(0)) {\\n revert TargetContractCannotBeZeroAddress(name);\\n }\\n if (interfaceId == bytes4(0)) {\\n revert InterfaceIdCannotBeZeroBytes();\\n }\\n if (!ERC165(target).supportsInterface(interfaceId)) {\\n revert TargetNotSupportInterface(name, interfaceId);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa5bb1a5b9f8135b5fec1dfa183fab8f6685a4eb6d9daba23864a7d49d01dc8a3\",\"license\":\"Apache-2.0\"},\"contracts/payments/ticketing/TicketingParameters.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\n\\nimport \\\"../../libraries/SyloUtils.sol\\\";\\nimport \\\"../../interfaces/payments/ticketing/ITicketingParameters.sol\\\";\\n\\n/**\\n * @dev Persists the parameters for the ticketing mechanism. This contract is\\n * read by the EpochManager. Extracting the parameters into another\\n * contract is necessary to avoid a cyclic dependency between the ticketing\\n * and epoch contracts.\\n */\\ncontract TicketingParameters is\\n ITicketingParameters,\\n Initializable,\\n Ownable2StepUpgradeable,\\n ERC165\\n{\\n /** @notice The value of a winning ticket in SOLO. */\\n uint256 public faceValue;\\n\\n /**\\n * @notice The probability of a ticket winning during the start of its lifetime.\\n * This is a uint128 value representing the numerator in the probability\\n * ratio where 2^128 - 1 is the denominator.\\n */\\n uint128 public baseLiveWinProb;\\n\\n /**\\n * @notice The probability of a ticket winning after it has expired.\\n * This is a uint128 value representing the numerator in the probability\\n * ratio where 2^128 - 1 is the denominator. Note: Redeeming expired\\n * tickets is currently not supported.\\n */\\n uint128 public expiredWinProb;\\n\\n /**\\n * @notice The length in blocks before a ticket is considered expired.\\n * The default initialization value is 80,000. This equates\\n * to roughly two weeks (15s per block).\\n */\\n uint256 public ticketDuration;\\n\\n /**\\n * @notice A percentage value representing the proportion of the base win\\n * probability that will be decayed once a ticket has expired.\\n * Example: 80% decayRate indicates that a ticket will decay down to 20% of its\\n * base win probability upon reaching the block before its expiry.\\n * The value is expressed as a fraction of 100000.\\n */\\n uint32 public decayRate;\\n\\n event FaceValueUpdated(uint256 faceValue);\\n event BaseLiveWinProbUpdated(uint128 baseLiveWinprob);\\n event ExpiredWinProbUpdated(uint128 expiredWinProb);\\n event TicketDurationUpdated(uint256 ticketDuration);\\n event DecayRateUpdated(uint32 decayRate);\\n\\n error FaceValueCannotBeZero();\\n error TicketDurationCannotBeZero();\\n\\n function initialize(\\n uint256 _faceValue,\\n uint128 _baseLiveWinProb,\\n uint128 _expiredWinProb,\\n uint32 _decayRate,\\n uint256 _ticketDuration\\n ) external initializer {\\n if (_faceValue == 0) {\\n revert FaceValueCannotBeZero();\\n }\\n if (_ticketDuration == 0) {\\n revert TicketDurationCannotBeZero();\\n }\\n\\n Ownable2StepUpgradeable.__Ownable2Step_init();\\n\\n faceValue = _faceValue;\\n baseLiveWinProb = _baseLiveWinProb;\\n expiredWinProb = _expiredWinProb;\\n decayRate = _decayRate;\\n ticketDuration = _ticketDuration;\\n }\\n\\n /**\\n * @notice Returns true if the contract implements the interface defined by\\n * `interfaceId` from ERC165.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(ITicketingParameters).interfaceId;\\n }\\n\\n /**\\n * @notice Set the face value for tickets in SOLO. Only callable by\\n * the contract owner.\\n * @param _faceValue The face value to set in SOLO.\\n */\\n function setFaceValue(uint256 _faceValue) external onlyOwner {\\n if (_faceValue == 0) {\\n revert FaceValueCannotBeZero();\\n }\\n\\n faceValue = _faceValue;\\n emit FaceValueUpdated(_faceValue);\\n }\\n\\n /**\\n * @notice Set the base live win probability of a ticket. Only callable by\\n * the contract owner.\\n * @param _baseLiveWinProb The probability represented as a value\\n * between 0 to 2**128 - 1.\\n */\\n function setBaseLiveWinProb(uint128 _baseLiveWinProb) external onlyOwner {\\n baseLiveWinProb = _baseLiveWinProb;\\n emit BaseLiveWinProbUpdated(_baseLiveWinProb);\\n }\\n\\n /**\\n * @notice Set the expired win probability of a ticket. Only callable by\\n * the contract owner.\\n * @param _expiredWinProb The probability represented as a value\\n * between 0 to 2**128 - 1.\\n */\\n function setExpiredWinProb(uint128 _expiredWinProb) external onlyOwner {\\n expiredWinProb = _expiredWinProb;\\n emit ExpiredWinProbUpdated(_expiredWinProb);\\n }\\n\\n /**\\n * @notice Set the decay rate of a ticket. Only callable by the\\n * the contract owner.\\n * @param _decayRate The decay rate as a percentage, where the\\n * denominator is 10000.\\n */\\n function setDecayRate(uint32 _decayRate) external onlyOwner {\\n decayRate = _decayRate;\\n emit DecayRateUpdated(_decayRate);\\n }\\n\\n /**\\n * @notice Set the ticket duration of a ticket. Only callable by the\\n * contract owner.\\n * @param _ticketDuration The duration of a ticket in number of blocks.\\n */\\n function setTicketDuration(uint256 _ticketDuration) external onlyOwner {\\n if (_ticketDuration == 0) {\\n revert TicketDurationCannotBeZero();\\n }\\n\\n ticketDuration = _ticketDuration;\\n emit TicketDurationUpdated(_ticketDuration);\\n }\\n\\n /**\\n * @notice Retrieve the current ticketing parameters.\\n * @return faceValue The face value of a ticket in SOLO.\\n * @return baseLiveWinProb The base live win probability of a ticket.\\n * @return expiredWinProb The expired win probability of a ticket.\\n * @return ticketDuration The duration of a ticket in number of blocks.\\n * @return decayRate The decay rate of a ticket.\\n */\\n function getTicketingParameters()\\n external\\n view\\n returns (uint256, uint128, uint128, uint256, uint32)\\n {\\n return (faceValue, baseLiveWinProb, expiredWinProb, ticketDuration, decayRate);\\n }\\n}\\n\",\"keccak256\":\"0x44b4c2eb70c0583f888ff8fca7ad21b084b6c58a453b7dd914275ccabed98ec0\",\"license\":\"Apache-2.0\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610a27806100206000396000f3fe608060405234801561001057600080fd5b50600436106101165760003560e01c8063a90a6027116100a2578063ce1b1d2411610071578063ce1b1d2414610260578063dedcebda146102ad578063e30c3978146102c0578063ef8032ef146102d1578063f2fde38b146102e457600080fd5b8063a90a6027146101e3578063a9c1f2f1146101f6578063bcbee5431461021b578063be8a151e1461024d57600080fd5b806387bcc0c5116100e957806387bcc0c51461017c5780638da5cb5b146101855780639e9ceeca146101aa578063a4990c31146101bd578063a8f19c14146101d057600080fd5b806301ffc9a71461011b57806344fd9caa14610153578063715018a61461016a57806379ba509714610174575b600080fd5b61013e610129366004610878565b6001600160e01b031916621d8a0b60e21b1490565b60405190151581526020015b60405180910390f35b61015c60975481565b60405190815260200161014a565b6101726102f7565b005b61017261030b565b61015c60995481565b6033546001600160a01b03165b6040516001600160a01b03909116815260200161014a565b6101726101b83660046108a9565b61038a565b6101726101cb3660046108f2565b6103ef565b6101726101de366004610947565b610580565b6101726101f1366004610947565b6105d6565b609a546102069063ffffffff1681565b60405163ffffffff909116815260200161014a565b60985461023590600160801b90046001600160801b031681565b6040516001600160801b03909116815260200161014a565b61017261025b366004610962565b610635565b609754609854609954609a54604080519485526001600160801b038085166020870152600160801b90940490931692840192909252606083015263ffffffff16608082015260a00161014a565b609854610235906001600160801b031681565b6065546001600160a01b0316610192565b6101726102df3660046108a9565b610685565b6101726102f236600461097d565b6106e3565b6102ff610754565b61030960006107ae565b565b60655433906001600160a01b0316811461037e5760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b610387816107ae565b50565b610392610754565b806000036103b357604051637422e0f760e01b815260040160405180910390fd5b60998190556040518181527f630561d0640d69f1caae7ef80c14ce15f4ce289e4e6079ddafd3fb1fabc2310b906020015b60405180910390a150565b600054610100900460ff161580801561040f5750600054600160ff909116105b806104295750303b158015610429575060005460ff166001145b61048c5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610375565b6000805460ff1916600117905580156104af576000805461ff0019166101001790555b856000036104d05760405163c1ac8e3d60e01b815260040160405180910390fd5b816000036104f157604051637422e0f760e01b815260040160405180910390fd5b6104f96107c7565b60978690556001600160801b03848116600160801b0290861617609855609a805463ffffffff851663ffffffff1990911617905560998290558015610578576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b610588610754565b609880546001600160801b03908116600160801b918416918202179091556040519081527fcea6d6aa1fc810e8098cd2197e9519b272b52e4cbfcd01fd82c6dd6cbe959924906020016103e4565b6105de610754565b609880546fffffffffffffffffffffffffffffffff19166001600160801b0383169081179091556040519081527fe10770a55eeb4e34b333c34a4399e1f50cdff2ce802e17ac9397488c7c830e8f906020016103e4565b61063d610754565b609a805463ffffffff191663ffffffff83169081179091556040519081527f921fcc05cd90a734956c8b8506293611565ff19723aa0a45457d08a7bc737901906020016103e4565b61068d610754565b806000036106ae5760405163c1ac8e3d60e01b815260040160405180910390fd5b60978190556040518181527fa4a7f18f5a3930835e81e675fe279a69bd4d37bae19f35cac4e978371d139544906020016103e4565b6106eb610754565b606580546001600160a01b0383166001600160a01b0319909116811790915561071c6033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6033546001600160a01b031633146103095760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610375565b606580546001600160a01b0319169055610387816107f6565b600054610100900460ff166107ee5760405162461bcd60e51b8152600401610375906109a6565b610309610848565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff1661086f5760405162461bcd60e51b8152600401610375906109a6565b610309336107ae565b60006020828403121561088a57600080fd5b81356001600160e01b0319811681146108a257600080fd5b9392505050565b6000602082840312156108bb57600080fd5b5035919050565b80356001600160801b03811681146108d957600080fd5b919050565b803563ffffffff811681146108d957600080fd5b600080600080600060a0868803121561090a57600080fd5b8535945061091a602087016108c2565b9350610928604087016108c2565b9250610936606087016108de565b949793965091946080013592915050565b60006020828403121561095957600080fd5b6108a2826108c2565b60006020828403121561097457600080fd5b6108a2826108de565b60006020828403121561098f57600080fd5b81356001600160a01b03811681146108a257600080fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea26469706673582212202c8c9a510369b0ceb7e405d3ae71743e50ca4aae7db1a4da43a528b7a7114d5064736f6c63430008120033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101165760003560e01c8063a90a6027116100a2578063ce1b1d2411610071578063ce1b1d2414610260578063dedcebda146102ad578063e30c3978146102c0578063ef8032ef146102d1578063f2fde38b146102e457600080fd5b8063a90a6027146101e3578063a9c1f2f1146101f6578063bcbee5431461021b578063be8a151e1461024d57600080fd5b806387bcc0c5116100e957806387bcc0c51461017c5780638da5cb5b146101855780639e9ceeca146101aa578063a4990c31146101bd578063a8f19c14146101d057600080fd5b806301ffc9a71461011b57806344fd9caa14610153578063715018a61461016a57806379ba509714610174575b600080fd5b61013e610129366004610878565b6001600160e01b031916621d8a0b60e21b1490565b60405190151581526020015b60405180910390f35b61015c60975481565b60405190815260200161014a565b6101726102f7565b005b61017261030b565b61015c60995481565b6033546001600160a01b03165b6040516001600160a01b03909116815260200161014a565b6101726101b83660046108a9565b61038a565b6101726101cb3660046108f2565b6103ef565b6101726101de366004610947565b610580565b6101726101f1366004610947565b6105d6565b609a546102069063ffffffff1681565b60405163ffffffff909116815260200161014a565b60985461023590600160801b90046001600160801b031681565b6040516001600160801b03909116815260200161014a565b61017261025b366004610962565b610635565b609754609854609954609a54604080519485526001600160801b038085166020870152600160801b90940490931692840192909252606083015263ffffffff16608082015260a00161014a565b609854610235906001600160801b031681565b6065546001600160a01b0316610192565b6101726102df3660046108a9565b610685565b6101726102f236600461097d565b6106e3565b6102ff610754565b61030960006107ae565b565b60655433906001600160a01b0316811461037e5760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b610387816107ae565b50565b610392610754565b806000036103b357604051637422e0f760e01b815260040160405180910390fd5b60998190556040518181527f630561d0640d69f1caae7ef80c14ce15f4ce289e4e6079ddafd3fb1fabc2310b906020015b60405180910390a150565b600054610100900460ff161580801561040f5750600054600160ff909116105b806104295750303b158015610429575060005460ff166001145b61048c5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610375565b6000805460ff1916600117905580156104af576000805461ff0019166101001790555b856000036104d05760405163c1ac8e3d60e01b815260040160405180910390fd5b816000036104f157604051637422e0f760e01b815260040160405180910390fd5b6104f96107c7565b60978690556001600160801b03848116600160801b0290861617609855609a805463ffffffff851663ffffffff1990911617905560998290558015610578576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b610588610754565b609880546001600160801b03908116600160801b918416918202179091556040519081527fcea6d6aa1fc810e8098cd2197e9519b272b52e4cbfcd01fd82c6dd6cbe959924906020016103e4565b6105de610754565b609880546fffffffffffffffffffffffffffffffff19166001600160801b0383169081179091556040519081527fe10770a55eeb4e34b333c34a4399e1f50cdff2ce802e17ac9397488c7c830e8f906020016103e4565b61063d610754565b609a805463ffffffff191663ffffffff83169081179091556040519081527f921fcc05cd90a734956c8b8506293611565ff19723aa0a45457d08a7bc737901906020016103e4565b61068d610754565b806000036106ae5760405163c1ac8e3d60e01b815260040160405180910390fd5b60978190556040518181527fa4a7f18f5a3930835e81e675fe279a69bd4d37bae19f35cac4e978371d139544906020016103e4565b6106eb610754565b606580546001600160a01b0383166001600160a01b0319909116811790915561071c6033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6033546001600160a01b031633146103095760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610375565b606580546001600160a01b0319169055610387816107f6565b600054610100900460ff166107ee5760405162461bcd60e51b8152600401610375906109a6565b610309610848565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff1661086f5760405162461bcd60e51b8152600401610375906109a6565b610309336107ae565b60006020828403121561088a57600080fd5b81356001600160e01b0319811681146108a257600080fd5b9392505050565b6000602082840312156108bb57600080fd5b5035919050565b80356001600160801b03811681146108d957600080fd5b919050565b803563ffffffff811681146108d957600080fd5b600080600080600060a0868803121561090a57600080fd5b8535945061091a602087016108c2565b9350610928604087016108c2565b9250610936606087016108de565b949793965091946080013592915050565b60006020828403121561095957600080fd5b6108a2826108c2565b60006020828403121561097457600080fd5b6108a2826108de565b60006020828403121561098f57600080fd5b81356001600160a01b03811681146108a257600080fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea26469706673582212202c8c9a510369b0ceb7e405d3ae71743e50ca4aae7db1a4da43a528b7a7114d5064736f6c63430008120033", + "devdoc": { + "details": "Persists the parameters for the ticketing mechanism. This contract is read by the EpochManager. Extracting the parameters into another contract is necessary to avoid a cyclic dependency between the ticketing and epoch contracts.", + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "acceptOwnership()": { + "details": "The new owner accepts the ownership transfer." + }, + "getTicketingParameters()": { + "returns": { + "_0": "faceValue The face value of a ticket in SOLO.", + "_1": "baseLiveWinProb The base live win probability of a ticket.", + "_2": "expiredWinProb The expired win probability of a ticket.", + "_3": "ticketDuration The duration of a ticket in number of blocks.", + "_4": "decayRate The decay rate of a ticket." + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pendingOwner()": { + "details": "Returns the address of the pending owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "setBaseLiveWinProb(uint128)": { + "params": { + "_baseLiveWinProb": "The probability represented as a value between 0 to 2**128 - 1." + } + }, + "setDecayRate(uint32)": { + "params": { + "_decayRate": "The decay rate as a percentage, where the denominator is 10000." + } + }, + "setExpiredWinProb(uint128)": { + "params": { + "_expiredWinProb": "The probability represented as a value between 0 to 2**128 - 1." + } + }, + "setFaceValue(uint256)": { + "params": { + "_faceValue": "The face value to set in SOLO." + } + }, + "setTicketDuration(uint256)": { + "params": { + "_ticketDuration": "The duration of a ticket in number of blocks." + } + }, + "transferOwnership(address)": { + "details": "Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "baseLiveWinProb()": { + "notice": "The probability of a ticket winning during the start of its lifetime. This is a uint128 value representing the numerator in the probability ratio where 2^128 - 1 is the denominator." + }, + "decayRate()": { + "notice": "A percentage value representing the proportion of the base win probability that will be decayed once a ticket has expired. Example: 80% decayRate indicates that a ticket will decay down to 20% of its base win probability upon reaching the block before its expiry. The value is expressed as a fraction of 100000." + }, + "expiredWinProb()": { + "notice": "The probability of a ticket winning after it has expired. This is a uint128 value representing the numerator in the probability ratio where 2^128 - 1 is the denominator. Note: Redeeming expired tickets is currently not supported." + }, + "faceValue()": { + "notice": "The value of a winning ticket in SOLO. " + }, + "getTicketingParameters()": { + "notice": "Retrieve the current ticketing parameters." + }, + "setBaseLiveWinProb(uint128)": { + "notice": "Set the base live win probability of a ticket. Only callable by the contract owner." + }, + "setDecayRate(uint32)": { + "notice": "Set the decay rate of a ticket. Only callable by the the contract owner." + }, + "setExpiredWinProb(uint128)": { + "notice": "Set the expired win probability of a ticket. Only callable by the contract owner." + }, + "setFaceValue(uint256)": { + "notice": "Set the face value for tickets in SOLO. Only callable by the contract owner." + }, + "setTicketDuration(uint256)": { + "notice": "Set the ticket duration of a ticket. Only callable by the contract owner." + }, + "supportsInterface(bytes4)": { + "notice": "Returns true if the contract implements the interface defined by `interfaceId` from ERC165." + }, + "ticketDuration()": { + "notice": "The length in blocks before a ticket is considered expired. The default initialization value is 80,000. This equates to roughly two weeks (15s per block)." + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 244, + "contract": "contracts/payments/ticketing/TicketingParameters.sol:TicketingParameters", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 247, + "contract": "contracts/payments/ticketing/TicketingParameters.sol:TicketingParameters", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 777, + "contract": "contracts/payments/ticketing/TicketingParameters.sol:TicketingParameters", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 116, + "contract": "contracts/payments/ticketing/TicketingParameters.sol:TicketingParameters", + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address" + }, + { + "astId": 236, + "contract": "contracts/payments/ticketing/TicketingParameters.sol:TicketingParameters", + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 25, + "contract": "contracts/payments/ticketing/TicketingParameters.sol:TicketingParameters", + "label": "_pendingOwner", + "offset": 0, + "slot": "101", + "type": "t_address" + }, + { + "astId": 104, + "contract": "contracts/payments/ticketing/TicketingParameters.sol:TicketingParameters", + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 14161, + "contract": "contracts/payments/ticketing/TicketingParameters.sol:TicketingParameters", + "label": "faceValue", + "offset": 0, + "slot": "151", + "type": "t_uint256" + }, + { + "astId": 14164, + "contract": "contracts/payments/ticketing/TicketingParameters.sol:TicketingParameters", + "label": "baseLiveWinProb", + "offset": 0, + "slot": "152", + "type": "t_uint128" + }, + { + "astId": 14167, + "contract": "contracts/payments/ticketing/TicketingParameters.sol:TicketingParameters", + "label": "expiredWinProb", + "offset": 16, + "slot": "152", + "type": "t_uint128" + }, + { + "astId": 14170, + "contract": "contracts/payments/ticketing/TicketingParameters.sol:TicketingParameters", + "label": "ticketDuration", + "offset": 0, + "slot": "153", + "type": "t_uint256" + }, + { + "astId": 14173, + "contract": "contracts/payments/ticketing/TicketingParameters.sol:TicketingParameters", + "label": "decayRate", + "offset": 0, + "slot": "154", + "type": "t_uint32" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_uint128": { + "encoding": "inplace", + "label": "uint128", + "numberOfBytes": "16" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint32": { + "encoding": "inplace", + "label": "uint32", + "numberOfBytes": "4" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/deployments/porcini-dev/TicketingParameters_Proxy.json b/deployments/porcini-dev/TicketingParameters_Proxy.json new file mode 100644 index 00000000..dcf5e2fa --- /dev/null +++ b/deployments/porcini-dev/TicketingParameters_Proxy.json @@ -0,0 +1,235 @@ +{ + "address": "0xCE1BAd6FaC2eDab78C607bfA50a9BfC29A172214", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xa286b4823cf45f7911819cb7f14e629601fb750b2d1fa2ce93c3ebe310a32b91", + "receipt": { + "to": null, + "from": "0x448c8e9e1816300Dd052e77D2A44c990A2807D15", + "contractAddress": "0xCE1BAd6FaC2eDab78C607bfA50a9BfC29A172214", + "transactionIndex": 0, + "gasUsed": "720430", + "logsBloom": "0x00000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000800000020000000800000010000000000000000000000000000000000000000080000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000200000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xcf8081fd55dbe42508dcf09914d65ecb90305ed009c3e6bb56f87d1369a64762", + "transactionHash": "0xa286b4823cf45f7911819cb7f14e629601fb750b2d1fa2ce93c3ebe310a32b91", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 10978369, + "transactionHash": "0xa286b4823cf45f7911819cb7f14e629601fb750b2d1fa2ce93c3ebe310a32b91", + "address": "0xCE1BAd6FaC2eDab78C607bfA50a9BfC29A172214", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000f635d6a59eeffdcdce76422a81a1542d6f99949f" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0xcf8081fd55dbe42508dcf09914d65ecb90305ed009c3e6bb56f87d1369a64762" + }, + { + "transactionIndex": 0, + "blockNumber": 10978369, + "transactionHash": "0xa286b4823cf45f7911819cb7f14e629601fb750b2d1fa2ce93c3ebe310a32b91", + "address": "0xCE1BAd6FaC2eDab78C607bfA50a9BfC29A172214", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f06d5edb04f4995fff2c362a14826107f7cccbcc", + "logIndex": 1, + "blockHash": "0xcf8081fd55dbe42508dcf09914d65ecb90305ed009c3e6bb56f87d1369a64762" + } + ], + "blockNumber": 10978369, + "cumulativeGasUsed": "720430", + "status": 1, + "byzantium": true + }, + "args": [ + "0xf635d6A59EeFfDcdcE76422a81A1542D6f99949f", + "0xf06d5Edb04F4995FFF2c362a14826107F7CCCBCc", + "0x" + ], + "numDeployments": 1, + "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", + "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\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\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.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 *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\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 Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) 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 Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view virtual 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 Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\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(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\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(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) 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\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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 overriden 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 internall 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 overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/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\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\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 * ```\\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`, and `uint256`._\\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 /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\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 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 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 assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/porcini-dev/solcInputs/028a55b8eaa1999d8f382c93dbafe26d.json b/deployments/porcini-dev/solcInputs/028a55b8eaa1999d8f382c93dbafe26d.json new file mode 100644 index 00000000..50c85bf4 --- /dev/null +++ b/deployments/porcini-dev/solcInputs/028a55b8eaa1999d8f382c93dbafe26d.json @@ -0,0 +1,179 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./OwnableUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership} and {acceptOwnership}.\n *\n * This module is used through inheritance. It will make available all functions\n * from parent (Ownable).\n */\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\n function __Ownable2Step_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable2Step_init_unchained() internal onlyInitializing {\n }\n address private _pendingOwner;\n\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Returns the address of the pending owner.\n */\n function pendingOwner() public view virtual returns (address) {\n return _pendingOwner;\n }\n\n /**\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual override onlyOwner {\n _pendingOwner = newOwner;\n emit OwnershipTransferStarted(owner(), newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual override {\n delete _pendingOwner;\n super._transferOwnership(newOwner);\n }\n\n /**\n * @dev The new owner accepts the ownership transfer.\n */\n function acceptOwnership() public virtual {\n address sender = _msgSender();\n require(pendingOwner() == sender, \"Ownable2Step: caller is not the new owner\");\n _transferOwnership(sender);\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/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n /**\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/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/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/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/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/extensions/IERC20Permit.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 IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/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/ERC20/utils/SafeERC20.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 \"../IERC20.sol\";\nimport \"../extensions/IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.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(IERC20 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(IERC20 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(IERC20 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(IERC20 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(IERC20 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 IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n 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(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-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 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-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 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.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/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.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/cryptography/ECDSA.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 \"../Strings.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 ECDSA {\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\", Strings.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/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/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/math/Math.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 Math {\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/utils/math/SafeCast.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n *\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\n * all math on `uint256` and `int256` and then downcasting.\n */\nlibrary SafeCast {\n /**\n * @dev Returns the downcasted uint248 from uint256, reverting on\n * overflow (when the input is greater than largest uint248).\n *\n * Counterpart to Solidity's `uint248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n *\n * _Available since v4.7._\n */\n function toUint248(uint256 value) internal pure returns (uint248) {\n require(value <= type(uint248).max, \"SafeCast: value doesn't fit in 248 bits\");\n return uint248(value);\n }\n\n /**\n * @dev Returns the downcasted uint240 from uint256, reverting on\n * overflow (when the input is greater than largest uint240).\n *\n * Counterpart to Solidity's `uint240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n *\n * _Available since v4.7._\n */\n function toUint240(uint256 value) internal pure returns (uint240) {\n require(value <= type(uint240).max, \"SafeCast: value doesn't fit in 240 bits\");\n return uint240(value);\n }\n\n /**\n * @dev Returns the downcasted uint232 from uint256, reverting on\n * overflow (when the input is greater than largest uint232).\n *\n * Counterpart to Solidity's `uint232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n *\n * _Available since v4.7._\n */\n function toUint232(uint256 value) internal pure returns (uint232) {\n require(value <= type(uint232).max, \"SafeCast: value doesn't fit in 232 bits\");\n return uint232(value);\n }\n\n /**\n * @dev Returns the downcasted uint224 from uint256, reverting on\n * overflow (when the input is greater than largest uint224).\n *\n * Counterpart to Solidity's `uint224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n *\n * _Available since v4.2._\n */\n function toUint224(uint256 value) internal pure returns (uint224) {\n require(value <= type(uint224).max, \"SafeCast: value doesn't fit in 224 bits\");\n return uint224(value);\n }\n\n /**\n * @dev Returns the downcasted uint216 from uint256, reverting on\n * overflow (when the input is greater than largest uint216).\n *\n * Counterpart to Solidity's `uint216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n *\n * _Available since v4.7._\n */\n function toUint216(uint256 value) internal pure returns (uint216) {\n require(value <= type(uint216).max, \"SafeCast: value doesn't fit in 216 bits\");\n return uint216(value);\n }\n\n /**\n * @dev Returns the downcasted uint208 from uint256, reverting on\n * overflow (when the input is greater than largest uint208).\n *\n * Counterpart to Solidity's `uint208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n *\n * _Available since v4.7._\n */\n function toUint208(uint256 value) internal pure returns (uint208) {\n require(value <= type(uint208).max, \"SafeCast: value doesn't fit in 208 bits\");\n return uint208(value);\n }\n\n /**\n * @dev Returns the downcasted uint200 from uint256, reverting on\n * overflow (when the input is greater than largest uint200).\n *\n * Counterpart to Solidity's `uint200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n *\n * _Available since v4.7._\n */\n function toUint200(uint256 value) internal pure returns (uint200) {\n require(value <= type(uint200).max, \"SafeCast: value doesn't fit in 200 bits\");\n return uint200(value);\n }\n\n /**\n * @dev Returns the downcasted uint192 from uint256, reverting on\n * overflow (when the input is greater than largest uint192).\n *\n * Counterpart to Solidity's `uint192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n *\n * _Available since v4.7._\n */\n function toUint192(uint256 value) internal pure returns (uint192) {\n require(value <= type(uint192).max, \"SafeCast: value doesn't fit in 192 bits\");\n return uint192(value);\n }\n\n /**\n * @dev Returns the downcasted uint184 from uint256, reverting on\n * overflow (when the input is greater than largest uint184).\n *\n * Counterpart to Solidity's `uint184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n *\n * _Available since v4.7._\n */\n function toUint184(uint256 value) internal pure returns (uint184) {\n require(value <= type(uint184).max, \"SafeCast: value doesn't fit in 184 bits\");\n return uint184(value);\n }\n\n /**\n * @dev Returns the downcasted uint176 from uint256, reverting on\n * overflow (when the input is greater than largest uint176).\n *\n * Counterpart to Solidity's `uint176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n *\n * _Available since v4.7._\n */\n function toUint176(uint256 value) internal pure returns (uint176) {\n require(value <= type(uint176).max, \"SafeCast: value doesn't fit in 176 bits\");\n return uint176(value);\n }\n\n /**\n * @dev Returns the downcasted uint168 from uint256, reverting on\n * overflow (when the input is greater than largest uint168).\n *\n * Counterpart to Solidity's `uint168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n *\n * _Available since v4.7._\n */\n function toUint168(uint256 value) internal pure returns (uint168) {\n require(value <= type(uint168).max, \"SafeCast: value doesn't fit in 168 bits\");\n return uint168(value);\n }\n\n /**\n * @dev Returns the downcasted uint160 from uint256, reverting on\n * overflow (when the input is greater than largest uint160).\n *\n * Counterpart to Solidity's `uint160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n *\n * _Available since v4.7._\n */\n function toUint160(uint256 value) internal pure returns (uint160) {\n require(value <= type(uint160).max, \"SafeCast: value doesn't fit in 160 bits\");\n return uint160(value);\n }\n\n /**\n * @dev Returns the downcasted uint152 from uint256, reverting on\n * overflow (when the input is greater than largest uint152).\n *\n * Counterpart to Solidity's `uint152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n *\n * _Available since v4.7._\n */\n function toUint152(uint256 value) internal pure returns (uint152) {\n require(value <= type(uint152).max, \"SafeCast: value doesn't fit in 152 bits\");\n return uint152(value);\n }\n\n /**\n * @dev Returns the downcasted uint144 from uint256, reverting on\n * overflow (when the input is greater than largest uint144).\n *\n * Counterpart to Solidity's `uint144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n *\n * _Available since v4.7._\n */\n function toUint144(uint256 value) internal pure returns (uint144) {\n require(value <= type(uint144).max, \"SafeCast: value doesn't fit in 144 bits\");\n return uint144(value);\n }\n\n /**\n * @dev Returns the downcasted uint136 from uint256, reverting on\n * overflow (when the input is greater than largest uint136).\n *\n * Counterpart to Solidity's `uint136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n *\n * _Available since v4.7._\n */\n function toUint136(uint256 value) internal pure returns (uint136) {\n require(value <= type(uint136).max, \"SafeCast: value doesn't fit in 136 bits\");\n return uint136(value);\n }\n\n /**\n * @dev Returns the downcasted uint128 from uint256, reverting on\n * overflow (when the input is greater than largest uint128).\n *\n * Counterpart to Solidity's `uint128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v2.5._\n */\n function toUint128(uint256 value) internal pure returns (uint128) {\n require(value <= type(uint128).max, \"SafeCast: value doesn't fit in 128 bits\");\n return uint128(value);\n }\n\n /**\n * @dev Returns the downcasted uint120 from uint256, reverting on\n * overflow (when the input is greater than largest uint120).\n *\n * Counterpart to Solidity's `uint120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n *\n * _Available since v4.7._\n */\n function toUint120(uint256 value) internal pure returns (uint120) {\n require(value <= type(uint120).max, \"SafeCast: value doesn't fit in 120 bits\");\n return uint120(value);\n }\n\n /**\n * @dev Returns the downcasted uint112 from uint256, reverting on\n * overflow (when the input is greater than largest uint112).\n *\n * Counterpart to Solidity's `uint112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n *\n * _Available since v4.7._\n */\n function toUint112(uint256 value) internal pure returns (uint112) {\n require(value <= type(uint112).max, \"SafeCast: value doesn't fit in 112 bits\");\n return uint112(value);\n }\n\n /**\n * @dev Returns the downcasted uint104 from uint256, reverting on\n * overflow (when the input is greater than largest uint104).\n *\n * Counterpart to Solidity's `uint104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n *\n * _Available since v4.7._\n */\n function toUint104(uint256 value) internal pure returns (uint104) {\n require(value <= type(uint104).max, \"SafeCast: value doesn't fit in 104 bits\");\n return uint104(value);\n }\n\n /**\n * @dev Returns the downcasted uint96 from uint256, reverting on\n * overflow (when the input is greater than largest uint96).\n *\n * Counterpart to Solidity's `uint96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n *\n * _Available since v4.2._\n */\n function toUint96(uint256 value) internal pure returns (uint96) {\n require(value <= type(uint96).max, \"SafeCast: value doesn't fit in 96 bits\");\n return uint96(value);\n }\n\n /**\n * @dev Returns the downcasted uint88 from uint256, reverting on\n * overflow (when the input is greater than largest uint88).\n *\n * Counterpart to Solidity's `uint88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n *\n * _Available since v4.7._\n */\n function toUint88(uint256 value) internal pure returns (uint88) {\n require(value <= type(uint88).max, \"SafeCast: value doesn't fit in 88 bits\");\n return uint88(value);\n }\n\n /**\n * @dev Returns the downcasted uint80 from uint256, reverting on\n * overflow (when the input is greater than largest uint80).\n *\n * Counterpart to Solidity's `uint80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n *\n * _Available since v4.7._\n */\n function toUint80(uint256 value) internal pure returns (uint80) {\n require(value <= type(uint80).max, \"SafeCast: value doesn't fit in 80 bits\");\n return uint80(value);\n }\n\n /**\n * @dev Returns the downcasted uint72 from uint256, reverting on\n * overflow (when the input is greater than largest uint72).\n *\n * Counterpart to Solidity's `uint72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n *\n * _Available since v4.7._\n */\n function toUint72(uint256 value) internal pure returns (uint72) {\n require(value <= type(uint72).max, \"SafeCast: value doesn't fit in 72 bits\");\n return uint72(value);\n }\n\n /**\n * @dev Returns the downcasted uint64 from uint256, reverting on\n * overflow (when the input is greater than largest uint64).\n *\n * Counterpart to Solidity's `uint64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v2.5._\n */\n function toUint64(uint256 value) internal pure returns (uint64) {\n require(value <= type(uint64).max, \"SafeCast: value doesn't fit in 64 bits\");\n return uint64(value);\n }\n\n /**\n * @dev Returns the downcasted uint56 from uint256, reverting on\n * overflow (when the input is greater than largest uint56).\n *\n * Counterpart to Solidity's `uint56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n *\n * _Available since v4.7._\n */\n function toUint56(uint256 value) internal pure returns (uint56) {\n require(value <= type(uint56).max, \"SafeCast: value doesn't fit in 56 bits\");\n return uint56(value);\n }\n\n /**\n * @dev Returns the downcasted uint48 from uint256, reverting on\n * overflow (when the input is greater than largest uint48).\n *\n * Counterpart to Solidity's `uint48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n *\n * _Available since v4.7._\n */\n function toUint48(uint256 value) internal pure returns (uint48) {\n require(value <= type(uint48).max, \"SafeCast: value doesn't fit in 48 bits\");\n return uint48(value);\n }\n\n /**\n * @dev Returns the downcasted uint40 from uint256, reverting on\n * overflow (when the input is greater than largest uint40).\n *\n * Counterpart to Solidity's `uint40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n *\n * _Available since v4.7._\n */\n function toUint40(uint256 value) internal pure returns (uint40) {\n require(value <= type(uint40).max, \"SafeCast: value doesn't fit in 40 bits\");\n return uint40(value);\n }\n\n /**\n * @dev Returns the downcasted uint32 from uint256, reverting on\n * overflow (when the input is greater than largest uint32).\n *\n * Counterpart to Solidity's `uint32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v2.5._\n */\n function toUint32(uint256 value) internal pure returns (uint32) {\n require(value <= type(uint32).max, \"SafeCast: value doesn't fit in 32 bits\");\n return uint32(value);\n }\n\n /**\n * @dev Returns the downcasted uint24 from uint256, reverting on\n * overflow (when the input is greater than largest uint24).\n *\n * Counterpart to Solidity's `uint24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n *\n * _Available since v4.7._\n */\n function toUint24(uint256 value) internal pure returns (uint24) {\n require(value <= type(uint24).max, \"SafeCast: value doesn't fit in 24 bits\");\n return uint24(value);\n }\n\n /**\n * @dev Returns the downcasted uint16 from uint256, reverting on\n * overflow (when the input is greater than largest uint16).\n *\n * Counterpart to Solidity's `uint16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v2.5._\n */\n function toUint16(uint256 value) internal pure returns (uint16) {\n require(value <= type(uint16).max, \"SafeCast: value doesn't fit in 16 bits\");\n return uint16(value);\n }\n\n /**\n * @dev Returns the downcasted uint8 from uint256, reverting on\n * overflow (when the input is greater than largest uint8).\n *\n * Counterpart to Solidity's `uint8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n *\n * _Available since v2.5._\n */\n function toUint8(uint256 value) internal pure returns (uint8) {\n require(value <= type(uint8).max, \"SafeCast: value doesn't fit in 8 bits\");\n return uint8(value);\n }\n\n /**\n * @dev Converts a signed int256 into an unsigned uint256.\n *\n * Requirements:\n *\n * - input must be greater than or equal to 0.\n *\n * _Available since v3.0._\n */\n function toUint256(int256 value) internal pure returns (uint256) {\n require(value >= 0, \"SafeCast: value must be positive\");\n return uint256(value);\n }\n\n /**\n * @dev Returns the downcasted int248 from int256, reverting on\n * overflow (when the input is less than smallest int248 or\n * greater than largest int248).\n *\n * Counterpart to Solidity's `int248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n *\n * _Available since v4.7._\n */\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\n downcasted = int248(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 248 bits\");\n }\n\n /**\n * @dev Returns the downcasted int240 from int256, reverting on\n * overflow (when the input is less than smallest int240 or\n * greater than largest int240).\n *\n * Counterpart to Solidity's `int240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n *\n * _Available since v4.7._\n */\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\n downcasted = int240(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 240 bits\");\n }\n\n /**\n * @dev Returns the downcasted int232 from int256, reverting on\n * overflow (when the input is less than smallest int232 or\n * greater than largest int232).\n *\n * Counterpart to Solidity's `int232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n *\n * _Available since v4.7._\n */\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\n downcasted = int232(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 232 bits\");\n }\n\n /**\n * @dev Returns the downcasted int224 from int256, reverting on\n * overflow (when the input is less than smallest int224 or\n * greater than largest int224).\n *\n * Counterpart to Solidity's `int224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n *\n * _Available since v4.7._\n */\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\n downcasted = int224(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 224 bits\");\n }\n\n /**\n * @dev Returns the downcasted int216 from int256, reverting on\n * overflow (when the input is less than smallest int216 or\n * greater than largest int216).\n *\n * Counterpart to Solidity's `int216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n *\n * _Available since v4.7._\n */\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\n downcasted = int216(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 216 bits\");\n }\n\n /**\n * @dev Returns the downcasted int208 from int256, reverting on\n * overflow (when the input is less than smallest int208 or\n * greater than largest int208).\n *\n * Counterpart to Solidity's `int208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n *\n * _Available since v4.7._\n */\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\n downcasted = int208(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 208 bits\");\n }\n\n /**\n * @dev Returns the downcasted int200 from int256, reverting on\n * overflow (when the input is less than smallest int200 or\n * greater than largest int200).\n *\n * Counterpart to Solidity's `int200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n *\n * _Available since v4.7._\n */\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\n downcasted = int200(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 200 bits\");\n }\n\n /**\n * @dev Returns the downcasted int192 from int256, reverting on\n * overflow (when the input is less than smallest int192 or\n * greater than largest int192).\n *\n * Counterpart to Solidity's `int192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n *\n * _Available since v4.7._\n */\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\n downcasted = int192(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 192 bits\");\n }\n\n /**\n * @dev Returns the downcasted int184 from int256, reverting on\n * overflow (when the input is less than smallest int184 or\n * greater than largest int184).\n *\n * Counterpart to Solidity's `int184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n *\n * _Available since v4.7._\n */\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\n downcasted = int184(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 184 bits\");\n }\n\n /**\n * @dev Returns the downcasted int176 from int256, reverting on\n * overflow (when the input is less than smallest int176 or\n * greater than largest int176).\n *\n * Counterpart to Solidity's `int176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n *\n * _Available since v4.7._\n */\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\n downcasted = int176(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 176 bits\");\n }\n\n /**\n * @dev Returns the downcasted int168 from int256, reverting on\n * overflow (when the input is less than smallest int168 or\n * greater than largest int168).\n *\n * Counterpart to Solidity's `int168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n *\n * _Available since v4.7._\n */\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\n downcasted = int168(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 168 bits\");\n }\n\n /**\n * @dev Returns the downcasted int160 from int256, reverting on\n * overflow (when the input is less than smallest int160 or\n * greater than largest int160).\n *\n * Counterpart to Solidity's `int160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n *\n * _Available since v4.7._\n */\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\n downcasted = int160(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 160 bits\");\n }\n\n /**\n * @dev Returns the downcasted int152 from int256, reverting on\n * overflow (when the input is less than smallest int152 or\n * greater than largest int152).\n *\n * Counterpart to Solidity's `int152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n *\n * _Available since v4.7._\n */\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\n downcasted = int152(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 152 bits\");\n }\n\n /**\n * @dev Returns the downcasted int144 from int256, reverting on\n * overflow (when the input is less than smallest int144 or\n * greater than largest int144).\n *\n * Counterpart to Solidity's `int144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n *\n * _Available since v4.7._\n */\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\n downcasted = int144(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 144 bits\");\n }\n\n /**\n * @dev Returns the downcasted int136 from int256, reverting on\n * overflow (when the input is less than smallest int136 or\n * greater than largest int136).\n *\n * Counterpart to Solidity's `int136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n *\n * _Available since v4.7._\n */\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\n downcasted = int136(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 136 bits\");\n }\n\n /**\n * @dev Returns the downcasted int128 from int256, reverting on\n * overflow (when the input is less than smallest int128 or\n * greater than largest int128).\n *\n * Counterpart to Solidity's `int128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v3.1._\n */\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\n downcasted = int128(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 128 bits\");\n }\n\n /**\n * @dev Returns the downcasted int120 from int256, reverting on\n * overflow (when the input is less than smallest int120 or\n * greater than largest int120).\n *\n * Counterpart to Solidity's `int120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n *\n * _Available since v4.7._\n */\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\n downcasted = int120(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 120 bits\");\n }\n\n /**\n * @dev Returns the downcasted int112 from int256, reverting on\n * overflow (when the input is less than smallest int112 or\n * greater than largest int112).\n *\n * Counterpart to Solidity's `int112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n *\n * _Available since v4.7._\n */\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\n downcasted = int112(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 112 bits\");\n }\n\n /**\n * @dev Returns the downcasted int104 from int256, reverting on\n * overflow (when the input is less than smallest int104 or\n * greater than largest int104).\n *\n * Counterpart to Solidity's `int104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n *\n * _Available since v4.7._\n */\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\n downcasted = int104(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 104 bits\");\n }\n\n /**\n * @dev Returns the downcasted int96 from int256, reverting on\n * overflow (when the input is less than smallest int96 or\n * greater than largest int96).\n *\n * Counterpart to Solidity's `int96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n *\n * _Available since v4.7._\n */\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\n downcasted = int96(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 96 bits\");\n }\n\n /**\n * @dev Returns the downcasted int88 from int256, reverting on\n * overflow (when the input is less than smallest int88 or\n * greater than largest int88).\n *\n * Counterpart to Solidity's `int88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n *\n * _Available since v4.7._\n */\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\n downcasted = int88(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 88 bits\");\n }\n\n /**\n * @dev Returns the downcasted int80 from int256, reverting on\n * overflow (when the input is less than smallest int80 or\n * greater than largest int80).\n *\n * Counterpart to Solidity's `int80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n *\n * _Available since v4.7._\n */\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\n downcasted = int80(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 80 bits\");\n }\n\n /**\n * @dev Returns the downcasted int72 from int256, reverting on\n * overflow (when the input is less than smallest int72 or\n * greater than largest int72).\n *\n * Counterpart to Solidity's `int72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n *\n * _Available since v4.7._\n */\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\n downcasted = int72(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 72 bits\");\n }\n\n /**\n * @dev Returns the downcasted int64 from int256, reverting on\n * overflow (when the input is less than smallest int64 or\n * greater than largest int64).\n *\n * Counterpart to Solidity's `int64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v3.1._\n */\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\n downcasted = int64(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 64 bits\");\n }\n\n /**\n * @dev Returns the downcasted int56 from int256, reverting on\n * overflow (when the input is less than smallest int56 or\n * greater than largest int56).\n *\n * Counterpart to Solidity's `int56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n *\n * _Available since v4.7._\n */\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\n downcasted = int56(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 56 bits\");\n }\n\n /**\n * @dev Returns the downcasted int48 from int256, reverting on\n * overflow (when the input is less than smallest int48 or\n * greater than largest int48).\n *\n * Counterpart to Solidity's `int48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n *\n * _Available since v4.7._\n */\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\n downcasted = int48(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 48 bits\");\n }\n\n /**\n * @dev Returns the downcasted int40 from int256, reverting on\n * overflow (when the input is less than smallest int40 or\n * greater than largest int40).\n *\n * Counterpart to Solidity's `int40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n *\n * _Available since v4.7._\n */\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\n downcasted = int40(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 40 bits\");\n }\n\n /**\n * @dev Returns the downcasted int32 from int256, reverting on\n * overflow (when the input is less than smallest int32 or\n * greater than largest int32).\n *\n * Counterpart to Solidity's `int32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v3.1._\n */\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\n downcasted = int32(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 32 bits\");\n }\n\n /**\n * @dev Returns the downcasted int24 from int256, reverting on\n * overflow (when the input is less than smallest int24 or\n * greater than largest int24).\n *\n * Counterpart to Solidity's `int24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n *\n * _Available since v4.7._\n */\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\n downcasted = int24(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 24 bits\");\n }\n\n /**\n * @dev Returns the downcasted int16 from int256, reverting on\n * overflow (when the input is less than smallest int16 or\n * greater than largest int16).\n *\n * Counterpart to Solidity's `int16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v3.1._\n */\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\n downcasted = int16(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 16 bits\");\n }\n\n /**\n * @dev Returns the downcasted int8 from int256, reverting on\n * overflow (when the input is less than smallest int8 or\n * greater than largest int8).\n *\n * Counterpart to Solidity's `int8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n *\n * _Available since v3.1._\n */\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\n downcasted = int8(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 8 bits\");\n }\n\n /**\n * @dev Converts an unsigned uint256 into a signed int256.\n *\n * Requirements:\n *\n * - input must be less than or equal to maxInt256.\n *\n * _Available since v3.0._\n */\n function toInt256(uint256 value) internal pure returns (int256) {\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\n require(value <= uint256(type(int256).max), \"SafeCast: value doesn't fit in an int256\");\n return int256(value);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SignedMath.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 SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.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/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\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 = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _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(SignedMath.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n 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" + }, + "abdk-libraries-solidity/ABDKMath64x64.sol": { + "content": "// SPDX-License-Identifier: BSD-4-Clause\n/*\n * ABDK Math 64.64 Smart Contract Library. Copyright Ā© 2019 by ABDK Consulting.\n * Author: Mikhail Vladimirov \n */\npragma solidity ^0.8.0;\n\n/**\n * Smart contract library of mathematical functions operating with signed\n * 64.64-bit fixed point numbers. Signed 64.64-bit fixed point number is\n * basically a simple fraction whose numerator is signed 128-bit integer and\n * denominator is 2^64. As long as denominator is always the same, there is no\n * need to store it, thus in Solidity signed 64.64-bit fixed point numbers are\n * represented by int128 type holding only the numerator.\n */\nlibrary ABDKMath64x64 {\n /*\n * Minimum value signed 64.64-bit fixed point number may have. \n */\n int128 private constant MIN_64x64 = -0x80000000000000000000000000000000;\n\n /*\n * Maximum value signed 64.64-bit fixed point number may have. \n */\n int128 private constant MAX_64x64 = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;\n\n /**\n * Convert signed 256-bit integer number into signed 64.64-bit fixed point\n * number. Revert on overflow.\n *\n * @param x signed 256-bit integer number\n * @return signed 64.64-bit fixed point number\n */\n function fromInt (int256 x) internal pure returns (int128) {\n unchecked {\n require (x >= -0x8000000000000000 && x <= 0x7FFFFFFFFFFFFFFF);\n return int128 (x << 64);\n }\n }\n\n /**\n * Convert signed 64.64 fixed point number into signed 64-bit integer number\n * rounding down.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64-bit integer number\n */\n function toInt (int128 x) internal pure returns (int64) {\n unchecked {\n return int64 (x >> 64);\n }\n }\n\n /**\n * Convert unsigned 256-bit integer number into signed 64.64-bit fixed point\n * number. Revert on overflow.\n *\n * @param x unsigned 256-bit integer number\n * @return signed 64.64-bit fixed point number\n */\n function fromUInt (uint256 x) internal pure returns (int128) {\n unchecked {\n require (x <= 0x7FFFFFFFFFFFFFFF);\n return int128 (int256 (x << 64));\n }\n }\n\n /**\n * Convert signed 64.64 fixed point number into unsigned 64-bit integer\n * number rounding down. Revert on underflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @return unsigned 64-bit integer number\n */\n function toUInt (int128 x) internal pure returns (uint64) {\n unchecked {\n require (x >= 0);\n return uint64 (uint128 (x >> 64));\n }\n }\n\n /**\n * Convert signed 128.128 fixed point number into signed 64.64-bit fixed point\n * number rounding down. Revert on overflow.\n *\n * @param x signed 128.128-bin fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function from128x128 (int256 x) internal pure returns (int128) {\n unchecked {\n int256 result = x >> 64;\n require (result >= MIN_64x64 && result <= MAX_64x64);\n return int128 (result);\n }\n }\n\n /**\n * Convert signed 64.64 fixed point number into signed 128.128 fixed point\n * number.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 128.128 fixed point number\n */\n function to128x128 (int128 x) internal pure returns (int256) {\n unchecked {\n return int256 (x) << 64;\n }\n }\n\n /**\n * Calculate x + y. Revert on overflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @param y signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function add (int128 x, int128 y) internal pure returns (int128) {\n unchecked {\n int256 result = int256(x) + y;\n require (result >= MIN_64x64 && result <= MAX_64x64);\n return int128 (result);\n }\n }\n\n /**\n * Calculate x - y. Revert on overflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @param y signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function sub (int128 x, int128 y) internal pure returns (int128) {\n unchecked {\n int256 result = int256(x) - y;\n require (result >= MIN_64x64 && result <= MAX_64x64);\n return int128 (result);\n }\n }\n\n /**\n * Calculate x * y rounding down. Revert on overflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @param y signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function mul (int128 x, int128 y) internal pure returns (int128) {\n unchecked {\n int256 result = int256(x) * y >> 64;\n require (result >= MIN_64x64 && result <= MAX_64x64);\n return int128 (result);\n }\n }\n\n /**\n * Calculate x * y rounding towards zero, where x is signed 64.64 fixed point\n * number and y is signed 256-bit integer number. Revert on overflow.\n *\n * @param x signed 64.64 fixed point number\n * @param y signed 256-bit integer number\n * @return signed 256-bit integer number\n */\n function muli (int128 x, int256 y) internal pure returns (int256) {\n unchecked {\n if (x == MIN_64x64) {\n require (y >= -0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF &&\n y <= 0x1000000000000000000000000000000000000000000000000);\n return -y << 63;\n } else {\n bool negativeResult = false;\n if (x < 0) {\n x = -x;\n negativeResult = true;\n }\n if (y < 0) {\n y = -y; // We rely on overflow behavior here\n negativeResult = !negativeResult;\n }\n uint256 absoluteResult = mulu (x, uint256 (y));\n if (negativeResult) {\n require (absoluteResult <=\n 0x8000000000000000000000000000000000000000000000000000000000000000);\n return -int256 (absoluteResult); // We rely on overflow behavior here\n } else {\n require (absoluteResult <=\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\n return int256 (absoluteResult);\n }\n }\n }\n }\n\n /**\n * Calculate x * y rounding down, where x is signed 64.64 fixed point number\n * and y is unsigned 256-bit integer number. Revert on overflow.\n *\n * @param x signed 64.64 fixed point number\n * @param y unsigned 256-bit integer number\n * @return unsigned 256-bit integer number\n */\n function mulu (int128 x, uint256 y) internal pure returns (uint256) {\n unchecked {\n if (y == 0) return 0;\n\n require (x >= 0);\n\n uint256 lo = (uint256 (int256 (x)) * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) >> 64;\n uint256 hi = uint256 (int256 (x)) * (y >> 128);\n\n require (hi <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\n hi <<= 64;\n\n require (hi <=\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - lo);\n return hi + lo;\n }\n }\n\n /**\n * Calculate x / y rounding towards zero. Revert on overflow or when y is\n * zero.\n *\n * @param x signed 64.64-bit fixed point number\n * @param y signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function div (int128 x, int128 y) internal pure returns (int128) {\n unchecked {\n require (y != 0);\n int256 result = (int256 (x) << 64) / y;\n require (result >= MIN_64x64 && result <= MAX_64x64);\n return int128 (result);\n }\n }\n\n /**\n * Calculate x / y rounding towards zero, where x and y are signed 256-bit\n * integer numbers. Revert on overflow or when y is zero.\n *\n * @param x signed 256-bit integer number\n * @param y signed 256-bit integer number\n * @return signed 64.64-bit fixed point number\n */\n function divi (int256 x, int256 y) internal pure returns (int128) {\n unchecked {\n require (y != 0);\n\n bool negativeResult = false;\n if (x < 0) {\n x = -x; // We rely on overflow behavior here\n negativeResult = true;\n }\n if (y < 0) {\n y = -y; // We rely on overflow behavior here\n negativeResult = !negativeResult;\n }\n uint128 absoluteResult = divuu (uint256 (x), uint256 (y));\n if (negativeResult) {\n require (absoluteResult <= 0x80000000000000000000000000000000);\n return -int128 (absoluteResult); // We rely on overflow behavior here\n } else {\n require (absoluteResult <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\n return int128 (absoluteResult); // We rely on overflow behavior here\n }\n }\n }\n\n /**\n * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit\n * integer numbers. Revert on overflow or when y is zero.\n *\n * @param x unsigned 256-bit integer number\n * @param y unsigned 256-bit integer number\n * @return signed 64.64-bit fixed point number\n */\n function divu (uint256 x, uint256 y) internal pure returns (int128) {\n unchecked {\n require (y != 0);\n uint128 result = divuu (x, y);\n require (result <= uint128 (MAX_64x64));\n return int128 (result);\n }\n }\n\n /**\n * Calculate -x. Revert on overflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function neg (int128 x) internal pure returns (int128) {\n unchecked {\n require (x != MIN_64x64);\n return -x;\n }\n }\n\n /**\n * Calculate |x|. Revert on overflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function abs (int128 x) internal pure returns (int128) {\n unchecked {\n require (x != MIN_64x64);\n return x < 0 ? -x : x;\n }\n }\n\n /**\n * Calculate 1 / x rounding towards zero. Revert on overflow or when x is\n * zero.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function inv (int128 x) internal pure returns (int128) {\n unchecked {\n require (x != 0);\n int256 result = int256 (0x100000000000000000000000000000000) / x;\n require (result >= MIN_64x64 && result <= MAX_64x64);\n return int128 (result);\n }\n }\n\n /**\n * Calculate arithmetics average of x and y, i.e. (x + y) / 2 rounding down.\n *\n * @param x signed 64.64-bit fixed point number\n * @param y signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function avg (int128 x, int128 y) internal pure returns (int128) {\n unchecked {\n return int128 ((int256 (x) + int256 (y)) >> 1);\n }\n }\n\n /**\n * Calculate geometric average of x and y, i.e. sqrt (x * y) rounding down.\n * Revert on overflow or in case x * y is negative.\n *\n * @param x signed 64.64-bit fixed point number\n * @param y signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function gavg (int128 x, int128 y) internal pure returns (int128) {\n unchecked {\n int256 m = int256 (x) * int256 (y);\n require (m >= 0);\n require (m <\n 0x4000000000000000000000000000000000000000000000000000000000000000);\n return int128 (sqrtu (uint256 (m)));\n }\n }\n\n /**\n * Calculate x^y assuming 0^0 is 1, where x is signed 64.64 fixed point number\n * and y is unsigned 256-bit integer number. Revert on overflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @param y uint256 value\n * @return signed 64.64-bit fixed point number\n */\n function pow (int128 x, uint256 y) internal pure returns (int128) {\n unchecked {\n bool negative = x < 0 && y & 1 == 1;\n\n uint256 absX = uint128 (x < 0 ? -x : x);\n uint256 absResult;\n absResult = 0x100000000000000000000000000000000;\n\n if (absX <= 0x10000000000000000) {\n absX <<= 63;\n while (y != 0) {\n if (y & 0x1 != 0) {\n absResult = absResult * absX >> 127;\n }\n absX = absX * absX >> 127;\n\n if (y & 0x2 != 0) {\n absResult = absResult * absX >> 127;\n }\n absX = absX * absX >> 127;\n\n if (y & 0x4 != 0) {\n absResult = absResult * absX >> 127;\n }\n absX = absX * absX >> 127;\n\n if (y & 0x8 != 0) {\n absResult = absResult * absX >> 127;\n }\n absX = absX * absX >> 127;\n\n y >>= 4;\n }\n\n absResult >>= 64;\n } else {\n uint256 absXShift = 63;\n if (absX < 0x1000000000000000000000000) { absX <<= 32; absXShift -= 32; }\n if (absX < 0x10000000000000000000000000000) { absX <<= 16; absXShift -= 16; }\n if (absX < 0x1000000000000000000000000000000) { absX <<= 8; absXShift -= 8; }\n if (absX < 0x10000000000000000000000000000000) { absX <<= 4; absXShift -= 4; }\n if (absX < 0x40000000000000000000000000000000) { absX <<= 2; absXShift -= 2; }\n if (absX < 0x80000000000000000000000000000000) { absX <<= 1; absXShift -= 1; }\n\n uint256 resultShift = 0;\n while (y != 0) {\n require (absXShift < 64);\n\n if (y & 0x1 != 0) {\n absResult = absResult * absX >> 127;\n resultShift += absXShift;\n if (absResult > 0x100000000000000000000000000000000) {\n absResult >>= 1;\n resultShift += 1;\n }\n }\n absX = absX * absX >> 127;\n absXShift <<= 1;\n if (absX >= 0x100000000000000000000000000000000) {\n absX >>= 1;\n absXShift += 1;\n }\n\n y >>= 1;\n }\n\n require (resultShift < 64);\n absResult >>= 64 - resultShift;\n }\n int256 result = negative ? -int256 (absResult) : int256 (absResult);\n require (result >= MIN_64x64 && result <= MAX_64x64);\n return int128 (result);\n }\n }\n\n /**\n * Calculate sqrt (x) rounding down. Revert if x < 0.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function sqrt (int128 x) internal pure returns (int128) {\n unchecked {\n require (x >= 0);\n return int128 (sqrtu (uint256 (int256 (x)) << 64));\n }\n }\n\n /**\n * Calculate binary logarithm of x. Revert if x <= 0.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function log_2 (int128 x) internal pure returns (int128) {\n unchecked {\n require (x > 0);\n\n int256 msb = 0;\n int256 xc = x;\n if (xc >= 0x10000000000000000) { xc >>= 64; msb += 64; }\n if (xc >= 0x100000000) { xc >>= 32; msb += 32; }\n if (xc >= 0x10000) { xc >>= 16; msb += 16; }\n if (xc >= 0x100) { xc >>= 8; msb += 8; }\n if (xc >= 0x10) { xc >>= 4; msb += 4; }\n if (xc >= 0x4) { xc >>= 2; msb += 2; }\n if (xc >= 0x2) msb += 1; // No need to shift xc anymore\n\n int256 result = msb - 64 << 64;\n uint256 ux = uint256 (int256 (x)) << uint256 (127 - msb);\n for (int256 bit = 0x8000000000000000; bit > 0; bit >>= 1) {\n ux *= ux;\n uint256 b = ux >> 255;\n ux >>= 127 + b;\n result += bit * int256 (b);\n }\n\n return int128 (result);\n }\n }\n\n /**\n * Calculate natural logarithm of x. Revert if x <= 0.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function ln (int128 x) internal pure returns (int128) {\n unchecked {\n require (x > 0);\n\n return int128 (int256 (\n uint256 (int256 (log_2 (x))) * 0xB17217F7D1CF79ABC9E3B39803F2F6AF >> 128));\n }\n }\n\n /**\n * Calculate binary exponent of x. Revert on overflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function exp_2 (int128 x) internal pure returns (int128) {\n unchecked {\n require (x < 0x400000000000000000); // Overflow\n\n if (x < -0x400000000000000000) return 0; // Underflow\n\n uint256 result = 0x80000000000000000000000000000000;\n\n if (x & 0x8000000000000000 > 0)\n result = result * 0x16A09E667F3BCC908B2FB1366EA957D3E >> 128;\n if (x & 0x4000000000000000 > 0)\n result = result * 0x1306FE0A31B7152DE8D5A46305C85EDEC >> 128;\n if (x & 0x2000000000000000 > 0)\n result = result * 0x1172B83C7D517ADCDF7C8C50EB14A791F >> 128;\n if (x & 0x1000000000000000 > 0)\n result = result * 0x10B5586CF9890F6298B92B71842A98363 >> 128;\n if (x & 0x800000000000000 > 0)\n result = result * 0x1059B0D31585743AE7C548EB68CA417FD >> 128;\n if (x & 0x400000000000000 > 0)\n result = result * 0x102C9A3E778060EE6F7CACA4F7A29BDE8 >> 128;\n if (x & 0x200000000000000 > 0)\n result = result * 0x10163DA9FB33356D84A66AE336DCDFA3F >> 128;\n if (x & 0x100000000000000 > 0)\n result = result * 0x100B1AFA5ABCBED6129AB13EC11DC9543 >> 128;\n if (x & 0x80000000000000 > 0)\n result = result * 0x10058C86DA1C09EA1FF19D294CF2F679B >> 128;\n if (x & 0x40000000000000 > 0)\n result = result * 0x1002C605E2E8CEC506D21BFC89A23A00F >> 128;\n if (x & 0x20000000000000 > 0)\n result = result * 0x100162F3904051FA128BCA9C55C31E5DF >> 128;\n if (x & 0x10000000000000 > 0)\n result = result * 0x1000B175EFFDC76BA38E31671CA939725 >> 128;\n if (x & 0x8000000000000 > 0)\n result = result * 0x100058BA01FB9F96D6CACD4B180917C3D >> 128;\n if (x & 0x4000000000000 > 0)\n result = result * 0x10002C5CC37DA9491D0985C348C68E7B3 >> 128;\n if (x & 0x2000000000000 > 0)\n result = result * 0x1000162E525EE054754457D5995292026 >> 128;\n if (x & 0x1000000000000 > 0)\n result = result * 0x10000B17255775C040618BF4A4ADE83FC >> 128;\n if (x & 0x800000000000 > 0)\n result = result * 0x1000058B91B5BC9AE2EED81E9B7D4CFAB >> 128;\n if (x & 0x400000000000 > 0)\n result = result * 0x100002C5C89D5EC6CA4D7C8ACC017B7C9 >> 128;\n if (x & 0x200000000000 > 0)\n result = result * 0x10000162E43F4F831060E02D839A9D16D >> 128;\n if (x & 0x100000000000 > 0)\n result = result * 0x100000B1721BCFC99D9F890EA06911763 >> 128;\n if (x & 0x80000000000 > 0)\n result = result * 0x10000058B90CF1E6D97F9CA14DBCC1628 >> 128;\n if (x & 0x40000000000 > 0)\n result = result * 0x1000002C5C863B73F016468F6BAC5CA2B >> 128;\n if (x & 0x20000000000 > 0)\n result = result * 0x100000162E430E5A18F6119E3C02282A5 >> 128;\n if (x & 0x10000000000 > 0)\n result = result * 0x1000000B1721835514B86E6D96EFD1BFE >> 128;\n if (x & 0x8000000000 > 0)\n result = result * 0x100000058B90C0B48C6BE5DF846C5B2EF >> 128;\n if (x & 0x4000000000 > 0)\n result = result * 0x10000002C5C8601CC6B9E94213C72737A >> 128;\n if (x & 0x2000000000 > 0)\n result = result * 0x1000000162E42FFF037DF38AA2B219F06 >> 128;\n if (x & 0x1000000000 > 0)\n result = result * 0x10000000B17217FBA9C739AA5819F44F9 >> 128;\n if (x & 0x800000000 > 0)\n result = result * 0x1000000058B90BFCDEE5ACD3C1CEDC823 >> 128;\n if (x & 0x400000000 > 0)\n result = result * 0x100000002C5C85FE31F35A6A30DA1BE50 >> 128;\n if (x & 0x200000000 > 0)\n result = result * 0x10000000162E42FF0999CE3541B9FFFCF >> 128;\n if (x & 0x100000000 > 0)\n result = result * 0x100000000B17217F80F4EF5AADDA45554 >> 128;\n if (x & 0x80000000 > 0)\n result = result * 0x10000000058B90BFBF8479BD5A81B51AD >> 128;\n if (x & 0x40000000 > 0)\n result = result * 0x1000000002C5C85FDF84BD62AE30A74CC >> 128;\n if (x & 0x20000000 > 0)\n result = result * 0x100000000162E42FEFB2FED257559BDAA >> 128;\n if (x & 0x10000000 > 0)\n result = result * 0x1000000000B17217F7D5A7716BBA4A9AE >> 128;\n if (x & 0x8000000 > 0)\n result = result * 0x100000000058B90BFBE9DDBAC5E109CCE >> 128;\n if (x & 0x4000000 > 0)\n result = result * 0x10000000002C5C85FDF4B15DE6F17EB0D >> 128;\n if (x & 0x2000000 > 0)\n result = result * 0x1000000000162E42FEFA494F1478FDE05 >> 128;\n if (x & 0x1000000 > 0)\n result = result * 0x10000000000B17217F7D20CF927C8E94C >> 128;\n if (x & 0x800000 > 0)\n result = result * 0x1000000000058B90BFBE8F71CB4E4B33D >> 128;\n if (x & 0x400000 > 0)\n result = result * 0x100000000002C5C85FDF477B662B26945 >> 128;\n if (x & 0x200000 > 0)\n result = result * 0x10000000000162E42FEFA3AE53369388C >> 128;\n if (x & 0x100000 > 0)\n result = result * 0x100000000000B17217F7D1D351A389D40 >> 128;\n if (x & 0x80000 > 0)\n result = result * 0x10000000000058B90BFBE8E8B2D3D4EDE >> 128;\n if (x & 0x40000 > 0)\n result = result * 0x1000000000002C5C85FDF4741BEA6E77E >> 128;\n if (x & 0x20000 > 0)\n result = result * 0x100000000000162E42FEFA39FE95583C2 >> 128;\n if (x & 0x10000 > 0)\n result = result * 0x1000000000000B17217F7D1CFB72B45E1 >> 128;\n if (x & 0x8000 > 0)\n result = result * 0x100000000000058B90BFBE8E7CC35C3F0 >> 128;\n if (x & 0x4000 > 0)\n result = result * 0x10000000000002C5C85FDF473E242EA38 >> 128;\n if (x & 0x2000 > 0)\n result = result * 0x1000000000000162E42FEFA39F02B772C >> 128;\n if (x & 0x1000 > 0)\n result = result * 0x10000000000000B17217F7D1CF7D83C1A >> 128;\n if (x & 0x800 > 0)\n result = result * 0x1000000000000058B90BFBE8E7BDCBE2E >> 128;\n if (x & 0x400 > 0)\n result = result * 0x100000000000002C5C85FDF473DEA871F >> 128;\n if (x & 0x200 > 0)\n result = result * 0x10000000000000162E42FEFA39EF44D91 >> 128;\n if (x & 0x100 > 0)\n result = result * 0x100000000000000B17217F7D1CF79E949 >> 128;\n if (x & 0x80 > 0)\n result = result * 0x10000000000000058B90BFBE8E7BCE544 >> 128;\n if (x & 0x40 > 0)\n result = result * 0x1000000000000002C5C85FDF473DE6ECA >> 128;\n if (x & 0x20 > 0)\n result = result * 0x100000000000000162E42FEFA39EF366F >> 128;\n if (x & 0x10 > 0)\n result = result * 0x1000000000000000B17217F7D1CF79AFA >> 128;\n if (x & 0x8 > 0)\n result = result * 0x100000000000000058B90BFBE8E7BCD6D >> 128;\n if (x & 0x4 > 0)\n result = result * 0x10000000000000002C5C85FDF473DE6B2 >> 128;\n if (x & 0x2 > 0)\n result = result * 0x1000000000000000162E42FEFA39EF358 >> 128;\n if (x & 0x1 > 0)\n result = result * 0x10000000000000000B17217F7D1CF79AB >> 128;\n\n result >>= uint256 (int256 (63 - (x >> 64)));\n require (result <= uint256 (int256 (MAX_64x64)));\n\n return int128 (int256 (result));\n }\n }\n\n /**\n * Calculate natural exponent of x. Revert on overflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function exp (int128 x) internal pure returns (int128) {\n unchecked {\n require (x < 0x400000000000000000); // Overflow\n\n if (x < -0x400000000000000000) return 0; // Underflow\n\n return exp_2 (\n int128 (int256 (x) * 0x171547652B82FE1777D0FFDA0D23A7D12 >> 128));\n }\n }\n\n /**\n * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit\n * integer numbers. Revert on overflow or when y is zero.\n *\n * @param x unsigned 256-bit integer number\n * @param y unsigned 256-bit integer number\n * @return unsigned 64.64-bit fixed point number\n */\n function divuu (uint256 x, uint256 y) private pure returns (uint128) {\n unchecked {\n require (y != 0);\n\n uint256 result;\n\n if (x <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)\n result = (x << 64) / y;\n else {\n uint256 msb = 192;\n uint256 xc = x >> 192;\n if (xc >= 0x100000000) { xc >>= 32; msb += 32; }\n if (xc >= 0x10000) { xc >>= 16; msb += 16; }\n if (xc >= 0x100) { xc >>= 8; msb += 8; }\n if (xc >= 0x10) { xc >>= 4; msb += 4; }\n if (xc >= 0x4) { xc >>= 2; msb += 2; }\n if (xc >= 0x2) msb += 1; // No need to shift xc anymore\n\n result = (x << 255 - msb) / ((y - 1 >> msb - 191) + 1);\n require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\n\n uint256 hi = result * (y >> 128);\n uint256 lo = result * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\n\n uint256 xh = x >> 192;\n uint256 xl = x << 64;\n\n if (xl < lo) xh -= 1;\n xl -= lo; // We rely on overflow behavior here\n lo = hi << 128;\n if (xl < lo) xh -= 1;\n xl -= lo; // We rely on overflow behavior here\n\n result += xh == hi >> 128 ? xl / y : 1;\n }\n\n require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\n return uint128 (result);\n }\n }\n\n /**\n * Calculate sqrt (x) rounding down, where x is unsigned 256-bit integer\n * number.\n *\n * @param x unsigned 256-bit integer number\n * @return unsigned 128-bit integer number\n */\n function sqrtu (uint256 x) private pure returns (uint128) {\n unchecked {\n if (x == 0) return 0;\n else {\n uint256 xx = x;\n uint256 r = 1;\n if (xx >= 0x100000000000000000000000000000000) { xx >>= 128; r <<= 64; }\n if (xx >= 0x10000000000000000) { xx >>= 64; r <<= 32; }\n if (xx >= 0x100000000) { xx >>= 32; r <<= 16; }\n if (xx >= 0x10000) { xx >>= 16; r <<= 8; }\n if (xx >= 0x100) { xx >>= 8; r <<= 4; }\n if (xx >= 0x10) { xx >>= 4; r <<= 2; }\n if (xx >= 0x4) { r <<= 1; }\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1; // Seven iterations should be enough\n uint256 r1 = x / r;\n return uint128 (r < r1 ? r : r1);\n }\n }\n }\n}\n" + }, + "contracts/AuthorizedAccounts.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nimport \"./interfaces/IAuthorizedAccounts.sol\";\n\n/**\n * @notice Manages authorized accounts with limited permissions on behalf of main account\n * these authorized accounts are allowed to perform some certain actions in the Sylo network\n * in order to reduce the works for main account\n */\ncontract AuthorizedAccounts is\n IAuthorizedAccounts,\n Initializable,\n Ownable2StepUpgradeable,\n ERC165\n{\n /**\n * @notice Tracks authorized accounts for every main account\n */\n mapping(address => AuthorizedAccount[]) public authorizedAccounts;\n\n event PermissionsAdded(\n address indexed main,\n address indexed authorized,\n Permission[] permissions\n );\n\n event PermissionsRemoved(\n address indexed main,\n address indexed authorized,\n Permission[] permissions\n );\n\n error AuthorizedAccountCannotBeZeroAddress();\n error MainAccountCannotBeZeroAddress();\n error AtBlockNumberCannotBeZero();\n error AccountAlreadyAuthorized();\n error AccountDoesNotExist();\n\n function initialize() external initializer {\n Ownable2StepUpgradeable.__Ownable2Step_init();\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAuthorizedAccounts).interfaceId;\n }\n\n /**\n * @notice Adds new authorized accounts with certain permissions.\n * This will revert if the account has already existed.\n * @param authorized The address that the main account wants to authorize\n * @param permissions The list of permissions that the authorized account\n * can perform within the Sylo network.\n */\n function authorizeAccount(address authorized, Permission[] calldata permissions) external {\n if (authorized == address(0)) {\n revert AuthorizedAccountCannotBeZeroAddress();\n }\n\n // check if account has already been authorized\n AuthorizedAccount[] storage authAccounts = authorizedAccounts[msg.sender];\n for (uint i; i < authAccounts.length; ++i) {\n if (authAccounts[i].account == authorized) {\n if (authAccounts[i].authorizedAt != 0) {\n revert AccountAlreadyAuthorized();\n }\n\n authAccounts[i].authorizedAt = block.number;\n return _addPermissions(authorized, authAccounts[i], permissions);\n }\n }\n\n // add new authorized account to the list\n authAccounts.push();\n AuthorizedAccount storage newAccount = authAccounts[authAccounts.length - 1];\n newAccount.account = authorized;\n newAccount.authorizedAt = block.number;\n\n _addPermissions(authorized, newAccount, permissions);\n }\n\n /**\n * @notice Removes all permissions of a specific authorized account\n * associated with the msg.sender, and sets the account's authorizedAt to 0.\n * Note: It does not remove the authorized account from the list.\n * This will revert if the account does not exist.\n * @param authorized The address of the authorized account\n */\n function unauthorizeAccount(address authorized) external {\n if (authorized == address(0)) {\n revert AuthorizedAccountCannotBeZeroAddress();\n }\n\n AuthorizedAccount[] storage authAccounts = authorizedAccounts[msg.sender];\n for (uint i; i < authAccounts.length; ++i) {\n if (authAccounts[i].account == authorized) {\n delete authAccounts[i].authorizedAt;\n return _removePermissions(authorized, authAccounts[i], getAllPermissions());\n }\n }\n\n revert AccountDoesNotExist();\n }\n\n /**\n * @notice Adds new permissions to a specific authorized account.\n * - Adding permissions that don't exist in the Permission enum will return\n * with panic code 0x21 (convert a value that is too big or negative into an enum type).\n * - Adding duplicate permissions will update the permissions' authorizedAt value.\n * - Adding permissions that were previously unauthorized will update\n * the authorizedAt and unauthorizedAt values (refer to the comment in\n * IAuthorizedAccount -> AuthorizedPermission struct).\n * This will revert if the account does not exist.\n * @param authorized The authorized account address\n * @param permissions The new permissions will be added to the authorized account\n */\n function addPermissions(address authorized, Permission[] calldata permissions) external {\n if (authorized == address(0)) {\n revert AuthorizedAccountCannotBeZeroAddress();\n }\n\n AuthorizedAccount[] storage authAccounts = authorizedAccounts[msg.sender];\n for (uint i; i < authAccounts.length; ++i) {\n if (authAccounts[i].account == authorized) {\n return _addPermissions(authorized, authAccounts[i], permissions);\n }\n }\n\n revert AccountDoesNotExist();\n }\n\n function _addPermissions(\n address authorized,\n AuthorizedAccount storage authAccount,\n Permission[] memory permissions\n ) private {\n for (uint i; i < permissions.length; ++i) {\n bool exists;\n for (uint j; j < authAccount.permissions.length; ++j) {\n AuthorizedPermission storage authPermission = authAccount.permissions[j];\n if (permissions[i] == authPermission.permission) {\n exists = true;\n authPermission.authorizedAt = block.number;\n\n // make sure unauthorizedAt is not greater than authorizedAt\n // (refer to the comment in IAuthorizedAccount -> AuthorizedPermission struct)\n if (authPermission.unauthorizedAt > authPermission.authorizedAt) {\n authPermission.unauthorizedAt = authPermission.authorizedAt;\n }\n break;\n }\n }\n if (!exists) {\n authAccount.permissions.push(\n AuthorizedPermission({\n permission: permissions[i],\n authorizedAt: block.number,\n unauthorizedAt: 0\n })\n );\n }\n }\n\n emit PermissionsAdded(msg.sender, authorized, permissions);\n }\n\n /**\n * @notice Removes permissions of specific authorized account.\n * - Removing permissions that don't exist in the Permission enum will return\n * with panic code 0x21 (convert a value that is too big or negative into an enum type).\n * - Removing duplicate/authorized permissions will update the permissions'\n * unauthorizedAt value.\n * This will revert if the account does not exist.\n * @param authorized The address of authorized account\n * @param permissions The list of permissions will be removed\n */\n function removePermissions(address authorized, Permission[] calldata permissions) external {\n if (authorized == address(0)) {\n revert AuthorizedAccountCannotBeZeroAddress();\n }\n\n AuthorizedAccount[] storage authAccounts = authorizedAccounts[msg.sender];\n for (uint i; i < authAccounts.length; ++i) {\n if (authAccounts[i].account == authorized) {\n return _removePermissions(authorized, authAccounts[i], permissions);\n }\n }\n\n revert AccountDoesNotExist();\n }\n\n function _removePermissions(\n address authorized,\n AuthorizedAccount storage authAccount,\n Permission[] memory permissions\n ) private {\n for (uint i; i < permissions.length; ++i) {\n for (uint j; j < authAccount.permissions.length; ++j) {\n if (permissions[i] == authAccount.permissions[j].permission) {\n // only update unauthorizedAt if the permission is authorized\n if (\n authAccount.permissions[j].authorizedAt >=\n authAccount.permissions[j].unauthorizedAt\n ) {\n authAccount.permissions[j].unauthorizedAt = block.number + 1;\n }\n break;\n }\n }\n }\n\n emit PermissionsRemoved(msg.sender, authorized, permissions);\n }\n\n /**\n * @notice Validates permission of an authorized account associated with the main account.\n *\n * @param main The address of main account\n * @param authorized The address of authorized account\n * @param permission The permission needs to be verified with the authorized account\n * @param atBlock The block number to check if the permission is valid between\n * the permission's authorizedAt and unauthorizedAt period. It is added later to prevent\n * the timing attack. E.g. If the main account authorizes the PersonalSign permission at\n * block 1, creates a ticket at block 2, then unauthorizes the permission at block 3, the\n * ticket will be invalid and cannot be redeemed. To avoid this, the `atBlock` param is\n * needed to check if the permission is authorized between its authorizedAt and unauthorizedAt\n * duration.\n *\n * @return boolean value\n */\n function validatePermission(\n address main,\n address authorized,\n Permission permission,\n uint256 atBlock\n ) external view returns (bool) {\n if (main == address(0)) {\n revert MainAccountCannotBeZeroAddress();\n }\n\n if (authorized == address(0)) {\n revert AuthorizedAccountCannotBeZeroAddress();\n }\n\n if (atBlock == 0) {\n revert AtBlockNumberCannotBeZero();\n }\n\n AuthorizedAccount[] storage authAccounts = authorizedAccounts[main];\n\n for (uint i = 0; i < authAccounts.length; ++i) {\n if (authAccounts[i].account == authorized) {\n for (uint j = 0; j < authAccounts[i].permissions.length; ++j) {\n if (authAccounts[i].permissions[j].permission == permission) {\n uint256 authorizedAt = authAccounts[i].permissions[j].authorizedAt;\n uint256 unauthorizedAt = authAccounts[i].permissions[j].unauthorizedAt;\n\n bool isPermissionUnauthorized = authorizedAt > 0 &&\n authorizedAt < unauthorizedAt;\n if (isPermissionUnauthorized) {\n // the permission was previously valid, so we check that\n // the `atBlock` is referencing a time when the permission was valid\n return authorizedAt <= atBlock && atBlock < unauthorizedAt;\n }\n\n // otherwise just check if the permission was authorized before the\n // atBlock\n return authorizedAt > 0 && authorizedAt <= atBlock;\n }\n }\n }\n }\n\n return false;\n }\n\n /**\n * @notice Get all authorized accounts associated with a given account\n * @param main The address of main account\n * @return An array of authorized accounts\n */\n function getAuthorizedAccounts(\n address main\n ) external view returns (AuthorizedAccount[] memory) {\n if (main == address(0)) {\n revert MainAccountCannotBeZeroAddress();\n }\n\n return authorizedAccounts[main];\n }\n\n function getAllPermissions() internal pure returns (Permission[] memory) {\n Permission[] memory permissions = new Permission[](1);\n permissions[0] = Permission.PersonalSign;\n return permissions;\n }\n}\n" + }, + "contracts/epochs/EpochsManager.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\n\nimport \"../Registries.sol\";\nimport \"../staking/Directory.sol\";\nimport \"../interfaces/epochs/IEpochsManager.sol\";\nimport \"../payments/ticketing/TicketingParameters.sol\";\n\ncontract EpochsManager is IEpochsManager, Initializable, Ownable2StepUpgradeable, ERC165 {\n Directory public _directory;\n\n Registries public _registries;\n\n IERC721 public _rootSeekers;\n\n TicketingParameters public _ticketingParameters;\n\n /**\n * @notice Track seekers that have joined for a specific epoch.\n */\n mapping(uint256 => mapping(uint256 => address)) public activeSeekers;\n\n // Define all Epoch specific parameters here.\n // When initializing an epoch, these parameters are read,\n // along with parameters from the other contracts to create the\n // new epoch.\n\n /**\n * @notice A mapping of all epochs that have been initialized.\n */\n mapping(uint256 => Epoch) public epochs;\n\n /**\n * @notice The block number since the first epoch can be initialized.\n */\n uint256 public initialEpoch;\n\n /**\n * @notice The duration in blocks an epoch will last for.\n */\n uint256 public epochDuration;\n\n /**\n * @notice The value of the integer used as the current\n * epoch's identifier. This value is incremented as each epoch\n * is initialized.\n */\n uint256 public currentIteration;\n\n event NewEpoch(uint256 indexed epochId);\n event EpochJoined(uint256 indexed epochId, address indexed node, uint256 indexed seekerId);\n event InitialEpochUpdated(uint256 initialEpoch);\n event EpochDurationUpdated(uint256 epochDuration);\n\n error SeekerOwnerMismatch();\n error InitialEpochCannotBeZero();\n error EpochDurationCannotBeZero();\n error DirectoryCannotBeZeroAddress();\n error RegistriesCannotBeZeroAddress();\n error RootSeekerCannotBeZeroAddress();\n error EpochHasNotEnded(uint256 epochId);\n error SeekerAccountCannotBeZeroAddress();\n error TicketingParametersCannotBeZeroAddress();\n error SeekerAlreadyJoinedEpoch(uint256 epochId, uint256 seekerId);\n error InitialEpochNotYetReady(uint256 expectedBlock, uint256 currentBlock);\n\n function initialize(\n IERC721 rootSeekers,\n Directory directory,\n Registries registries,\n TicketingParameters ticketingParameters,\n uint256 _initialEpoch,\n uint256 _epochDuration\n ) external initializer {\n if (address(rootSeekers) == address(0)) {\n revert RootSeekerCannotBeZeroAddress();\n }\n\n SyloUtils.validateContractInterface(\n \"Directory\",\n address(directory),\n type(IDirectory).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"Registries\",\n address(registries),\n type(IRegistries).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"TicketingParameters\",\n address(ticketingParameters),\n type(ITicketingParameters).interfaceId\n );\n\n Ownable2StepUpgradeable.__Ownable2Step_init();\n\n _rootSeekers = rootSeekers;\n _directory = directory;\n _registries = registries;\n _ticketingParameters = ticketingParameters;\n\n initialEpoch = _initialEpoch;\n epochDuration = _epochDuration;\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IEpochsManager).interfaceId;\n }\n\n /**\n * @notice Call this to initialize the next epoch. On success, a `NewEpoch` event\n * will be emitted.\n * @dev The function will read the current set of network parameters, and store\n * the parameters in a new Epoch struct. The end block of the current epoch\n * will also be set to a non-zero value.\n */\n function initializeEpoch() external returns (uint256) {\n if (currentIteration == 0 && initialEpoch > block.number) {\n revert InitialEpochNotYetReady(initialEpoch, block.number);\n }\n\n Epoch storage current = epochs[currentIteration];\n\n uint256 end = current.startBlock + current.duration;\n if (end > block.number) {\n revert EpochHasNotEnded(currentIteration);\n }\n\n (\n uint256 faceValue,\n uint128 baseLiveWinProb,\n uint128 expiredWinProb,\n uint256 ticketDuration,\n uint16 decayRate\n ) = _ticketingParameters.getTicketingParameters();\n\n uint256 nextEpochId = getNextEpochId();\n\n epochs[nextEpochId] = Epoch(\n block.number,\n epochDuration,\n 0,\n _registries.defaultPayoutPercentage(),\n decayRate,\n faceValue,\n baseLiveWinProb,\n expiredWinProb,\n ticketDuration\n );\n\n current.endBlock = block.number;\n\n currentIteration = nextEpochId;\n\n _directory.setCurrentDirectory(nextEpochId);\n\n emit NewEpoch(nextEpochId);\n\n return nextEpochId;\n }\n\n /**\n * @notice Set the first epoch starting block. Only callable by the owner.\n * @param _initialEpoch The block number when the first epoch can be initialized.\n */\n function setInitialEpoch(uint256 _initialEpoch) external onlyOwner {\n if (_initialEpoch == 0) {\n revert InitialEpochCannotBeZero();\n }\n initialEpoch = _initialEpoch;\n emit InitialEpochUpdated(_initialEpoch);\n }\n\n /**\n * @notice Set the epoch duration. Will take effect in the next epoch. Only\n * callable by the owner.\n * @param _epochDuration The epoch duration in number of blocks.\n */\n function setEpochDuration(uint256 _epochDuration) external onlyOwner {\n if (_epochDuration == 0) {\n revert EpochDurationCannotBeZero();\n }\n epochDuration = _epochDuration;\n emit EpochDurationUpdated(epochDuration);\n }\n\n /**\n * @notice Retrieve the parameters for the current epoch.\n * @return The current Epoch parameters.\n */\n function getCurrentActiveEpoch() external view returns (uint256, Epoch memory) {\n return (currentIteration, epochs[currentIteration]);\n }\n\n /**\n * @notice Nodes should call this to join the next epoch. It will\n * initialize the next reward pool and set the stake for the next directory.\n * @dev This is a proxy function for `initalizeNextRewardPool` and\n * `joinNextDirectory`.\n */\n function joinNextEpoch() external {\n Registries.Registry memory registry = _registries.getRegistry(msg.sender);\n\n // validate the node's seeker ownership\n if (registry.seekerAccount == address(0)) {\n revert SeekerAccountCannotBeZeroAddress();\n }\n\n uint256 seekerId = registry.seekerId;\n\n address owner = _rootSeekers.ownerOf(seekerId);\n if (registry.seekerAccount != owner) {\n revert SeekerOwnerMismatch();\n }\n\n uint256 nextEpoch = getNextEpochId();\n if (activeSeekers[nextEpoch][seekerId] != address(0)) {\n revert SeekerAlreadyJoinedEpoch(nextEpoch, seekerId);\n }\n\n activeSeekers[nextEpoch][seekerId] = msg.sender;\n\n _directory._rewardsManager().initializeNextRewardPool(msg.sender);\n _directory.joinNextDirectory(msg.sender);\n\n emit EpochJoined(nextEpoch, msg.sender, seekerId);\n }\n\n /**\n * @notice Retrieve the epoch parameter for the given id.\n * @param epochId The id of the epoch to retrieve.\n * @return The epoch parameters associated with the id.\n */\n function getEpoch(uint256 epochId) external view returns (Epoch memory) {\n return epochs[epochId];\n }\n\n /**\n * @notice Retrieve the integer value that will be used for the\n * next epoch id.\n * @return The next epoch id identifier.\n */\n function getNextEpochId() public view returns (uint256) {\n return currentIteration + 1;\n }\n}\n" + }, + "contracts/interfaces/epochs/IEpochsManager.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface IEpochsManager {\n /**\n * @dev This struct will hold all network parameters that will be static\n * for the entire epoch. This value will be stored in a mapping, where the\n * key is the current epoch id.\n */\n struct Epoch {\n // time related variables\n uint256 startBlock; // Block the epoch was initialized\n uint256 duration; // Minimum time epoch will be alive measured in number of blocks\n uint256 endBlock; // Block the epoch ended (and when the next epoch was initialized)\n // Zero here represents the epoch has not yet ended.\n\n // registry variables\n uint16 defaultPayoutPercentage;\n // ticketing variables\n uint16 decayRate;\n uint256 faceValue;\n uint128 baseLiveWinProb;\n uint128 expiredWinProb;\n uint256 ticketDuration;\n }\n\n function initializeEpoch() external returns (uint256);\n\n function setEpochDuration(uint256 _epochDuration) external;\n\n function getCurrentActiveEpoch() external view returns (uint256, Epoch memory);\n\n function joinNextEpoch() external;\n\n function getEpoch(uint256 epochId) external view returns (Epoch memory);\n\n function getNextEpochId() external view returns (uint256);\n}\n" + }, + "contracts/interfaces/IAuthorizedAccounts.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface IAuthorizedAccounts {\n enum Permission {\n // PersonalSign permission allows the authorized account to\n // sign on behalf of the sending account.\n PersonalSign\n }\n\n /**\n * @dev This type will hold the permission type and the block number from\n * which the permission was set to be authorized and unauthorized.\n * The permission is authorized when authorizedAt >= unauthorizedAt.\n *\n * Note: authorizedAt and unauthorizedAt won't be set to 0 when the permission\n * is updated, because they are both needed when validating the permission.\n */\n struct AuthorizedPermission {\n // Permission type\n Permission permission;\n // Block number from which the permission was set to be authorized.\n // If the transaction is called in block 1, the permission is\n // authorized from block 1 (authorizedAt = block.number).\n uint256 authorizedAt;\n // Block number from which the permission was set to be unauthorized.\n // If the transaction is called in block 1, the permission is\n // unauthorized from block 2 (unauthorizedAt = block.number + 1)\n // unauthorizedAt is set that way to avoid the case where the\n // permission is authorized and unauthorized in the same block:\n // E.g. addPermission is called => authorizedAt = 1\n // removePermission is called => unauthorizedAt = 1\n // => We cannot tell if the permission is authorized or not.\n // E.g. addPermission is called => authorizedAt = 1\n // removePermission is called => unauthorizedAt = 2\n // addPermission is called => authorizedAt = 1 AND update unauthorizedAt = authorizedAt = 1\n // => The permission is authorized when authorizedAt >= unauthorizedAt\n uint256 unauthorizedAt;\n }\n\n struct AuthorizedAccount {\n // The authorized account\n address account;\n // Block number at which the account was authorized.\n // If the transaction is called in block 1, the account is\n // authorized at block 1 (authorizedAt = block.number).\n // If the account is unauthorized, authorizedAt will be set to 0.\n uint256 authorizedAt;\n // Permission list\n AuthorizedPermission[] permissions;\n }\n\n function authorizeAccount(address authorized, Permission[] calldata permissions) external;\n\n function unauthorizeAccount(address authorized) external;\n\n function addPermissions(address authorized, Permission[] calldata permissions) external;\n\n function removePermissions(\n address authorized,\n Permission[] calldata permissionsToRemove\n ) external;\n\n function validatePermission(\n address main,\n address authorized,\n Permission permission,\n uint256 atBlock\n ) external returns (bool);\n\n function getAuthorizedAccounts(\n address main\n ) external view returns (AuthorizedAccount[] memory);\n}\n" + }, + "contracts/interfaces/IFuturePassRegistrar.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface IFuturePassRegistrar {\n function futurepassOf(address owner) external view returns (address);\n\n function create(address owner) external returns (address);\n}\n" + }, + "contracts/interfaces/IRegistries.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface IRegistries {\n struct Registry {\n // Percentage of a tickets value that will be rewarded to\n // delegated stakers expressed as a fraction of 10000.\n // This value is currently locked to the default payout percentage\n // until epochs are implemented.\n uint16 payoutPercentage;\n // Public http/s endpoint to retrieve additional metadata\n // about the node.\n // The current metadata schema is as follows:\n // { name: string, multiaddrs: string[] }\n string publicEndpoint;\n // The account which owns a seeker that will be used to\n // operate the Node for this registry.\n address seekerAccount;\n // The id of the seeker used to operate the node. The owner\n // of this id should be the seeker account.\n uint256 seekerId;\n }\n\n function register(string calldata publicEndpoint) external;\n\n function setDefaultPayoutPercentage(uint16 _defaultPayoutPercentage) external;\n\n function setSeekerAccount(\n address seekerAccount,\n uint256 seekerId,\n bytes32 nonce,\n bytes calldata signature\n ) external;\n\n function revokeSeekerAccount(address node) external;\n\n function getRegistry(address account) external view returns (Registry memory);\n\n function getNodes() external view returns (address[] memory);\n\n function getRegistries(\n uint256 start,\n uint256 end\n ) external view returns (address[] memory, Registry[] memory);\n\n function getTotalNodes() external view returns (uint256);\n}\n" + }, + "contracts/interfaces/ISeekerPowerOracle.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface ISeekerPowerOracle {\n function setOracle(address oracle) external;\n\n function registerSeekerPowerRestricted(uint256 seekerId, uint256 power) external;\n\n function registerSeekerPower(\n uint256 seekerId,\n uint256 power,\n bytes32 nonce,\n bytes calldata proof\n ) external;\n\n function getSeekerPower(uint256 seekerId) external view returns (uint256);\n\n function getProofMessage(\n uint256 seekerId,\n uint256 power,\n bytes32 nonce\n ) external pure returns (bytes memory);\n}\n" + }, + "contracts/interfaces/payments/ISyloTicketing.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface ISyloTicketing {\n struct Deposit {\n uint256 escrow; // Balance of users escrow\n uint256 penalty; // Balance of users penalty\n uint256 unlockAt; // Block number a user can withdraw their balances\n }\n\n struct User {\n address main; // Main address of the ticket sender or receiver\n address delegated; // Delegated address used to sign and redeem tickets\n }\n\n struct Ticket {\n uint256 epochId; // The epoch this ticket is associated with\n User sender; // Ticket sender's main and delegated addresses\n User receiver; // Ticket receiver's main and delegated addresses\n address redeemer; // Address of the intended recipient\n uint256 generationBlock; // Block number the ticket was generated\n bytes32 redeemerCommit; // Hash of the secret random number of the redeemer\n }\n\n // A type of ticket that does not explicit state the receiver address.\n struct MultiReceiverTicket {\n uint256 epochId; // The epoch this ticket is associated with\n User sender; // Ticket sender's main and delegated addresses\n address redeemer; // Address of the intended recipient\n uint256 generationBlock; // Block number the ticket was generated\n bytes32 redeemerCommit; // Hash of the secret random number of the redeemer\n }\n\n function setUnlockDuration(uint256 _unlockDuration) external;\n\n function depositEscrow(uint256 amount, address account) external;\n\n function depositPenalty(uint256 amount, address account) external;\n\n function unlockDeposits() external returns (uint256);\n\n function lockDeposits() external;\n\n function withdraw() external;\n\n function redeem(\n Ticket calldata ticket,\n uint256 redeemerRand,\n bytes calldata senderSig,\n bytes calldata receiverSig\n ) external;\n\n function redeemMultiReceiver(\n MultiReceiverTicket calldata ticket,\n uint256 redeemerRand,\n User calldata receiver,\n bytes calldata senderSig,\n bytes calldata receiverSig\n ) external;\n}\n" + }, + "contracts/interfaces/payments/ticketing/IRewardsManager.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface IRewardsManager {\n /**\n * @dev This type will hold the necessary information for delegated stakers\n * to make reward claims against their Node. Every Node will initialize\n * and store a new Reward Pool for each epoch they participate in.\n */\n struct RewardPool {\n // Tracks the balance of the reward pool owed to the stakers\n uint256 stakersRewardTotal;\n // Tracks the block number this reward pool was initialized\n uint256 initializedAt;\n // The total active stake for the node for will be the sum of the\n // stakes owned by its delegators and the node's own stake.\n uint256 totalActiveStake;\n // track the cumulative reward factor as of the time the first ticket\n // for this pool was redeemed\n int128 initialCumulativeRewardFactor;\n }\n\n struct LastClaim {\n // The epoch the claim was made.\n uint256 claimedAt;\n // The stake at the time the claim was made. This is tracked as\n // rewards can only be claimed after an epoch has ended, but the\n // user's stake may have changed by then. This field tracks the\n // staking value before the change so the reward for that epoch\n // can be manually calculated.\n uint256 stake;\n }\n\n function getRewardPool(\n uint256 epochId,\n address stakee\n ) external view returns (RewardPool memory);\n\n function getRewardPoolKey(uint256 epochId, address stakee) external pure returns (bytes32);\n\n function getRewardPoolStakersTotal(\n uint256 epochId,\n address stakee\n ) external view returns (uint256);\n\n function getRewardPoolActiveStake(\n uint256 epochId,\n address stakee\n ) external view returns (uint256);\n\n function getPendingRewards(address stakee) external view returns (uint256);\n\n function getLastClaim(address stakee, address staker) external view returns (LastClaim memory);\n\n function getTotalEpochRewards(uint256 epochId) external view returns (uint256);\n\n function getTotalEpochStakingRewards(uint256 epochId) external view returns (uint256);\n\n function initializeNextRewardPool(address stakee) external;\n\n function incrementRewardPool(address stakee, uint256 amount) external;\n\n function claimStakingRewards(address stakee) external returns (uint256);\n\n function updatePendingRewards(address stakee, address staker) external;\n}\n" + }, + "contracts/interfaces/payments/ticketing/ITicketingParameters.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface ITicketingParameters {\n function setFaceValue(uint256 _faceValue) external;\n\n function setBaseLiveWinProb(uint128 _baseLiveWinProb) external;\n\n function setExpiredWinProb(uint128 _expiredWinProb) external;\n\n function setDecayRate(uint16 _decayRate) external;\n\n function setTicketDuration(uint256 _ticketDuration) external;\n\n function getTicketingParameters()\n external\n view\n returns (uint256, uint128, uint128, uint256, uint16);\n}\n" + }, + "contracts/interfaces/staking/IDirectory.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface IDirectory {\n /**\n * @dev A DirectoryEntry will be stored for every node that joins the\n * network in a specific epoch. The entry will contain the stakee's\n * address, and a boundary value which is a sum of the current directory's\n * total stake, and the current stakee's total stake.\n */\n struct DirectoryEntry {\n address stakee;\n uint256 boundary;\n }\n\n /**\n * @dev An EpochDirectory will be stored for every epoch. The\n * directory will be constructed piece by piece as Nodes join,\n * each adding their own directory entry based on their current\n * stake value.\n */\n struct EpochDirectory {\n DirectoryEntry[] entries;\n mapping(address => uint256) stakes;\n uint256 totalStake;\n }\n\n function setCurrentDirectory(uint256 epochId) external;\n\n function joinNextDirectory(address stakee) external;\n\n function scan(uint128 point) external view returns (address stakee);\n\n function scanWithEpochId(\n uint128 point,\n uint256 epochId\n ) external view returns (address stakee);\n\n function getTotalStakeForStakee(\n uint256 epochId,\n address stakee\n ) external view returns (uint256);\n\n function getTotalStake(uint256 epochId) external view returns (uint256);\n\n function getEntries(\n uint256 epochId\n ) external view returns (address[] memory, uint256[] memory);\n}\n" + }, + "contracts/interfaces/staking/IStakingManager.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface IStakingManager {\n /**\n * For every Node, there will be a mapping of the staker to a\n * StakeEntry. The stake entry tracks the amount of stake in SOLO,\n * and also when the stake was updated.\n */\n struct StakeEntry {\n uint256 amount;\n // Block number this entry was updated at\n uint256 updatedAt;\n // Epoch this entry was updated. The stake will become active\n // in the following epoch\n uint256 epochId;\n }\n\n /**\n * Every Node must have stake in order to participate in the Epoch.\n * Stake can be provided by the Node itself or by other accounts in\n * the network.\n */\n struct Stake {\n // Track each stake entry associated to a node\n mapping(address => StakeEntry) stakeEntries;\n // The total stake held by this contract for a node,\n // which will be the sum of all addStake and unlockStake calls\n uint256 totalManagedStake;\n }\n\n /**\n * This struct will track stake that is in the process of unlocking.\n */\n struct Unlock {\n uint256 amount; // Amount of stake unlocking\n uint256 unlockAt; // Block number the stake becomes withdrawable\n }\n\n function setUnlockDuration(uint256 _unlockDuration) external;\n\n function setMinimumStakeProportion(uint16 _minimumStakeProportion) external;\n\n function addStake(uint256 amount, address stakee) external;\n\n function unlockStake(uint256 amount, address stakee) external returns (uint256);\n\n function withdrawStake(address stakee) external;\n\n function cancelUnlocking(uint256 amount, address stakee) external;\n\n function calculateMaxAdditionalDelegatedStake(address stakee) external view returns (uint256);\n\n function getTotalManagedStake() external view returns (uint256);\n\n function getStakeEntry(\n address stakee,\n address staker\n ) external view returns (StakeEntry memory);\n\n function getStakeeTotalManagedStake(address stakee) external view returns (uint256);\n}\n" + }, + "contracts/libraries/Manageable.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an list of public managers who may be added or removed.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyManager`, which can be applied to your functions to restrict their use to\n * other contracts which have explicitly been added.\n */\nabstract contract Manageable is Ownable2StepUpgradeable {\n /**\n * @dev Tracks the managers added to this contract, where they key is the\n * address of the managing contract, and the value is the block the manager was added in.\n * We use this mapping to restrict access to those functions in a similar\n * fashion to the onlyOwner construct.\n */\n mapping(address => uint256) public managers;\n\n error OnlyManagers();\n error ManagerCannotBeZeroAddress();\n\n /**\n * @notice Adds a manager to this contract. Only callable by the owner.\n * @param manager The address of the manager contract.\n */\n function addManager(address manager) external onlyOwner {\n if (manager == address(0)) {\n revert ManagerCannotBeZeroAddress();\n }\n managers[manager] = block.number;\n }\n\n /**\n * @notice Removes a manager from this contract. Only callable by the owner.\n * @param manager The address of the manager contract.\n */\n function removeManager(address manager) external onlyOwner {\n delete managers[manager];\n }\n\n /**\n * @dev This modifier allows us to specify that certain contracts have\n * special privileges to call restricted functions.\n */\n modifier onlyManager() {\n if (managers[msg.sender] == 0) {\n revert OnlyManagers();\n }\n _;\n }\n\n // Reserve storage slots for future variables\n uint256[49] private __gap;\n}\n" + }, + "contracts/libraries/SyloUtils.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nerror ContractNameCannotBeEmpty();\nerror InterfaceIdCannotBeZeroBytes();\nerror TargetContractCannotBeZeroAddress(string name);\nerror TargetNotSupportInterface(string name, bytes4 interfaceId);\n\nlibrary SyloUtils {\n /**\n * @dev Percentages are expressed as a ratio where 10000 is the denominator.\n * A large denominator allows for more precision, e.g representing 12.5%\n * can be done as 1250 / 10000\n */\n uint16 public constant PERCENTAGE_DENOMINATOR = 10000;\n\n /**\n * @dev Multiply a value by a given percentage. Converts the provided\n * uint128 value to uint256 to avoid any reverts on overflow.\n * @param value The value to multiply.\n * @param percentage The percentage, as a ratio of 10000.\n */\n function percOf(uint128 value, uint16 percentage) internal pure returns (uint256) {\n return (uint256(value) * percentage) / PERCENTAGE_DENOMINATOR;\n }\n\n /**\n * @dev Return a fraction as a percentage.\n * @param numerator The numerator limited to a uint128 value to prevent\n * phantom overflow.\n * @param denominator The denominator.\n * @return The percentage, as a ratio of 10000.\n */\n function asPerc(uint128 numerator, uint256 denominator) internal pure returns (uint16) {\n return SafeCast.toUint16((uint256(numerator) * PERCENTAGE_DENOMINATOR) / denominator);\n }\n\n /**\n * @dev Validate that a contract implements a given interface.\n * @param name The name of the contract, used in error messages.\n * @param target The address of the contract.\n * @param interfaceId The interface ID to check.\n */\n function validateContractInterface(\n string memory name,\n address target,\n bytes4 interfaceId\n ) internal view {\n if (bytes(name).length == 0) {\n revert ContractNameCannotBeEmpty();\n }\n if (target == address(0)) {\n revert TargetContractCannotBeZeroAddress(name);\n }\n if (interfaceId == bytes4(0)) {\n revert InterfaceIdCannotBeZeroBytes();\n }\n if (!ERC165(target).supportsInterface(interfaceId)) {\n revert TargetNotSupportInterface(name, interfaceId);\n }\n }\n}\n" + }, + "contracts/mocks/TestFuturepassRegistrar.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ncontract TestFuturepassRegistrar {\n mapping(address => address) registrations;\n\n function futurepassOf(address owner) external view returns (address) {\n return registrations[owner];\n }\n\n function create(address owner) external returns (address) {\n // ticketing contract does not actually care about futurepass\n // address value, just needs to be non-zero\n registrations[owner] = owner;\n return owner;\n }\n}\n" + }, + "contracts/mocks/TestSeekers.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\n\n// Basic ERC721 contract with an unrestricted mint function.\n// Useful for mimicking the Seekers ERC721 contract for testing\n// purposes.\ncontract TestSeekers is ERC721 {\n constructor() ERC721(\"Seekers\", \"SEEKERS\") {}\n\n function mint(address to, uint256 tokenId) external {\n _safeMint(to, tokenId);\n }\n\n function exists(uint256 tokenId) external view returns (bool) {\n return _exists(tokenId);\n }\n}\n" + }, + "contracts/mocks/TestSyloUtils.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"../libraries/SyloUtils.sol\";\n\ncontract TestSyloUtils {\n function percOf(uint128 value, uint16 percentage) public pure returns (uint256) {\n return SyloUtils.percOf(value, percentage);\n }\n\n function asPerc(uint128 numerator, uint256 denominator) public pure returns (uint16) {\n return SyloUtils.asPerc(numerator, denominator);\n }\n\n function validateContractInterface(\n string memory name,\n address target,\n bytes4 interfaceId\n ) public view {\n SyloUtils.validateContractInterface(name, target, interfaceId);\n }\n}\n" + }, + "contracts/payments/SyloTicketing.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\n\nimport \"../Registries.sol\";\nimport \"../staking/Directory.sol\";\nimport \"../libraries/SyloUtils.sol\";\nimport \"../epochs/EpochsManager.sol\";\nimport \"../staking/StakingManager.sol\";\nimport \"./ticketing/RewardsManager.sol\";\nimport \"../AuthorizedAccounts.sol\";\nimport \"../interfaces/payments/ISyloTicketing.sol\";\nimport \"../interfaces/IFuturePassRegistrar.sol\";\n\n/**\n * @notice The SyloTicketing contract manages the Probabilistic\n * Micro-Payment Ticketing system that pays Nodes for providing the\n * Event Relay service.\n */\ncontract SyloTicketing is ISyloTicketing, Initializable, Ownable2StepUpgradeable, ERC165 {\n /** ERC20 Sylo token contract.*/\n IERC20 public _token;\n\n /** Sylo Registries contract */\n Registries public _registries;\n\n /** Sylo Staking Manager contract */\n StakingManager public _stakingManager;\n\n /** Sylo Directory contract */\n Directory public _directory;\n\n /** Rewards Manager contract */\n RewardsManager public _rewardsManager;\n\n /**\n * @notice Sylo Epochs Manager.\n * @dev The ticketing parameters used when redeeming tickets\n * will be read from this contract.\n */\n EpochsManager public _epochsManager;\n\n /**\n * @notice Sylo Authorized Accounts.\n */\n AuthorizedAccounts public _authorizedAccounts;\n\n /**\n * @notice Futurepass Registrar Pre-compile.\n */\n IFuturePassRegistrar public _futurepassRegistrar;\n\n /**\n * @notice The number of blocks a user must wait after calling \"unlock\"\n * before they can withdraw their funds.\n */\n uint256 public unlockDuration;\n\n /** @notice Mapping of user deposits */\n mapping(address => Deposit) public deposits;\n\n /** @notice Mapping of ticket hashes, used to check if a ticket has been redeemed */\n mapping(bytes32 => bool) public usedTickets;\n\n event UnlockDurationUpdated(uint256 unlockDuration);\n event SenderPenaltyBurnt(address sender);\n event Redemption(\n uint256 indexed epochId,\n address indexed redeemer,\n address indexed sender,\n address receiver,\n uint256 generationBlock,\n uint256 amount\n );\n event MultiReceiverRedemption(\n uint256 indexed epochId,\n address indexed redeemer,\n address indexed sender,\n address receiver,\n uint256 generationBlock,\n uint256 amount\n );\n\n error NoEsrowAndPenalty();\n error UnlockingInProcess();\n error UnlockingNotInProcess();\n error UnlockingNotCompleted();\n error EscrowAmountCannotBeZero();\n error PenaltyAmountCannotBeZero();\n error UnlockDurationCannotBeZero();\n error AccountCannotBeZeroAddress();\n error InvalidSenderSigningPermission();\n error InvalidReceiverSigningPermission();\n\n error TicketNotWinning();\n error MissingFuturepassAccount(address receiver);\n error TicketAlreadyUsed();\n error TicketEpochNotFound();\n error TicketAlreadyRedeemed();\n error RedeemerCommitMismatch();\n error InvalidSenderSignature();\n error InvalidReceiverSignature();\n error TokenCannotBeZeroAddress();\n error TicketNotCreatedInTheEpoch();\n error TicketCannotBeFromFutureBlock();\n error TicketSenderCannotBeZeroAddress();\n error TicketReceiverCannotBeZeroAddress();\n error TicketRedeemerCannotBeZeroAddress();\n error RedeemerMustHaveJoinedEpoch(uint256 epochId);\n\n function initialize(\n IERC20 token,\n Registries registries,\n StakingManager stakingManager,\n Directory directory,\n EpochsManager epochsManager,\n RewardsManager rewardsManager,\n AuthorizedAccounts authorizedAccounts,\n IFuturePassRegistrar futurepassRegistrar,\n uint256 _unlockDuration\n ) external initializer {\n if (address(token) == address(0)) {\n revert TokenCannotBeZeroAddress();\n }\n\n SyloUtils.validateContractInterface(\n \"Registries\",\n address(registries),\n type(IRegistries).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"StakingManager\",\n address(stakingManager),\n type(IStakingManager).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"Directory\",\n address(directory),\n type(IDirectory).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"EpochsManager\",\n address(epochsManager),\n type(IEpochsManager).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"RewardsManager\",\n address(rewardsManager),\n type(IRewardsManager).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"AuthorizedAccounts\",\n address(authorizedAccounts),\n type(IAuthorizedAccounts).interfaceId\n );\n\n if (_unlockDuration == 0) {\n revert UnlockDurationCannotBeZero();\n }\n\n Ownable2StepUpgradeable.__Ownable2Step_init();\n\n _token = token;\n _registries = registries;\n _stakingManager = stakingManager;\n _directory = directory;\n _epochsManager = epochsManager;\n _rewardsManager = rewardsManager;\n _authorizedAccounts = authorizedAccounts;\n _futurepassRegistrar = futurepassRegistrar;\n\n unlockDuration = _unlockDuration;\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(ISyloTicketing).interfaceId;\n }\n\n /**\n * @notice Set the unlock duration for deposits. Only callable\n * by the owner.\n * @param _unlockDuration The unlock duration in blocks.\n */\n function setUnlockDuration(uint256 _unlockDuration) external onlyOwner {\n if (_unlockDuration == 0) {\n revert UnlockDurationCannotBeZero();\n }\n\n unlockDuration = _unlockDuration;\n emit UnlockDurationUpdated(_unlockDuration);\n }\n\n /**\n * @notice Use this function to deposit funds into the\n * escrow. This will fail if the deposit is currently being\n * unlocked.\n * @param amount The amount in SOLO to add to the escrow.\n * @param account The address of the account holding the escrow.\n */\n function depositEscrow(uint256 amount, address account) external {\n if (amount == 0) {\n revert EscrowAmountCannotBeZero();\n }\n if (account == address(0)) {\n revert AccountCannotBeZeroAddress();\n }\n\n Deposit storage deposit = getDeposit(account);\n if (deposit.unlockAt != 0) {\n revert UnlockingInProcess();\n }\n\n deposit.escrow = deposit.escrow + amount;\n\n SafeERC20.safeTransferFrom(_token, msg.sender, address(this), amount);\n }\n\n /**\n * @notice Use this function to deposit funds into the\n * penalty. This will fail if the deposit is currently being\n * unlocked.\n * @param amount The amount in SOLO to add to the escrow.\n * @param account The address of the account holding the penalty.\n */\n function depositPenalty(uint256 amount, address account) external {\n if (amount == 0) {\n revert PenaltyAmountCannotBeZero();\n }\n if (account == address(0)) {\n revert AccountCannotBeZeroAddress();\n }\n\n Deposit storage deposit = getDeposit(account);\n if (deposit.unlockAt != 0) {\n revert UnlockingInProcess();\n }\n\n deposit.penalty = deposit.penalty + amount;\n\n SafeERC20.safeTransferFrom(_token, msg.sender, address(this), amount);\n }\n\n /**\n * @notice Call this function to begin unlocking deposits. This function\n * will fail if no deposit exists, or if the unlock process has\n * already begun.\n */\n function unlockDeposits() external returns (uint256) {\n Deposit storage deposit = getDeposit(msg.sender);\n\n if (deposit.escrow == 0 && deposit.penalty == 0) {\n revert NoEsrowAndPenalty();\n }\n if (deposit.unlockAt != 0) {\n revert UnlockingInProcess();\n }\n\n deposit.unlockAt = block.number + unlockDuration;\n\n return deposit.unlockAt;\n }\n\n /**\n * @notice Call this function to cancel any deposit that is in the\n * unlocking process.\n */\n function lockDeposits() external {\n Deposit storage deposit = getDeposit(msg.sender);\n if (deposit.unlockAt == 0) {\n revert UnlockingNotInProcess();\n }\n\n delete deposit.unlockAt;\n }\n\n /**\n * @notice Call this function once the unlock duration has\n * elapsed in order to transfer the unlocked tokens to the caller's account.\n */\n function withdraw() external {\n return withdrawTo(msg.sender);\n }\n\n /**\n * @notice Call this function once the unlock duration has\n * elapsed in order to transfer the unlocked tokens to the specified\n * account.\n * @param account The address of the account the tokens should be\n * transferred to.\n */\n function withdrawTo(address account) public {\n Deposit memory deposit = getDeposit(msg.sender);\n if (deposit.unlockAt == 0) {\n revert UnlockingNotInProcess();\n }\n if (deposit.unlockAt >= block.number) {\n revert UnlockingNotCompleted();\n }\n\n uint256 amount = deposit.escrow + deposit.penalty;\n\n // Reset deposit values to 0\n delete deposits[msg.sender];\n\n SafeERC20.safeTransfer(_token, account, amount);\n }\n\n /**\n * @notice Nodes should call this function on completing an event\n * delivery. This function will fail if the ticket is invalid or if the\n * ticket is not a winner. Clients should calculate if the ticket is a\n * winner locally, but can also use the public view functions:\n * `requireValidWinningTicket` and `isWinningTicket` to check that a ticket\n * is winning.\n * @param ticket The ticket issued by the sender.\n * @param redeemerRand The redeemer random value, generated by the Node prior\n * to performing the event relay.\n * @param senderSig The signature of the sender of the ticket.\n * @param receiverSig The signature of the redeemer of the ticket.\n */\n function redeem(\n Ticket calldata ticket,\n uint256 redeemerRand,\n bytes calldata senderSig,\n bytes calldata receiverSig\n ) external {\n EpochsManager.Epoch memory epoch = _epochsManager.getEpoch(ticket.epochId);\n if (ticket.generationBlock > block.number) {\n revert TicketCannotBeFromFutureBlock();\n }\n\n bytes32 ticketHash = requireValidWinningTicket(\n ticket,\n redeemerRand,\n senderSig,\n receiverSig\n );\n\n usedTickets[ticketHash] = true;\n\n uint256 directoryStake = _directory.getTotalStakeForStakee(\n ticket.epochId,\n ticket.redeemer\n );\n if (directoryStake == 0) {\n revert RedeemerMustHaveJoinedEpoch(ticket.epochId);\n }\n\n _redeem(epoch, ticket);\n }\n\n /**\n * @notice Nodes should call this function on completing a one-to-many event\n * delivery. This function will fail if the ticket is invalid or if the\n * ticket is not a winner. Additionally, the specified receiver must have\n * a valid futurepass account associated with it. Clients should calculate\n * if the ticket is a winner locally, but can also use the public view\n * functions:\n * `requireValidWinningMultiReceiverTicket` and `isWinningTicket` to check\n * that a ticket is winning.\n * @param ticket The ticket issued by the sender.\n * @param redeemerRand The redeemer random value, generated by the Node prior\n * to performing the event relay.\n * @param receiver A valid receiver of the the relay.\n * @param senderSig The signature of the sender of the ticket.\n * @param receiverSig The signature of the redeemer of the ticket.\n */\n function redeemMultiReceiver(\n MultiReceiverTicket calldata ticket,\n uint256 redeemerRand,\n User calldata receiver,\n bytes calldata senderSig,\n bytes calldata receiverSig\n ) external {\n EpochsManager.Epoch memory epoch = _epochsManager.getEpoch(ticket.epochId);\n if (ticket.generationBlock > block.number) {\n revert TicketCannotBeFromFutureBlock();\n }\n\n (, bytes32 ticketReceiverHash) = requireValidWinningMultiReceiverTicket(\n ticket,\n receiver,\n redeemerRand,\n senderSig,\n receiverSig\n );\n\n usedTickets[ticketReceiverHash] = true;\n\n uint256 directoryStake = _directory.getTotalStakeForStakee(\n ticket.epochId,\n ticket.redeemer\n );\n if (directoryStake == 0) {\n revert RedeemerMustHaveJoinedEpoch(ticket.epochId);\n }\n\n _redeemMultiReceiver(epoch, ticket, receiver.main);\n }\n\n function _redeem(EpochsManager.Epoch memory epoch, Ticket calldata ticket) internal {\n uint256 rewardAmount = rewardRedeemer(epoch, ticket.sender, ticket.redeemer);\n\n emit Redemption(\n ticket.epochId,\n ticket.redeemer,\n ticket.sender.main,\n ticket.receiver.main,\n ticket.generationBlock,\n rewardAmount\n );\n }\n\n function _redeemMultiReceiver(\n EpochsManager.Epoch memory epoch,\n MultiReceiverTicket calldata ticket,\n address receiver\n ) internal {\n uint256 rewardAmount = rewardRedeemer(epoch, ticket.sender, ticket.redeemer);\n\n emit MultiReceiverRedemption(\n ticket.epochId,\n ticket.redeemer,\n ticket.sender.main,\n receiver,\n ticket.generationBlock,\n rewardAmount\n );\n }\n\n function rewardRedeemer(\n EpochsManager.Epoch memory epoch,\n User calldata sender,\n address redeemer\n ) internal returns (uint256) {\n Deposit storage deposit = getDeposit(sender.main);\n\n uint256 amount;\n\n if (epoch.faceValue > deposit.escrow) {\n amount = deposit.escrow;\n incrementRewardPool(redeemer, deposit, amount);\n SafeERC20.safeTransfer(\n _token,\n address(0x000000000000000000000000000000000000dEaD),\n deposit.penalty\n );\n\n delete deposit.penalty;\n emit SenderPenaltyBurnt(sender.main);\n } else {\n amount = epoch.faceValue;\n incrementRewardPool(redeemer, deposit, amount);\n }\n\n return amount;\n }\n\n /**\n * @notice Call this function to check if a ticket is valid and is\n * a winning ticket. It will fail if the ticket is invalid or is not\n * a winner. A ticket is invalid if:\n * - The sender or redeemer addresses are null\n * - The ticket has already been redeemed.\n * - The secret random value of the sender does not match the commit\n * in the ticket.\n * - The signatures are invalid.\n * @param ticket The ticket issued by the sender.\n * @param redeemerRand The redeemer random value, generated by the Node prior\n * to performing the event relay.\n * @param senderSig The signature of the sender of the ticket.\n * @param receiverSig The signature of the redeemer of the ticket.\n * @return ticketHash The hash of the ticket. Should match the hash generated\n * by `getTicketHash`.\n */\n function requireValidWinningTicket(\n Ticket memory ticket,\n uint256 redeemerRand,\n bytes calldata senderSig,\n bytes calldata receiverSig\n ) public view returns (bytes32 ticketHash) {\n if (ticket.sender.main == address(0)) {\n revert TicketSenderCannotBeZeroAddress();\n }\n if (ticket.receiver.main == address(0)) {\n revert TicketReceiverCannotBeZeroAddress();\n }\n if (ticket.redeemer == address(0)) {\n revert TicketRedeemerCannotBeZeroAddress();\n }\n\n ticketHash = getTicketHash(ticket);\n if (usedTickets[ticketHash]) {\n revert TicketAlreadyRedeemed();\n }\n\n // validate the redeemer has knowledge of the redeemer rand\n if (createCommit(ticket.generationBlock, redeemerRand) != ticket.redeemerCommit) {\n revert RedeemerCommitMismatch();\n }\n\n if (!hasSigningPermission(ticket.sender, ticket.generationBlock)) {\n revert InvalidSenderSigningPermission();\n }\n if (!hasSigningPermission(ticket.receiver, ticket.generationBlock)) {\n revert InvalidReceiverSigningPermission();\n }\n\n if (!isValidTicketSig(ticket.sender, senderSig, ticketHash)) {\n revert InvalidSenderSignature();\n }\n if (!isValidTicketSig(ticket.receiver, receiverSig, ticketHash)) {\n revert InvalidReceiverSignature();\n }\n\n if (\n !isWinningTicket(\n senderSig,\n receiverSig,\n ticket.epochId,\n ticket.generationBlock,\n redeemerRand\n )\n ) {\n revert TicketNotWinning();\n }\n }\n\n /**\n * @notice Call this function to check if a multi receiver ticket is valid and is\n * a winning ticket. It will fail if the ticket is invalid or is not\n * a winner. A ticket is invalid if:\n * - The sender, receiver or redeemer addresses are null\n * - The receiver does not have a valid futurepass account\n * - The ticket has already been redeemed.\n * - The secret random value of the redeemer does not match the commit\n * in the ticket.\n * - The signatures are invalid.\n * @param ticket The ticket issued by the sender.\n * @param receiver The receiver associated with the ticket.\n * @param redeemerRand The redeemer random value, generated by the Node prior\n * to performing the event relay.\n * @param senderSig The signature of the sender of the ticket.\n * @param receiverSig The signature of the redeemer of the ticket.\n */\n function requireValidWinningMultiReceiverTicket(\n MultiReceiverTicket memory ticket,\n User calldata receiver,\n uint256 redeemerRand,\n bytes calldata senderSig,\n bytes calldata receiverSig\n ) public view returns (bytes32 ticketHash, bytes32 ticketReceiverHash) {\n if (ticket.sender.main == address(0)) {\n revert TicketSenderCannotBeZeroAddress();\n }\n if (receiver.main == address(0)) {\n revert TicketReceiverCannotBeZeroAddress();\n }\n if (ticket.redeemer == address(0)) {\n revert TicketRedeemerCannotBeZeroAddress();\n }\n\n address futurepassAccount = _futurepassRegistrar.futurepassOf(receiver.main);\n if (futurepassAccount == address(0)) {\n revert MissingFuturepassAccount(receiver.main);\n }\n\n // There are two hashes create. The first hash is signed by the\n // sender and receiver, and is primarily used to validate these actors\n // agreed on the contents of the ticket.\n // The second hash is to prevent re-use. In a multi-receiver context,\n // the same ticket can be re-used amongst many receiver, but should\n // only be used ONCE per futurepass account. Thus the second hash\n // additionally appends the futurepass address as well.\n ticketHash = getMultiReceiverTicketHash(ticket);\n ticketReceiverHash = keccak256(abi.encodePacked(ticketHash, futurepassAccount));\n if (usedTickets[ticketReceiverHash]) {\n revert TicketAlreadyRedeemed();\n }\n\n // validate the redeemer has knowledge of the redeemer rand\n if (createCommit(ticket.generationBlock, redeemerRand) != ticket.redeemerCommit) {\n revert RedeemerCommitMismatch();\n }\n\n if (!hasSigningPermission(ticket.sender, ticket.generationBlock)) {\n revert InvalidSenderSigningPermission();\n }\n if (!hasSigningPermission(receiver, ticket.generationBlock)) {\n revert InvalidReceiverSigningPermission();\n }\n\n if (!isValidTicketSig(ticket.sender, senderSig, ticketHash)) {\n revert InvalidSenderSignature();\n }\n if (!isValidTicketSig(receiver, receiverSig, ticketHash)) {\n revert InvalidReceiverSignature();\n }\n\n if (\n !isWinningTicket(\n senderSig,\n receiverSig,\n ticket.epochId,\n ticket.generationBlock,\n redeemerRand\n )\n ) {\n revert TicketNotWinning();\n }\n\n return (ticketHash, ticketReceiverHash);\n }\n\n function hasSigningPermission(\n User memory user,\n uint256 generationBlock\n ) internal view returns (bool) {\n if (user.delegated == address(0)) {\n return true;\n }\n\n IAuthorizedAccounts.Permission permission = IAuthorizedAccounts.Permission.PersonalSign;\n return\n _authorizedAccounts.validatePermission(\n user.main,\n user.delegated,\n permission,\n generationBlock\n );\n }\n\n function createCommit(uint256 generationBlock, uint256 rand) public pure returns (bytes32) {\n return keccak256(abi.encodePacked(keccak256(abi.encodePacked(generationBlock, rand))));\n }\n\n function getDeposit(address account) private view returns (Deposit storage) {\n return deposits[account];\n }\n\n function isValidTicketSig(\n User memory user,\n bytes memory sig,\n bytes32 ticketHash\n ) internal pure returns (bool) {\n address signer = address(0);\n if (user.delegated != address(0)) {\n signer = user.delegated;\n } else {\n signer = user.main;\n }\n bytes32 ethHash = ECDSA.toEthSignedMessageHash(ticketHash);\n return ECDSA.recover(ethHash, sig) == signer;\n }\n\n /**\n * @notice Use this function to check if a ticket is winning.\n * @param senderSig The signature of the sender of the ticket.\n * @param receiverSig The signature of the receiver of the ticket.\n * @param epochId The epochId of the ticket.\n * @param generationBlock The generationBlock of the ticket.\n * @param redeemerRand The redeemer random value, generated by the Node prior\n * to performing the event relay.\n * @return True if a ticket is a winner.\n */\n function isWinningTicket(\n bytes memory senderSig,\n bytes memory receiverSig,\n uint256 epochId,\n uint256 generationBlock,\n uint256 redeemerRand\n ) public view returns (bool) {\n uint256 winProb = calculateWinningProbability(epochId, generationBlock);\n // bitshift the winProb to a 256 bit value to allow comparison to a 32 byte hash\n uint256 prob = (uint256(winProb) << 128) | uint256(winProb);\n return uint256(keccak256(abi.encodePacked(senderSig, receiverSig, redeemerRand))) < prob;\n }\n\n /**\n * @notice This function calculates the probability of a ticket winning at\n * the block that this function was called. A ticket's winning probability\n * will decay every block since its issuance. The amount of decay will depend\n * on the decay rate parameter of the epoch the ticket was generated in.\n * @param epochId The epochId of the ticket.\n * @param generationBlock The generationBlock of the ticket.\n */\n function calculateWinningProbability(\n uint256 epochId,\n uint256 generationBlock\n ) public view returns (uint128) {\n EpochsManager.Epoch memory epoch = _epochsManager.getEpoch(epochId);\n if (epoch.startBlock == 0) {\n revert TicketEpochNotFound();\n }\n\n if (\n generationBlock < epoch.startBlock ||\n (epoch.endBlock > 0 && generationBlock >= epoch.endBlock)\n ) {\n revert TicketNotCreatedInTheEpoch();\n }\n\n uint256 elapsedDuration = block.number - generationBlock;\n\n // Ticket has completely expired\n if (elapsedDuration >= epoch.ticketDuration) {\n return 0;\n }\n\n uint256 maxDecayValue = SyloUtils.percOf(epoch.baseLiveWinProb, epoch.decayRate);\n\n // determine the amount of probability that has actually decayed\n // by multiplying the maximum decay value against ratio of the tickets elapsed duration\n // vs the actual ticket duration. The max decay value is calculated from a fraction of a\n // uint128 value so we cannot phantom overflow here\n uint256 decayedProbability = (maxDecayValue * elapsedDuration) / epoch.ticketDuration;\n\n // calculate the remaining probability by subtracting the decayed probability\n // from the base\n return epoch.baseLiveWinProb - SafeCast.toUint128(decayedProbability);\n }\n\n /**\n * @notice Returns the hash of the ticket. Takes all fields in a ticket\n * as inputs to the hash.\n * @return A byte-array representing the hash.\n */\n function getTicketHash(Ticket memory ticket) public pure returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(\n ticket.epochId,\n ticket.sender.main,\n ticket.receiver.main,\n ticket.redeemer,\n ticket.generationBlock,\n ticket.redeemerCommit\n )\n );\n }\n\n /**\n * @notice Returns the hash of a multi receiver ticket. Takes all fields in\n * a ticket as inputs to the hash, as well as a specific receiver.\n * @return A byte-array representing the hash.\n */\n function getMultiReceiverTicketHash(\n MultiReceiverTicket memory ticket\n ) public pure returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(\n ticket.epochId,\n ticket.sender.main,\n ticket.redeemer,\n ticket.generationBlock,\n ticket.redeemerCommit\n )\n );\n }\n\n function incrementRewardPool(\n address stakee,\n Deposit storage deposit,\n uint256 amount\n ) internal {\n deposit.escrow = deposit.escrow - amount;\n\n SafeERC20.safeTransfer(_token, address(_rewardsManager), amount);\n _rewardsManager.incrementRewardPool(stakee, amount);\n }\n}\n" + }, + "contracts/payments/ticketing/RewardsManager.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"abdk-libraries-solidity/ABDKMath64x64.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\n\nimport \"../../libraries/SyloUtils.sol\";\nimport \"../../libraries/Manageable.sol\";\nimport \"../../epochs/EpochsManager.sol\";\nimport \"../../staking/StakingManager.sol\";\nimport \"../../interfaces/epochs/IEpochsManager.sol\";\nimport \"../../interfaces/staking/IStakingManager.sol\";\nimport \"../../interfaces/payments/ticketing/IRewardsManager.sol\";\n\n/**\n * @notice Handles epoch based reward pools that are incremented from redeeming tickets.\n * Nodes use this contract to set up their reward pool for the next epoch,\n * and stakers use this contract to track and claim staking rewards.\n * @dev After deployment, the SyloTicketing contract should be\n * set up as a manager to be able to call certain restricted functions.\n */\ncontract RewardsManager is IRewardsManager, Initializable, Manageable, ERC165 {\n uint256 internal constant ONE_SYLO = 1 ether;\n\n // 64x64 Fixed point representation of 1 SYLO (10**18 >> 64)\n int128 internal constant ONE_SYLO_FIXED = 18446744073709551616000000000000000000;\n\n uint256 internal constant MAX_INT64 = 9223372036854775807;\n\n /** ERC20 Sylo token contract. */\n IERC20 public _token;\n\n /** Sylo Staking Manager contract. */\n StakingManager public _stakingManager;\n\n /** Sylo Epochs Manager. */\n EpochsManager public _epochsManager;\n\n /**\n * @dev Each node will manage a cumulative reward factor (CRF) that is incremented\n * whenever a ticket is redeemed. This factor acts as a single value\n * that can be used to calculate any particular staker's reward share. This\n * prevents the need to individually track each staker's proportion, and also allows\n * a claim calculation to be performed without iterating through every epoch.\n *\n * The CRF is calculated as CRF = CRF + Reward / TotalStake.\n */\n mapping(address => int128) private cumulativeRewardFactors;\n\n /**\n * @notice Tracks the last epoch a delegated staker made a reward claim in.\n * The key to this mapping is a hash of the Node's address and the delegated\n * stakers address.\n */\n mapping(bytes32 => LastClaim) public lastClaims;\n\n /**\n * @notice Tracks each Nodes total pending rewards in SOLOs. This\n * value is accumulated as Node's redeem tickets. Rewards are pending if the\n * distribution amongst the stakers has not been accounted for yet. Pending rewards\n * are transferred to unclaimed rewards once the the staker's share has been\n * calculated.\n */\n mapping(address => uint256) public pendingRewards;\n\n /**\n * @notice Tracks rewards for stakers after the stakers share has been calculated,\n * but has not actually been claimed by the staker.\n * The node fee reward is also added to the node's unclaimedStakingRewards.\n */\n mapping(bytes32 => uint256) public unclaimedStakingRewards;\n\n /**\n * @notice Tracks each Node's most recently active reward pool\n */\n mapping(address => uint256) public latestActiveRewardPools;\n\n /**\n * @notice Tracks total accumulated rewards in each epoch\n */\n mapping(uint256 => uint256) public totalEpochRewards;\n\n /**\n * @notice Tracks total accumulated staking rewards in each epoch\n */\n mapping(uint256 => uint256) public totalEpochStakingRewards;\n\n /**\n * @notice Tracks each reward pool initialized by a Node. The key to this map\n * is derived from the epochId and the Node's address.\n */\n mapping(bytes32 => RewardPool) public rewardPools;\n\n error NoRewardToClaim();\n error AmountCannotBeZero();\n error RewardPoolNotExist();\n error RewardPoolAlreadyExist();\n error DoNotAllowZeroAddress();\n error TokenCannotBeZeroAddress();\n error NoStakeToCreateRewardPool();\n error StakeeCannotBeZeroAddress();\n error StakerCannotBeZeroAddress();\n error StakerKeyCannotBeZeroBytes();\n error InvalidFixedPointResult();\n\n function initialize(\n IERC20 token,\n StakingManager stakingManager,\n EpochsManager epochsManager\n ) external initializer {\n if (address(token) == address(0)) {\n revert TokenCannotBeZeroAddress();\n }\n\n SyloUtils.validateContractInterface(\n \"StakingManager\",\n address(stakingManager),\n type(IStakingManager).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"EpochsManager\",\n address(epochsManager),\n type(IEpochsManager).interfaceId\n );\n\n Ownable2StepUpgradeable.__Ownable2Step_init();\n\n _token = token;\n _epochsManager = epochsManager;\n _stakingManager = stakingManager;\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IRewardsManager).interfaceId;\n }\n\n /**\n * @notice Returns the key used to index a reward pool. The key is a hash of\n * the epochId and Node's address.\n * @param epochId The epoch ID the reward pool was created in.\n * @param stakee The address of the Node.\n * @return A byte-array representing the reward pool key.\n */\n function getRewardPoolKey(uint256 epochId, address stakee) public pure returns (bytes32) {\n return keccak256(abi.encodePacked(epochId, stakee));\n }\n\n /**\n * @notice Returns the key used to index staking claims. The key is a hash of\n * the Node's address and the staker's address.\n * @param stakee The address of the Node.\n * @param staker The address of the stake.\n * @return A byte-array representing the key.\n */\n function getStakerKey(address stakee, address staker) public pure returns (bytes32) {\n return keccak256(abi.encodePacked(stakee, staker));\n }\n\n /**\n * @notice Retrieve the reward pool initialized by the given node, at the specified\n * epoch.\n * @param epochId The ID of the epoch the reward pool was initialized in.\n * @param stakee The address of the Node.\n * @return The reward pool.\n */\n function getRewardPool(\n uint256 epochId,\n address stakee\n ) external view returns (RewardPool memory) {\n return rewardPools[getRewardPoolKey(epochId, stakee)];\n }\n\n /**\n * @notice Retrieve the total accumulated reward that will be distributed to a Node's\n * delegated stakers for a given epoch.\n * @param epochId The ID of the epoch the reward pool was initialized in.\n * @param stakee The address of the Node.\n * @return The total accumulated staker reward in SOLO.\n */\n function getRewardPoolStakersTotal(\n uint256 epochId,\n address stakee\n ) external view returns (uint256) {\n return rewardPools[getRewardPoolKey(epochId, stakee)].stakersRewardTotal;\n }\n\n /**\n * @notice Retrieve the total active stake that will be used for a Node's reward\n * pool in a given epoch.\n * @param epochId The ID of the epoch the reward pool was initialized in.\n * @param stakee The address of the Node.\n * @return The total active stake for that reward pool in SOLO.\n */\n function getRewardPoolActiveStake(\n uint256 epochId,\n address stakee\n ) external view returns (uint256) {\n return rewardPools[getRewardPoolKey(epochId, stakee)].totalActiveStake;\n }\n\n /**\n * @notice Retrieve the total pending staking reward allocated to a Node's\n * stakers.\n * @param stakee The address of the Node.\n * @return The total pending staking reward in SOLO.\n */\n function getPendingRewards(address stakee) external view returns (uint256) {\n return pendingRewards[stakee];\n }\n\n /**\n * @notice Retrieves the ID of the epoch in which a staker last made their\n * staking claim.\n * @param stakee The address of the Node.\n * @param staker The address of the staker.\n * @return The ID of the epoch.\n */\n function getLastClaim(\n address stakee,\n address staker\n ) external view returns (LastClaim memory) {\n return lastClaims[getStakerKey(stakee, staker)];\n }\n\n /**\n * @notice Retrieves the total accumulated rewards for a specific epoch.\n * @param epochId The epoch id.\n * @return The total reward in that epoch, including staking rewards and fee\n * reward.\n */\n function getTotalEpochRewards(uint256 epochId) external view returns (uint256) {\n return totalEpochRewards[epochId];\n }\n\n /**\n * @notice Retrieves the total accumulated rewards for stakers in a specific epoch.\n * @param epochId The epoch id.\n * @return The total staking reward in that epoch.\n */\n function getTotalEpochStakingRewards(uint256 epochId) external view returns (uint256) {\n return totalEpochStakingRewards[epochId];\n }\n\n /**\n * @notice This is used by Nodes to initialize their reward pool for\n * the next epoch. This function will revert if the caller has no stake, or\n * if the reward pool has already been initialized. The total active stake\n * for the next reward pool is calculated by summing up the total managed\n * stake held by the RewardsManager contract.\n */\n function initializeNextRewardPool(address stakee) external onlyManager {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n\n uint256 nextEpochId = _epochsManager.getNextEpochId();\n\n RewardPool storage nextRewardPool = rewardPools[getRewardPoolKey(nextEpochId, stakee)];\n if (nextRewardPool.initializedAt != 0) {\n revert RewardPoolAlreadyExist();\n }\n\n uint256 totalStake = _stakingManager.getStakeeTotalManagedStake(stakee);\n if (totalStake == 0) {\n revert NoStakeToCreateRewardPool();\n }\n\n nextRewardPool.totalActiveStake = totalStake;\n\n nextRewardPool.initializedAt = block.number;\n }\n\n /**\n * @dev This function should be called by the Ticketing contract when a\n * ticket is successfully redeemed. The face value of the ticket\n * should be split between incrementing the node's reward balance,\n * and the reward balance for the node's delegated stakers. The face value\n * will be added to the current reward pool's balance. This function will\n * fail if the Ticketing contract has not been set as a manager.\n * @param stakee The address of the Node.\n * @param amount The face value of the ticket in SOLO.\n */\n function incrementRewardPool(address stakee, uint256 amount) external onlyManager {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n if (amount == 0) {\n revert AmountCannotBeZero();\n }\n\n (uint256 epochId, IEpochsManager.Epoch memory currentEpoch) = _epochsManager\n .getCurrentActiveEpoch();\n\n RewardPool storage rewardPool = rewardPools[getRewardPoolKey(epochId, stakee)];\n if (rewardPool.initializedAt == 0) {\n revert RewardPoolNotExist();\n }\n\n // Update the latest active reward pool for the node to be this pool\n if (latestActiveRewardPools[stakee] < epochId) {\n latestActiveRewardPools[stakee] = epochId;\n }\n\n uint256 stakersReward = SyloUtils.percOf(\n SafeCast.toUint128(amount),\n currentEpoch.defaultPayoutPercentage\n );\n\n // transfer the node's fee reward to it's unclaimed reward value\n unclaimedStakingRewards[getStakerKey(stakee, stakee)] =\n unclaimedStakingRewards[getStakerKey(stakee, stakee)] +\n (amount - stakersReward);\n\n // update the value of the reward owed to the stakers\n pendingRewards[stakee] = pendingRewards[stakee] + stakersReward;\n\n // if this is the first ticket redeemed for this reward, set the initial\n // CRF value for this pool\n if (rewardPool.stakersRewardTotal == 0) {\n rewardPool.initialCumulativeRewardFactor = cumulativeRewardFactors[stakee];\n }\n\n rewardPool.stakersRewardTotal = rewardPool.stakersRewardTotal + stakersReward;\n\n // We preemptively prevent an overflow revert with the abdk library.\n // Dividing the stakers reward with the pool's total active\n // stake may produce a value that is greater than the maximum possible\n // 64.64 fixed point value.\n // This error is incredibly niche and unlikely to happen, so we just\n // revert here as well (with a named error) and remediation involves\n // just increasing the amount of stake a node has.\n if (rewardPool.totalActiveStake * MAX_INT64 < stakersReward) {\n revert InvalidFixedPointResult();\n }\n\n cumulativeRewardFactors[stakee] = ABDKMath64x64.add(\n cumulativeRewardFactors[stakee],\n ABDKMath64x64.div(\n toFixedPointSYLO(stakersReward),\n toFixedPointSYLO(rewardPool.totalActiveStake)\n )\n );\n\n totalEpochRewards[epochId] = totalEpochRewards[epochId] + amount;\n totalEpochStakingRewards[epochId] = totalEpochStakingRewards[epochId] + stakersReward;\n }\n\n /**\n * @dev This function utilizes the cumulative reward factors, and the staker's\n * value in stake to calculate the staker's share of the pending reward.\n */\n function calculatePendingClaim(\n bytes32 stakerKey,\n address stakee,\n address staker\n ) internal view returns (uint256) {\n uint256 claim = calculateInitialClaim(stakerKey, stakee);\n\n // find the first reward pool where their stake was active and had\n // generated rewards\n uint256 activeAt;\n RewardPool memory initialActivePool;\n\n uint256 currentEpochId = _epochsManager.currentIteration();\n\n for (uint256 i = lastClaims[stakerKey].claimedAt + 1; i < currentEpochId; ++i) {\n initialActivePool = rewardPools[getRewardPoolKey(i, stakee)];\n // check if node initialized a reward pool for this epoch and\n // gained rewards\n if (initialActivePool.initializedAt > 0 && initialActivePool.stakersRewardTotal > 0) {\n activeAt = i;\n break;\n }\n }\n\n if (activeAt == 0) {\n return claim;\n }\n\n IStakingManager.StakeEntry memory stakeEntry = _stakingManager.getStakeEntry(\n stakee,\n staker\n );\n\n // We convert the staker amount to SYLO as the maximum uint256 value that\n // can be used for the fixed point representation is 2^64-1.\n int128 initialStake = toFixedPointSYLO(stakeEntry.amount);\n\n int128 initialCumulativeRewardFactor = initialActivePool.initialCumulativeRewardFactor;\n\n int128 finalCumulativeRewardFactor = getFinalCumulativeRewardFactor(\n stakee,\n currentEpochId\n );\n\n return\n claim +\n fromFixedPointSYLO(\n ABDKMath64x64.mul(\n initialStake,\n ABDKMath64x64.sub(finalCumulativeRewardFactor, initialCumulativeRewardFactor)\n )\n );\n }\n\n /**\n * Manually calculates the reward claim for the first epoch the claim is being\n * made for. This manual calculation is necessary as claims are only made up\n * to the previous epoch.\n */\n function calculateInitialClaim(\n bytes32 stakerKey,\n address stakee\n ) internal view returns (uint256) {\n LastClaim memory lastClaim = lastClaims[stakerKey];\n\n // if we have already made a claim up to the previous epoch, then\n // there is no need to calculate the initial claim\n if (_epochsManager.currentIteration() == lastClaim.claimedAt) {\n return 0;\n }\n\n RewardPool memory firstRewardPool = rewardPools[\n getRewardPoolKey(lastClaim.claimedAt, stakee)\n ];\n\n // if there was no reward pool initialized for the first epoch,\n // then there is no need to calculate the initial claim\n if (firstRewardPool.totalActiveStake == 0) {\n return 0;\n }\n\n return\n (firstRewardPool.stakersRewardTotal * lastClaim.stake) /\n firstRewardPool.totalActiveStake;\n }\n\n /**\n * Determines the cumulative reward factor to use for claim calculations. The\n * CRF will depend on when the Node last initialized a reward pool, and also when\n * the staker last made their claim.\n */\n function getFinalCumulativeRewardFactor(\n address stakee,\n uint256 currentEpochId\n ) internal view returns (int128) {\n int128 finalCumulativeRewardFactor;\n\n // Get the cumulative reward factor for the Node\n // for the start of this epoch, since we only perform\n // calculations up to the end of the previous epoch.\n if (latestActiveRewardPools[stakee] < currentEpochId) {\n // If the Node has not been active, then the final\n // cumulative reward factor will just be the current one.\n finalCumulativeRewardFactor = cumulativeRewardFactors[stakee];\n } else {\n // We are calculating the claim for an active epoch, the\n // final cumulative reward factor will be taken from the start of this\n // epoch (end of previous epoch).\n RewardPool storage latestRewardPool = rewardPools[\n getRewardPoolKey(latestActiveRewardPools[stakee], stakee)\n ];\n finalCumulativeRewardFactor = latestRewardPool.initialCumulativeRewardFactor;\n }\n\n return finalCumulativeRewardFactor;\n }\n\n /**\n * @notice Call this function to calculate the total reward owed to a staker.\n * This value will include all epochs since the last claim was made up to\n * the previous epoch. This will also add any pending rewards to the\n * final value as well.\n * @dev This function will utilize the cumulative reward factor to perform the\n * calculation, keeping the gas cost scaling of this function to a constant value.\n * @param stakee The address of the Node.\n * @param staker The address of the staker.\n * @return The value of the reward owed to the staker in SOLO.\n */\n function calculateStakerClaim(address stakee, address staker) public view returns (uint256) {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n if (staker == address(0)) {\n revert StakerCannotBeZeroAddress();\n }\n\n bytes32 stakerKey = getStakerKey(stakee, staker);\n uint256 pendingClaim = calculatePendingClaim(stakerKey, stakee, staker);\n\n return pendingClaim + unclaimedStakingRewards[stakerKey];\n }\n\n /**\n * Helper function to convert a uint256 value in SOLOs to a 64.64 fixed point\n * representation in SYLOs while avoiding any possibility of overflow.\n * Any remainders from converting SOLO to SYLO is explicitly handled to mitigate\n * precision loss. The error when using this function is [-1/2^64, 0].\n */\n function toFixedPointSYLO(uint256 amount) internal pure returns (int128) {\n int128 fullSylos = ABDKMath64x64.fromUInt(amount / ONE_SYLO);\n int128 fracSylos = ABDKMath64x64.fromUInt(amount % ONE_SYLO); // remainder\n\n return ABDKMath64x64.add(fullSylos, ABDKMath64x64.div(fracSylos, ONE_SYLO_FIXED));\n }\n\n /**\n * Helper function to convert a 64.64 fixed point value in SYLOs to a uint256\n * representation in SOLOs while avoiding any possibility of overflow.\n */\n function fromFixedPointSYLO(int128 amount) internal pure returns (uint256) {\n uint256 fullSylos = ABDKMath64x64.toUInt(amount);\n uint256 fullSolos = fullSylos * ONE_SYLO;\n\n // calculate the value lost when converting the fixed point amount to a uint\n int128 fracSylos = ABDKMath64x64.sub(amount, ABDKMath64x64.fromUInt(fullSylos));\n uint256 fracSolos = ABDKMath64x64.toUInt(ABDKMath64x64.mul(fracSylos, ONE_SYLO_FIXED));\n\n return fullSolos + fracSolos;\n }\n\n /**\n * @notice Call this function to claim rewards as a staker. The\n * SYLO tokens will be transferred to the caller's account. This function will\n * fail if there exists no reward to claim. Note: Calling this will remove\n * the current unclaimed reward from being used as stake in the next round.\n * @param stakee The address of the Node to claim against.\n */\n function claimStakingRewards(address stakee) external returns (uint256) {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n\n bytes32 stakerKey = getStakerKey(stakee, msg.sender);\n uint256 pendingReward = calculatePendingClaim(stakerKey, stakee, msg.sender);\n\n uint256 totalClaim = pendingReward + unclaimedStakingRewards[stakerKey];\n if (totalClaim == 0) {\n revert NoRewardToClaim();\n }\n\n delete unclaimedStakingRewards[stakerKey];\n pendingRewards[stakee] = pendingRewards[stakee] - pendingReward;\n\n updateLastClaim(stakee, msg.sender);\n\n SafeERC20.safeTransfer(_token, msg.sender, totalClaim);\n\n return totalClaim;\n }\n\n /**\n * @notice This is called by the staking manager to transfer pending rewards\n * to unclaimed rewards for a staker. This is required as the last used CRF\n * needs to be updated whenever stake changes.\n */\n function updatePendingRewards(address stakee, address staker) external onlyManager {\n bytes32 stakerKey = getStakerKey(stakee, staker);\n uint256 pendingReward = calculatePendingClaim(stakerKey, stakee, staker);\n\n pendingRewards[stakee] = pendingRewards[stakee] - pendingReward;\n\n unclaimedStakingRewards[stakerKey] = unclaimedStakingRewards[stakerKey] + pendingReward;\n\n updateLastClaim(stakee, staker);\n }\n\n function updateLastClaim(address stakee, address staker) internal {\n IStakingManager.StakeEntry memory stakeEntry = _stakingManager.getStakeEntry(\n stakee,\n staker\n );\n lastClaims[getStakerKey(stakee, staker)] = LastClaim(\n _epochsManager.currentIteration(),\n stakeEntry.amount\n );\n }\n}\n" + }, + "contracts/payments/ticketing/TicketingParameters.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\n\nimport \"../../libraries/SyloUtils.sol\";\nimport \"../../interfaces/payments/ticketing/ITicketingParameters.sol\";\n\n/**\n * @dev Persists the parameters for the ticketing mechanism. This contract is\n * read by the EpochManager. Extracting the parameters into another\n * contract is necessary to avoid a cyclic dependency between the ticketing\n * and epoch contracts.\n */\ncontract TicketingParameters is\n ITicketingParameters,\n Initializable,\n Ownable2StepUpgradeable,\n ERC165\n{\n /** @notice The value of a winning ticket in SOLO. */\n uint256 public faceValue;\n\n /**\n * @notice The probability of a ticket winning during the start of its lifetime.\n * This is a uint128 value representing the numerator in the probability\n * ratio where 2^128 - 1 is the denominator.\n */\n uint128 public baseLiveWinProb;\n\n /**\n * @notice The probability of a ticket winning after it has expired.\n * This is a uint128 value representing the numerator in the probability\n * ratio where 2^128 - 1 is the denominator. Note: Redeeming expired\n * tickets is currently not supported.\n */\n uint128 public expiredWinProb;\n\n /**\n * @notice The length in blocks before a ticket is considered expired.\n * The default initialization value is 80,000. This equates\n * to roughly two weeks (15s per block).\n */\n uint256 public ticketDuration;\n\n /**\n * @notice A percentage value representing the proportion of the base win\n * probability that will be decayed once a ticket has expired.\n * Example: 80% decayRate indicates that a ticket will decay down to 20% of its\n * base win probability upon reaching the block before its expiry.\n * The value is expressed as a fraction of 10000.\n */\n uint16 public decayRate;\n\n event FaceValueUpdated(uint256 faceValue);\n event BaseLiveWinProbUpdated(uint128 baseLiveWinprob);\n event ExpiredWinProbUpdated(uint128 expiredWinProb);\n event TicketDurationUpdated(uint256 ticketDuration);\n event DecayRateUpdated(uint16 decayRate);\n\n error FaceValueCannotBeZero();\n error TicketDurationCannotBeZero();\n\n function initialize(\n uint256 _faceValue,\n uint128 _baseLiveWinProb,\n uint128 _expiredWinProb,\n uint16 _decayRate,\n uint256 _ticketDuration\n ) external initializer {\n if (_faceValue == 0) {\n revert FaceValueCannotBeZero();\n }\n if (_ticketDuration == 0) {\n revert TicketDurationCannotBeZero();\n }\n\n Ownable2StepUpgradeable.__Ownable2Step_init();\n\n faceValue = _faceValue;\n baseLiveWinProb = _baseLiveWinProb;\n expiredWinProb = _expiredWinProb;\n decayRate = _decayRate;\n ticketDuration = _ticketDuration;\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(ITicketingParameters).interfaceId;\n }\n\n /**\n * @notice Set the face value for tickets in SOLO. Only callable by\n * the contract owner.\n * @param _faceValue The face value to set in SOLO.\n */\n function setFaceValue(uint256 _faceValue) external onlyOwner {\n if (_faceValue == 0) {\n revert FaceValueCannotBeZero();\n }\n\n faceValue = _faceValue;\n emit FaceValueUpdated(_faceValue);\n }\n\n /**\n * @notice Set the base live win probability of a ticket. Only callable by\n * the contract owner.\n * @param _baseLiveWinProb The probability represented as a value\n * between 0 to 2**128 - 1.\n */\n function setBaseLiveWinProb(uint128 _baseLiveWinProb) external onlyOwner {\n baseLiveWinProb = _baseLiveWinProb;\n emit BaseLiveWinProbUpdated(_baseLiveWinProb);\n }\n\n /**\n * @notice Set the expired win probability of a ticket. Only callable by\n * the contract owner.\n * @param _expiredWinProb The probability represented as a value\n * between 0 to 2**128 - 1.\n */\n function setExpiredWinProb(uint128 _expiredWinProb) external onlyOwner {\n expiredWinProb = _expiredWinProb;\n emit ExpiredWinProbUpdated(_expiredWinProb);\n }\n\n /**\n * @notice Set the decay rate of a ticket. Only callable by the\n * the contract owner.\n * @param _decayRate The decay rate as a percentage, where the\n * denominator is 10000.\n */\n function setDecayRate(uint16 _decayRate) external onlyOwner {\n decayRate = _decayRate;\n emit DecayRateUpdated(_decayRate);\n }\n\n /**\n * @notice Set the ticket duration of a ticket. Only callable by the\n * contract owner.\n * @param _ticketDuration The duration of a ticket in number of blocks.\n */\n function setTicketDuration(uint256 _ticketDuration) external onlyOwner {\n if (_ticketDuration == 0) {\n revert TicketDurationCannotBeZero();\n }\n\n ticketDuration = _ticketDuration;\n emit TicketDurationUpdated(_ticketDuration);\n }\n\n /**\n * @notice Retrieve the current ticketing parameters.\n * @return faceValue The face value of a ticket in SOLO.\n * @return baseLiveWinProb The base live win probability of a ticket.\n * @return expiredWinProb The expired win probability of a ticket.\n * @return ticketDuration The duration of a ticket in number of blocks.\n * @return decayRate The decay rate of a ticket.\n */\n function getTicketingParameters()\n external\n view\n returns (uint256, uint128, uint128, uint256, uint16)\n {\n return (faceValue, baseLiveWinProb, expiredWinProb, ticketDuration, decayRate);\n }\n}\n" + }, + "contracts/Registries.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\n\nimport \"./libraries/SyloUtils.sol\";\nimport \"./interfaces/IRegistries.sol\";\n\n/**\n * @notice This contract manages Registries for Nodes. A Registry is a\n * set of parameters configured by the Node itself. A Node is required\n * to have a valid Registry to be able to participate in the network.\n */\ncontract Registries is IRegistries, Initializable, Ownable2StepUpgradeable, IERC165 {\n using ECDSA for bytes32;\n\n /**\n * @notice ERC721 contract for bridged Seekers. Used for verifying ownership\n * of a seeker.\n */\n IERC721 public _rootSeekers;\n\n /**\n * @notice Tracks each Node's registry.\n */\n mapping(address => IRegistries.Registry) public registries;\n\n /**\n * @notice Tracks the node address that each seeker id is registered with\n */\n mapping(uint256 => address) public seekerRegistration;\n\n /**\n * @notice Tracks the address of every registered node.\n */\n address[] public nodes;\n\n /**\n * @notice Tracks nonces used when registering the seeker account\n * to prevent signature re-use.\n */\n mapping(bytes32 => address) private signatureNonces;\n\n /**\n * @notice Payout percentage refers to the portion of a tickets reward\n * that will be allocated to the Node's stakers. This is global, and is\n * currently set for all Nodes.\n */\n uint16 public defaultPayoutPercentage;\n\n event DefaultPayoutPercentageUpdated(uint16 defaultPayoutPercentage);\n\n error NonceCannotBeReused();\n error EndMustBeGreaterThanStart();\n error PercentageCannotExceed10000();\n error PublicEndpointCannotBeEmpty();\n error SeekerAccountMustOwnSeekerId();\n error SeekerAccountMustBeMsgSender();\n error ProofNotSignedBySeekerAccount();\n error RootSeekersCannotBeZeroAddress();\n error SeekerAccountCannotBeZeroAddress();\n error EndCannotExceedNumberOfNodes(uint256 nodeLength);\n\n function initialize(\n IERC721 rootSeekers,\n uint16 _defaultPayoutPercentage\n ) external initializer {\n if (address(rootSeekers) == address(0)) {\n revert RootSeekersCannotBeZeroAddress();\n }\n if (_defaultPayoutPercentage > 10000) {\n revert PercentageCannotExceed10000();\n }\n\n Ownable2StepUpgradeable.__Ownable2Step_init();\n\n _rootSeekers = rootSeekers;\n defaultPayoutPercentage = _defaultPayoutPercentage;\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IRegistries).interfaceId;\n }\n\n /**\n * @notice Set the global default payout percentage value. Only callable\n * by the owner.\n * @param _defaultPayoutPercentage The payout percentage as a value where the\n * denominator is 10000.\n */\n function setDefaultPayoutPercentage(uint16 _defaultPayoutPercentage) external onlyOwner {\n if (_defaultPayoutPercentage > 10000) {\n revert PercentageCannotExceed10000();\n }\n\n defaultPayoutPercentage = _defaultPayoutPercentage;\n emit DefaultPayoutPercentageUpdated(_defaultPayoutPercentage);\n }\n\n /**\n * @notice Call this as a Node to set or update your Registry entry.\n * @param publicEndpoint The public endpoint of your Node. Essential for\n * clients to be able to retrieve additional information, such as\n * an address to establish a p2p connection.\n */\n function register(string calldata publicEndpoint) external {\n if (bytes(publicEndpoint).length == 0) {\n revert PublicEndpointCannotBeEmpty();\n }\n\n // This is the nodes first registration\n if (bytes(registries[msg.sender].publicEndpoint).length == 0) {\n nodes.push(msg.sender);\n }\n\n registries[msg.sender].publicEndpoint = publicEndpoint;\n }\n\n function setSeekerAccount(\n address seekerAccount,\n uint256 seekerId,\n bytes32 nonce,\n bytes calldata signature\n ) external {\n if (seekerAccount == address(0)) {\n revert SeekerAccountCannotBeZeroAddress();\n }\n if (signatureNonces[nonce] != address(0)) {\n revert NonceCannotBeReused();\n }\n\n bytes memory proofMessage = getProofMessage(seekerId, msg.sender, nonce);\n bytes32 ethProof = ECDSA.toEthSignedMessageHash(proofMessage);\n\n if (ECDSA.recover(ethProof, signature) != seekerAccount) {\n revert ProofNotSignedBySeekerAccount();\n }\n\n // Now verify the seeker account actually owns the seeker\n address owner = _rootSeekers.ownerOf(seekerId);\n\n if (seekerAccount != owner) {\n revert SeekerAccountMustOwnSeekerId();\n }\n\n delete registries[seekerRegistration[seekerId]].seekerId;\n delete registries[seekerRegistration[seekerId]].seekerAccount;\n\n registries[msg.sender].seekerAccount = seekerAccount;\n registries[msg.sender].seekerId = seekerId;\n\n seekerRegistration[seekerId] = msg.sender;\n\n signatureNonces[nonce] = seekerAccount;\n }\n\n function revokeSeekerAccount(address node) external {\n Registry storage registry = registries[node];\n\n if (registry.seekerAccount != msg.sender) {\n revert SeekerAccountMustBeMsgSender();\n }\n\n delete registry.seekerAccount;\n delete seekerRegistration[registry.seekerId];\n delete registry.seekerId;\n }\n\n /**\n * @notice Retrieve the registry associated with a Node.\n * @param account The address of the Node.\n * @return The Node's Registry.\n */\n function getRegistry(address account) external view returns (Registry memory) {\n return registries[account];\n }\n\n /**\n * @notice Retrieve all registered nodes.\n * @return An array of node addresses.\n */\n function getNodes() external view returns (address[] memory) {\n return nodes;\n }\n\n /**\n * @notice Retrieves a list of registries. Takes in a\n * a start and end indices to allow pagination.\n * @param start The start index which is inclusive.\n * @param end The end index which is exclusive.\n * @return An array of Registries.\n */\n function getRegistries(\n uint256 start,\n uint256 end\n ) external view returns (address[] memory, Registry[] memory) {\n uint256 nodesLength = nodes.length;\n\n if (end <= start) {\n revert EndMustBeGreaterThanStart();\n }\n if (end > nodesLength) {\n revert EndCannotExceedNumberOfNodes(nodesLength);\n }\n\n address[] memory _nodes = new address[](end - start);\n Registry[] memory _registries = new Registry[](_nodes.length);\n\n for (uint256 i = start; i < end; ++i) {\n _nodes[i - start] = nodes[i];\n _registries[i - start] = registries[nodes[i]];\n }\n\n return (_nodes, _registries);\n }\n\n /**\n * @notice Returns the total number of registered nodes.\n * @return The number of registered nodes.\n */\n function getTotalNodes() external view returns (uint256) {\n return nodes.length;\n }\n\n /**\n * @notice Helper function for deriving the proof message used to\n * validate seeker ownership.\n * @param seekerId The tokenId of the seeker used for operation.\n * @param node The address of the node which that will be operated\n * by the specified seeker.\n * @param nonce The nonce used for this message.\n */\n function getProofMessage(\n uint256 seekerId,\n address node,\n bytes32 nonce\n ) public pure returns (bytes memory) {\n return\n abi.encodePacked(\n unicode\"šŸ¤– Hi frend! šŸ¤–\\n\\nšŸ“œ Signing this message proves that you're the owner of this Seeker NFT and allows your Seeker to be used to operate your Seeker's Node. It's a simple but important step to ensure smooth operation.\\n\\nThis request will not trigger a blockchain transaction or cost any gas fees.\\n\\nšŸ”„ Your node's address: \",\n Strings.toHexString(uint256(uint160(node)), 20),\n unicode\"\\n\\nšŸ†” Your seeker id: \",\n Strings.toString(seekerId),\n unicode\"\\n\\nšŸ“¦ A unique random value which secures this message: \",\n Strings.toHexString(uint256(nonce), 32)\n );\n }\n}\n" + }, + "contracts/SeekerPowerOracle.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\n\nimport \"./interfaces/ISeekerPowerOracle.sol\";\n\n/**\n * @notice Acts as a source of information for Seeker Powers. Allows setting\n * a Seeker's power level via a restricted oracle account call. Seeker Power can also\n * be set by any account if the correct Oracle signature proof is provided.\n */\ncontract SeekerPowerOracle is ISeekerPowerOracle, Initializable, Ownable2StepUpgradeable {\n /**\n * @notice The oracle account. This contract accepts any attestations of\n * Seeker power that have been signed by this account.\n */\n address public oracle;\n\n /**\n * @notice Tracks nonce used when register the Seeker power to\n * prevent signature re-use.\n */\n mapping(bytes32 => address) private proofNonces;\n\n /**\n * @notice Tracks the set of Seeker Power levels.\n */\n mapping(uint256 => uint256) public seekerPowers;\n\n event SeekerPowerUpdated(uint256 indexed seekerId, uint256 indexed power);\n\n error UnauthorizedRegisterSeekerPowerCall();\n error NonceCannotBeReused();\n\n function initialize(address _oracle) external initializer {\n Ownable2StepUpgradeable.__Ownable2Step_init();\n\n oracle = _oracle;\n }\n\n /**\n * @notice Sets the oracle account.\n * @param _oracle The oracle account.\n */\n function setOracle(address _oracle) external onlyOwner {\n oracle = _oracle;\n }\n\n /**\n * @notice Registers a Seeker's power level. Only callable by the\n * owner or the oracle account.\n * @param seekerId The id of the Seeker.\n * @param power The power level of the Seeker.\n */\n function registerSeekerPowerRestricted(uint256 seekerId, uint256 power) external {\n if (msg.sender != oracle) {\n revert UnauthorizedRegisterSeekerPowerCall();\n }\n\n seekerPowers[seekerId] = power;\n emit SeekerPowerUpdated(seekerId, power);\n }\n\n /**\n * @notice Registers a Seeker's power level. Callable by any account\n * but requires a proof signed by the oracle.\n * @param seekerId The id of the Seeker.\n * @param power The power level of the Seeker.\n */\n function registerSeekerPower(\n uint256 seekerId,\n uint256 power,\n bytes32 nonce,\n bytes calldata proof\n ) external {\n if (proofNonces[nonce] != address(0)) {\n revert NonceCannotBeReused();\n }\n\n bytes memory proofMessage = getProofMessage(seekerId, power, nonce);\n bytes32 ecdsaHash = ECDSA.toEthSignedMessageHash(proofMessage);\n\n if (ECDSA.recover(ecdsaHash, proof) != oracle) {\n revert UnauthorizedRegisterSeekerPowerCall();\n }\n\n seekerPowers[seekerId] = power;\n proofNonces[nonce] = oracle;\n\n emit SeekerPowerUpdated(seekerId, power);\n }\n\n /**\n * @notice Retrieves a Seeker's stored power level.\n * @param seekerId The id of the Seeker.\n */\n function getSeekerPower(uint256 seekerId) external view returns (uint256) {\n return seekerPowers[seekerId];\n }\n\n /**\n * @notice Constructs a proof message for the oracle to sign.\n * @param seekerId The id of the Seeker.\n * @param power The power level of the Seeker.\n */\n function getProofMessage(\n uint256 seekerId,\n uint256 power,\n bytes32 nonce\n ) public pure returns (bytes memory) {\n return\n abi.encodePacked(\n Strings.toString(seekerId),\n \":\",\n Strings.toString(power),\n \":\",\n Strings.toHexString(uint256(nonce), 32)\n );\n }\n}\n" + }, + "contracts/staking/Directory.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"./StakingManager.sol\";\nimport \"../libraries/SyloUtils.sol\";\nimport \"../libraries/Manageable.sol\";\nimport \"../interfaces/staking/IDirectory.sol\";\nimport \"../payments/ticketing/RewardsManager.sol\";\n\n/**\n * @notice The Directory contract constructs and manages a structure holding the current stakes,\n * which is queried against using the scan function. The scan function allows submitting\n * random points which will return a staked node's address in proportion to the stake it has.\n */\ncontract Directory is IDirectory, Initializable, Manageable, IERC165 {\n /** Sylo Staking Manager contract */\n StakingManager public _stakingManager;\n\n /** Sylo Rewards Manager contract */\n RewardsManager public _rewardsManager;\n\n /**\n * @notice The epoch ID of the current directory.\n */\n uint256 public currentDirectory;\n\n /**\n * @notice Tracks every directory, which will be indexed by an epoch ID\n */\n mapping(uint256 => EpochDirectory) public directories;\n\n event CurrentDirectoryUpdated(uint256 indexed currentDirectory);\n\n error NoStakeToJoinEpoch();\n error StakeeAlreadyJoinedEpoch();\n error StakeeCannotBeZeroAddress();\n error NoJoiningStakeToJoinEpoch();\n\n function initialize(\n StakingManager stakingManager,\n RewardsManager rewardsManager\n ) external initializer {\n SyloUtils.validateContractInterface(\n \"StakingManager\",\n address(stakingManager),\n type(IStakingManager).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"RewardsManager\",\n address(rewardsManager),\n type(IRewardsManager).interfaceId\n );\n\n Ownable2StepUpgradeable.__Ownable2Step_init();\n\n _stakingManager = stakingManager;\n _rewardsManager = rewardsManager;\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IDirectory).interfaceId;\n }\n\n /**\n * @notice This function should be called when a new epoch is initialized.\n * This will set the current directory to the specified epoch. This is only\n * callable by the owner of this contract, which should be the EpochsManager\n * contract.\n * @dev After deployment, the EpochsManager should immediately be set as\n * the owner.\n * @param epochId The ID of the specified epoch.\n */\n function setCurrentDirectory(uint256 epochId) external onlyManager {\n currentDirectory = epochId;\n emit CurrentDirectoryUpdated(epochId);\n }\n\n /**\n * @notice This function is called by a node as a prerequisite to participate in the next epoch.\n * @dev This will construct the directory as nodes join. The directory is constructed\n * by creating a boundary value which is a sum of the current directory's total stake, and\n * the current stakee's total stake, and pushing the new boundary into the entries array.\n * The previous boundary and the current boundary essentially create a range, where if a\n * random point were to fall within that range, it would belong to the respective stakee.\n * The boundary value grows in size as each stakee joins, thus the directory array\n * always remains sorted. This allows us to perform a binary search on the directory.\n *\n * Example\n *\n * Stakes: [ Alice/20, Bob/10, Carl/40, Dave/25 ]\n * TotalStake: 95\n *\n * EpochDirectory:\n *\n * |-----------|------|----------------|--------|\n * Alice/20 Bob/30 Carl/70 Dave/95\n */\n function joinNextDirectory(address stakee) external onlyManager {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n\n uint256 nextEpochId = currentDirectory + 1;\n\n uint256 totalStake = _stakingManager.getStakeeTotalManagedStake(stakee);\n if (totalStake == 0) {\n revert NoStakeToJoinEpoch();\n }\n\n uint256 currentStake = _stakingManager.getCurrentStakerAmount(stakee, stakee);\n uint16 ownedStakeProportion = SyloUtils.asPerc(\n SafeCast.toUint128(currentStake),\n totalStake\n );\n\n uint16 minimumStakeProportion = _stakingManager.minimumStakeProportion();\n\n uint256 joiningStake;\n if (ownedStakeProportion >= minimumStakeProportion) {\n joiningStake = totalStake;\n } else {\n // if the node is below the minimum stake proportion, then we reduce\n // the stake used to join the epoch proportionally\n joiningStake = (totalStake * ownedStakeProportion) / minimumStakeProportion;\n }\n if (joiningStake == 0) {\n revert NoJoiningStakeToJoinEpoch();\n }\n\n if (directories[nextEpochId].stakes[stakee] > 0) {\n revert StakeeAlreadyJoinedEpoch();\n }\n\n uint256 nextBoundary = directories[nextEpochId].totalStake + joiningStake;\n\n directories[nextEpochId].entries.push(DirectoryEntry(stakee, nextBoundary));\n directories[nextEpochId].stakes[stakee] = joiningStake;\n directories[nextEpochId].totalStake = nextBoundary;\n }\n\n /**\n * @notice Call this to perform a stake-weighted scan to find the Node assigned\n * to the given point of the current directory.\n * @param point The point, which will usually be a hash of a public key.\n */\n function scan(uint128 point) external view returns (address stakee) {\n return _scan(point, currentDirectory);\n }\n\n /**\n * @notice Call this to perform a stake-weighted scan to find the Node assigned\n * to the given point of the requested directory.\n * @param point The point, which will usually be a hash of a public key.\n * @param epochId The epoch id associated with the directory to scan.\n */\n function scanWithEpochId(\n uint128 point,\n uint256 epochId\n ) external view returns (address stakee) {\n return _scan(point, epochId);\n }\n\n /**\n * @notice Call this to perform a stake-weighted scan to find the Node assigned\n * to the given point of the requested directory (internal).\n * @dev The current implementation will perform a binary search through\n * the directory. This can allow gas costs to be low if this needs to be\n * used in a transaction.\n * @param point The point, which will usually be a hash of a public key.\n * @param epochId The epoch id associated with the directory to scan.\n */\n function _scan(uint128 point, uint256 epochId) internal view returns (address stakee) {\n uint256 entryLength = directories[epochId].entries.length;\n\n if (entryLength == 0) {\n return address(0);\n }\n\n // Staking all the Sylo would only be 94 bits, so multiplying this with\n // a uint128 cannot overflow a uint256.\n uint256 expectedVal = (directories[epochId].totalStake * uint256(point)) >> 128;\n\n uint256 left;\n uint256 right = entryLength - 1;\n\n // perform a binary search through the directory\n uint256 lower;\n uint256 upper;\n uint256 index;\n\n while (left <= right) {\n index = (left + right) >> 1;\n\n lower = index == 0 ? 0 : directories[epochId].entries[index - 1].boundary;\n upper = directories[epochId].entries[index].boundary;\n\n if (expectedVal >= lower && expectedVal < upper) {\n return directories[epochId].entries[index].stakee;\n } else if (expectedVal < lower) {\n right = index - 1;\n } else {\n // expectedVal >= upper\n left = index + 1;\n }\n }\n }\n\n /**\n * @notice Retrieve the total stake a Node has for the directory in the\n * specified epoch.\n * @param epochId The ID of the epoch.\n * @param stakee The address of the Node.\n * @return The amount of stake the Node has for the given directory in SOLO.\n */\n function getTotalStakeForStakee(\n uint256 epochId,\n address stakee\n ) external view returns (uint256) {\n return directories[epochId].stakes[stakee];\n }\n\n /**\n * @notice Retrieve the total stake for a directory in the specified epoch, which\n * will be the sum of the stakes for all Nodes participating in that epoch.\n * @param epochId The ID of the epoch.\n * @return The total amount of stake in SOLO.\n */\n function getTotalStake(uint256 epochId) external view returns (uint256) {\n return directories[epochId].totalStake;\n }\n\n /**\n * @notice Retrieve all entries for a directory in a specified epoch.\n * @return An array of all the directory entries.\n */\n function getEntries(\n uint256 epochId\n ) external view returns (address[] memory, uint256[] memory) {\n uint256 entryLength = directories[epochId].entries.length;\n\n address[] memory stakees = new address[](entryLength);\n uint256[] memory boundaries = new uint256[](entryLength);\n\n DirectoryEntry memory entry;\n DirectoryEntry[] memory entries = directories[epochId].entries;\n\n for (uint256 i; i < entryLength; ++i) {\n entry = entries[i];\n stakees[i] = entry.stakee;\n boundaries[i] = entry.boundary;\n }\n return (stakees, boundaries);\n }\n}\n" + }, + "contracts/staking/StakingManager.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\n\nimport \"../SyloToken.sol\";\nimport \"../libraries/SyloUtils.sol\";\nimport \"../epochs/EpochsManager.sol\";\nimport \"../payments/ticketing/RewardsManager.sol\";\nimport \"../interfaces/staking/IStakingManager.sol\";\n\n/**\n * @notice Manages stakes and delegated stakes for Nodes. Holding\n * staked Sylo is necessary for a Node to participate in the\n * Sylo Network. The stake is used in stake-weighted scan function,\n * and delegated stakers are rewarded on a pro-rata basis.\n */\ncontract StakingManager is IStakingManager, Initializable, Ownable2StepUpgradeable, ERC165 {\n /** ERC 20 compatible token we are dealing with */\n IERC20 public _token;\n\n /**\n * @notice Rewards Manager contract. Any changes to stake will automatically\n * trigger a claim to any outstanding rewards.\n */\n RewardsManager public _rewardsManager;\n\n EpochsManager public _epochsManager;\n\n /**\n * @notice Tracks the managed stake for every Node.\n */\n mapping(address => Stake) public stakes;\n\n /** @notice Tracks overall total stake held by this contract */\n uint256 public totalManagedStake;\n\n /**\n * @notice Tracks funds that are in the process of being unlocked. This\n * is indexed by a key that hashes both the address of the staked Node and\n * the address of the staker.\n */\n mapping(bytes32 => Unlock) public unlockings;\n\n /**\n * @notice The number of blocks a user must wait after calling \"unlock\"\n * before they can withdraw their stake\n */\n uint256 public unlockDuration;\n\n /**\n * @notice Minimum amount of stake that a Node needs to stake\n * against itself in order to participate in the network. This is\n * represented as a percentage of the Node's total stake, where\n * the value is a ratio of 10000.\n */\n uint16 public minimumStakeProportion;\n\n event UnlockDurationUpdated(uint256 unlockDuration);\n event MinimumStakeProportionUpdated(uint256 minimumStakeProportion);\n\n error NoStakeToUnlock();\n error StakeNotYetUnlocked();\n error CannotStakeZeroAmount();\n error CannotUnlockZeroAmount();\n error TokenCannotBeZeroAddress();\n error StakeeCannotBeZeroAddress();\n error UnlockDurationCannotBeZero();\n error CannotCancelUnlockZeroAmount();\n error CannotUnlockMoreThanStaked(uint256 stakeAmount, uint256 unlockAmount);\n error StakeCapacityReached(uint256 maxCapacity, uint256 currentCapacity);\n\n function initialize(\n IERC20 token,\n RewardsManager rewardsManager,\n EpochsManager epochsManager,\n uint256 _unlockDuration,\n uint16 _minimumStakeProportion\n ) external initializer {\n if (address(token) == address(0)) {\n revert TokenCannotBeZeroAddress();\n }\n\n SyloUtils.validateContractInterface(\n \"RewardsManager\",\n address(rewardsManager),\n type(IRewardsManager).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"EpochsManager\",\n address(epochsManager),\n type(IEpochsManager).interfaceId\n );\n\n if (_unlockDuration == 0) {\n revert UnlockDurationCannotBeZero();\n }\n\n Ownable2StepUpgradeable.__Ownable2Step_init();\n\n _token = token;\n _rewardsManager = rewardsManager;\n _epochsManager = epochsManager;\n unlockDuration = _unlockDuration;\n minimumStakeProportion = _minimumStakeProportion;\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IStakingManager).interfaceId;\n }\n\n /**\n * @notice Sets the unlock duration for stakes. Only callable by\n * the owner.\n * @param _unlockDuration The unlock duration in number of blocks.\n */\n function setUnlockDuration(uint256 _unlockDuration) external onlyOwner {\n if (_unlockDuration == 0) {\n revert UnlockDurationCannotBeZero();\n }\n\n unlockDuration = _unlockDuration;\n emit UnlockDurationUpdated(_unlockDuration);\n }\n\n /**\n * @notice Sets the minimum stake proportion for Nodes. Only callable by\n * the owner.\n * @param _minimumStakeProportion The minimum stake proportion in SOLO.\n */\n function setMinimumStakeProportion(uint16 _minimumStakeProportion) external onlyOwner {\n minimumStakeProportion = _minimumStakeProportion;\n emit MinimumStakeProportionUpdated(_minimumStakeProportion);\n }\n\n /**\n * @notice Called by Nodes and delegated stakers to add stake.\n * This function will fail under the following conditions:\n * - If the Node address is invalid\n * - If the specified stake value is zero\n * - If the additional stake causes the Node to fail to meet the\n * minimum stake proportion requirement.\n * @param amount The amount of stake to add in SOLO.\n * @param stakee The address of the staked Node.\n */\n function addStake(uint256 amount, address stakee) external {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n if (amount == 0) {\n revert CannotStakeZeroAmount();\n }\n\n _addStake(amount, stakee);\n SafeERC20.safeTransferFrom(_token, msg.sender, address(this), amount);\n }\n\n function _addStake(uint256 amount, address stakee) internal {\n // automatically move any pending rewards generated by their existing stake\n _rewardsManager.updatePendingRewards(stakee, msg.sender);\n\n uint256 currentEpochId = _epochsManager.currentIteration();\n\n Stake storage stake = stakes[stakee];\n\n uint256 currentStake = getCurrentStakerAmount(stakee, msg.sender);\n\n stake.stakeEntries[msg.sender] = StakeEntry(\n currentStake + amount,\n block.number,\n currentEpochId\n );\n\n stake.totalManagedStake = stake.totalManagedStake + amount;\n totalManagedStake = totalManagedStake + amount;\n }\n\n /**\n * @notice Call this function to begin the unlocking process. Calling this\n * will trigger an automatic claim of any outstanding staking rewards. Any\n * stake that was already in the unlocking phase will have the specified\n * amount added to it, and its duration refreshed. This function will fail\n * under the following conditions:\n * - If no stake exists for the caller\n * - If the unlock amount is zero\n * - If the unlock amount is more than what is staked\n * Note: If calling as a Node, this function will *not* revert if it causes\n * the Node to fail to meet the minimum stake proportion. However it will still\n * prevent the Node from participating in the network until the minimum is met\n * again.\n * @param amount The amount of stake to unlock in SOLO.\n * @param stakee The address of the staked Node.\n */\n function unlockStake(uint256 amount, address stakee) external returns (uint256) {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n if (amount == 0) {\n revert CannotUnlockZeroAmount();\n }\n\n uint256 currentStake = getCurrentStakerAmount(stakee, msg.sender);\n\n if (currentStake == 0) {\n revert NoStakeToUnlock();\n }\n if (currentStake < amount) {\n revert CannotUnlockMoreThanStaked(currentStake, amount);\n }\n\n // automatically move any pending rewards generated by their existing stake\n _rewardsManager.updatePendingRewards(stakee, msg.sender);\n\n uint256 currentEpochId = _epochsManager.currentIteration();\n\n Stake storage stake = stakes[stakee];\n\n stake.stakeEntries[msg.sender] = StakeEntry(\n currentStake - amount,\n block.number,\n currentEpochId\n );\n\n stake.totalManagedStake = stake.totalManagedStake - amount;\n totalManagedStake = totalManagedStake - amount;\n\n bytes32 key = getKey(stakee, msg.sender);\n\n // Keep track of when the stake can be withdrawn\n Unlock storage unlock = unlockings[key];\n\n uint256 unlockAt = block.number + unlockDuration;\n if (unlock.unlockAt < unlockAt) {\n unlock.unlockAt = unlockAt;\n }\n\n unlock.amount = unlock.amount + amount;\n\n return unlockAt;\n }\n\n /**\n * @notice Call this function to withdraw stake that has finished unlocking.\n * This will fail if the stake has not yet unlocked.\n * @param stakee The address of the staked Node.\n */\n function withdrawStake(address stakee) external {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n\n bytes32 key = getKey(stakee, msg.sender);\n\n Unlock storage unlock = unlockings[key];\n\n if (unlock.unlockAt >= block.number) {\n revert StakeNotYetUnlocked();\n }\n\n uint256 amount = unlock.amount;\n\n delete unlockings[key];\n\n SafeERC20.safeTransfer(_token, msg.sender, amount);\n }\n\n /**\n * @notice Call this function to cancel any stake that is in the process\n * of unlocking. As this essentially adds back stake to the Node, this\n * will trigger an automatic claim of any outstanding staking rewards.\n * If the specified amount to cancel is greater than the stake that is\n * currently being unlocked, it will cancel the maximum stake possible.\n * @param amount The amount of unlocking stake to cancel in SOLO.\n * @param stakee The address of the staked Node.\n */\n function cancelUnlocking(uint256 amount, address stakee) external {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n if (amount == 0) {\n revert CannotCancelUnlockZeroAmount();\n }\n\n bytes32 key = getKey(stakee, msg.sender);\n\n Unlock storage unlock = unlockings[key];\n\n if (amount >= unlock.amount) {\n amount = unlock.amount;\n delete unlockings[key];\n } else {\n unlock.amount = unlock.amount - amount;\n }\n\n _addStake(amount, stakee);\n }\n\n /**\n * @notice This function should be called by clients to determine how much\n * additional delegated stake can be allocated to a Node via an addStake or\n * cancelUnlocking call. This is useful to avoid a revert due to\n * the minimum stake proportion requirement not being met from the additional stake.\n * @param stakee The address of the staked Node.\n */\n function calculateMaxAdditionalDelegatedStake(address stakee) external view returns (uint256) {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n\n Stake storage stake = stakes[stakee];\n\n uint256 currentlyOwnedStake = stake.stakeEntries[stakee].amount;\n uint256 totalMaxStake = (currentlyOwnedStake * SyloUtils.PERCENTAGE_DENOMINATOR) /\n minimumStakeProportion;\n\n if (totalMaxStake < stake.totalManagedStake) {\n revert StakeCapacityReached(totalMaxStake, stake.totalManagedStake);\n }\n\n return totalMaxStake - stake.totalManagedStake;\n }\n\n /**\n * @notice Retrieve the key used to index a stake entry. The key is a hash\n * which takes both address of the Node and the staker as input.\n * @param stakee The address of the staked Node.\n * @param staker The address of the staker.\n * @return A byte-array representing the key.\n */\n function getKey(address stakee, address staker) public pure returns (bytes32) {\n return keccak256(abi.encodePacked(stakee, staker));\n }\n\n /**\n * @notice Retrieve the total stake being managed by this contract.\n * @return The total amount of managed stake in SOLO.\n */\n function getTotalManagedStake() external view returns (uint256) {\n return totalManagedStake;\n }\n\n /**\n * @notice Retrieve a stake entry.\n * @param stakee The address of the staked Node.\n * @param staker The address of the staker.\n * @return The stake entry.\n */\n function getStakeEntry(\n address stakee,\n address staker\n ) external view returns (StakeEntry memory) {\n return stakes[stakee].stakeEntries[staker];\n }\n\n /**\n * @notice Retrieve the total amount of SOLO staked against a Node.\n * @param stakee The address of the staked Node.\n * @return The amount of staked SOLO.\n */\n function getStakeeTotalManagedStake(address stakee) external view returns (uint256) {\n return stakes[stakee].totalManagedStake;\n }\n\n /**\n * @notice Check if a Node is meeting the minimum stake proportion requirement.\n * @param stakee The address of the staked Node.\n * @return True if the Node is meeting minimum stake proportion requirement.\n */\n function checkMinimumStakeProportion(address stakee) public view returns (bool) {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n\n Stake storage stake = stakes[stakee];\n\n uint256 currentlyOwnedStake = stake.stakeEntries[stakee].amount;\n uint16 ownedStakeProportion = SyloUtils.asPerc(\n SafeCast.toUint128(currentlyOwnedStake),\n stake.totalManagedStake\n );\n\n return ownedStakeProportion >= minimumStakeProportion;\n }\n\n /**\n * @notice Retrieve the current amount of SOLO staked against a Node by\n * a specified staker.\n * @param stakee The address of the staked Node.\n * @param staker The address of the staker.\n * @return The amount of staked SOLO.\n */\n function getCurrentStakerAmount(address stakee, address staker) public view returns (uint256) {\n return stakes[stakee].stakeEntries[staker].amount;\n }\n}\n" + }, + "contracts/SyloToken.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract SyloToken is ERC20 {\n constructor() ERC20(\"Sylo\", \"SYLO\") {\n _mint(msg.sender, 10_000_000_000 ether);\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/deployments/porcini-dev/solcInputs/0e89febeebc7444140de8e67c9067d2c.json b/deployments/porcini-dev/solcInputs/0e89febeebc7444140de8e67c9067d2c.json new file mode 100644 index 00000000..6eb5ed90 --- /dev/null +++ b/deployments/porcini-dev/solcInputs/0e89febeebc7444140de8e67c9067d2c.json @@ -0,0 +1,80 @@ +{ + "language": "Solidity", + "sources": { + "solc_0.8/openzeppelin/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor (address initialOwner) {\n _transferOwnership(initialOwner);\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "solc_0.8/openzeppelin/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" + }, + "solc_0.8/openzeppelin/proxy/transparent/ProxyAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/ProxyAdmin.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./TransparentUpgradeableProxy.sol\";\nimport \"../../access/Ownable.sol\";\n\n/**\n * @dev This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For an\n * explanation of why you would want to use this see the documentation for {TransparentUpgradeableProxy}.\n */\ncontract ProxyAdmin is Ownable {\n\n constructor (address initialOwner) Ownable(initialOwner) {}\n\n /**\n * @dev Returns the current implementation of `proxy`.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function getProxyImplementation(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"implementation()\")) == 0x5c60da1b\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"5c60da1b\");\n require(success);\n return abi.decode(returndata, (address));\n }\n\n /**\n * @dev Returns the current admin of `proxy`.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function getProxyAdmin(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"admin()\")) == 0xf851a440\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"f851a440\");\n require(success);\n return abi.decode(returndata, (address));\n }\n\n /**\n * @dev Changes the admin of `proxy` to `newAdmin`.\n *\n * Requirements:\n *\n * - This contract must be the current admin of `proxy`.\n */\n function changeProxyAdmin(TransparentUpgradeableProxy proxy, address newAdmin) public virtual onlyOwner {\n proxy.changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrades `proxy` to `implementation`. See {TransparentUpgradeableProxy-upgradeTo}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function upgrade(TransparentUpgradeableProxy proxy, address implementation) public virtual onlyOwner {\n proxy.upgradeTo(implementation);\n }\n\n /**\n * @dev Upgrades `proxy` to `implementation` and calls a function on the new implementation. See\n * {TransparentUpgradeableProxy-upgradeToAndCall}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function upgradeAndCall(\n TransparentUpgradeableProxy proxy,\n address implementation,\n bytes memory data\n ) public payable virtual onlyOwner {\n proxy.upgradeToAndCall{value: msg.value}(implementation, data);\n }\n}\n" + }, + "solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1967/ERC1967Proxy.sol\";\n\n/**\n * @dev This contract implements a proxy that is upgradeable by an admin.\n *\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\n * clashing], which can potentially be used in an attack, this contract uses the\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\n * things that go hand in hand:\n *\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\n * that call matches one of the admin functions exposed by the proxy itself.\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\n * \"admin cannot fallback to proxy target\".\n *\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\n * to sudden errors when trying to call a function from the proxy implementation.\n *\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\n */\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\n /**\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\n */\n constructor(\n address _logic,\n address admin_,\n bytes memory _data\n ) payable ERC1967Proxy(_logic, _data) {\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\"eip1967.proxy.admin\")) - 1));\n _changeAdmin(admin_);\n }\n\n /**\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\n */\n modifier ifAdmin() {\n if (msg.sender == _getAdmin()) {\n _;\n } else {\n _fallback();\n }\n }\n\n /**\n * @dev Returns the current admin.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\n */\n function admin() external ifAdmin returns (address admin_) {\n admin_ = _getAdmin();\n }\n\n /**\n * @dev Returns the current implementation.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\n */\n function implementation() external ifAdmin returns (address implementation_) {\n implementation_ = _implementation();\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\n */\n function changeAdmin(address newAdmin) external virtual ifAdmin {\n _changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\n */\n function upgradeTo(address newImplementation) external ifAdmin {\n _upgradeToAndCall(newImplementation, bytes(\"\"), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\n * proxied contract.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\n */\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\n _upgradeToAndCall(newImplementation, data, true);\n }\n\n /**\n * @dev Returns the current admin.\n */\n function _admin() internal view virtual returns (address) {\n return _getAdmin();\n }\n\n /**\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\n */\n function _beforeFallback() internal virtual override {\n require(msg.sender != _getAdmin(), \"TransparentUpgradeableProxy: admin cannot fallback to proxy target\");\n super._beforeFallback();\n }\n}\n" + }, + "solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 initializating the storage of the proxy like a Solidity constructor.\n */\n constructor(address _logic, bytes memory _data) payable {\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\"eip1967.proxy.implementation\")) - 1));\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" + }, + "solc_0.8/openzeppelin/proxy/Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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 overriden 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 internall 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 overriden should call `super._beforeFallback()`.\n */\n function _beforeFallback() internal virtual {}\n}\n" + }, + "solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeacon.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 *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967Upgrade {\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 Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\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(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) 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(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) 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 Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view virtual 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 Emitted when the beacon is upgraded.\n */\n event BeaconUpgraded(address indexed beacon);\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(Address.isContract(IBeacon(newBeacon).implementation()), \"ERC1967: beacon implementation is not a contract\");\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(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) 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" + }, + "solc_0.8/openzeppelin/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" + }, + "solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0-rc.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" + }, + "solc_0.8/openzeppelin/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "solc_0.8/openzeppelin/utils/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\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 * ```\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`, and `uint256`._\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 /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\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 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 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 assembly {\n r.slot := slot\n }\n }\n}\n" + }, + "solc_0.8/proxy/OptimizedTransparentUpgradeableProxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\";\n\n/**\n * @dev This contract implements a proxy that is upgradeable by an admin.\n *\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\n * clashing], which can potentially be used in an attack, this contract uses the\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\n * things that go hand in hand:\n *\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\n * that call matches one of the admin functions exposed by the proxy itself.\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\n * \"admin cannot fallback to proxy target\".\n *\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\n * to sudden errors when trying to call a function from the proxy implementation.\n *\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\n */\ncontract OptimizedTransparentUpgradeableProxy is ERC1967Proxy {\n address internal immutable _ADMIN;\n\n /**\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\n */\n constructor(\n address _logic,\n address admin_,\n bytes memory _data\n ) payable ERC1967Proxy(_logic, _data) {\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\"eip1967.proxy.admin\")) - 1));\n _ADMIN = admin_;\n\n // still store it to work with EIP-1967\n bytes32 slot = _ADMIN_SLOT;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sstore(slot, admin_)\n }\n emit AdminChanged(address(0), admin_);\n }\n\n /**\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\n */\n modifier ifAdmin() {\n if (msg.sender == _getAdmin()) {\n _;\n } else {\n _fallback();\n }\n }\n\n /**\n * @dev Returns the current admin.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\n */\n function admin() external ifAdmin returns (address admin_) {\n admin_ = _getAdmin();\n }\n\n /**\n * @dev Returns the current implementation.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\n */\n function implementation() external ifAdmin returns (address implementation_) {\n implementation_ = _implementation();\n }\n\n /**\n * @dev Upgrade the implementation of the proxy.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\n */\n function upgradeTo(address newImplementation) external ifAdmin {\n _upgradeToAndCall(newImplementation, bytes(\"\"), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\n * proxied contract.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\n */\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\n _upgradeToAndCall(newImplementation, data, true);\n }\n\n /**\n * @dev Returns the current admin.\n */\n function _admin() internal view virtual returns (address) {\n return _getAdmin();\n }\n\n /**\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\n */\n function _beforeFallback() internal virtual override {\n require(msg.sender != _getAdmin(), \"TransparentUpgradeableProxy: admin cannot fallback to proxy target\");\n super._beforeFallback();\n }\n\n function _getAdmin() internal view virtual override returns (address) {\n return _ADMIN;\n }\n}\n" + }, + "solc_0.8/openzeppelin/proxy/utils/UUPSUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/utils/UUPSUpgradeable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/draft-IERC1822.sol\";\nimport \"../ERC1967/ERC1967Upgrade.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 IERC1822Proxiable, ERC1967Upgrade {\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 that the this implementation remains valid after 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 function upgradeTo(address newImplementation) external 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 function upgradeToAndCall(address newImplementation, bytes memory data) external 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" + }, + "solc_0.8/openzeppelin/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/Address.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 * 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 initialize the implementation contract, you can either invoke the\n * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() initializer {}\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n */\n bool private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Modifier to protect an initializer function from being invoked twice.\n */\n modifier initializer() {\n // If the contract is initializing we ignore whether _initialized is set in order to support multiple\n // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the\n // contract may have been reentered.\n require(_initializing ? _isConstructor() : !_initialized, \"Initializable: contract is already initialized\");\n\n bool isTopLevelCall = !_initializing;\n if (isTopLevelCall) {\n _initializing = true;\n _initialized = true;\n }\n\n _;\n\n if (isTopLevelCall) {\n _initializing = false;\n }\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} modifier, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n function _isConstructor() private view returns (bool) {\n return !Address.isContract(address(this));\n }\n}\n" + }, + "solc_0.8/openzeppelin/proxy/beacon/UpgradeableBeacon.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/UpgradeableBeacon.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IBeacon.sol\";\nimport \"../../access/Ownable.sol\";\nimport \"../../utils/Address.sol\";\n\n/**\n * @dev This contract is used in conjunction with one or more instances of {BeaconProxy} to determine their\n * implementation contract, which is where they will delegate all function calls.\n *\n * An owner is able to change the implementation the beacon points to, thus upgrading the proxies that use this beacon.\n */\ncontract UpgradeableBeacon is IBeacon, Ownable {\n address private _implementation;\n\n /**\n * @dev Emitted when the implementation returned by the beacon is changed.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Sets the address of the initial implementation, and the deployer account as the owner who can upgrade the\n * beacon.\n */\n\n constructor(address implementation_, address initialOwner) Ownable(initialOwner) {\n _setImplementation(implementation_);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function implementation() public view virtual override returns (address) {\n return _implementation;\n }\n\n /**\n * @dev Upgrades the beacon to a new implementation.\n *\n * Emits an {Upgraded} event.\n *\n * Requirements:\n *\n * - msg.sender must be the owner of the contract.\n * - `newImplementation` must be a contract.\n */\n function upgradeTo(address newImplementation) public virtual onlyOwner {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Sets the implementation contract address for this beacon\n *\n * Requirements:\n *\n * - `newImplementation` must be a contract.\n */\n function _setImplementation(address newImplementation) private {\n require(Address.isContract(newImplementation), \"UpgradeableBeacon: implementation is not a contract\");\n _implementation = newImplementation;\n }\n}\n" + }, + "solc_0.8/openzeppelin/proxy/beacon/BeaconProxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/BeaconProxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IBeacon.sol\";\nimport \"../Proxy.sol\";\nimport \"../ERC1967/ERC1967Upgrade.sol\";\n\n/**\n * @dev This contract implements a proxy that gets the implementation address for each call from a {UpgradeableBeacon}.\n *\n * The beacon address is stored in storage slot `uint256(keccak256('eip1967.proxy.beacon')) - 1`, so that it doesn't\n * conflict with the storage layout of the implementation behind the proxy.\n *\n * _Available since v3.4._\n */\ncontract BeaconProxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Initializes the proxy with `beacon`.\n *\n * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. This\n * will typically be an encoded function call, and allows initializating the storage of the proxy like a Solidity\n * constructor.\n *\n * Requirements:\n *\n * - `beacon` must be a contract with the interface {IBeacon}.\n */\n constructor(address beacon, bytes memory data) payable {\n assert(_BEACON_SLOT == bytes32(uint256(keccak256(\"eip1967.proxy.beacon\")) - 1));\n _upgradeBeaconToAndCall(beacon, data, false);\n }\n\n /**\n * @dev Returns the current beacon address.\n */\n function _beacon() internal view virtual returns (address) {\n return _getBeacon();\n }\n\n /**\n * @dev Returns the current implementation address of the associated beacon.\n */\n function _implementation() internal view virtual override returns (address) {\n return IBeacon(_getBeacon()).implementation();\n }\n\n /**\n * @dev Changes the proxy to use a new beacon. Deprecated: see {_upgradeBeaconToAndCall}.\n *\n * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon.\n *\n * Requirements:\n *\n * - `beacon` must be a contract.\n * - The implementation returned by `beacon` must be a contract.\n */\n function _setBeacon(address beacon, bytes memory data) internal virtual {\n _upgradeBeaconToAndCall(beacon, data, false);\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 999999 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/deployments/porcini-dev/solcInputs/4e3bc77852cb55aaa633eb254b5b5cf7.json b/deployments/porcini-dev/solcInputs/4e3bc77852cb55aaa633eb254b5b5cf7.json new file mode 100644 index 00000000..d080b3f9 --- /dev/null +++ b/deployments/porcini-dev/solcInputs/4e3bc77852cb55aaa633eb254b5b5cf7.json @@ -0,0 +1,161 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./OwnableUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership} and {acceptOwnership}.\n *\n * This module is used through inheritance. It will make available all functions\n * from parent (Ownable).\n */\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\n function __Ownable2Step_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable2Step_init_unchained() internal onlyInitializing {\n }\n address private _pendingOwner;\n\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Returns the address of the pending owner.\n */\n function pendingOwner() public view virtual returns (address) {\n return _pendingOwner;\n }\n\n /**\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual override onlyOwner {\n _pendingOwner = newOwner;\n emit OwnershipTransferStarted(owner(), newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual override {\n delete _pendingOwner;\n super._transferOwnership(newOwner);\n }\n\n /**\n * @dev The new owner accepts the ownership transfer.\n */\n function acceptOwnership() public virtual {\n address sender = _msgSender();\n require(pendingOwner() == sender, \"Ownable2Step: caller is not the new owner\");\n _transferOwnership(sender);\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/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n /**\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/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/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/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/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/extensions/IERC20Permit.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 IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/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/ERC20/utils/SafeERC20.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 \"../IERC20.sol\";\nimport \"../extensions/IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.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(IERC20 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(IERC20 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(IERC20 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(IERC20 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(IERC20 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 IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n 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(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\n }\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/cryptography/ECDSA.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 \"../Strings.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 ECDSA {\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\", Strings.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/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/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/math/Math.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 Math {\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/utils/math/SafeCast.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n *\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\n * all math on `uint256` and `int256` and then downcasting.\n */\nlibrary SafeCast {\n /**\n * @dev Returns the downcasted uint248 from uint256, reverting on\n * overflow (when the input is greater than largest uint248).\n *\n * Counterpart to Solidity's `uint248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n *\n * _Available since v4.7._\n */\n function toUint248(uint256 value) internal pure returns (uint248) {\n require(value <= type(uint248).max, \"SafeCast: value doesn't fit in 248 bits\");\n return uint248(value);\n }\n\n /**\n * @dev Returns the downcasted uint240 from uint256, reverting on\n * overflow (when the input is greater than largest uint240).\n *\n * Counterpart to Solidity's `uint240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n *\n * _Available since v4.7._\n */\n function toUint240(uint256 value) internal pure returns (uint240) {\n require(value <= type(uint240).max, \"SafeCast: value doesn't fit in 240 bits\");\n return uint240(value);\n }\n\n /**\n * @dev Returns the downcasted uint232 from uint256, reverting on\n * overflow (when the input is greater than largest uint232).\n *\n * Counterpart to Solidity's `uint232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n *\n * _Available since v4.7._\n */\n function toUint232(uint256 value) internal pure returns (uint232) {\n require(value <= type(uint232).max, \"SafeCast: value doesn't fit in 232 bits\");\n return uint232(value);\n }\n\n /**\n * @dev Returns the downcasted uint224 from uint256, reverting on\n * overflow (when the input is greater than largest uint224).\n *\n * Counterpart to Solidity's `uint224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n *\n * _Available since v4.2._\n */\n function toUint224(uint256 value) internal pure returns (uint224) {\n require(value <= type(uint224).max, \"SafeCast: value doesn't fit in 224 bits\");\n return uint224(value);\n }\n\n /**\n * @dev Returns the downcasted uint216 from uint256, reverting on\n * overflow (when the input is greater than largest uint216).\n *\n * Counterpart to Solidity's `uint216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n *\n * _Available since v4.7._\n */\n function toUint216(uint256 value) internal pure returns (uint216) {\n require(value <= type(uint216).max, \"SafeCast: value doesn't fit in 216 bits\");\n return uint216(value);\n }\n\n /**\n * @dev Returns the downcasted uint208 from uint256, reverting on\n * overflow (when the input is greater than largest uint208).\n *\n * Counterpart to Solidity's `uint208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n *\n * _Available since v4.7._\n */\n function toUint208(uint256 value) internal pure returns (uint208) {\n require(value <= type(uint208).max, \"SafeCast: value doesn't fit in 208 bits\");\n return uint208(value);\n }\n\n /**\n * @dev Returns the downcasted uint200 from uint256, reverting on\n * overflow (when the input is greater than largest uint200).\n *\n * Counterpart to Solidity's `uint200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n *\n * _Available since v4.7._\n */\n function toUint200(uint256 value) internal pure returns (uint200) {\n require(value <= type(uint200).max, \"SafeCast: value doesn't fit in 200 bits\");\n return uint200(value);\n }\n\n /**\n * @dev Returns the downcasted uint192 from uint256, reverting on\n * overflow (when the input is greater than largest uint192).\n *\n * Counterpart to Solidity's `uint192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n *\n * _Available since v4.7._\n */\n function toUint192(uint256 value) internal pure returns (uint192) {\n require(value <= type(uint192).max, \"SafeCast: value doesn't fit in 192 bits\");\n return uint192(value);\n }\n\n /**\n * @dev Returns the downcasted uint184 from uint256, reverting on\n * overflow (when the input is greater than largest uint184).\n *\n * Counterpart to Solidity's `uint184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n *\n * _Available since v4.7._\n */\n function toUint184(uint256 value) internal pure returns (uint184) {\n require(value <= type(uint184).max, \"SafeCast: value doesn't fit in 184 bits\");\n return uint184(value);\n }\n\n /**\n * @dev Returns the downcasted uint176 from uint256, reverting on\n * overflow (when the input is greater than largest uint176).\n *\n * Counterpart to Solidity's `uint176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n *\n * _Available since v4.7._\n */\n function toUint176(uint256 value) internal pure returns (uint176) {\n require(value <= type(uint176).max, \"SafeCast: value doesn't fit in 176 bits\");\n return uint176(value);\n }\n\n /**\n * @dev Returns the downcasted uint168 from uint256, reverting on\n * overflow (when the input is greater than largest uint168).\n *\n * Counterpart to Solidity's `uint168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n *\n * _Available since v4.7._\n */\n function toUint168(uint256 value) internal pure returns (uint168) {\n require(value <= type(uint168).max, \"SafeCast: value doesn't fit in 168 bits\");\n return uint168(value);\n }\n\n /**\n * @dev Returns the downcasted uint160 from uint256, reverting on\n * overflow (when the input is greater than largest uint160).\n *\n * Counterpart to Solidity's `uint160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n *\n * _Available since v4.7._\n */\n function toUint160(uint256 value) internal pure returns (uint160) {\n require(value <= type(uint160).max, \"SafeCast: value doesn't fit in 160 bits\");\n return uint160(value);\n }\n\n /**\n * @dev Returns the downcasted uint152 from uint256, reverting on\n * overflow (when the input is greater than largest uint152).\n *\n * Counterpart to Solidity's `uint152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n *\n * _Available since v4.7._\n */\n function toUint152(uint256 value) internal pure returns (uint152) {\n require(value <= type(uint152).max, \"SafeCast: value doesn't fit in 152 bits\");\n return uint152(value);\n }\n\n /**\n * @dev Returns the downcasted uint144 from uint256, reverting on\n * overflow (when the input is greater than largest uint144).\n *\n * Counterpart to Solidity's `uint144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n *\n * _Available since v4.7._\n */\n function toUint144(uint256 value) internal pure returns (uint144) {\n require(value <= type(uint144).max, \"SafeCast: value doesn't fit in 144 bits\");\n return uint144(value);\n }\n\n /**\n * @dev Returns the downcasted uint136 from uint256, reverting on\n * overflow (when the input is greater than largest uint136).\n *\n * Counterpart to Solidity's `uint136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n *\n * _Available since v4.7._\n */\n function toUint136(uint256 value) internal pure returns (uint136) {\n require(value <= type(uint136).max, \"SafeCast: value doesn't fit in 136 bits\");\n return uint136(value);\n }\n\n /**\n * @dev Returns the downcasted uint128 from uint256, reverting on\n * overflow (when the input is greater than largest uint128).\n *\n * Counterpart to Solidity's `uint128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v2.5._\n */\n function toUint128(uint256 value) internal pure returns (uint128) {\n require(value <= type(uint128).max, \"SafeCast: value doesn't fit in 128 bits\");\n return uint128(value);\n }\n\n /**\n * @dev Returns the downcasted uint120 from uint256, reverting on\n * overflow (when the input is greater than largest uint120).\n *\n * Counterpart to Solidity's `uint120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n *\n * _Available since v4.7._\n */\n function toUint120(uint256 value) internal pure returns (uint120) {\n require(value <= type(uint120).max, \"SafeCast: value doesn't fit in 120 bits\");\n return uint120(value);\n }\n\n /**\n * @dev Returns the downcasted uint112 from uint256, reverting on\n * overflow (when the input is greater than largest uint112).\n *\n * Counterpart to Solidity's `uint112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n *\n * _Available since v4.7._\n */\n function toUint112(uint256 value) internal pure returns (uint112) {\n require(value <= type(uint112).max, \"SafeCast: value doesn't fit in 112 bits\");\n return uint112(value);\n }\n\n /**\n * @dev Returns the downcasted uint104 from uint256, reverting on\n * overflow (when the input is greater than largest uint104).\n *\n * Counterpart to Solidity's `uint104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n *\n * _Available since v4.7._\n */\n function toUint104(uint256 value) internal pure returns (uint104) {\n require(value <= type(uint104).max, \"SafeCast: value doesn't fit in 104 bits\");\n return uint104(value);\n }\n\n /**\n * @dev Returns the downcasted uint96 from uint256, reverting on\n * overflow (when the input is greater than largest uint96).\n *\n * Counterpart to Solidity's `uint96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n *\n * _Available since v4.2._\n */\n function toUint96(uint256 value) internal pure returns (uint96) {\n require(value <= type(uint96).max, \"SafeCast: value doesn't fit in 96 bits\");\n return uint96(value);\n }\n\n /**\n * @dev Returns the downcasted uint88 from uint256, reverting on\n * overflow (when the input is greater than largest uint88).\n *\n * Counterpart to Solidity's `uint88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n *\n * _Available since v4.7._\n */\n function toUint88(uint256 value) internal pure returns (uint88) {\n require(value <= type(uint88).max, \"SafeCast: value doesn't fit in 88 bits\");\n return uint88(value);\n }\n\n /**\n * @dev Returns the downcasted uint80 from uint256, reverting on\n * overflow (when the input is greater than largest uint80).\n *\n * Counterpart to Solidity's `uint80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n *\n * _Available since v4.7._\n */\n function toUint80(uint256 value) internal pure returns (uint80) {\n require(value <= type(uint80).max, \"SafeCast: value doesn't fit in 80 bits\");\n return uint80(value);\n }\n\n /**\n * @dev Returns the downcasted uint72 from uint256, reverting on\n * overflow (when the input is greater than largest uint72).\n *\n * Counterpart to Solidity's `uint72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n *\n * _Available since v4.7._\n */\n function toUint72(uint256 value) internal pure returns (uint72) {\n require(value <= type(uint72).max, \"SafeCast: value doesn't fit in 72 bits\");\n return uint72(value);\n }\n\n /**\n * @dev Returns the downcasted uint64 from uint256, reverting on\n * overflow (when the input is greater than largest uint64).\n *\n * Counterpart to Solidity's `uint64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v2.5._\n */\n function toUint64(uint256 value) internal pure returns (uint64) {\n require(value <= type(uint64).max, \"SafeCast: value doesn't fit in 64 bits\");\n return uint64(value);\n }\n\n /**\n * @dev Returns the downcasted uint56 from uint256, reverting on\n * overflow (when the input is greater than largest uint56).\n *\n * Counterpart to Solidity's `uint56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n *\n * _Available since v4.7._\n */\n function toUint56(uint256 value) internal pure returns (uint56) {\n require(value <= type(uint56).max, \"SafeCast: value doesn't fit in 56 bits\");\n return uint56(value);\n }\n\n /**\n * @dev Returns the downcasted uint48 from uint256, reverting on\n * overflow (when the input is greater than largest uint48).\n *\n * Counterpart to Solidity's `uint48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n *\n * _Available since v4.7._\n */\n function toUint48(uint256 value) internal pure returns (uint48) {\n require(value <= type(uint48).max, \"SafeCast: value doesn't fit in 48 bits\");\n return uint48(value);\n }\n\n /**\n * @dev Returns the downcasted uint40 from uint256, reverting on\n * overflow (when the input is greater than largest uint40).\n *\n * Counterpart to Solidity's `uint40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n *\n * _Available since v4.7._\n */\n function toUint40(uint256 value) internal pure returns (uint40) {\n require(value <= type(uint40).max, \"SafeCast: value doesn't fit in 40 bits\");\n return uint40(value);\n }\n\n /**\n * @dev Returns the downcasted uint32 from uint256, reverting on\n * overflow (when the input is greater than largest uint32).\n *\n * Counterpart to Solidity's `uint32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v2.5._\n */\n function toUint32(uint256 value) internal pure returns (uint32) {\n require(value <= type(uint32).max, \"SafeCast: value doesn't fit in 32 bits\");\n return uint32(value);\n }\n\n /**\n * @dev Returns the downcasted uint24 from uint256, reverting on\n * overflow (when the input is greater than largest uint24).\n *\n * Counterpart to Solidity's `uint24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n *\n * _Available since v4.7._\n */\n function toUint24(uint256 value) internal pure returns (uint24) {\n require(value <= type(uint24).max, \"SafeCast: value doesn't fit in 24 bits\");\n return uint24(value);\n }\n\n /**\n * @dev Returns the downcasted uint16 from uint256, reverting on\n * overflow (when the input is greater than largest uint16).\n *\n * Counterpart to Solidity's `uint16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v2.5._\n */\n function toUint16(uint256 value) internal pure returns (uint16) {\n require(value <= type(uint16).max, \"SafeCast: value doesn't fit in 16 bits\");\n return uint16(value);\n }\n\n /**\n * @dev Returns the downcasted uint8 from uint256, reverting on\n * overflow (when the input is greater than largest uint8).\n *\n * Counterpart to Solidity's `uint8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n *\n * _Available since v2.5._\n */\n function toUint8(uint256 value) internal pure returns (uint8) {\n require(value <= type(uint8).max, \"SafeCast: value doesn't fit in 8 bits\");\n return uint8(value);\n }\n\n /**\n * @dev Converts a signed int256 into an unsigned uint256.\n *\n * Requirements:\n *\n * - input must be greater than or equal to 0.\n *\n * _Available since v3.0._\n */\n function toUint256(int256 value) internal pure returns (uint256) {\n require(value >= 0, \"SafeCast: value must be positive\");\n return uint256(value);\n }\n\n /**\n * @dev Returns the downcasted int248 from int256, reverting on\n * overflow (when the input is less than smallest int248 or\n * greater than largest int248).\n *\n * Counterpart to Solidity's `int248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n *\n * _Available since v4.7._\n */\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\n downcasted = int248(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 248 bits\");\n }\n\n /**\n * @dev Returns the downcasted int240 from int256, reverting on\n * overflow (when the input is less than smallest int240 or\n * greater than largest int240).\n *\n * Counterpart to Solidity's `int240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n *\n * _Available since v4.7._\n */\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\n downcasted = int240(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 240 bits\");\n }\n\n /**\n * @dev Returns the downcasted int232 from int256, reverting on\n * overflow (when the input is less than smallest int232 or\n * greater than largest int232).\n *\n * Counterpart to Solidity's `int232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n *\n * _Available since v4.7._\n */\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\n downcasted = int232(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 232 bits\");\n }\n\n /**\n * @dev Returns the downcasted int224 from int256, reverting on\n * overflow (when the input is less than smallest int224 or\n * greater than largest int224).\n *\n * Counterpart to Solidity's `int224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n *\n * _Available since v4.7._\n */\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\n downcasted = int224(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 224 bits\");\n }\n\n /**\n * @dev Returns the downcasted int216 from int256, reverting on\n * overflow (when the input is less than smallest int216 or\n * greater than largest int216).\n *\n * Counterpart to Solidity's `int216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n *\n * _Available since v4.7._\n */\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\n downcasted = int216(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 216 bits\");\n }\n\n /**\n * @dev Returns the downcasted int208 from int256, reverting on\n * overflow (when the input is less than smallest int208 or\n * greater than largest int208).\n *\n * Counterpart to Solidity's `int208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n *\n * _Available since v4.7._\n */\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\n downcasted = int208(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 208 bits\");\n }\n\n /**\n * @dev Returns the downcasted int200 from int256, reverting on\n * overflow (when the input is less than smallest int200 or\n * greater than largest int200).\n *\n * Counterpart to Solidity's `int200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n *\n * _Available since v4.7._\n */\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\n downcasted = int200(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 200 bits\");\n }\n\n /**\n * @dev Returns the downcasted int192 from int256, reverting on\n * overflow (when the input is less than smallest int192 or\n * greater than largest int192).\n *\n * Counterpart to Solidity's `int192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n *\n * _Available since v4.7._\n */\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\n downcasted = int192(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 192 bits\");\n }\n\n /**\n * @dev Returns the downcasted int184 from int256, reverting on\n * overflow (when the input is less than smallest int184 or\n * greater than largest int184).\n *\n * Counterpart to Solidity's `int184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n *\n * _Available since v4.7._\n */\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\n downcasted = int184(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 184 bits\");\n }\n\n /**\n * @dev Returns the downcasted int176 from int256, reverting on\n * overflow (when the input is less than smallest int176 or\n * greater than largest int176).\n *\n * Counterpart to Solidity's `int176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n *\n * _Available since v4.7._\n */\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\n downcasted = int176(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 176 bits\");\n }\n\n /**\n * @dev Returns the downcasted int168 from int256, reverting on\n * overflow (when the input is less than smallest int168 or\n * greater than largest int168).\n *\n * Counterpart to Solidity's `int168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n *\n * _Available since v4.7._\n */\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\n downcasted = int168(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 168 bits\");\n }\n\n /**\n * @dev Returns the downcasted int160 from int256, reverting on\n * overflow (when the input is less than smallest int160 or\n * greater than largest int160).\n *\n * Counterpart to Solidity's `int160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n *\n * _Available since v4.7._\n */\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\n downcasted = int160(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 160 bits\");\n }\n\n /**\n * @dev Returns the downcasted int152 from int256, reverting on\n * overflow (when the input is less than smallest int152 or\n * greater than largest int152).\n *\n * Counterpart to Solidity's `int152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n *\n * _Available since v4.7._\n */\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\n downcasted = int152(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 152 bits\");\n }\n\n /**\n * @dev Returns the downcasted int144 from int256, reverting on\n * overflow (when the input is less than smallest int144 or\n * greater than largest int144).\n *\n * Counterpart to Solidity's `int144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n *\n * _Available since v4.7._\n */\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\n downcasted = int144(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 144 bits\");\n }\n\n /**\n * @dev Returns the downcasted int136 from int256, reverting on\n * overflow (when the input is less than smallest int136 or\n * greater than largest int136).\n *\n * Counterpart to Solidity's `int136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n *\n * _Available since v4.7._\n */\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\n downcasted = int136(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 136 bits\");\n }\n\n /**\n * @dev Returns the downcasted int128 from int256, reverting on\n * overflow (when the input is less than smallest int128 or\n * greater than largest int128).\n *\n * Counterpart to Solidity's `int128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v3.1._\n */\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\n downcasted = int128(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 128 bits\");\n }\n\n /**\n * @dev Returns the downcasted int120 from int256, reverting on\n * overflow (when the input is less than smallest int120 or\n * greater than largest int120).\n *\n * Counterpart to Solidity's `int120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n *\n * _Available since v4.7._\n */\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\n downcasted = int120(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 120 bits\");\n }\n\n /**\n * @dev Returns the downcasted int112 from int256, reverting on\n * overflow (when the input is less than smallest int112 or\n * greater than largest int112).\n *\n * Counterpart to Solidity's `int112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n *\n * _Available since v4.7._\n */\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\n downcasted = int112(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 112 bits\");\n }\n\n /**\n * @dev Returns the downcasted int104 from int256, reverting on\n * overflow (when the input is less than smallest int104 or\n * greater than largest int104).\n *\n * Counterpart to Solidity's `int104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n *\n * _Available since v4.7._\n */\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\n downcasted = int104(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 104 bits\");\n }\n\n /**\n * @dev Returns the downcasted int96 from int256, reverting on\n * overflow (when the input is less than smallest int96 or\n * greater than largest int96).\n *\n * Counterpart to Solidity's `int96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n *\n * _Available since v4.7._\n */\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\n downcasted = int96(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 96 bits\");\n }\n\n /**\n * @dev Returns the downcasted int88 from int256, reverting on\n * overflow (when the input is less than smallest int88 or\n * greater than largest int88).\n *\n * Counterpart to Solidity's `int88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n *\n * _Available since v4.7._\n */\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\n downcasted = int88(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 88 bits\");\n }\n\n /**\n * @dev Returns the downcasted int80 from int256, reverting on\n * overflow (when the input is less than smallest int80 or\n * greater than largest int80).\n *\n * Counterpart to Solidity's `int80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n *\n * _Available since v4.7._\n */\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\n downcasted = int80(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 80 bits\");\n }\n\n /**\n * @dev Returns the downcasted int72 from int256, reverting on\n * overflow (when the input is less than smallest int72 or\n * greater than largest int72).\n *\n * Counterpart to Solidity's `int72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n *\n * _Available since v4.7._\n */\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\n downcasted = int72(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 72 bits\");\n }\n\n /**\n * @dev Returns the downcasted int64 from int256, reverting on\n * overflow (when the input is less than smallest int64 or\n * greater than largest int64).\n *\n * Counterpart to Solidity's `int64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v3.1._\n */\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\n downcasted = int64(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 64 bits\");\n }\n\n /**\n * @dev Returns the downcasted int56 from int256, reverting on\n * overflow (when the input is less than smallest int56 or\n * greater than largest int56).\n *\n * Counterpart to Solidity's `int56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n *\n * _Available since v4.7._\n */\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\n downcasted = int56(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 56 bits\");\n }\n\n /**\n * @dev Returns the downcasted int48 from int256, reverting on\n * overflow (when the input is less than smallest int48 or\n * greater than largest int48).\n *\n * Counterpart to Solidity's `int48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n *\n * _Available since v4.7._\n */\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\n downcasted = int48(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 48 bits\");\n }\n\n /**\n * @dev Returns the downcasted int40 from int256, reverting on\n * overflow (when the input is less than smallest int40 or\n * greater than largest int40).\n *\n * Counterpart to Solidity's `int40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n *\n * _Available since v4.7._\n */\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\n downcasted = int40(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 40 bits\");\n }\n\n /**\n * @dev Returns the downcasted int32 from int256, reverting on\n * overflow (when the input is less than smallest int32 or\n * greater than largest int32).\n *\n * Counterpart to Solidity's `int32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v3.1._\n */\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\n downcasted = int32(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 32 bits\");\n }\n\n /**\n * @dev Returns the downcasted int24 from int256, reverting on\n * overflow (when the input is less than smallest int24 or\n * greater than largest int24).\n *\n * Counterpart to Solidity's `int24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n *\n * _Available since v4.7._\n */\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\n downcasted = int24(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 24 bits\");\n }\n\n /**\n * @dev Returns the downcasted int16 from int256, reverting on\n * overflow (when the input is less than smallest int16 or\n * greater than largest int16).\n *\n * Counterpart to Solidity's `int16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v3.1._\n */\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\n downcasted = int16(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 16 bits\");\n }\n\n /**\n * @dev Returns the downcasted int8 from int256, reverting on\n * overflow (when the input is less than smallest int8 or\n * greater than largest int8).\n *\n * Counterpart to Solidity's `int8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n *\n * _Available since v3.1._\n */\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\n downcasted = int8(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 8 bits\");\n }\n\n /**\n * @dev Converts an unsigned uint256 into a signed int256.\n *\n * Requirements:\n *\n * - input must be less than or equal to maxInt256.\n *\n * _Available since v3.0._\n */\n function toInt256(uint256 value) internal pure returns (int256) {\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\n require(value <= uint256(type(int256).max), \"SafeCast: value doesn't fit in an int256\");\n return int256(value);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SignedMath.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 SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.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/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\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 = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _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(SignedMath.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n 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" + }, + "abdk-libraries-solidity/ABDKMath64x64.sol": { + "content": "// SPDX-License-Identifier: BSD-4-Clause\n/*\n * ABDK Math 64.64 Smart Contract Library. Copyright Ā© 2019 by ABDK Consulting.\n * Author: Mikhail Vladimirov \n */\npragma solidity ^0.8.0;\n\n/**\n * Smart contract library of mathematical functions operating with signed\n * 64.64-bit fixed point numbers. Signed 64.64-bit fixed point number is\n * basically a simple fraction whose numerator is signed 128-bit integer and\n * denominator is 2^64. As long as denominator is always the same, there is no\n * need to store it, thus in Solidity signed 64.64-bit fixed point numbers are\n * represented by int128 type holding only the numerator.\n */\nlibrary ABDKMath64x64 {\n /*\n * Minimum value signed 64.64-bit fixed point number may have. \n */\n int128 private constant MIN_64x64 = -0x80000000000000000000000000000000;\n\n /*\n * Maximum value signed 64.64-bit fixed point number may have. \n */\n int128 private constant MAX_64x64 = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;\n\n /**\n * Convert signed 256-bit integer number into signed 64.64-bit fixed point\n * number. Revert on overflow.\n *\n * @param x signed 256-bit integer number\n * @return signed 64.64-bit fixed point number\n */\n function fromInt (int256 x) internal pure returns (int128) {\n unchecked {\n require (x >= -0x8000000000000000 && x <= 0x7FFFFFFFFFFFFFFF);\n return int128 (x << 64);\n }\n }\n\n /**\n * Convert signed 64.64 fixed point number into signed 64-bit integer number\n * rounding down.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64-bit integer number\n */\n function toInt (int128 x) internal pure returns (int64) {\n unchecked {\n return int64 (x >> 64);\n }\n }\n\n /**\n * Convert unsigned 256-bit integer number into signed 64.64-bit fixed point\n * number. Revert on overflow.\n *\n * @param x unsigned 256-bit integer number\n * @return signed 64.64-bit fixed point number\n */\n function fromUInt (uint256 x) internal pure returns (int128) {\n unchecked {\n require (x <= 0x7FFFFFFFFFFFFFFF);\n return int128 (int256 (x << 64));\n }\n }\n\n /**\n * Convert signed 64.64 fixed point number into unsigned 64-bit integer\n * number rounding down. Revert on underflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @return unsigned 64-bit integer number\n */\n function toUInt (int128 x) internal pure returns (uint64) {\n unchecked {\n require (x >= 0);\n return uint64 (uint128 (x >> 64));\n }\n }\n\n /**\n * Convert signed 128.128 fixed point number into signed 64.64-bit fixed point\n * number rounding down. Revert on overflow.\n *\n * @param x signed 128.128-bin fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function from128x128 (int256 x) internal pure returns (int128) {\n unchecked {\n int256 result = x >> 64;\n require (result >= MIN_64x64 && result <= MAX_64x64);\n return int128 (result);\n }\n }\n\n /**\n * Convert signed 64.64 fixed point number into signed 128.128 fixed point\n * number.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 128.128 fixed point number\n */\n function to128x128 (int128 x) internal pure returns (int256) {\n unchecked {\n return int256 (x) << 64;\n }\n }\n\n /**\n * Calculate x + y. Revert on overflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @param y signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function add (int128 x, int128 y) internal pure returns (int128) {\n unchecked {\n int256 result = int256(x) + y;\n require (result >= MIN_64x64 && result <= MAX_64x64);\n return int128 (result);\n }\n }\n\n /**\n * Calculate x - y. Revert on overflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @param y signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function sub (int128 x, int128 y) internal pure returns (int128) {\n unchecked {\n int256 result = int256(x) - y;\n require (result >= MIN_64x64 && result <= MAX_64x64);\n return int128 (result);\n }\n }\n\n /**\n * Calculate x * y rounding down. Revert on overflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @param y signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function mul (int128 x, int128 y) internal pure returns (int128) {\n unchecked {\n int256 result = int256(x) * y >> 64;\n require (result >= MIN_64x64 && result <= MAX_64x64);\n return int128 (result);\n }\n }\n\n /**\n * Calculate x * y rounding towards zero, where x is signed 64.64 fixed point\n * number and y is signed 256-bit integer number. Revert on overflow.\n *\n * @param x signed 64.64 fixed point number\n * @param y signed 256-bit integer number\n * @return signed 256-bit integer number\n */\n function muli (int128 x, int256 y) internal pure returns (int256) {\n unchecked {\n if (x == MIN_64x64) {\n require (y >= -0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF &&\n y <= 0x1000000000000000000000000000000000000000000000000);\n return -y << 63;\n } else {\n bool negativeResult = false;\n if (x < 0) {\n x = -x;\n negativeResult = true;\n }\n if (y < 0) {\n y = -y; // We rely on overflow behavior here\n negativeResult = !negativeResult;\n }\n uint256 absoluteResult = mulu (x, uint256 (y));\n if (negativeResult) {\n require (absoluteResult <=\n 0x8000000000000000000000000000000000000000000000000000000000000000);\n return -int256 (absoluteResult); // We rely on overflow behavior here\n } else {\n require (absoluteResult <=\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\n return int256 (absoluteResult);\n }\n }\n }\n }\n\n /**\n * Calculate x * y rounding down, where x is signed 64.64 fixed point number\n * and y is unsigned 256-bit integer number. Revert on overflow.\n *\n * @param x signed 64.64 fixed point number\n * @param y unsigned 256-bit integer number\n * @return unsigned 256-bit integer number\n */\n function mulu (int128 x, uint256 y) internal pure returns (uint256) {\n unchecked {\n if (y == 0) return 0;\n\n require (x >= 0);\n\n uint256 lo = (uint256 (int256 (x)) * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) >> 64;\n uint256 hi = uint256 (int256 (x)) * (y >> 128);\n\n require (hi <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\n hi <<= 64;\n\n require (hi <=\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - lo);\n return hi + lo;\n }\n }\n\n /**\n * Calculate x / y rounding towards zero. Revert on overflow or when y is\n * zero.\n *\n * @param x signed 64.64-bit fixed point number\n * @param y signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function div (int128 x, int128 y) internal pure returns (int128) {\n unchecked {\n require (y != 0);\n int256 result = (int256 (x) << 64) / y;\n require (result >= MIN_64x64 && result <= MAX_64x64);\n return int128 (result);\n }\n }\n\n /**\n * Calculate x / y rounding towards zero, where x and y are signed 256-bit\n * integer numbers. Revert on overflow or when y is zero.\n *\n * @param x signed 256-bit integer number\n * @param y signed 256-bit integer number\n * @return signed 64.64-bit fixed point number\n */\n function divi (int256 x, int256 y) internal pure returns (int128) {\n unchecked {\n require (y != 0);\n\n bool negativeResult = false;\n if (x < 0) {\n x = -x; // We rely on overflow behavior here\n negativeResult = true;\n }\n if (y < 0) {\n y = -y; // We rely on overflow behavior here\n negativeResult = !negativeResult;\n }\n uint128 absoluteResult = divuu (uint256 (x), uint256 (y));\n if (negativeResult) {\n require (absoluteResult <= 0x80000000000000000000000000000000);\n return -int128 (absoluteResult); // We rely on overflow behavior here\n } else {\n require (absoluteResult <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\n return int128 (absoluteResult); // We rely on overflow behavior here\n }\n }\n }\n\n /**\n * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit\n * integer numbers. Revert on overflow or when y is zero.\n *\n * @param x unsigned 256-bit integer number\n * @param y unsigned 256-bit integer number\n * @return signed 64.64-bit fixed point number\n */\n function divu (uint256 x, uint256 y) internal pure returns (int128) {\n unchecked {\n require (y != 0);\n uint128 result = divuu (x, y);\n require (result <= uint128 (MAX_64x64));\n return int128 (result);\n }\n }\n\n /**\n * Calculate -x. Revert on overflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function neg (int128 x) internal pure returns (int128) {\n unchecked {\n require (x != MIN_64x64);\n return -x;\n }\n }\n\n /**\n * Calculate |x|. Revert on overflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function abs (int128 x) internal pure returns (int128) {\n unchecked {\n require (x != MIN_64x64);\n return x < 0 ? -x : x;\n }\n }\n\n /**\n * Calculate 1 / x rounding towards zero. Revert on overflow or when x is\n * zero.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function inv (int128 x) internal pure returns (int128) {\n unchecked {\n require (x != 0);\n int256 result = int256 (0x100000000000000000000000000000000) / x;\n require (result >= MIN_64x64 && result <= MAX_64x64);\n return int128 (result);\n }\n }\n\n /**\n * Calculate arithmetics average of x and y, i.e. (x + y) / 2 rounding down.\n *\n * @param x signed 64.64-bit fixed point number\n * @param y signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function avg (int128 x, int128 y) internal pure returns (int128) {\n unchecked {\n return int128 ((int256 (x) + int256 (y)) >> 1);\n }\n }\n\n /**\n * Calculate geometric average of x and y, i.e. sqrt (x * y) rounding down.\n * Revert on overflow or in case x * y is negative.\n *\n * @param x signed 64.64-bit fixed point number\n * @param y signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function gavg (int128 x, int128 y) internal pure returns (int128) {\n unchecked {\n int256 m = int256 (x) * int256 (y);\n require (m >= 0);\n require (m <\n 0x4000000000000000000000000000000000000000000000000000000000000000);\n return int128 (sqrtu (uint256 (m)));\n }\n }\n\n /**\n * Calculate x^y assuming 0^0 is 1, where x is signed 64.64 fixed point number\n * and y is unsigned 256-bit integer number. Revert on overflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @param y uint256 value\n * @return signed 64.64-bit fixed point number\n */\n function pow (int128 x, uint256 y) internal pure returns (int128) {\n unchecked {\n bool negative = x < 0 && y & 1 == 1;\n\n uint256 absX = uint128 (x < 0 ? -x : x);\n uint256 absResult;\n absResult = 0x100000000000000000000000000000000;\n\n if (absX <= 0x10000000000000000) {\n absX <<= 63;\n while (y != 0) {\n if (y & 0x1 != 0) {\n absResult = absResult * absX >> 127;\n }\n absX = absX * absX >> 127;\n\n if (y & 0x2 != 0) {\n absResult = absResult * absX >> 127;\n }\n absX = absX * absX >> 127;\n\n if (y & 0x4 != 0) {\n absResult = absResult * absX >> 127;\n }\n absX = absX * absX >> 127;\n\n if (y & 0x8 != 0) {\n absResult = absResult * absX >> 127;\n }\n absX = absX * absX >> 127;\n\n y >>= 4;\n }\n\n absResult >>= 64;\n } else {\n uint256 absXShift = 63;\n if (absX < 0x1000000000000000000000000) { absX <<= 32; absXShift -= 32; }\n if (absX < 0x10000000000000000000000000000) { absX <<= 16; absXShift -= 16; }\n if (absX < 0x1000000000000000000000000000000) { absX <<= 8; absXShift -= 8; }\n if (absX < 0x10000000000000000000000000000000) { absX <<= 4; absXShift -= 4; }\n if (absX < 0x40000000000000000000000000000000) { absX <<= 2; absXShift -= 2; }\n if (absX < 0x80000000000000000000000000000000) { absX <<= 1; absXShift -= 1; }\n\n uint256 resultShift = 0;\n while (y != 0) {\n require (absXShift < 64);\n\n if (y & 0x1 != 0) {\n absResult = absResult * absX >> 127;\n resultShift += absXShift;\n if (absResult > 0x100000000000000000000000000000000) {\n absResult >>= 1;\n resultShift += 1;\n }\n }\n absX = absX * absX >> 127;\n absXShift <<= 1;\n if (absX >= 0x100000000000000000000000000000000) {\n absX >>= 1;\n absXShift += 1;\n }\n\n y >>= 1;\n }\n\n require (resultShift < 64);\n absResult >>= 64 - resultShift;\n }\n int256 result = negative ? -int256 (absResult) : int256 (absResult);\n require (result >= MIN_64x64 && result <= MAX_64x64);\n return int128 (result);\n }\n }\n\n /**\n * Calculate sqrt (x) rounding down. Revert if x < 0.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function sqrt (int128 x) internal pure returns (int128) {\n unchecked {\n require (x >= 0);\n return int128 (sqrtu (uint256 (int256 (x)) << 64));\n }\n }\n\n /**\n * Calculate binary logarithm of x. Revert if x <= 0.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function log_2 (int128 x) internal pure returns (int128) {\n unchecked {\n require (x > 0);\n\n int256 msb = 0;\n int256 xc = x;\n if (xc >= 0x10000000000000000) { xc >>= 64; msb += 64; }\n if (xc >= 0x100000000) { xc >>= 32; msb += 32; }\n if (xc >= 0x10000) { xc >>= 16; msb += 16; }\n if (xc >= 0x100) { xc >>= 8; msb += 8; }\n if (xc >= 0x10) { xc >>= 4; msb += 4; }\n if (xc >= 0x4) { xc >>= 2; msb += 2; }\n if (xc >= 0x2) msb += 1; // No need to shift xc anymore\n\n int256 result = msb - 64 << 64;\n uint256 ux = uint256 (int256 (x)) << uint256 (127 - msb);\n for (int256 bit = 0x8000000000000000; bit > 0; bit >>= 1) {\n ux *= ux;\n uint256 b = ux >> 255;\n ux >>= 127 + b;\n result += bit * int256 (b);\n }\n\n return int128 (result);\n }\n }\n\n /**\n * Calculate natural logarithm of x. Revert if x <= 0.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function ln (int128 x) internal pure returns (int128) {\n unchecked {\n require (x > 0);\n\n return int128 (int256 (\n uint256 (int256 (log_2 (x))) * 0xB17217F7D1CF79ABC9E3B39803F2F6AF >> 128));\n }\n }\n\n /**\n * Calculate binary exponent of x. Revert on overflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function exp_2 (int128 x) internal pure returns (int128) {\n unchecked {\n require (x < 0x400000000000000000); // Overflow\n\n if (x < -0x400000000000000000) return 0; // Underflow\n\n uint256 result = 0x80000000000000000000000000000000;\n\n if (x & 0x8000000000000000 > 0)\n result = result * 0x16A09E667F3BCC908B2FB1366EA957D3E >> 128;\n if (x & 0x4000000000000000 > 0)\n result = result * 0x1306FE0A31B7152DE8D5A46305C85EDEC >> 128;\n if (x & 0x2000000000000000 > 0)\n result = result * 0x1172B83C7D517ADCDF7C8C50EB14A791F >> 128;\n if (x & 0x1000000000000000 > 0)\n result = result * 0x10B5586CF9890F6298B92B71842A98363 >> 128;\n if (x & 0x800000000000000 > 0)\n result = result * 0x1059B0D31585743AE7C548EB68CA417FD >> 128;\n if (x & 0x400000000000000 > 0)\n result = result * 0x102C9A3E778060EE6F7CACA4F7A29BDE8 >> 128;\n if (x & 0x200000000000000 > 0)\n result = result * 0x10163DA9FB33356D84A66AE336DCDFA3F >> 128;\n if (x & 0x100000000000000 > 0)\n result = result * 0x100B1AFA5ABCBED6129AB13EC11DC9543 >> 128;\n if (x & 0x80000000000000 > 0)\n result = result * 0x10058C86DA1C09EA1FF19D294CF2F679B >> 128;\n if (x & 0x40000000000000 > 0)\n result = result * 0x1002C605E2E8CEC506D21BFC89A23A00F >> 128;\n if (x & 0x20000000000000 > 0)\n result = result * 0x100162F3904051FA128BCA9C55C31E5DF >> 128;\n if (x & 0x10000000000000 > 0)\n result = result * 0x1000B175EFFDC76BA38E31671CA939725 >> 128;\n if (x & 0x8000000000000 > 0)\n result = result * 0x100058BA01FB9F96D6CACD4B180917C3D >> 128;\n if (x & 0x4000000000000 > 0)\n result = result * 0x10002C5CC37DA9491D0985C348C68E7B3 >> 128;\n if (x & 0x2000000000000 > 0)\n result = result * 0x1000162E525EE054754457D5995292026 >> 128;\n if (x & 0x1000000000000 > 0)\n result = result * 0x10000B17255775C040618BF4A4ADE83FC >> 128;\n if (x & 0x800000000000 > 0)\n result = result * 0x1000058B91B5BC9AE2EED81E9B7D4CFAB >> 128;\n if (x & 0x400000000000 > 0)\n result = result * 0x100002C5C89D5EC6CA4D7C8ACC017B7C9 >> 128;\n if (x & 0x200000000000 > 0)\n result = result * 0x10000162E43F4F831060E02D839A9D16D >> 128;\n if (x & 0x100000000000 > 0)\n result = result * 0x100000B1721BCFC99D9F890EA06911763 >> 128;\n if (x & 0x80000000000 > 0)\n result = result * 0x10000058B90CF1E6D97F9CA14DBCC1628 >> 128;\n if (x & 0x40000000000 > 0)\n result = result * 0x1000002C5C863B73F016468F6BAC5CA2B >> 128;\n if (x & 0x20000000000 > 0)\n result = result * 0x100000162E430E5A18F6119E3C02282A5 >> 128;\n if (x & 0x10000000000 > 0)\n result = result * 0x1000000B1721835514B86E6D96EFD1BFE >> 128;\n if (x & 0x8000000000 > 0)\n result = result * 0x100000058B90C0B48C6BE5DF846C5B2EF >> 128;\n if (x & 0x4000000000 > 0)\n result = result * 0x10000002C5C8601CC6B9E94213C72737A >> 128;\n if (x & 0x2000000000 > 0)\n result = result * 0x1000000162E42FFF037DF38AA2B219F06 >> 128;\n if (x & 0x1000000000 > 0)\n result = result * 0x10000000B17217FBA9C739AA5819F44F9 >> 128;\n if (x & 0x800000000 > 0)\n result = result * 0x1000000058B90BFCDEE5ACD3C1CEDC823 >> 128;\n if (x & 0x400000000 > 0)\n result = result * 0x100000002C5C85FE31F35A6A30DA1BE50 >> 128;\n if (x & 0x200000000 > 0)\n result = result * 0x10000000162E42FF0999CE3541B9FFFCF >> 128;\n if (x & 0x100000000 > 0)\n result = result * 0x100000000B17217F80F4EF5AADDA45554 >> 128;\n if (x & 0x80000000 > 0)\n result = result * 0x10000000058B90BFBF8479BD5A81B51AD >> 128;\n if (x & 0x40000000 > 0)\n result = result * 0x1000000002C5C85FDF84BD62AE30A74CC >> 128;\n if (x & 0x20000000 > 0)\n result = result * 0x100000000162E42FEFB2FED257559BDAA >> 128;\n if (x & 0x10000000 > 0)\n result = result * 0x1000000000B17217F7D5A7716BBA4A9AE >> 128;\n if (x & 0x8000000 > 0)\n result = result * 0x100000000058B90BFBE9DDBAC5E109CCE >> 128;\n if (x & 0x4000000 > 0)\n result = result * 0x10000000002C5C85FDF4B15DE6F17EB0D >> 128;\n if (x & 0x2000000 > 0)\n result = result * 0x1000000000162E42FEFA494F1478FDE05 >> 128;\n if (x & 0x1000000 > 0)\n result = result * 0x10000000000B17217F7D20CF927C8E94C >> 128;\n if (x & 0x800000 > 0)\n result = result * 0x1000000000058B90BFBE8F71CB4E4B33D >> 128;\n if (x & 0x400000 > 0)\n result = result * 0x100000000002C5C85FDF477B662B26945 >> 128;\n if (x & 0x200000 > 0)\n result = result * 0x10000000000162E42FEFA3AE53369388C >> 128;\n if (x & 0x100000 > 0)\n result = result * 0x100000000000B17217F7D1D351A389D40 >> 128;\n if (x & 0x80000 > 0)\n result = result * 0x10000000000058B90BFBE8E8B2D3D4EDE >> 128;\n if (x & 0x40000 > 0)\n result = result * 0x1000000000002C5C85FDF4741BEA6E77E >> 128;\n if (x & 0x20000 > 0)\n result = result * 0x100000000000162E42FEFA39FE95583C2 >> 128;\n if (x & 0x10000 > 0)\n result = result * 0x1000000000000B17217F7D1CFB72B45E1 >> 128;\n if (x & 0x8000 > 0)\n result = result * 0x100000000000058B90BFBE8E7CC35C3F0 >> 128;\n if (x & 0x4000 > 0)\n result = result * 0x10000000000002C5C85FDF473E242EA38 >> 128;\n if (x & 0x2000 > 0)\n result = result * 0x1000000000000162E42FEFA39F02B772C >> 128;\n if (x & 0x1000 > 0)\n result = result * 0x10000000000000B17217F7D1CF7D83C1A >> 128;\n if (x & 0x800 > 0)\n result = result * 0x1000000000000058B90BFBE8E7BDCBE2E >> 128;\n if (x & 0x400 > 0)\n result = result * 0x100000000000002C5C85FDF473DEA871F >> 128;\n if (x & 0x200 > 0)\n result = result * 0x10000000000000162E42FEFA39EF44D91 >> 128;\n if (x & 0x100 > 0)\n result = result * 0x100000000000000B17217F7D1CF79E949 >> 128;\n if (x & 0x80 > 0)\n result = result * 0x10000000000000058B90BFBE8E7BCE544 >> 128;\n if (x & 0x40 > 0)\n result = result * 0x1000000000000002C5C85FDF473DE6ECA >> 128;\n if (x & 0x20 > 0)\n result = result * 0x100000000000000162E42FEFA39EF366F >> 128;\n if (x & 0x10 > 0)\n result = result * 0x1000000000000000B17217F7D1CF79AFA >> 128;\n if (x & 0x8 > 0)\n result = result * 0x100000000000000058B90BFBE8E7BCD6D >> 128;\n if (x & 0x4 > 0)\n result = result * 0x10000000000000002C5C85FDF473DE6B2 >> 128;\n if (x & 0x2 > 0)\n result = result * 0x1000000000000000162E42FEFA39EF358 >> 128;\n if (x & 0x1 > 0)\n result = result * 0x10000000000000000B17217F7D1CF79AB >> 128;\n\n result >>= uint256 (int256 (63 - (x >> 64)));\n require (result <= uint256 (int256 (MAX_64x64)));\n\n return int128 (int256 (result));\n }\n }\n\n /**\n * Calculate natural exponent of x. Revert on overflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function exp (int128 x) internal pure returns (int128) {\n unchecked {\n require (x < 0x400000000000000000); // Overflow\n\n if (x < -0x400000000000000000) return 0; // Underflow\n\n return exp_2 (\n int128 (int256 (x) * 0x171547652B82FE1777D0FFDA0D23A7D12 >> 128));\n }\n }\n\n /**\n * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit\n * integer numbers. Revert on overflow or when y is zero.\n *\n * @param x unsigned 256-bit integer number\n * @param y unsigned 256-bit integer number\n * @return unsigned 64.64-bit fixed point number\n */\n function divuu (uint256 x, uint256 y) private pure returns (uint128) {\n unchecked {\n require (y != 0);\n\n uint256 result;\n\n if (x <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)\n result = (x << 64) / y;\n else {\n uint256 msb = 192;\n uint256 xc = x >> 192;\n if (xc >= 0x100000000) { xc >>= 32; msb += 32; }\n if (xc >= 0x10000) { xc >>= 16; msb += 16; }\n if (xc >= 0x100) { xc >>= 8; msb += 8; }\n if (xc >= 0x10) { xc >>= 4; msb += 4; }\n if (xc >= 0x4) { xc >>= 2; msb += 2; }\n if (xc >= 0x2) msb += 1; // No need to shift xc anymore\n\n result = (x << 255 - msb) / ((y - 1 >> msb - 191) + 1);\n require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\n\n uint256 hi = result * (y >> 128);\n uint256 lo = result * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\n\n uint256 xh = x >> 192;\n uint256 xl = x << 64;\n\n if (xl < lo) xh -= 1;\n xl -= lo; // We rely on overflow behavior here\n lo = hi << 128;\n if (xl < lo) xh -= 1;\n xl -= lo; // We rely on overflow behavior here\n\n result += xh == hi >> 128 ? xl / y : 1;\n }\n\n require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\n return uint128 (result);\n }\n }\n\n /**\n * Calculate sqrt (x) rounding down, where x is unsigned 256-bit integer\n * number.\n *\n * @param x unsigned 256-bit integer number\n * @return unsigned 128-bit integer number\n */\n function sqrtu (uint256 x) private pure returns (uint128) {\n unchecked {\n if (x == 0) return 0;\n else {\n uint256 xx = x;\n uint256 r = 1;\n if (xx >= 0x100000000000000000000000000000000) { xx >>= 128; r <<= 64; }\n if (xx >= 0x10000000000000000) { xx >>= 64; r <<= 32; }\n if (xx >= 0x100000000) { xx >>= 32; r <<= 16; }\n if (xx >= 0x10000) { xx >>= 16; r <<= 8; }\n if (xx >= 0x100) { xx >>= 8; r <<= 4; }\n if (xx >= 0x10) { xx >>= 4; r <<= 2; }\n if (xx >= 0x4) { r <<= 1; }\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1; // Seven iterations should be enough\n uint256 r1 = x / r;\n return uint128 (r < r1 ? r : r1);\n }\n }\n }\n}\n" + }, + "contracts/AuthorizedAccounts.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nimport \"./interfaces/IAuthorizedAccounts.sol\";\n\n/**\n * @notice Manages authorized accounts with limited permissions on behalf of main account\n * these authorized accounts are allowed to perform some certain actions in the Sylo network\n * in order to reduce the works for main account\n */\ncontract AuthorizedAccounts is\n IAuthorizedAccounts,\n Initializable,\n Ownable2StepUpgradeable,\n ERC165\n{\n /**\n * @notice Tracks authorized accounts for every main account\n */\n mapping(address => AuthorizedAccount[]) public authorizedAccounts;\n\n event PermissionsAdded(\n address indexed main,\n address indexed authorized,\n Permission[] permissions\n );\n\n event PermissionsRemoved(\n address indexed main,\n address indexed authorized,\n Permission[] permissions\n );\n\n error AuthorizedAccountCannotBeZeroAddress();\n error MainAccountCannotBeZeroAddress();\n error AtBlockNumberCannotBeZero();\n error AccountAlreadyAuthorized();\n error AccountDoesNotExist();\n\n function initialize() external initializer {\n Ownable2StepUpgradeable.__Ownable2Step_init();\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAuthorizedAccounts).interfaceId;\n }\n\n /**\n * @notice Adds new authorized accounts with certain permissions.\n * This will revert if the account has already existed.\n * @param authorized The address that the main account wants to authorize\n * @param permissions The list of permissions that the authorized account\n * can perform within the Sylo network.\n */\n function authorizeAccount(address authorized, Permission[] calldata permissions) external {\n if (authorized == address(0)) {\n revert AuthorizedAccountCannotBeZeroAddress();\n }\n\n // check if account has already been authorized\n AuthorizedAccount[] storage authAccounts = authorizedAccounts[msg.sender];\n for (uint i; i < authAccounts.length; ++i) {\n if (authAccounts[i].account == authorized) {\n if (authAccounts[i].authorizedAt != 0) {\n revert AccountAlreadyAuthorized();\n }\n\n authAccounts[i].authorizedAt = block.number;\n return _addPermissions(authorized, authAccounts[i], permissions);\n }\n }\n\n // add new authorized account to the list\n authAccounts.push();\n AuthorizedAccount storage newAccount = authAccounts[authAccounts.length - 1];\n newAccount.account = authorized;\n newAccount.authorizedAt = block.number;\n\n _addPermissions(authorized, newAccount, permissions);\n }\n\n /**\n * @notice Removes all permissions of a specific authorized account\n * associated with the msg.sender, and sets the account's authorizedAt to 0.\n * Note: It does not remove the authorized account from the list.\n * This will revert if the account does not exist.\n * @param authorized The address of the authorized account\n */\n function unauthorizeAccount(address authorized) external {\n if (authorized == address(0)) {\n revert AuthorizedAccountCannotBeZeroAddress();\n }\n\n AuthorizedAccount[] storage authAccounts = authorizedAccounts[msg.sender];\n for (uint i; i < authAccounts.length; ++i) {\n if (authAccounts[i].account == authorized) {\n delete authAccounts[i].authorizedAt;\n return _removePermissions(authorized, authAccounts[i], getAllPermissions());\n }\n }\n\n revert AccountDoesNotExist();\n }\n\n /**\n * @notice Adds new permissions to a specific authorized account.\n * - Adding permissions that don't exist in the Permission enum will return\n * with panic code 0x21 (convert a value that is too big or negative into an enum type).\n * - Adding duplicate permissions will update the permissions' authorizedAt value.\n * - Adding permissions that were previously unauthorized will update\n * the authorizedAt and unauthorizedAt values (refer to the comment in\n * IAuthorizedAccount -> AuthorizedPermission struct).\n * This will revert if the account does not exist.\n * @param authorized The authorized account address\n * @param permissions The new permissions will be added to the authorized account\n */\n function addPermissions(address authorized, Permission[] calldata permissions) external {\n if (authorized == address(0)) {\n revert AuthorizedAccountCannotBeZeroAddress();\n }\n\n AuthorizedAccount[] storage authAccounts = authorizedAccounts[msg.sender];\n for (uint i; i < authAccounts.length; ++i) {\n if (authAccounts[i].account == authorized) {\n return _addPermissions(authorized, authAccounts[i], permissions);\n }\n }\n\n revert AccountDoesNotExist();\n }\n\n function _addPermissions(\n address authorized,\n AuthorizedAccount storage authAccount,\n Permission[] memory permissions\n ) private {\n for (uint i; i < permissions.length; ++i) {\n bool exists;\n for (uint j; j < authAccount.permissions.length; ++j) {\n AuthorizedPermission storage authPermission = authAccount.permissions[j];\n if (permissions[i] == authPermission.permission) {\n exists = true;\n authPermission.authorizedAt = block.number;\n\n // make sure unauthorizedAt is not greater than authorizedAt\n // (refer to the comment in IAuthorizedAccount -> AuthorizedPermission struct)\n if (authPermission.unauthorizedAt > authPermission.authorizedAt) {\n authPermission.unauthorizedAt = authPermission.authorizedAt;\n }\n break;\n }\n }\n if (!exists) {\n authAccount.permissions.push(\n AuthorizedPermission({\n permission: permissions[i],\n authorizedAt: block.number,\n unauthorizedAt: 0\n })\n );\n }\n }\n\n emit PermissionsAdded(msg.sender, authorized, permissions);\n }\n\n /**\n * @notice Removes permissions of specific authorized account.\n * - Removing permissions that don't exist in the Permission enum will return\n * with panic code 0x21 (convert a value that is too big or negative into an enum type).\n * - Removing duplicate/authorized permissions will update the permissions'\n * unauthorizedAt value.\n * This will revert if the account does not exist.\n * @param authorized The address of authorized account\n * @param permissions The list of permissions will be removed\n */\n function removePermissions(address authorized, Permission[] calldata permissions) external {\n if (authorized == address(0)) {\n revert AuthorizedAccountCannotBeZeroAddress();\n }\n\n AuthorizedAccount[] storage authAccounts = authorizedAccounts[msg.sender];\n for (uint i; i < authAccounts.length; ++i) {\n if (authAccounts[i].account == authorized) {\n return _removePermissions(authorized, authAccounts[i], permissions);\n }\n }\n\n revert AccountDoesNotExist();\n }\n\n function _removePermissions(\n address authorized,\n AuthorizedAccount storage authAccount,\n Permission[] memory permissions\n ) private {\n for (uint i; i < permissions.length; ++i) {\n for (uint j; j < authAccount.permissions.length; ++j) {\n if (permissions[i] == authAccount.permissions[j].permission) {\n // only update unauthorizedAt if the permission is authorized\n if (\n authAccount.permissions[j].authorizedAt >=\n authAccount.permissions[j].unauthorizedAt\n ) {\n authAccount.permissions[j].unauthorizedAt = block.number + 1;\n }\n break;\n }\n }\n }\n\n emit PermissionsRemoved(msg.sender, authorized, permissions);\n }\n\n /**\n * @notice Validates permission of an authorized account associated with the main account.\n *\n * @param main The address of main account\n * @param authorized The address of authorized account\n * @param permission The permission needs to be verified with the authorized account\n * @param atBlock The block number to check if the permission is valid between\n * the permission's authorizedAt and unauthorizedAt period. It is added later to prevent\n * the timing attack. E.g. If the main account authorizes the PersonalSign permission at\n * block 1, creates a ticket at block 2, then unauthorizes the permission at block 3, the\n * ticket will be invalid and cannot be redeemed. To avoid this, the `atBlock` param is\n * needed to check if the permission is authorized between its authorizedAt and unauthorizedAt\n * duration.\n *\n * @return boolean value\n */\n function validatePermission(\n address main,\n address authorized,\n Permission permission,\n uint256 atBlock\n ) external view returns (bool) {\n if (main == address(0)) {\n revert MainAccountCannotBeZeroAddress();\n }\n\n if (authorized == address(0)) {\n revert AuthorizedAccountCannotBeZeroAddress();\n }\n\n if (atBlock == 0) {\n revert AtBlockNumberCannotBeZero();\n }\n\n AuthorizedAccount[] storage authAccounts = authorizedAccounts[main];\n\n for (uint i = 0; i < authAccounts.length; ++i) {\n if (authAccounts[i].account == authorized) {\n for (uint j = 0; j < authAccounts[i].permissions.length; ++j) {\n if (authAccounts[i].permissions[j].permission == permission) {\n uint256 authorizedAt = authAccounts[i].permissions[j].authorizedAt;\n uint256 unauthorizedAt = authAccounts[i].permissions[j].unauthorizedAt;\n\n bool isPermissionUnauthorized = authorizedAt > 0 &&\n authorizedAt < unauthorizedAt;\n if (isPermissionUnauthorized) {\n // the permission was previously valid, so we check that\n // the `atBlock` is referencing a time when the permission was valid\n return authorizedAt <= atBlock && atBlock < unauthorizedAt;\n }\n\n // otherwise just check if the permission was authorized before the\n // atBlock\n return authorizedAt > 0 && authorizedAt <= atBlock;\n }\n }\n }\n }\n\n return false;\n }\n\n /**\n * @notice Get all authorized accounts associated with a given account\n * @param main The address of main account\n * @return An array of authorized accounts\n */\n function getAuthorizedAccounts(\n address main\n ) external view returns (AuthorizedAccount[] memory) {\n if (main == address(0)) {\n revert MainAccountCannotBeZeroAddress();\n }\n\n return authorizedAccounts[main];\n }\n\n function getAllPermissions() internal pure returns (Permission[] memory) {\n Permission[] memory permissions = new Permission[](1);\n permissions[0] = Permission.PersonalSign;\n return permissions;\n }\n}\n" + }, + "contracts/epochs/EpochsManager.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\n\nimport \"../Registries.sol\";\nimport \"../staking/Directory.sol\";\nimport \"../interfaces/epochs/IEpochsManager.sol\";\nimport \"../payments/ticketing/TicketingParameters.sol\";\n\ncontract EpochsManager is IEpochsManager, Initializable, Ownable2StepUpgradeable, ERC165 {\n Directory public _directory;\n\n Registries public _registries;\n\n IERC721 public _rootSeekers;\n\n TicketingParameters public _ticketingParameters;\n\n /**\n * @notice Track seekers that have joined for a specific epoch.\n */\n mapping(uint256 => mapping(uint256 => address)) public activeSeekers;\n\n // Define all Epoch specific parameters here.\n // When initializing an epoch, these parameters are read,\n // along with parameters from the other contracts to create the\n // new epoch.\n\n /**\n * @notice A mapping of all epochs that have been initialized.\n */\n mapping(uint256 => Epoch) public epochs;\n\n /**\n * @notice The block number since the first epoch can be initialized.\n */\n uint256 public initialEpoch;\n\n /**\n * @notice The duration in blocks an epoch will last for.\n */\n uint256 public epochDuration;\n\n /**\n * @notice The value of the integer used as the current\n * epoch's identifier. This value is incremented as each epoch\n * is initialized.\n */\n uint256 public currentIteration;\n\n event NewEpoch(uint256 indexed epochId);\n event EpochJoined(uint256 indexed epochId, address indexed node, uint256 indexed seekerId);\n event InitialEpochUpdated(uint256 initialEpoch);\n event EpochDurationUpdated(uint256 epochDuration);\n\n error SeekerOwnerMismatch();\n error InitialEpochCannotBeZero();\n error EpochDurationCannotBeZero();\n error DirectoryCannotBeZeroAddress();\n error RegistriesCannotBeZeroAddress();\n error RootSeekerCannotBeZeroAddress();\n error EpochHasNotEnded(uint256 epochId);\n error SeekerAccountCannotBeZeroAddress();\n error TicketingParametersCannotBeZeroAddress();\n error SeekerAlreadyJoinedEpoch(uint256 epochId, uint256 seekerId);\n error InitialEpochNotYetReady(uint256 expectedBlock, uint256 currentBlock);\n\n function initialize(\n IERC721 rootSeekers,\n Directory directory,\n Registries registries,\n TicketingParameters ticketingParameters,\n uint256 _initialEpoch,\n uint256 _epochDuration\n ) external initializer {\n if (address(rootSeekers) == address(0)) {\n revert RootSeekerCannotBeZeroAddress();\n }\n\n SyloUtils.validateContractInterface(\n \"Directory\",\n address(directory),\n type(IDirectory).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"Registries\",\n address(registries),\n type(IRegistries).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"TicketingParameters\",\n address(ticketingParameters),\n type(ITicketingParameters).interfaceId\n );\n\n Ownable2StepUpgradeable.__Ownable2Step_init();\n\n _rootSeekers = rootSeekers;\n _directory = directory;\n _registries = registries;\n _ticketingParameters = ticketingParameters;\n\n initialEpoch = _initialEpoch;\n epochDuration = _epochDuration;\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IEpochsManager).interfaceId;\n }\n\n /**\n * @notice Call this to initialize the next epoch. On success, a `NewEpoch` event\n * will be emitted.\n * @dev The function will read the current set of network parameters, and store\n * the parameters in a new Epoch struct. The end block of the current epoch\n * will also be set to a non-zero value.\n */\n function initializeEpoch() external returns (uint256) {\n if (currentIteration == 0 && initialEpoch > block.number) {\n revert InitialEpochNotYetReady(initialEpoch, block.number);\n }\n\n Epoch storage current = epochs[currentIteration];\n\n uint256 end = current.startBlock + current.duration;\n if (end > block.number) {\n revert EpochHasNotEnded(currentIteration);\n }\n\n (\n uint256 faceValue,\n uint128 baseLiveWinProb,\n uint128 expiredWinProb,\n uint256 ticketDuration,\n uint32 decayRate\n ) = _ticketingParameters.getTicketingParameters();\n\n uint256 nextEpochId = getNextEpochId();\n\n epochs[nextEpochId] = Epoch(\n block.number,\n epochDuration,\n 0,\n _registries.defaultPayoutPercentage(),\n decayRate,\n faceValue,\n baseLiveWinProb,\n expiredWinProb,\n ticketDuration\n );\n\n current.endBlock = block.number;\n\n currentIteration = nextEpochId;\n\n _directory.setCurrentDirectory(nextEpochId);\n\n emit NewEpoch(nextEpochId);\n\n return nextEpochId;\n }\n\n /**\n * @notice Set the first epoch starting block. Only callable by the owner.\n * @param _initialEpoch The block number when the first epoch can be initialized.\n */\n function setInitialEpoch(uint256 _initialEpoch) external onlyOwner {\n if (_initialEpoch == 0) {\n revert InitialEpochCannotBeZero();\n }\n initialEpoch = _initialEpoch;\n emit InitialEpochUpdated(_initialEpoch);\n }\n\n /**\n * @notice Set the epoch duration. Will take effect in the next epoch. Only\n * callable by the owner.\n * @param _epochDuration The epoch duration in number of blocks.\n */\n function setEpochDuration(uint256 _epochDuration) external onlyOwner {\n if (_epochDuration == 0) {\n revert EpochDurationCannotBeZero();\n }\n epochDuration = _epochDuration;\n emit EpochDurationUpdated(epochDuration);\n }\n\n /**\n * @notice Retrieve the parameters for the current epoch.\n * @return The current Epoch parameters.\n */\n function getCurrentActiveEpoch() external view returns (uint256, Epoch memory) {\n return (currentIteration, epochs[currentIteration]);\n }\n\n /**\n * @notice Nodes should call this to join the next epoch. It will\n * initialize the next reward pool and set the stake for the next directory.\n * @dev This is a proxy function for `initalizeNextRewardPool` and\n * `joinNextDirectory`.\n */\n function joinNextEpoch() external {\n Registries.Registry memory registry = _registries.getRegistry(msg.sender);\n\n // validate the node's seeker ownership\n if (registry.seekerAccount == address(0)) {\n revert SeekerAccountCannotBeZeroAddress();\n }\n\n uint256 seekerId = registry.seekerId;\n\n address owner = _rootSeekers.ownerOf(seekerId);\n if (registry.seekerAccount != owner) {\n revert SeekerOwnerMismatch();\n }\n\n uint256 nextEpoch = getNextEpochId();\n if (activeSeekers[nextEpoch][seekerId] != address(0)) {\n revert SeekerAlreadyJoinedEpoch(nextEpoch, seekerId);\n }\n\n activeSeekers[nextEpoch][seekerId] = msg.sender;\n\n _directory._rewardsManager().initializeNextRewardPool(msg.sender);\n _directory.joinNextDirectory(msg.sender, seekerId);\n\n emit EpochJoined(nextEpoch, msg.sender, seekerId);\n }\n\n /**\n * @notice Retrieve the epoch parameter for the given id.\n * @param epochId The id of the epoch to retrieve.\n * @return The epoch parameters associated with the id.\n */\n function getEpoch(uint256 epochId) external view returns (Epoch memory) {\n return epochs[epochId];\n }\n\n /**\n * @notice Retrieve the integer value that will be used for the\n * next epoch id.\n * @return The next epoch id identifier.\n */\n function getNextEpochId() public view returns (uint256) {\n return currentIteration + 1;\n }\n}\n" + }, + "contracts/interfaces/epochs/IEpochsManager.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface IEpochsManager {\n /**\n * @dev This struct will hold all network parameters that will be static\n * for the entire epoch. This value will be stored in a mapping, where the\n * key is the current epoch id.\n */\n struct Epoch {\n // time related variables\n uint256 startBlock; // Block the epoch was initialized\n uint256 duration; // Minimum time epoch will be alive measured in number of blocks\n uint256 endBlock; // Block the epoch ended (and when the next epoch was initialized)\n // Zero here represents the epoch has not yet ended.\n\n // registry variables\n uint32 defaultPayoutPercentage;\n // ticketing variables\n uint32 decayRate;\n uint256 faceValue;\n uint128 baseLiveWinProb;\n uint128 expiredWinProb;\n uint256 ticketDuration;\n }\n\n function initializeEpoch() external returns (uint256);\n\n function setEpochDuration(uint256 _epochDuration) external;\n\n function getCurrentActiveEpoch() external view returns (uint256, Epoch memory);\n\n function joinNextEpoch() external;\n\n function getEpoch(uint256 epochId) external view returns (Epoch memory);\n\n function getNextEpochId() external view returns (uint256);\n}\n" + }, + "contracts/interfaces/IAuthorizedAccounts.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface IAuthorizedAccounts {\n enum Permission {\n // PersonalSign permission allows the authorized account to\n // sign on behalf of the sending account.\n PersonalSign\n }\n\n /**\n * @dev This type will hold the permission type and the block number from\n * which the permission was set to be authorized and unauthorized.\n * The permission is authorized when authorizedAt >= unauthorizedAt.\n *\n * Note: authorizedAt and unauthorizedAt won't be set to 0 when the permission\n * is updated, because they are both needed when validating the permission.\n */\n struct AuthorizedPermission {\n // Permission type\n Permission permission;\n // Block number from which the permission was set to be authorized.\n // If the transaction is called in block 1, the permission is\n // authorized from block 1 (authorizedAt = block.number).\n uint256 authorizedAt;\n // Block number from which the permission was set to be unauthorized.\n // If the transaction is called in block 1, the permission is\n // unauthorized from block 2 (unauthorizedAt = block.number + 1)\n // unauthorizedAt is set that way to avoid the case where the\n // permission is authorized and unauthorized in the same block:\n // E.g. addPermission is called => authorizedAt = 1\n // removePermission is called => unauthorizedAt = 1\n // => We cannot tell if the permission is authorized or not.\n // E.g. addPermission is called => authorizedAt = 1\n // removePermission is called => unauthorizedAt = 2\n // addPermission is called => authorizedAt = 1 AND update unauthorizedAt = authorizedAt = 1\n // => The permission is authorized when authorizedAt >= unauthorizedAt\n uint256 unauthorizedAt;\n }\n\n struct AuthorizedAccount {\n // The authorized account\n address account;\n // Block number at which the account was authorized.\n // If the transaction is called in block 1, the account is\n // authorized at block 1 (authorizedAt = block.number).\n // If the account is unauthorized, authorizedAt will be set to 0.\n uint256 authorizedAt;\n // Permission list\n AuthorizedPermission[] permissions;\n }\n\n function authorizeAccount(address authorized, Permission[] calldata permissions) external;\n\n function unauthorizeAccount(address authorized) external;\n\n function addPermissions(address authorized, Permission[] calldata permissions) external;\n\n function removePermissions(\n address authorized,\n Permission[] calldata permissionsToRemove\n ) external;\n\n function validatePermission(\n address main,\n address authorized,\n Permission permission,\n uint256 atBlock\n ) external returns (bool);\n\n function getAuthorizedAccounts(\n address main\n ) external view returns (AuthorizedAccount[] memory);\n}\n" + }, + "contracts/interfaces/IFuturePassRegistrar.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface IFuturePassRegistrar {\n function futurepassOf(address owner) external view returns (address);\n\n function create(address owner) external returns (address);\n}\n" + }, + "contracts/interfaces/IRegistries.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface IRegistries {\n struct Registry {\n // Percentage of a tickets value that will be rewarded to\n // delegated stakers expressed as a fraction of 100000.\n // This value is currently locked to the default payout percentage\n // until epochs are implemented.\n uint32 payoutPercentage;\n // Public http/s endpoint to retrieve additional metadata\n // about the node.\n // The current metadata schema is as follows:\n // { name: string, multiaddrs: string[] }\n string publicEndpoint;\n // The account which owns a seeker that will be used to\n // operate the Node for this registry.\n address seekerAccount;\n // The id of the seeker used to operate the node. The owner\n // of this id should be the seeker account.\n uint256 seekerId;\n }\n\n function register(string calldata publicEndpoint) external;\n\n function setDefaultPayoutPercentage(uint32 _defaultPayoutPercentage) external;\n\n function setSeekerAccount(\n address seekerAccount,\n uint256 seekerId,\n bytes32 nonce,\n bytes calldata signature\n ) external;\n\n function revokeSeekerAccount(address node) external;\n\n function getRegistry(address account) external view returns (Registry memory);\n\n function getNodes() external view returns (address[] memory);\n\n function getRegistries(\n uint256 start,\n uint256 end\n ) external view returns (address[] memory, Registry[] memory);\n\n function getTotalNodes() external view returns (uint256);\n}\n" + }, + "contracts/interfaces/ISeekerPowerOracle.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface ISeekerPowerOracle {\n function setOracle(address oracle) external;\n\n function registerSeekerPowerRestricted(uint256 seekerId, uint256 power) external;\n\n function registerSeekerPower(\n uint256 seekerId,\n uint256 power,\n bytes32 nonce,\n bytes calldata proof\n ) external;\n\n function getSeekerPower(uint256 seekerId) external view returns (uint256);\n\n function getProofMessage(\n uint256 seekerId,\n uint256 power,\n bytes32 nonce\n ) external pure returns (bytes memory);\n}\n" + }, + "contracts/interfaces/payments/ISyloTicketing.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface ISyloTicketing {\n struct Deposit {\n uint256 escrow; // Balance of users escrow\n uint256 penalty; // Balance of users penalty\n uint256 unlockAt; // Block number a user can withdraw their balances\n }\n\n struct User {\n address main; // Main address of the ticket sender or receiver\n address delegated; // Delegated address used to sign and redeem tickets\n }\n\n struct Ticket {\n uint256 epochId; // The epoch this ticket is associated with\n User sender; // Ticket sender's main and delegated addresses\n User receiver; // Ticket receiver's main and delegated addresses\n address redeemer; // Address of the intended recipient\n uint256 generationBlock; // Block number the ticket was generated\n bytes32 redeemerCommit; // Hash of the secret random number of the redeemer\n }\n\n // A type of ticket that does not explicit state the receiver address.\n struct MultiReceiverTicket {\n uint256 epochId; // The epoch this ticket is associated with\n User sender; // Ticket sender's main and delegated addresses\n address redeemer; // Address of the intended recipient\n uint256 generationBlock; // Block number the ticket was generated\n bytes32 redeemerCommit; // Hash of the secret random number of the redeemer\n }\n\n function setUnlockDuration(uint256 _unlockDuration) external;\n\n function depositEscrow(uint256 amount, address account) external;\n\n function depositPenalty(uint256 amount, address account) external;\n\n function unlockDeposits() external returns (uint256);\n\n function lockDeposits() external;\n\n function withdraw() external;\n\n function redeem(\n Ticket calldata ticket,\n uint256 redeemerRand,\n bytes calldata senderSig,\n bytes calldata receiverSig\n ) external;\n\n function redeemMultiReceiver(\n MultiReceiverTicket calldata ticket,\n uint256 redeemerRand,\n User calldata receiver,\n bytes calldata senderSig,\n bytes calldata receiverSig\n ) external;\n}\n" + }, + "contracts/interfaces/payments/ticketing/IRewardsManager.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface IRewardsManager {\n /**\n * @dev This type will hold the necessary information for delegated stakers\n * to make reward claims against their Node. Every Node will initialize\n * and store a new Reward Pool for each epoch they participate in.\n */\n struct RewardPool {\n // Tracks the balance of the reward pool owed to the stakers\n uint256 stakersRewardTotal;\n // Tracks the block number this reward pool was initialized\n uint256 initializedAt;\n // The total active stake for the node for will be the sum of the\n // stakes owned by its delegators and the node's own stake.\n uint256 totalActiveStake;\n // track the cumulative reward factor as of the time the first ticket\n // for this pool was redeemed\n int128 initialCumulativeRewardFactor;\n }\n\n struct LastClaim {\n // The epoch the claim was made.\n uint256 claimedAt;\n // The stake at the time the claim was made. This is tracked as\n // rewards can only be claimed after an epoch has ended, but the\n // user's stake may have changed by then. This field tracks the\n // staking value before the change so the reward for that epoch\n // can be manually calculated.\n uint256 stake;\n }\n\n function getRewardPool(\n uint256 epochId,\n address stakee\n ) external view returns (RewardPool memory);\n\n function getRewardPoolKey(uint256 epochId, address stakee) external pure returns (bytes32);\n\n function getRewardPoolStakersTotal(\n uint256 epochId,\n address stakee\n ) external view returns (uint256);\n\n function getRewardPoolActiveStake(\n uint256 epochId,\n address stakee\n ) external view returns (uint256);\n\n function getPendingRewards(address stakee) external view returns (uint256);\n\n function getLastClaim(address stakee, address staker) external view returns (LastClaim memory);\n\n function getTotalEpochRewards(uint256 epochId) external view returns (uint256);\n\n function getTotalEpochStakingRewards(uint256 epochId) external view returns (uint256);\n\n function initializeNextRewardPool(address stakee) external;\n\n function incrementRewardPool(address stakee, uint256 amount) external;\n\n function claimStakingRewards(address stakee) external returns (uint256);\n\n function updatePendingRewards(address stakee, address staker) external;\n}\n" + }, + "contracts/interfaces/payments/ticketing/ITicketingParameters.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface ITicketingParameters {\n function setFaceValue(uint256 _faceValue) external;\n\n function setBaseLiveWinProb(uint128 _baseLiveWinProb) external;\n\n function setExpiredWinProb(uint128 _expiredWinProb) external;\n\n function setDecayRate(uint32 _decayRate) external;\n\n function setTicketDuration(uint256 _ticketDuration) external;\n\n function getTicketingParameters()\n external\n view\n returns (uint256, uint128, uint128, uint256, uint32);\n}\n" + }, + "contracts/interfaces/staking/IDirectory.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface IDirectory {\n /**\n * @dev A DirectoryEntry will be stored for every node that joins the\n * network in a specific epoch. The entry will contain the stakee's\n * address, and a boundary value which is a sum of the current directory's\n * total stake, and the current stakee's total stake.\n */\n struct DirectoryEntry {\n address stakee;\n uint256 boundary;\n }\n\n /**\n * @dev An EpochDirectory will be stored for every epoch. The\n * directory will be constructed piece by piece as Nodes join,\n * each adding their own directory entry based on their current\n * stake value.\n */\n struct EpochDirectory {\n DirectoryEntry[] entries;\n mapping(address => uint256) stakes;\n uint256 totalStake;\n }\n\n function setCurrentDirectory(uint256 epochId) external;\n\n function joinNextDirectory(address stakee, uint256 seekerId) external;\n\n function scan(uint128 point) external view returns (address stakee);\n\n function scanWithEpochId(\n uint128 point,\n uint256 epochId\n ) external view returns (address stakee);\n\n function getTotalStakeForStakee(\n uint256 epochId,\n address stakee\n ) external view returns (uint256);\n\n function getTotalStake(uint256 epochId) external view returns (uint256);\n\n function getEntries(\n uint256 epochId\n ) external view returns (address[] memory, uint256[] memory);\n}\n" + }, + "contracts/interfaces/staking/IStakingManager.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface IStakingManager {\n /**\n * For every Node, there will be a mapping of the staker to a\n * StakeEntry. The stake entry tracks the amount of stake in SOLO,\n * and also when the stake was updated.\n */\n struct StakeEntry {\n uint256 amount;\n // Block number this entry was updated at\n uint256 updatedAt;\n // Epoch this entry was updated. The stake will become active\n // in the following epoch\n uint256 epochId;\n }\n\n /**\n * Every Node must have stake in order to participate in the Epoch.\n * Stake can be provided by the Node itself or by other accounts in\n * the network.\n */\n struct Stake {\n // Track each stake entry associated to a node\n mapping(address => StakeEntry) stakeEntries;\n // The total stake held by this contract for a node,\n // which will be the sum of all addStake and unlockStake calls\n uint256 totalManagedStake;\n }\n\n /**\n * This struct will track stake that is in the process of unlocking.\n */\n struct Unlock {\n uint256 amount; // Amount of stake unlocking\n uint256 unlockAt; // Block number the stake becomes withdrawable\n }\n\n function setUnlockDuration(uint256 _unlockDuration) external;\n\n function setMinimumStakeProportion(uint32 _minimumStakeProportion) external;\n\n function addStake(uint256 amount, address stakee) external;\n\n function unlockStake(uint256 amount, address stakee) external returns (uint256);\n\n function withdrawStake(address stakee) external;\n\n function cancelUnlocking(uint256 amount, address stakee) external;\n\n function calculateCapacityFromSeekerPower(uint256 seekerId) external view returns (uint256);\n\n function calculateMaxAdditionalDelegatedStake(address stakee) external view returns (uint256);\n\n function getTotalManagedStake() external view returns (uint256);\n\n function getStakeEntry(\n address stakee,\n address staker\n ) external view returns (StakeEntry memory);\n\n function getStakeeTotalManagedStake(address stakee) external view returns (uint256);\n}\n" + }, + "contracts/libraries/Manageable.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an list of public managers who may be added or removed.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyManager`, which can be applied to your functions to restrict their use to\n * other contracts which have explicitly been added.\n */\nabstract contract Manageable is Ownable2StepUpgradeable {\n /**\n * @dev Tracks the managers added to this contract, where they key is the\n * address of the managing contract, and the value is the block the manager was added in.\n * We use this mapping to restrict access to those functions in a similar\n * fashion to the onlyOwner construct.\n */\n mapping(address => uint256) public managers;\n\n error OnlyManagers();\n error ManagerCannotBeZeroAddress();\n\n /**\n * @notice Adds a manager to this contract. Only callable by the owner.\n * @param manager The address of the manager contract.\n */\n function addManager(address manager) external onlyOwner {\n if (manager == address(0)) {\n revert ManagerCannotBeZeroAddress();\n }\n managers[manager] = block.number;\n }\n\n /**\n * @notice Removes a manager from this contract. Only callable by the owner.\n * @param manager The address of the manager contract.\n */\n function removeManager(address manager) external onlyOwner {\n delete managers[manager];\n }\n\n /**\n * @dev This modifier allows us to specify that certain contracts have\n * special privileges to call restricted functions.\n */\n modifier onlyManager() {\n if (managers[msg.sender] == 0) {\n revert OnlyManagers();\n }\n _;\n }\n\n // Reserve storage slots for future variables\n uint256[49] private __gap;\n}\n" + }, + "contracts/libraries/SyloUtils.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nerror ContractNameCannotBeEmpty();\nerror InterfaceIdCannotBeZeroBytes();\nerror TargetContractCannotBeZeroAddress(string name);\nerror TargetNotSupportInterface(string name, bytes4 interfaceId);\n\nlibrary SyloUtils {\n /**\n * @dev The maximum possible SYLO that exists in the network.\n */\n uint256 public constant MAX_SYLO = 10_000_000_000 ether;\n\n /**\n * @dev Percentages are expressed as a ratio where 100000 is the denominator.\n * A large denominator allows for more precision, e.g representing 12.5%\n * can be done as 12500 / 100000\n */\n uint32 public constant PERCENTAGE_DENOMINATOR = 100000;\n\n /**\n * @dev Multiply a value by a given percentage. Converts the provided\n * uint128 value to uint256 to avoid any reverts on overflow.\n * @param value The value to multiply.\n * @param percentage The percentage, as a ratio of 10000.\n */\n function percOf(uint128 value, uint32 percentage) internal pure returns (uint256) {\n return (uint256(value) * percentage) / PERCENTAGE_DENOMINATOR;\n }\n\n /**\n * @dev Return a fraction as a percentage.\n * @param numerator The numerator limited to a uint128 value to prevent\n * phantom overflow.\n * @param denominator The denominator.\n * @return The percentage, as a ratio of 10000.\n */\n function asPerc(uint128 numerator, uint256 denominator) internal pure returns (uint32) {\n return SafeCast.toUint32((uint256(numerator) * PERCENTAGE_DENOMINATOR) / denominator);\n }\n\n /**\n * @dev Validate that a contract implements a given interface.\n * @param name The name of the contract, used in error messages.\n * @param target The address of the contract.\n * @param interfaceId The interface ID to check.\n */\n function validateContractInterface(\n string memory name,\n address target,\n bytes4 interfaceId\n ) internal view {\n if (bytes(name).length == 0) {\n revert ContractNameCannotBeEmpty();\n }\n if (target == address(0)) {\n revert TargetContractCannotBeZeroAddress(name);\n }\n if (interfaceId == bytes4(0)) {\n revert InterfaceIdCannotBeZeroBytes();\n }\n if (!ERC165(target).supportsInterface(interfaceId)) {\n revert TargetNotSupportInterface(name, interfaceId);\n }\n }\n}\n" + }, + "contracts/payments/SyloTicketing.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\n\nimport \"../Registries.sol\";\nimport \"../staking/Directory.sol\";\nimport \"../libraries/SyloUtils.sol\";\nimport \"../epochs/EpochsManager.sol\";\nimport \"../staking/StakingManager.sol\";\nimport \"./ticketing/RewardsManager.sol\";\nimport \"../AuthorizedAccounts.sol\";\nimport \"../interfaces/payments/ISyloTicketing.sol\";\nimport \"../interfaces/IFuturePassRegistrar.sol\";\n\n/**\n * @notice The SyloTicketing contract manages the Probabilistic\n * Micro-Payment Ticketing system that pays Nodes for providing the\n * Event Relay service.\n */\ncontract SyloTicketing is ISyloTicketing, Initializable, Ownable2StepUpgradeable, ERC165 {\n /** ERC20 Sylo token contract.*/\n IERC20 public _token;\n\n /** Sylo Registries contract */\n Registries public _registries;\n\n /** Sylo Staking Manager contract */\n StakingManager public _stakingManager;\n\n /** Sylo Directory contract */\n Directory public _directory;\n\n /** Rewards Manager contract */\n RewardsManager public _rewardsManager;\n\n /**\n * @notice Sylo Epochs Manager.\n * @dev The ticketing parameters used when redeeming tickets\n * will be read from this contract.\n */\n EpochsManager public _epochsManager;\n\n /**\n * @notice Sylo Authorized Accounts.\n */\n AuthorizedAccounts public _authorizedAccounts;\n\n /**\n * @notice Futurepass Registrar Pre-compile.\n */\n IFuturePassRegistrar public _futurepassRegistrar;\n\n /**\n * @notice The number of blocks a user must wait after calling \"unlock\"\n * before they can withdraw their funds.\n */\n uint256 public unlockDuration;\n\n /** @notice Mapping of user deposits */\n mapping(address => Deposit) public deposits;\n\n /** @notice Mapping of ticket hashes, used to check if a ticket has been redeemed */\n mapping(bytes32 => bool) public usedTickets;\n\n event UnlockDurationUpdated(uint256 unlockDuration);\n event SenderPenaltyBurnt(address sender);\n event Redemption(\n uint256 indexed epochId,\n address indexed redeemer,\n address indexed sender,\n address receiver,\n uint256 generationBlock,\n uint256 amount\n );\n event MultiReceiverRedemption(\n uint256 indexed epochId,\n address indexed redeemer,\n address indexed sender,\n address receiver,\n uint256 generationBlock,\n uint256 amount\n );\n\n error NoEsrowAndPenalty();\n error UnlockingInProcess();\n error UnlockingNotInProcess();\n error UnlockingNotCompleted();\n error EscrowAmountCannotBeZero();\n error PenaltyAmountCannotBeZero();\n error UnlockDurationCannotBeZero();\n error AccountCannotBeZeroAddress();\n error InvalidSenderSigningPermission();\n error InvalidReceiverSigningPermission();\n\n error TicketNotWinning();\n error MissingFuturepassAccount(address receiver);\n error TicketAlreadyUsed();\n error TicketEpochNotFound();\n error TicketAlreadyRedeemed();\n error RedeemerCommitMismatch();\n error InvalidSenderSignature();\n error InvalidReceiverSignature();\n error TokenCannotBeZeroAddress();\n error TicketNotCreatedInTheEpoch();\n error TicketCannotBeFromFutureBlock();\n error TicketSenderCannotBeZeroAddress();\n error TicketReceiverCannotBeZeroAddress();\n error TicketRedeemerCannotBeZeroAddress();\n error RedeemerMustHaveJoinedEpoch(uint256 epochId);\n\n function initialize(\n IERC20 token,\n Registries registries,\n StakingManager stakingManager,\n Directory directory,\n EpochsManager epochsManager,\n RewardsManager rewardsManager,\n AuthorizedAccounts authorizedAccounts,\n IFuturePassRegistrar futurepassRegistrar,\n uint256 _unlockDuration\n ) external initializer {\n if (address(token) == address(0)) {\n revert TokenCannotBeZeroAddress();\n }\n\n SyloUtils.validateContractInterface(\n \"Registries\",\n address(registries),\n type(IRegistries).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"StakingManager\",\n address(stakingManager),\n type(IStakingManager).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"Directory\",\n address(directory),\n type(IDirectory).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"EpochsManager\",\n address(epochsManager),\n type(IEpochsManager).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"RewardsManager\",\n address(rewardsManager),\n type(IRewardsManager).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"AuthorizedAccounts\",\n address(authorizedAccounts),\n type(IAuthorizedAccounts).interfaceId\n );\n\n if (_unlockDuration == 0) {\n revert UnlockDurationCannotBeZero();\n }\n\n Ownable2StepUpgradeable.__Ownable2Step_init();\n\n _token = token;\n _registries = registries;\n _stakingManager = stakingManager;\n _directory = directory;\n _epochsManager = epochsManager;\n _rewardsManager = rewardsManager;\n _authorizedAccounts = authorizedAccounts;\n _futurepassRegistrar = futurepassRegistrar;\n\n unlockDuration = _unlockDuration;\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(ISyloTicketing).interfaceId;\n }\n\n /**\n * @notice Set the unlock duration for deposits. Only callable\n * by the owner.\n * @param _unlockDuration The unlock duration in blocks.\n */\n function setUnlockDuration(uint256 _unlockDuration) external onlyOwner {\n if (_unlockDuration == 0) {\n revert UnlockDurationCannotBeZero();\n }\n\n unlockDuration = _unlockDuration;\n emit UnlockDurationUpdated(_unlockDuration);\n }\n\n /**\n * @notice Use this function to deposit funds into the\n * escrow. This will fail if the deposit is currently being\n * unlocked.\n * @param amount The amount in SOLO to add to the escrow.\n * @param account The address of the account holding the escrow.\n */\n function depositEscrow(uint256 amount, address account) external {\n if (amount == 0) {\n revert EscrowAmountCannotBeZero();\n }\n if (account == address(0)) {\n revert AccountCannotBeZeroAddress();\n }\n\n Deposit storage deposit = getDeposit(account);\n if (deposit.unlockAt != 0) {\n revert UnlockingInProcess();\n }\n\n deposit.escrow = deposit.escrow + amount;\n\n SafeERC20.safeTransferFrom(_token, msg.sender, address(this), amount);\n }\n\n /**\n * @notice Use this function to deposit funds into the\n * penalty. This will fail if the deposit is currently being\n * unlocked.\n * @param amount The amount in SOLO to add to the escrow.\n * @param account The address of the account holding the penalty.\n */\n function depositPenalty(uint256 amount, address account) external {\n if (amount == 0) {\n revert PenaltyAmountCannotBeZero();\n }\n if (account == address(0)) {\n revert AccountCannotBeZeroAddress();\n }\n\n Deposit storage deposit = getDeposit(account);\n if (deposit.unlockAt != 0) {\n revert UnlockingInProcess();\n }\n\n deposit.penalty = deposit.penalty + amount;\n\n SafeERC20.safeTransferFrom(_token, msg.sender, address(this), amount);\n }\n\n /**\n * @notice Call this function to begin unlocking deposits. This function\n * will fail if no deposit exists, or if the unlock process has\n * already begun.\n */\n function unlockDeposits() external returns (uint256) {\n Deposit storage deposit = getDeposit(msg.sender);\n\n if (deposit.escrow == 0 && deposit.penalty == 0) {\n revert NoEsrowAndPenalty();\n }\n if (deposit.unlockAt != 0) {\n revert UnlockingInProcess();\n }\n\n deposit.unlockAt = block.number + unlockDuration;\n\n return deposit.unlockAt;\n }\n\n /**\n * @notice Call this function to cancel any deposit that is in the\n * unlocking process.\n */\n function lockDeposits() external {\n Deposit storage deposit = getDeposit(msg.sender);\n if (deposit.unlockAt == 0) {\n revert UnlockingNotInProcess();\n }\n\n delete deposit.unlockAt;\n }\n\n /**\n * @notice Call this function once the unlock duration has\n * elapsed in order to transfer the unlocked tokens to the caller's account.\n */\n function withdraw() external {\n return withdrawTo(msg.sender);\n }\n\n /**\n * @notice Call this function once the unlock duration has\n * elapsed in order to transfer the unlocked tokens to the specified\n * account.\n * @param account The address of the account the tokens should be\n * transferred to.\n */\n function withdrawTo(address account) public {\n Deposit memory deposit = getDeposit(msg.sender);\n if (deposit.unlockAt == 0) {\n revert UnlockingNotInProcess();\n }\n if (deposit.unlockAt >= block.number) {\n revert UnlockingNotCompleted();\n }\n\n uint256 amount = deposit.escrow + deposit.penalty;\n\n // Reset deposit values to 0\n delete deposits[msg.sender];\n\n SafeERC20.safeTransfer(_token, account, amount);\n }\n\n /**\n * @notice Nodes should call this function on completing an event\n * delivery. This function will fail if the ticket is invalid or if the\n * ticket is not a winner. Clients should calculate if the ticket is a\n * winner locally, but can also use the public view functions:\n * `requireValidWinningTicket` and `isWinningTicket` to check that a ticket\n * is winning.\n * @param ticket The ticket issued by the sender.\n * @param redeemerRand The redeemer random value, generated by the Node prior\n * to performing the event relay.\n * @param senderSig The signature of the sender of the ticket.\n * @param receiverSig The signature of the redeemer of the ticket.\n */\n function redeem(\n Ticket calldata ticket,\n uint256 redeemerRand,\n bytes calldata senderSig,\n bytes calldata receiverSig\n ) external {\n EpochsManager.Epoch memory epoch = _epochsManager.getEpoch(ticket.epochId);\n if (ticket.generationBlock > block.number) {\n revert TicketCannotBeFromFutureBlock();\n }\n\n bytes32 ticketHash = requireValidWinningTicket(\n ticket,\n redeemerRand,\n senderSig,\n receiverSig\n );\n\n usedTickets[ticketHash] = true;\n\n uint256 directoryStake = _directory.getTotalStakeForStakee(\n ticket.epochId,\n ticket.redeemer\n );\n if (directoryStake == 0) {\n revert RedeemerMustHaveJoinedEpoch(ticket.epochId);\n }\n\n _redeem(epoch, ticket);\n }\n\n /**\n * @notice Nodes should call this function on completing a one-to-many event\n * delivery. This function will fail if the ticket is invalid or if the\n * ticket is not a winner. Additionally, the specified receiver must have\n * a valid futurepass account associated with it. Clients should calculate\n * if the ticket is a winner locally, but can also use the public view\n * functions:\n * `requireValidWinningMultiReceiverTicket` and `isWinningTicket` to check\n * that a ticket is winning.\n * @param ticket The ticket issued by the sender.\n * @param redeemerRand The redeemer random value, generated by the Node prior\n * to performing the event relay.\n * @param receiver A valid receiver of the the relay.\n * @param senderSig The signature of the sender of the ticket.\n * @param receiverSig The signature of the redeemer of the ticket.\n */\n function redeemMultiReceiver(\n MultiReceiverTicket calldata ticket,\n uint256 redeemerRand,\n User calldata receiver,\n bytes calldata senderSig,\n bytes calldata receiverSig\n ) external {\n EpochsManager.Epoch memory epoch = _epochsManager.getEpoch(ticket.epochId);\n if (ticket.generationBlock > block.number) {\n revert TicketCannotBeFromFutureBlock();\n }\n\n (, bytes32 ticketReceiverHash) = requireValidWinningMultiReceiverTicket(\n ticket,\n receiver,\n redeemerRand,\n senderSig,\n receiverSig\n );\n\n usedTickets[ticketReceiverHash] = true;\n\n uint256 directoryStake = _directory.getTotalStakeForStakee(\n ticket.epochId,\n ticket.redeemer\n );\n if (directoryStake == 0) {\n revert RedeemerMustHaveJoinedEpoch(ticket.epochId);\n }\n\n _redeemMultiReceiver(epoch, ticket, receiver.main);\n }\n\n function _redeem(EpochsManager.Epoch memory epoch, Ticket calldata ticket) internal {\n uint256 rewardAmount = rewardRedeemer(epoch, ticket.sender, ticket.redeemer);\n\n emit Redemption(\n ticket.epochId,\n ticket.redeemer,\n ticket.sender.main,\n ticket.receiver.main,\n ticket.generationBlock,\n rewardAmount\n );\n }\n\n function _redeemMultiReceiver(\n EpochsManager.Epoch memory epoch,\n MultiReceiverTicket calldata ticket,\n address receiver\n ) internal {\n uint256 rewardAmount = rewardRedeemer(epoch, ticket.sender, ticket.redeemer);\n\n emit MultiReceiverRedemption(\n ticket.epochId,\n ticket.redeemer,\n ticket.sender.main,\n receiver,\n ticket.generationBlock,\n rewardAmount\n );\n }\n\n function rewardRedeemer(\n EpochsManager.Epoch memory epoch,\n User calldata sender,\n address redeemer\n ) internal returns (uint256) {\n Deposit storage deposit = getDeposit(sender.main);\n\n uint256 amount;\n\n if (epoch.faceValue > deposit.escrow) {\n amount = deposit.escrow;\n incrementRewardPool(redeemer, deposit, amount);\n SafeERC20.safeTransfer(\n _token,\n address(0x000000000000000000000000000000000000dEaD),\n deposit.penalty\n );\n\n delete deposit.penalty;\n emit SenderPenaltyBurnt(sender.main);\n } else {\n amount = epoch.faceValue;\n incrementRewardPool(redeemer, deposit, amount);\n }\n\n return amount;\n }\n\n /**\n * @notice Call this function to check if a ticket is valid and is\n * a winning ticket. It will fail if the ticket is invalid or is not\n * a winner. A ticket is invalid if:\n * - The sender or redeemer addresses are null\n * - The ticket has already been redeemed.\n * - The secret random value of the sender does not match the commit\n * in the ticket.\n * - The signatures are invalid.\n * @param ticket The ticket issued by the sender.\n * @param redeemerRand The redeemer random value, generated by the Node prior\n * to performing the event relay.\n * @param senderSig The signature of the sender of the ticket.\n * @param receiverSig The signature of the redeemer of the ticket.\n * @return ticketHash The hash of the ticket. Should match the hash generated\n * by `getTicketHash`.\n */\n function requireValidWinningTicket(\n Ticket memory ticket,\n uint256 redeemerRand,\n bytes calldata senderSig,\n bytes calldata receiverSig\n ) public view returns (bytes32 ticketHash) {\n if (ticket.sender.main == address(0)) {\n revert TicketSenderCannotBeZeroAddress();\n }\n if (ticket.receiver.main == address(0)) {\n revert TicketReceiverCannotBeZeroAddress();\n }\n if (ticket.redeemer == address(0)) {\n revert TicketRedeemerCannotBeZeroAddress();\n }\n\n ticketHash = getTicketHash(ticket);\n if (usedTickets[ticketHash]) {\n revert TicketAlreadyRedeemed();\n }\n\n // validate the redeemer has knowledge of the redeemer rand\n if (createCommit(ticket.generationBlock, redeemerRand) != ticket.redeemerCommit) {\n revert RedeemerCommitMismatch();\n }\n\n if (!hasSigningPermission(ticket.sender, ticket.generationBlock)) {\n revert InvalidSenderSigningPermission();\n }\n if (!hasSigningPermission(ticket.receiver, ticket.generationBlock)) {\n revert InvalidReceiverSigningPermission();\n }\n\n if (!isValidTicketSig(ticket.sender, senderSig, ticketHash)) {\n revert InvalidSenderSignature();\n }\n if (!isValidTicketSig(ticket.receiver, receiverSig, ticketHash)) {\n revert InvalidReceiverSignature();\n }\n\n if (\n !isWinningTicket(\n senderSig,\n receiverSig,\n ticket.epochId,\n ticket.generationBlock,\n redeemerRand\n )\n ) {\n revert TicketNotWinning();\n }\n }\n\n /**\n * @notice Call this function to check if a multi receiver ticket is valid and is\n * a winning ticket. It will fail if the ticket is invalid or is not\n * a winner. A ticket is invalid if:\n * - The sender, receiver or redeemer addresses are null\n * - The receiver does not have a valid futurepass account\n * - The ticket has already been redeemed.\n * - The secret random value of the redeemer does not match the commit\n * in the ticket.\n * - The signatures are invalid.\n * @param ticket The ticket issued by the sender.\n * @param receiver The receiver associated with the ticket.\n * @param redeemerRand The redeemer random value, generated by the Node prior\n * to performing the event relay.\n * @param senderSig The signature of the sender of the ticket.\n * @param receiverSig The signature of the redeemer of the ticket.\n */\n function requireValidWinningMultiReceiverTicket(\n MultiReceiverTicket memory ticket,\n User calldata receiver,\n uint256 redeemerRand,\n bytes calldata senderSig,\n bytes calldata receiverSig\n ) public view returns (bytes32 ticketHash, bytes32 ticketReceiverHash) {\n if (ticket.sender.main == address(0)) {\n revert TicketSenderCannotBeZeroAddress();\n }\n if (receiver.main == address(0)) {\n revert TicketReceiverCannotBeZeroAddress();\n }\n if (ticket.redeemer == address(0)) {\n revert TicketRedeemerCannotBeZeroAddress();\n }\n\n address futurepassAccount = _futurepassRegistrar.futurepassOf(receiver.main);\n if (futurepassAccount == address(0)) {\n revert MissingFuturepassAccount(receiver.main);\n }\n\n // There are two hashes create. The first hash is signed by the\n // sender and receiver, and is primarily used to validate these actors\n // agreed on the contents of the ticket.\n // The second hash is to prevent re-use. In a multi-receiver context,\n // the same ticket can be re-used amongst many receiver, but should\n // only be used ONCE per futurepass account. Thus the second hash\n // additionally appends the futurepass address as well.\n ticketHash = getMultiReceiverTicketHash(ticket);\n ticketReceiverHash = keccak256(abi.encodePacked(ticketHash, futurepassAccount));\n if (usedTickets[ticketReceiverHash]) {\n revert TicketAlreadyRedeemed();\n }\n\n // validate the redeemer has knowledge of the redeemer rand\n if (createCommit(ticket.generationBlock, redeemerRand) != ticket.redeemerCommit) {\n revert RedeemerCommitMismatch();\n }\n\n if (!hasSigningPermission(ticket.sender, ticket.generationBlock)) {\n revert InvalidSenderSigningPermission();\n }\n if (!hasSigningPermission(receiver, ticket.generationBlock)) {\n revert InvalidReceiverSigningPermission();\n }\n\n if (!isValidTicketSig(ticket.sender, senderSig, ticketHash)) {\n revert InvalidSenderSignature();\n }\n if (!isValidTicketSig(receiver, receiverSig, ticketHash)) {\n revert InvalidReceiverSignature();\n }\n\n if (\n !isWinningTicket(\n senderSig,\n receiverSig,\n ticket.epochId,\n ticket.generationBlock,\n redeemerRand\n )\n ) {\n revert TicketNotWinning();\n }\n\n return (ticketHash, ticketReceiverHash);\n }\n\n function hasSigningPermission(\n User memory user,\n uint256 generationBlock\n ) internal view returns (bool) {\n if (user.delegated == address(0)) {\n return true;\n }\n\n IAuthorizedAccounts.Permission permission = IAuthorizedAccounts.Permission.PersonalSign;\n return\n _authorizedAccounts.validatePermission(\n user.main,\n user.delegated,\n permission,\n generationBlock\n );\n }\n\n function createCommit(uint256 generationBlock, uint256 rand) public pure returns (bytes32) {\n return keccak256(abi.encodePacked(keccak256(abi.encodePacked(generationBlock, rand))));\n }\n\n function getDeposit(address account) private view returns (Deposit storage) {\n return deposits[account];\n }\n\n function isValidTicketSig(\n User memory user,\n bytes memory sig,\n bytes32 ticketHash\n ) internal pure returns (bool) {\n address signer = address(0);\n if (user.delegated != address(0)) {\n signer = user.delegated;\n } else {\n signer = user.main;\n }\n bytes32 ethHash = ECDSA.toEthSignedMessageHash(ticketHash);\n return ECDSA.recover(ethHash, sig) == signer;\n }\n\n /**\n * @notice Use this function to check if a ticket is winning.\n * @param senderSig The signature of the sender of the ticket.\n * @param receiverSig The signature of the receiver of the ticket.\n * @param epochId The epochId of the ticket.\n * @param generationBlock The generationBlock of the ticket.\n * @param redeemerRand The redeemer random value, generated by the Node prior\n * to performing the event relay.\n * @return True if a ticket is a winner.\n */\n function isWinningTicket(\n bytes memory senderSig,\n bytes memory receiverSig,\n uint256 epochId,\n uint256 generationBlock,\n uint256 redeemerRand\n ) public view returns (bool) {\n uint256 winProb = calculateWinningProbability(epochId, generationBlock);\n // bitshift the winProb to a 256 bit value to allow comparison to a 32 byte hash\n uint256 prob = (uint256(winProb) << 128) | uint256(winProb);\n return uint256(keccak256(abi.encodePacked(senderSig, receiverSig, redeemerRand))) < prob;\n }\n\n /**\n * @notice This function calculates the probability of a ticket winning at\n * the block that this function was called. A ticket's winning probability\n * will decay every block since its issuance. The amount of decay will depend\n * on the decay rate parameter of the epoch the ticket was generated in.\n * @param epochId The epochId of the ticket.\n * @param generationBlock The generationBlock of the ticket.\n */\n function calculateWinningProbability(\n uint256 epochId,\n uint256 generationBlock\n ) public view returns (uint128) {\n EpochsManager.Epoch memory epoch = _epochsManager.getEpoch(epochId);\n if (epoch.startBlock == 0) {\n revert TicketEpochNotFound();\n }\n\n if (\n generationBlock < epoch.startBlock ||\n (epoch.endBlock > 0 && generationBlock >= epoch.endBlock)\n ) {\n revert TicketNotCreatedInTheEpoch();\n }\n\n uint256 elapsedDuration = block.number - generationBlock;\n\n // Ticket has completely expired\n if (elapsedDuration >= epoch.ticketDuration) {\n return 0;\n }\n\n uint256 maxDecayValue = SyloUtils.percOf(epoch.baseLiveWinProb, epoch.decayRate);\n\n // determine the amount of probability that has actually decayed\n // by multiplying the maximum decay value against ratio of the tickets elapsed duration\n // vs the actual ticket duration. The max decay value is calculated from a fraction of a\n // uint128 value so we cannot phantom overflow here\n uint256 decayedProbability = (maxDecayValue * elapsedDuration) / epoch.ticketDuration;\n\n // calculate the remaining probability by subtracting the decayed probability\n // from the base\n return epoch.baseLiveWinProb - SafeCast.toUint128(decayedProbability);\n }\n\n /**\n * @notice Returns the hash of the ticket. Takes all fields in a ticket\n * as inputs to the hash.\n * @return A byte-array representing the hash.\n */\n function getTicketHash(Ticket memory ticket) public pure returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(\n ticket.epochId,\n ticket.sender.main,\n ticket.receiver.main,\n ticket.redeemer,\n ticket.generationBlock,\n ticket.redeemerCommit\n )\n );\n }\n\n /**\n * @notice Returns the hash of a multi receiver ticket. Takes all fields in\n * a ticket as inputs to the hash, as well as a specific receiver.\n * @return A byte-array representing the hash.\n */\n function getMultiReceiverTicketHash(\n MultiReceiverTicket memory ticket\n ) public pure returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(\n ticket.epochId,\n ticket.sender.main,\n ticket.redeemer,\n ticket.generationBlock,\n ticket.redeemerCommit\n )\n );\n }\n\n function incrementRewardPool(\n address stakee,\n Deposit storage deposit,\n uint256 amount\n ) internal {\n deposit.escrow = deposit.escrow - amount;\n\n SafeERC20.safeTransfer(_token, address(_rewardsManager), amount);\n _rewardsManager.incrementRewardPool(stakee, amount);\n }\n}\n" + }, + "contracts/payments/ticketing/RewardsManager.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"abdk-libraries-solidity/ABDKMath64x64.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\n\nimport \"../../libraries/SyloUtils.sol\";\nimport \"../../libraries/Manageable.sol\";\nimport \"../../epochs/EpochsManager.sol\";\nimport \"../../staking/StakingManager.sol\";\nimport \"../../interfaces/epochs/IEpochsManager.sol\";\nimport \"../../interfaces/staking/IStakingManager.sol\";\nimport \"../../interfaces/payments/ticketing/IRewardsManager.sol\";\n\n/**\n * @notice Handles epoch based reward pools that are incremented from redeeming tickets.\n * Nodes use this contract to set up their reward pool for the next epoch,\n * and stakers use this contract to track and claim staking rewards.\n * @dev After deployment, the SyloTicketing contract should be\n * set up as a manager to be able to call certain restricted functions.\n */\ncontract RewardsManager is IRewardsManager, Initializable, Manageable, ERC165 {\n uint256 internal constant ONE_SYLO = 1 ether;\n\n // 64x64 Fixed point representation of 1 SYLO (10**18 >> 64)\n int128 internal constant ONE_SYLO_FIXED = 18446744073709551616000000000000000000;\n\n uint256 internal constant MAX_INT64 = 9223372036854775807;\n\n /** ERC20 Sylo token contract. */\n IERC20 public _token;\n\n /** Sylo Staking Manager contract. */\n StakingManager public _stakingManager;\n\n /** Sylo Epochs Manager. */\n EpochsManager public _epochsManager;\n\n /**\n * @dev Each node will manage a cumulative reward factor (CRF) that is incremented\n * whenever a ticket is redeemed. This factor acts as a single value\n * that can be used to calculate any particular staker's reward share. This\n * prevents the need to individually track each staker's proportion, and also allows\n * a claim calculation to be performed without iterating through every epoch.\n *\n * The CRF is calculated as CRF = CRF + Reward / TotalStake.\n */\n mapping(address => int128) private cumulativeRewardFactors;\n\n /**\n * @notice Tracks the last epoch a delegated staker made a reward claim in.\n * The key to this mapping is a hash of the Node's address and the delegated\n * stakers address.\n */\n mapping(bytes32 => LastClaim) public lastClaims;\n\n /**\n * @notice Tracks each Nodes total pending rewards in SOLOs. This\n * value is accumulated as Node's redeem tickets. Rewards are pending if the\n * distribution amongst the stakers has not been accounted for yet. Pending rewards\n * are transferred to unclaimed rewards once the the staker's share has been\n * calculated.\n */\n mapping(address => uint256) public pendingRewards;\n\n /**\n * @notice Tracks rewards for stakers after the stakers share has been calculated,\n * but has not actually been claimed by the staker.\n * The node fee reward is also added to the node's unclaimedStakingRewards.\n */\n mapping(bytes32 => uint256) public unclaimedStakingRewards;\n\n /**\n * @notice Tracks each Node's most recently active reward pool\n */\n mapping(address => uint256) public latestActiveRewardPools;\n\n /**\n * @notice Tracks total accumulated rewards in each epoch\n */\n mapping(uint256 => uint256) public totalEpochRewards;\n\n /**\n * @notice Tracks total accumulated staking rewards in each epoch\n */\n mapping(uint256 => uint256) public totalEpochStakingRewards;\n\n /**\n * @notice Tracks each reward pool initialized by a Node. The key to this map\n * is derived from the epochId and the Node's address.\n */\n mapping(bytes32 => RewardPool) public rewardPools;\n\n error NoRewardToClaim();\n error AmountCannotBeZero();\n error RewardPoolNotExist();\n error RewardPoolAlreadyExist();\n error DoNotAllowZeroAddress();\n error TokenCannotBeZeroAddress();\n error NoStakeToCreateRewardPool();\n error StakeeCannotBeZeroAddress();\n error StakerCannotBeZeroAddress();\n error StakerKeyCannotBeZeroBytes();\n error InvalidFixedPointResult();\n\n function initialize(\n IERC20 token,\n StakingManager stakingManager,\n EpochsManager epochsManager\n ) external initializer {\n if (address(token) == address(0)) {\n revert TokenCannotBeZeroAddress();\n }\n\n SyloUtils.validateContractInterface(\n \"StakingManager\",\n address(stakingManager),\n type(IStakingManager).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"EpochsManager\",\n address(epochsManager),\n type(IEpochsManager).interfaceId\n );\n\n Ownable2StepUpgradeable.__Ownable2Step_init();\n\n _token = token;\n _epochsManager = epochsManager;\n _stakingManager = stakingManager;\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IRewardsManager).interfaceId;\n }\n\n /**\n * @notice Returns the key used to index a reward pool. The key is a hash of\n * the epochId and Node's address.\n * @param epochId The epoch ID the reward pool was created in.\n * @param stakee The address of the Node.\n * @return A byte-array representing the reward pool key.\n */\n function getRewardPoolKey(uint256 epochId, address stakee) public pure returns (bytes32) {\n return keccak256(abi.encodePacked(epochId, stakee));\n }\n\n /**\n * @notice Returns the key used to index staking claims. The key is a hash of\n * the Node's address and the staker's address.\n * @param stakee The address of the Node.\n * @param staker The address of the stake.\n * @return A byte-array representing the key.\n */\n function getStakerKey(address stakee, address staker) public pure returns (bytes32) {\n return keccak256(abi.encodePacked(stakee, staker));\n }\n\n /**\n * @notice Retrieve the reward pool initialized by the given node, at the specified\n * epoch.\n * @param epochId The ID of the epoch the reward pool was initialized in.\n * @param stakee The address of the Node.\n * @return The reward pool.\n */\n function getRewardPool(\n uint256 epochId,\n address stakee\n ) external view returns (RewardPool memory) {\n return rewardPools[getRewardPoolKey(epochId, stakee)];\n }\n\n /**\n * @notice Retrieve the total accumulated reward that will be distributed to a Node's\n * delegated stakers for a given epoch.\n * @param epochId The ID of the epoch the reward pool was initialized in.\n * @param stakee The address of the Node.\n * @return The total accumulated staker reward in SOLO.\n */\n function getRewardPoolStakersTotal(\n uint256 epochId,\n address stakee\n ) external view returns (uint256) {\n return rewardPools[getRewardPoolKey(epochId, stakee)].stakersRewardTotal;\n }\n\n /**\n * @notice Retrieve the total active stake that will be used for a Node's reward\n * pool in a given epoch.\n * @param epochId The ID of the epoch the reward pool was initialized in.\n * @param stakee The address of the Node.\n * @return The total active stake for that reward pool in SOLO.\n */\n function getRewardPoolActiveStake(\n uint256 epochId,\n address stakee\n ) external view returns (uint256) {\n return rewardPools[getRewardPoolKey(epochId, stakee)].totalActiveStake;\n }\n\n /**\n * @notice Retrieve the total pending staking reward allocated to a Node's\n * stakers.\n * @param stakee The address of the Node.\n * @return The total pending staking reward in SOLO.\n */\n function getPendingRewards(address stakee) external view returns (uint256) {\n return pendingRewards[stakee];\n }\n\n /**\n * @notice Retrieves the ID of the epoch in which a staker last made their\n * staking claim.\n * @param stakee The address of the Node.\n * @param staker The address of the staker.\n * @return The ID of the epoch.\n */\n function getLastClaim(\n address stakee,\n address staker\n ) external view returns (LastClaim memory) {\n return lastClaims[getStakerKey(stakee, staker)];\n }\n\n /**\n * @notice Retrieves the total accumulated rewards for a specific epoch.\n * @param epochId The epoch id.\n * @return The total reward in that epoch, including staking rewards and fee\n * reward.\n */\n function getTotalEpochRewards(uint256 epochId) external view returns (uint256) {\n return totalEpochRewards[epochId];\n }\n\n /**\n * @notice Retrieves the total accumulated rewards for stakers in a specific epoch.\n * @param epochId The epoch id.\n * @return The total staking reward in that epoch.\n */\n function getTotalEpochStakingRewards(uint256 epochId) external view returns (uint256) {\n return totalEpochStakingRewards[epochId];\n }\n\n /**\n * @notice This is used by Nodes to initialize their reward pool for\n * the next epoch. This function will revert if the caller has no stake, or\n * if the reward pool has already been initialized. The total active stake\n * for the next reward pool is calculated by summing up the total managed\n * stake held by the RewardsManager contract.\n */\n function initializeNextRewardPool(address stakee) external onlyManager {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n\n uint256 nextEpochId = _epochsManager.getNextEpochId();\n\n RewardPool storage nextRewardPool = rewardPools[getRewardPoolKey(nextEpochId, stakee)];\n if (nextRewardPool.initializedAt != 0) {\n revert RewardPoolAlreadyExist();\n }\n\n uint256 totalStake = _stakingManager.getStakeeTotalManagedStake(stakee);\n if (totalStake == 0) {\n revert NoStakeToCreateRewardPool();\n }\n\n nextRewardPool.totalActiveStake = totalStake;\n\n nextRewardPool.initializedAt = block.number;\n }\n\n /**\n * @dev This function should be called by the Ticketing contract when a\n * ticket is successfully redeemed. The face value of the ticket\n * should be split between incrementing the node's reward balance,\n * and the reward balance for the node's delegated stakers. The face value\n * will be added to the current reward pool's balance. This function will\n * fail if the Ticketing contract has not been set as a manager.\n * @param stakee The address of the Node.\n * @param amount The face value of the ticket in SOLO.\n */\n function incrementRewardPool(address stakee, uint256 amount) external onlyManager {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n if (amount == 0) {\n revert AmountCannotBeZero();\n }\n\n (uint256 epochId, IEpochsManager.Epoch memory currentEpoch) = _epochsManager\n .getCurrentActiveEpoch();\n\n RewardPool storage rewardPool = rewardPools[getRewardPoolKey(epochId, stakee)];\n if (rewardPool.initializedAt == 0) {\n revert RewardPoolNotExist();\n }\n\n // Update the latest active reward pool for the node to be this pool\n if (latestActiveRewardPools[stakee] < epochId) {\n latestActiveRewardPools[stakee] = epochId;\n }\n\n uint256 stakersReward = SyloUtils.percOf(\n SafeCast.toUint128(amount),\n currentEpoch.defaultPayoutPercentage\n );\n\n // transfer the node's fee reward to it's unclaimed reward value\n unclaimedStakingRewards[getStakerKey(stakee, stakee)] =\n unclaimedStakingRewards[getStakerKey(stakee, stakee)] +\n (amount - stakersReward);\n\n // update the value of the reward owed to the stakers\n pendingRewards[stakee] = pendingRewards[stakee] + stakersReward;\n\n // if this is the first ticket redeemed for this reward, set the initial\n // CRF value for this pool\n if (rewardPool.stakersRewardTotal == 0) {\n rewardPool.initialCumulativeRewardFactor = cumulativeRewardFactors[stakee];\n }\n\n rewardPool.stakersRewardTotal = rewardPool.stakersRewardTotal + stakersReward;\n\n // We preemptively prevent an overflow revert with the abdk library.\n // Dividing the stakers reward with the pool's total active\n // stake may produce a value that is greater than the maximum possible\n // 64.64 fixed point value.\n // This error is incredibly niche and unlikely to happen, so we just\n // revert here as well (with a named error) and remediation involves\n // just increasing the amount of stake a node has.\n if (rewardPool.totalActiveStake * MAX_INT64 < stakersReward) {\n revert InvalidFixedPointResult();\n }\n\n cumulativeRewardFactors[stakee] = ABDKMath64x64.add(\n cumulativeRewardFactors[stakee],\n ABDKMath64x64.div(\n toFixedPointSYLO(stakersReward),\n toFixedPointSYLO(rewardPool.totalActiveStake)\n )\n );\n\n totalEpochRewards[epochId] = totalEpochRewards[epochId] + amount;\n totalEpochStakingRewards[epochId] = totalEpochStakingRewards[epochId] + stakersReward;\n }\n\n /**\n * @dev This function utilizes the cumulative reward factors, and the staker's\n * value in stake to calculate the staker's share of the pending reward.\n */\n function calculatePendingClaim(\n bytes32 stakerKey,\n address stakee,\n address staker\n ) internal view returns (uint256) {\n uint256 claim = calculateInitialClaim(stakerKey, stakee);\n\n // find the first reward pool where their stake was active and had\n // generated rewards\n uint256 activeAt;\n RewardPool memory initialActivePool;\n\n uint256 currentEpochId = _epochsManager.currentIteration();\n\n for (uint256 i = lastClaims[stakerKey].claimedAt + 1; i < currentEpochId; ++i) {\n initialActivePool = rewardPools[getRewardPoolKey(i, stakee)];\n // check if node initialized a reward pool for this epoch and\n // gained rewards\n if (initialActivePool.initializedAt > 0 && initialActivePool.stakersRewardTotal > 0) {\n activeAt = i;\n break;\n }\n }\n\n if (activeAt == 0) {\n return claim;\n }\n\n IStakingManager.StakeEntry memory stakeEntry = _stakingManager.getStakeEntry(\n stakee,\n staker\n );\n\n // We convert the staker amount to SYLO as the maximum uint256 value that\n // can be used for the fixed point representation is 2^64-1.\n int128 initialStake = toFixedPointSYLO(stakeEntry.amount);\n\n int128 initialCumulativeRewardFactor = initialActivePool.initialCumulativeRewardFactor;\n\n int128 finalCumulativeRewardFactor = getFinalCumulativeRewardFactor(\n stakee,\n currentEpochId\n );\n\n return\n claim +\n fromFixedPointSYLO(\n ABDKMath64x64.mul(\n initialStake,\n ABDKMath64x64.sub(finalCumulativeRewardFactor, initialCumulativeRewardFactor)\n )\n );\n }\n\n /**\n * Manually calculates the reward claim for the first epoch the claim is being\n * made for. This manual calculation is necessary as claims are only made up\n * to the previous epoch.\n */\n function calculateInitialClaim(\n bytes32 stakerKey,\n address stakee\n ) internal view returns (uint256) {\n LastClaim memory lastClaim = lastClaims[stakerKey];\n\n // if we have already made a claim up to the previous epoch, then\n // there is no need to calculate the initial claim\n if (_epochsManager.currentIteration() == lastClaim.claimedAt) {\n return 0;\n }\n\n RewardPool memory firstRewardPool = rewardPools[\n getRewardPoolKey(lastClaim.claimedAt, stakee)\n ];\n\n // if there was no reward pool initialized for the first epoch,\n // then there is no need to calculate the initial claim\n if (firstRewardPool.totalActiveStake == 0) {\n return 0;\n }\n\n return\n (firstRewardPool.stakersRewardTotal * lastClaim.stake) /\n firstRewardPool.totalActiveStake;\n }\n\n /**\n * Determines the cumulative reward factor to use for claim calculations. The\n * CRF will depend on when the Node last initialized a reward pool, and also when\n * the staker last made their claim.\n */\n function getFinalCumulativeRewardFactor(\n address stakee,\n uint256 currentEpochId\n ) internal view returns (int128) {\n int128 finalCumulativeRewardFactor;\n\n // Get the cumulative reward factor for the Node\n // for the start of this epoch, since we only perform\n // calculations up to the end of the previous epoch.\n if (latestActiveRewardPools[stakee] < currentEpochId) {\n // If the Node has not been active, then the final\n // cumulative reward factor will just be the current one.\n finalCumulativeRewardFactor = cumulativeRewardFactors[stakee];\n } else {\n // We are calculating the claim for an active epoch, the\n // final cumulative reward factor will be taken from the start of this\n // epoch (end of previous epoch).\n RewardPool storage latestRewardPool = rewardPools[\n getRewardPoolKey(latestActiveRewardPools[stakee], stakee)\n ];\n finalCumulativeRewardFactor = latestRewardPool.initialCumulativeRewardFactor;\n }\n\n return finalCumulativeRewardFactor;\n }\n\n /**\n * @notice Call this function to calculate the total reward owed to a staker.\n * This value will include all epochs since the last claim was made up to\n * the previous epoch. This will also add any pending rewards to the\n * final value as well.\n * @dev This function will utilize the cumulative reward factor to perform the\n * calculation, keeping the gas cost scaling of this function to a constant value.\n * @param stakee The address of the Node.\n * @param staker The address of the staker.\n * @return The value of the reward owed to the staker in SOLO.\n */\n function calculateStakerClaim(address stakee, address staker) public view returns (uint256) {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n if (staker == address(0)) {\n revert StakerCannotBeZeroAddress();\n }\n\n bytes32 stakerKey = getStakerKey(stakee, staker);\n uint256 pendingClaim = calculatePendingClaim(stakerKey, stakee, staker);\n\n return pendingClaim + unclaimedStakingRewards[stakerKey];\n }\n\n /**\n * Helper function to convert a uint256 value in SOLOs to a 64.64 fixed point\n * representation in SYLOs while avoiding any possibility of overflow.\n * Any remainders from converting SOLO to SYLO is explicitly handled to mitigate\n * precision loss. The error when using this function is [-1/2^64, 0].\n */\n function toFixedPointSYLO(uint256 amount) internal pure returns (int128) {\n int128 fullSylos = ABDKMath64x64.fromUInt(amount / ONE_SYLO);\n int128 fracSylos = ABDKMath64x64.fromUInt(amount % ONE_SYLO); // remainder\n\n return ABDKMath64x64.add(fullSylos, ABDKMath64x64.div(fracSylos, ONE_SYLO_FIXED));\n }\n\n /**\n * Helper function to convert a 64.64 fixed point value in SYLOs to a uint256\n * representation in SOLOs while avoiding any possibility of overflow.\n */\n function fromFixedPointSYLO(int128 amount) internal pure returns (uint256) {\n uint256 fullSylos = ABDKMath64x64.toUInt(amount);\n uint256 fullSolos = fullSylos * ONE_SYLO;\n\n // calculate the value lost when converting the fixed point amount to a uint\n int128 fracSylos = ABDKMath64x64.sub(amount, ABDKMath64x64.fromUInt(fullSylos));\n uint256 fracSolos = ABDKMath64x64.toUInt(ABDKMath64x64.mul(fracSylos, ONE_SYLO_FIXED));\n\n return fullSolos + fracSolos;\n }\n\n /**\n * @notice Call this function to claim rewards as a staker. The\n * SYLO tokens will be transferred to the caller's account. This function will\n * fail if there exists no reward to claim. Note: Calling this will remove\n * the current unclaimed reward from being used as stake in the next round.\n * @param stakee The address of the Node to claim against.\n */\n function claimStakingRewards(address stakee) external returns (uint256) {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n\n bytes32 stakerKey = getStakerKey(stakee, msg.sender);\n uint256 pendingReward = calculatePendingClaim(stakerKey, stakee, msg.sender);\n\n uint256 totalClaim = pendingReward + unclaimedStakingRewards[stakerKey];\n if (totalClaim == 0) {\n revert NoRewardToClaim();\n }\n\n delete unclaimedStakingRewards[stakerKey];\n pendingRewards[stakee] = pendingRewards[stakee] - pendingReward;\n\n updateLastClaim(stakee, msg.sender);\n\n SafeERC20.safeTransfer(_token, msg.sender, totalClaim);\n\n return totalClaim;\n }\n\n /**\n * @notice This is called by the staking manager to transfer pending rewards\n * to unclaimed rewards for a staker. This is required as the last used CRF\n * needs to be updated whenever stake changes.\n */\n function updatePendingRewards(address stakee, address staker) external onlyManager {\n bytes32 stakerKey = getStakerKey(stakee, staker);\n uint256 pendingReward = calculatePendingClaim(stakerKey, stakee, staker);\n\n pendingRewards[stakee] = pendingRewards[stakee] - pendingReward;\n\n unclaimedStakingRewards[stakerKey] = unclaimedStakingRewards[stakerKey] + pendingReward;\n\n updateLastClaim(stakee, staker);\n }\n\n function updateLastClaim(address stakee, address staker) internal {\n IStakingManager.StakeEntry memory stakeEntry = _stakingManager.getStakeEntry(\n stakee,\n staker\n );\n lastClaims[getStakerKey(stakee, staker)] = LastClaim(\n _epochsManager.currentIteration(),\n stakeEntry.amount\n );\n }\n}\n" + }, + "contracts/payments/ticketing/TicketingParameters.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\n\nimport \"../../libraries/SyloUtils.sol\";\nimport \"../../interfaces/payments/ticketing/ITicketingParameters.sol\";\n\n/**\n * @dev Persists the parameters for the ticketing mechanism. This contract is\n * read by the EpochManager. Extracting the parameters into another\n * contract is necessary to avoid a cyclic dependency between the ticketing\n * and epoch contracts.\n */\ncontract TicketingParameters is\n ITicketingParameters,\n Initializable,\n Ownable2StepUpgradeable,\n ERC165\n{\n /** @notice The value of a winning ticket in SOLO. */\n uint256 public faceValue;\n\n /**\n * @notice The probability of a ticket winning during the start of its lifetime.\n * This is a uint128 value representing the numerator in the probability\n * ratio where 2^128 - 1 is the denominator.\n */\n uint128 public baseLiveWinProb;\n\n /**\n * @notice The probability of a ticket winning after it has expired.\n * This is a uint128 value representing the numerator in the probability\n * ratio where 2^128 - 1 is the denominator. Note: Redeeming expired\n * tickets is currently not supported.\n */\n uint128 public expiredWinProb;\n\n /**\n * @notice The length in blocks before a ticket is considered expired.\n * The default initialization value is 80,000. This equates\n * to roughly two weeks (15s per block).\n */\n uint256 public ticketDuration;\n\n /**\n * @notice A percentage value representing the proportion of the base win\n * probability that will be decayed once a ticket has expired.\n * Example: 80% decayRate indicates that a ticket will decay down to 20% of its\n * base win probability upon reaching the block before its expiry.\n * The value is expressed as a fraction of 100000.\n */\n uint32 public decayRate;\n\n event FaceValueUpdated(uint256 faceValue);\n event BaseLiveWinProbUpdated(uint128 baseLiveWinprob);\n event ExpiredWinProbUpdated(uint128 expiredWinProb);\n event TicketDurationUpdated(uint256 ticketDuration);\n event DecayRateUpdated(uint32 decayRate);\n\n error FaceValueCannotBeZero();\n error TicketDurationCannotBeZero();\n\n function initialize(\n uint256 _faceValue,\n uint128 _baseLiveWinProb,\n uint128 _expiredWinProb,\n uint32 _decayRate,\n uint256 _ticketDuration\n ) external initializer {\n if (_faceValue == 0) {\n revert FaceValueCannotBeZero();\n }\n if (_ticketDuration == 0) {\n revert TicketDurationCannotBeZero();\n }\n\n Ownable2StepUpgradeable.__Ownable2Step_init();\n\n faceValue = _faceValue;\n baseLiveWinProb = _baseLiveWinProb;\n expiredWinProb = _expiredWinProb;\n decayRate = _decayRate;\n ticketDuration = _ticketDuration;\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(ITicketingParameters).interfaceId;\n }\n\n /**\n * @notice Set the face value for tickets in SOLO. Only callable by\n * the contract owner.\n * @param _faceValue The face value to set in SOLO.\n */\n function setFaceValue(uint256 _faceValue) external onlyOwner {\n if (_faceValue == 0) {\n revert FaceValueCannotBeZero();\n }\n\n faceValue = _faceValue;\n emit FaceValueUpdated(_faceValue);\n }\n\n /**\n * @notice Set the base live win probability of a ticket. Only callable by\n * the contract owner.\n * @param _baseLiveWinProb The probability represented as a value\n * between 0 to 2**128 - 1.\n */\n function setBaseLiveWinProb(uint128 _baseLiveWinProb) external onlyOwner {\n baseLiveWinProb = _baseLiveWinProb;\n emit BaseLiveWinProbUpdated(_baseLiveWinProb);\n }\n\n /**\n * @notice Set the expired win probability of a ticket. Only callable by\n * the contract owner.\n * @param _expiredWinProb The probability represented as a value\n * between 0 to 2**128 - 1.\n */\n function setExpiredWinProb(uint128 _expiredWinProb) external onlyOwner {\n expiredWinProb = _expiredWinProb;\n emit ExpiredWinProbUpdated(_expiredWinProb);\n }\n\n /**\n * @notice Set the decay rate of a ticket. Only callable by the\n * the contract owner.\n * @param _decayRate The decay rate as a percentage, where the\n * denominator is 10000.\n */\n function setDecayRate(uint32 _decayRate) external onlyOwner {\n decayRate = _decayRate;\n emit DecayRateUpdated(_decayRate);\n }\n\n /**\n * @notice Set the ticket duration of a ticket. Only callable by the\n * contract owner.\n * @param _ticketDuration The duration of a ticket in number of blocks.\n */\n function setTicketDuration(uint256 _ticketDuration) external onlyOwner {\n if (_ticketDuration == 0) {\n revert TicketDurationCannotBeZero();\n }\n\n ticketDuration = _ticketDuration;\n emit TicketDurationUpdated(_ticketDuration);\n }\n\n /**\n * @notice Retrieve the current ticketing parameters.\n * @return faceValue The face value of a ticket in SOLO.\n * @return baseLiveWinProb The base live win probability of a ticket.\n * @return expiredWinProb The expired win probability of a ticket.\n * @return ticketDuration The duration of a ticket in number of blocks.\n * @return decayRate The decay rate of a ticket.\n */\n function getTicketingParameters()\n external\n view\n returns (uint256, uint128, uint128, uint256, uint32)\n {\n return (faceValue, baseLiveWinProb, expiredWinProb, ticketDuration, decayRate);\n }\n}\n" + }, + "contracts/Registries.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\n\nimport \"./libraries/SyloUtils.sol\";\nimport \"./interfaces/IRegistries.sol\";\n\n/**\n * @notice This contract manages Registries for Nodes. A Registry is a\n * set of parameters configured by the Node itself. A Node is required\n * to have a valid Registry to be able to participate in the network.\n */\ncontract Registries is IRegistries, Initializable, Ownable2StepUpgradeable, IERC165 {\n using ECDSA for bytes32;\n\n /**\n * @notice ERC721 contract for bridged Seekers. Used for verifying ownership\n * of a seeker.\n */\n IERC721 public _rootSeekers;\n\n /**\n * @notice Tracks each Node's registry.\n */\n mapping(address => IRegistries.Registry) public registries;\n\n /**\n * @notice Tracks the node address that each seeker id is registered with\n */\n mapping(uint256 => address) public seekerRegistration;\n\n /**\n * @notice Tracks the address of every registered node.\n */\n address[] public nodes;\n\n /**\n * @notice Tracks nonces used when registering the seeker account\n * to prevent signature re-use.\n */\n mapping(bytes32 => address) private signatureNonces;\n\n /**\n * @notice Payout percentage refers to the portion of a tickets reward\n * that will be allocated to the Node's stakers. This is global, and is\n * currently set for all Nodes.\n */\n uint32 public defaultPayoutPercentage;\n\n event DefaultPayoutPercentageUpdated(uint32 defaultPayoutPercentage);\n\n error NonceCannotBeReused();\n error EndMustBeGreaterThanStart();\n error PercentageCannotExceed100000();\n error PublicEndpointCannotBeEmpty();\n error SeekerAccountMustOwnSeekerId();\n error SeekerAccountMustBeMsgSender();\n error ProofNotSignedBySeekerAccount();\n error RootSeekersCannotBeZeroAddress();\n error SeekerAccountCannotBeZeroAddress();\n error EndCannotExceedNumberOfNodes(uint256 nodeLength);\n\n function initialize(\n IERC721 rootSeekers,\n uint16 _defaultPayoutPercentage\n ) external initializer {\n if (address(rootSeekers) == address(0)) {\n revert RootSeekersCannotBeZeroAddress();\n }\n if (_defaultPayoutPercentage > 100000) {\n revert PercentageCannotExceed100000();\n }\n\n Ownable2StepUpgradeable.__Ownable2Step_init();\n\n _rootSeekers = rootSeekers;\n defaultPayoutPercentage = _defaultPayoutPercentage;\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IRegistries).interfaceId;\n }\n\n /**\n * @notice Set the global default payout percentage value. Only callable\n * by the owner.\n * @param _defaultPayoutPercentage The payout percentage as a value where the\n * denominator is 10000.\n */\n function setDefaultPayoutPercentage(uint32 _defaultPayoutPercentage) external onlyOwner {\n if (_defaultPayoutPercentage > 100000) {\n revert PercentageCannotExceed100000();\n }\n\n defaultPayoutPercentage = _defaultPayoutPercentage;\n emit DefaultPayoutPercentageUpdated(_defaultPayoutPercentage);\n }\n\n /**\n * @notice Call this as a Node to set or update your Registry entry.\n * @param publicEndpoint The public endpoint of your Node. Essential for\n * clients to be able to retrieve additional information, such as\n * an address to establish a p2p connection.\n */\n function register(string calldata publicEndpoint) external {\n if (bytes(publicEndpoint).length == 0) {\n revert PublicEndpointCannotBeEmpty();\n }\n\n // This is the nodes first registration\n if (bytes(registries[msg.sender].publicEndpoint).length == 0) {\n nodes.push(msg.sender);\n }\n\n registries[msg.sender].publicEndpoint = publicEndpoint;\n }\n\n function setSeekerAccount(\n address seekerAccount,\n uint256 seekerId,\n bytes32 nonce,\n bytes calldata signature\n ) external {\n if (seekerAccount == address(0)) {\n revert SeekerAccountCannotBeZeroAddress();\n }\n if (signatureNonces[nonce] != address(0)) {\n revert NonceCannotBeReused();\n }\n\n bytes memory proofMessage = getProofMessage(seekerId, msg.sender, nonce);\n bytes32 ethProof = ECDSA.toEthSignedMessageHash(proofMessage);\n\n if (ECDSA.recover(ethProof, signature) != seekerAccount) {\n revert ProofNotSignedBySeekerAccount();\n }\n\n // Now verify the seeker account actually owns the seeker\n address owner = _rootSeekers.ownerOf(seekerId);\n\n if (seekerAccount != owner) {\n revert SeekerAccountMustOwnSeekerId();\n }\n\n delete registries[seekerRegistration[seekerId]].seekerId;\n delete registries[seekerRegistration[seekerId]].seekerAccount;\n\n registries[msg.sender].seekerAccount = seekerAccount;\n registries[msg.sender].seekerId = seekerId;\n\n seekerRegistration[seekerId] = msg.sender;\n\n signatureNonces[nonce] = seekerAccount;\n }\n\n function revokeSeekerAccount(address node) external {\n Registry storage registry = registries[node];\n\n if (registry.seekerAccount != msg.sender) {\n revert SeekerAccountMustBeMsgSender();\n }\n\n delete registry.seekerAccount;\n delete seekerRegistration[registry.seekerId];\n delete registry.seekerId;\n }\n\n /**\n * @notice Retrieve the registry associated with a Node.\n * @param account The address of the Node.\n * @return The Node's Registry.\n */\n function getRegistry(address account) external view returns (Registry memory) {\n return registries[account];\n }\n\n /**\n * @notice Retrieve all registered nodes.\n * @return An array of node addresses.\n */\n function getNodes() external view returns (address[] memory) {\n return nodes;\n }\n\n /**\n * @notice Retrieves a list of registries. Takes in a\n * a start and end indices to allow pagination.\n * @param start The start index which is inclusive.\n * @param end The end index which is exclusive.\n * @return An array of Registries.\n */\n function getRegistries(\n uint256 start,\n uint256 end\n ) external view returns (address[] memory, Registry[] memory) {\n uint256 nodesLength = nodes.length;\n\n if (end <= start) {\n revert EndMustBeGreaterThanStart();\n }\n if (end > nodesLength) {\n revert EndCannotExceedNumberOfNodes(nodesLength);\n }\n\n address[] memory _nodes = new address[](end - start);\n Registry[] memory _registries = new Registry[](_nodes.length);\n\n for (uint256 i = start; i < end; ++i) {\n _nodes[i - start] = nodes[i];\n _registries[i - start] = registries[nodes[i]];\n }\n\n return (_nodes, _registries);\n }\n\n /**\n * @notice Returns the total number of registered nodes.\n * @return The number of registered nodes.\n */\n function getTotalNodes() external view returns (uint256) {\n return nodes.length;\n }\n\n /**\n * @notice Helper function for deriving the proof message used to\n * validate seeker ownership.\n * @param seekerId The tokenId of the seeker used for operation.\n * @param node The address of the node which that will be operated\n * by the specified seeker.\n * @param nonce The nonce used for this message.\n */\n function getProofMessage(\n uint256 seekerId,\n address node,\n bytes32 nonce\n ) public pure returns (bytes memory) {\n return\n abi.encodePacked(\n unicode\"šŸ¤– Hi frend! šŸ¤–\\n\\nšŸ“œ Signing this message proves that you're the owner of this Seeker NFT and allows your Seeker to be used to operate your Seeker's Node. It's a simple but important step to ensure smooth operation.\\n\\nThis request will not trigger a blockchain transaction or cost any gas fees.\\n\\nšŸ”„ Your node's address: \",\n Strings.toHexString(uint256(uint160(node)), 20),\n unicode\"\\n\\nšŸ†” Your seeker id: \",\n Strings.toString(seekerId),\n unicode\"\\n\\nšŸ“¦ A unique random value which secures this message: \",\n Strings.toHexString(uint256(nonce), 32)\n );\n }\n}\n" + }, + "contracts/SeekerPowerOracle.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nimport \"./interfaces/ISeekerPowerOracle.sol\";\n\n/**\n * @notice Acts as a source of information for Seeker Powers. Allows setting\n * a Seeker's power level via a restricted oracle account call. Seeker Power can also\n * be set by any account if the correct Oracle signature proof is provided.\n */\ncontract SeekerPowerOracle is ISeekerPowerOracle, Initializable, Ownable2StepUpgradeable, ERC165 {\n /**\n * @notice The oracle account. This contract accepts any attestations of\n * Seeker power that have been signed by this account.\n */\n address public oracle;\n\n /**\n * @notice Tracks nonce used when register the Seeker power to\n * prevent signature re-use.\n */\n mapping(bytes32 => address) private proofNonces;\n\n /**\n * @notice Tracks the set of Seeker Power levels.\n */\n mapping(uint256 => uint256) public seekerPowers;\n\n event SeekerPowerUpdated(uint256 indexed seekerId, uint256 indexed power);\n\n error UnauthorizedRegisterSeekerPowerCall();\n error NonceCannotBeReused();\n\n function initialize(address _oracle) external initializer {\n Ownable2StepUpgradeable.__Ownable2Step_init();\n\n oracle = _oracle;\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(ISeekerPowerOracle).interfaceId;\n }\n\n /**\n * @notice Sets the oracle account.\n * @param _oracle The oracle account.\n */\n function setOracle(address _oracle) external onlyOwner {\n oracle = _oracle;\n }\n\n /**\n * @notice Registers a Seeker's power level. Only callable by the\n * owner or the oracle account.\n * @param seekerId The id of the Seeker.\n * @param power The power level of the Seeker.\n */\n function registerSeekerPowerRestricted(uint256 seekerId, uint256 power) external {\n if (msg.sender != oracle) {\n revert UnauthorizedRegisterSeekerPowerCall();\n }\n\n seekerPowers[seekerId] = power;\n emit SeekerPowerUpdated(seekerId, power);\n }\n\n /**\n * @notice Registers a Seeker's power level. Callable by any account\n * but requires a proof signed by the oracle.\n * @param seekerId The id of the Seeker.\n * @param power The power level of the Seeker.\n */\n function registerSeekerPower(\n uint256 seekerId,\n uint256 power,\n bytes32 nonce,\n bytes calldata proof\n ) external {\n if (proofNonces[nonce] != address(0)) {\n revert NonceCannotBeReused();\n }\n\n bytes memory proofMessage = getProofMessage(seekerId, power, nonce);\n bytes32 ecdsaHash = ECDSA.toEthSignedMessageHash(proofMessage);\n\n if (ECDSA.recover(ecdsaHash, proof) != oracle) {\n revert UnauthorizedRegisterSeekerPowerCall();\n }\n\n seekerPowers[seekerId] = power;\n proofNonces[nonce] = oracle;\n\n emit SeekerPowerUpdated(seekerId, power);\n }\n\n /**\n * @notice Retrieves a Seeker's stored power level.\n * @param seekerId The id of the Seeker.\n */\n function getSeekerPower(uint256 seekerId) external view returns (uint256) {\n return seekerPowers[seekerId];\n }\n\n /**\n * @notice Constructs a proof message for the oracle to sign.\n * @param seekerId The id of the Seeker.\n * @param power The power level of the Seeker.\n */\n function getProofMessage(\n uint256 seekerId,\n uint256 power,\n bytes32 nonce\n ) public pure returns (bytes memory) {\n return\n abi.encodePacked(\n Strings.toString(seekerId),\n \":\",\n Strings.toString(power),\n \":\",\n Strings.toHexString(uint256(nonce), 32)\n );\n }\n}\n" + }, + "contracts/staking/Directory.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts/utils/math/Math.sol\";\n\nimport \"./StakingManager.sol\";\nimport \"../libraries/SyloUtils.sol\";\nimport \"../libraries/Manageable.sol\";\nimport \"../interfaces/staking/IDirectory.sol\";\nimport \"../payments/ticketing/RewardsManager.sol\";\n\n/**\n * @notice The Directory contract constructs and manages a structure holding the current stakes,\n * which is queried against using the scan function. The scan function allows submitting\n * random points which will return a staked node's address in proportion to the stake it has.\n */\ncontract Directory is IDirectory, Initializable, Manageable, IERC165 {\n /** Sylo Staking Manager contract */\n StakingManager public _stakingManager;\n\n /** Sylo Rewards Manager contract */\n RewardsManager public _rewardsManager;\n\n /**\n * @notice The epoch ID of the current directory.\n */\n uint256 public currentDirectory;\n\n /**\n * @notice Tracks every directory, which will be indexed by an epoch ID\n */\n mapping(uint256 => EpochDirectory) public directories;\n\n event CurrentDirectoryUpdated(uint256 indexed currentDirectory);\n\n error NoStakeToJoinEpoch();\n error StakeeAlreadyJoinedEpoch();\n error StakeeCannotBeZeroAddress();\n error NoJoiningStakeToJoinEpoch();\n\n function initialize(\n StakingManager stakingManager,\n RewardsManager rewardsManager\n ) external initializer {\n SyloUtils.validateContractInterface(\n \"StakingManager\",\n address(stakingManager),\n type(IStakingManager).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"RewardsManager\",\n address(rewardsManager),\n type(IRewardsManager).interfaceId\n );\n\n Ownable2StepUpgradeable.__Ownable2Step_init();\n\n _stakingManager = stakingManager;\n _rewardsManager = rewardsManager;\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IDirectory).interfaceId;\n }\n\n /**\n * @notice This function should be called when a new epoch is initialized.\n * This will set the current directory to the specified epoch. This is only\n * callable by the owner of this contract, which should be the EpochsManager\n * contract.\n * @dev After deployment, the EpochsManager should immediately be set as\n * the owner.\n * @param epochId The ID of the specified epoch.\n */\n function setCurrentDirectory(uint256 epochId) external onlyManager {\n currentDirectory = epochId;\n emit CurrentDirectoryUpdated(epochId);\n }\n\n /**\n * @notice This function is called by the epochs manager as a prerequisite to when the node joins the next epoch.\n * @param stakee The address of the node.\n * @param seekerId The seekerId of the Seeker that the node is\n * registered with when joining the epoch. It is used to determine the nodes\n * staking capacity based on its seeker power.\n *\n * @dev This will construct the directory as nodes join. The directory is constructed\n * by creating a boundary value which is a sum of the current directory's total stake, and\n * the current stakee's total stake, and pushing the new boundary into the entries array.\n * The previous boundary and the current boundary essentially create a range, where if a\n * random point were to fall within that range, it would belong to the respective stakee.\n * The boundary value grows in size as each stakee joins, thus the directory array\n * always remains sorted. This allows us to perform a binary search on the directory.\n *\n * Example\n *\n * Stakes: [ Alice/20, Bob/10, Carl/40, Dave/25 ]\n * TotalStake: 95\n *\n * EpochDirectory:\n *\n * |-----------|------|----------------|--------|\n * Alice/20 Bob/30 Carl/70 Dave/95\n *\n * The amount of stake that a node will join a directory with is dependent on its\n * different capacity values. There are two distinct capacity values, one\n * calculated from the seeker power, and another from the minimum stake\n * proportion. The final staking amount will not exceed either capacities,\n * and in the case that the current total stake exceeds both, then the final\n * will be the minimum of the two values.\n */\n function joinNextDirectory(address stakee, uint256 seekerId) external onlyManager {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n\n uint256 nextEpochId = currentDirectory + 1;\n\n uint256 totalStake = _stakingManager.getStakeeTotalManagedStake(stakee);\n if (totalStake == 0) {\n revert NoStakeToJoinEpoch();\n }\n\n // staking capacity based on seeker power\n uint256 seekerStakingCapacity = _stakingManager.calculateCapacityFromSeekerPower(seekerId);\n\n // staking capacity based on the min staking proportion constant\n uint256 minProportionStakingCapacity = _stakingManager.calculateCapacityFromMinStakingProportion(stakee);\n\n uint256 joiningStake;\n if (totalStake > seekerStakingCapacity && totalStake > minProportionStakingCapacity) {\n joiningStake = Math.min(seekerStakingCapacity, minProportionStakingCapacity);\n } else if (totalStake > seekerStakingCapacity) {\n joiningStake = seekerStakingCapacity;\n } else if (totalStake > minProportionStakingCapacity) {\n joiningStake = minProportionStakingCapacity;\n } else { // uncapped\n joiningStake = totalStake;\n }\n\n if (joiningStake == 0) {\n revert NoJoiningStakeToJoinEpoch();\n }\n\n if (directories[nextEpochId].stakes[stakee] > 0) {\n revert StakeeAlreadyJoinedEpoch();\n }\n\n uint256 nextBoundary = directories[nextEpochId].totalStake + joiningStake;\n\n directories[nextEpochId].entries.push(DirectoryEntry(stakee, nextBoundary));\n directories[nextEpochId].stakes[stakee] = joiningStake;\n directories[nextEpochId].totalStake = nextBoundary;\n }\n\n /**\n * @notice Call this to perform a stake-weighted scan to find the Node assigned\n * to the given point of the current directory.\n * @param point The point, which will usually be a hash of a public key.\n */\n function scan(uint128 point) external view returns (address stakee) {\n return _scan(point, currentDirectory);\n }\n\n /**\n * @notice Call this to perform a stake-weighted scan to find the Node assigned\n * to the given point of the requested directory.\n * @param point The point, which will usually be a hash of a public key.\n * @param epochId The epoch id associated with the directory to scan.\n */\n function scanWithEpochId(\n uint128 point,\n uint256 epochId\n ) external view returns (address stakee) {\n return _scan(point, epochId);\n }\n\n /**\n * @notice Call this to perform a stake-weighted scan to find the Node assigned\n * to the given point of the requested directory (internal).\n * @dev The current implementation will perform a binary search through\n * the directory. This can allow gas costs to be low if this needs to be\n * used in a transaction.\n * @param point The point, which will usually be a hash of a public key.\n * @param epochId The epoch id associated with the directory to scan.\n */\n function _scan(uint128 point, uint256 epochId) internal view returns (address stakee) {\n uint256 entryLength = directories[epochId].entries.length;\n\n if (entryLength == 0) {\n return address(0);\n }\n\n // Staking all the Sylo would only be 94 bits, so multiplying this with\n // a uint128 cannot overflow a uint256.\n uint256 expectedVal = (directories[epochId].totalStake * uint256(point)) >> 128;\n\n uint256 left;\n uint256 right = entryLength - 1;\n\n // perform a binary search through the directory\n uint256 lower;\n uint256 upper;\n uint256 index;\n\n while (left <= right) {\n index = (left + right) >> 1;\n\n lower = index == 0 ? 0 : directories[epochId].entries[index - 1].boundary;\n upper = directories[epochId].entries[index].boundary;\n\n if (expectedVal >= lower && expectedVal < upper) {\n return directories[epochId].entries[index].stakee;\n } else if (expectedVal < lower) {\n right = index - 1;\n } else {\n // expectedVal >= upper\n left = index + 1;\n }\n }\n }\n\n /**\n * @notice Retrieve the total stake a Node has for the directory in the\n * specified epoch.\n * @param epochId The ID of the epoch.\n * @param stakee The address of the Node.\n * @return The amount of stake the Node has for the given directory in SOLO.\n */\n function getTotalStakeForStakee(\n uint256 epochId,\n address stakee\n ) external view returns (uint256) {\n return directories[epochId].stakes[stakee];\n }\n\n /**\n * @notice Retrieve the total stake for a directory in the specified epoch, which\n * will be the sum of the stakes for all Nodes participating in that epoch.\n * @param epochId The ID of the epoch.\n * @return The total amount of stake in SOLO.\n */\n function getTotalStake(uint256 epochId) external view returns (uint256) {\n return directories[epochId].totalStake;\n }\n\n /**\n * @notice Retrieve all entries for a directory in a specified epoch.\n * @return An array of all the directory entries.\n */\n function getEntries(\n uint256 epochId\n ) external view returns (address[] memory, uint256[] memory) {\n uint256 entryLength = directories[epochId].entries.length;\n\n address[] memory stakees = new address[](entryLength);\n uint256[] memory boundaries = new uint256[](entryLength);\n\n DirectoryEntry memory entry;\n DirectoryEntry[] memory entries = directories[epochId].entries;\n\n for (uint256 i; i < entryLength; ++i) {\n entry = entries[i];\n stakees[i] = entry.stakee;\n boundaries[i] = entry.boundary;\n }\n return (stakees, boundaries);\n }\n}\n" + }, + "contracts/staking/StakingManager.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\n\nimport \"../SyloToken.sol\";\nimport \"../libraries/SyloUtils.sol\";\nimport \"../SeekerPowerOracle.sol\";\nimport \"../epochs/EpochsManager.sol\";\nimport \"../payments/ticketing/RewardsManager.sol\";\nimport \"../interfaces/staking/IStakingManager.sol\";\n\n/**\n * @notice Manages stakes and delegated stakes for Nodes. Holding\n * staked Sylo is necessary for a Node to participate in the\n * Sylo Network. The stake is used in stake-weighted scan function,\n * and delegated stakers are rewarded on a pro-rata basis.\n */\ncontract StakingManager is IStakingManager, Initializable, Ownable2StepUpgradeable, ERC165 {\n /** ERC 20 compatible token we are dealing with */\n IERC20 public _token;\n\n /**\n * @notice Rewards Manager contract. Any changes to stake will automatically\n * trigger a claim to any outstanding rewards.\n */\n RewardsManager public _rewardsManager;\n\n EpochsManager public _epochsManager;\n\n SeekerPowerOracle public _seekerPowerOracle;\n\n /**\n * @notice Tracks the managed stake for every Node.\n */\n mapping(address => Stake) public stakes;\n\n /** @notice Tracks overall total stake held by this contract */\n uint256 public totalManagedStake;\n\n /**\n * @notice Tracks funds that are in the process of being unlocked. This\n * is indexed by a key that hashes both the address of the staked Node and\n * the address of the staker.\n */\n mapping(bytes32 => Unlock) public unlockings;\n\n /**\n * @notice The number of blocks a user must wait after calling \"unlock\"\n * before they can withdraw their stake\n */\n uint256 public unlockDuration;\n\n /**\n * @notice Minimum amount of stake that a Node needs to stake\n * against itself in order to participate in the network. This is\n * represented as a percentage of the Node's total stake, where\n * the value is a ratio of 10000.\n */\n uint32 public minimumStakeProportion;\n\n /**\n * @notice The multiplier used in determining a Seeker's staking\n * capacity based on its power level.\n */\n uint256 public seekerPowerMultiplier;\n\n event UnlockDurationUpdated(uint256 unlockDuration);\n event MinimumStakeProportionUpdated(uint256 minimumStakeProportion);\n\n error NoStakeToUnlock();\n error StakeNotYetUnlocked();\n error CannotStakeZeroAmount();\n error CannotUnlockZeroAmount();\n error TokenCannotBeZeroAddress();\n error StakeeCannotBeZeroAddress();\n error UnlockDurationCannotBeZero();\n error CannotCancelUnlockZeroAmount();\n error CannotUnlockMoreThanStaked(uint256 stakeAmount, uint256 unlockAmount);\n error StakeCapacityReached(uint256 maxCapacity, uint256 currentCapacity);\n error SeekerPowerNotRegistered(uint256 seekerId);\n\n function initialize(\n IERC20 token,\n RewardsManager rewardsManager,\n EpochsManager epochsManager,\n SeekerPowerOracle seekerPowerOracle,\n uint256 _unlockDuration,\n uint32 _minimumStakeProportion,\n uint256 _seekerPowerMultiplier\n ) external initializer {\n if (address(token) == address(0)) {\n revert TokenCannotBeZeroAddress();\n }\n\n SyloUtils.validateContractInterface(\n \"RewardsManager\",\n address(rewardsManager),\n type(IRewardsManager).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"EpochsManager\",\n address(epochsManager),\n type(IEpochsManager).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"SeekerPowerOracle\",\n address(seekerPowerOracle),\n type(ISeekerPowerOracle).interfaceId\n );\n\n if (_unlockDuration == 0) {\n revert UnlockDurationCannotBeZero();\n }\n\n Ownable2StepUpgradeable.__Ownable2Step_init();\n\n _token = token;\n _rewardsManager = rewardsManager;\n _epochsManager = epochsManager;\n _seekerPowerOracle = seekerPowerOracle;\n unlockDuration = _unlockDuration;\n minimumStakeProportion = _minimumStakeProportion;\n seekerPowerMultiplier = _seekerPowerMultiplier;\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IStakingManager).interfaceId;\n }\n\n /**\n * @notice Sets the unlock duration for stakes. Only callable by\n * the owner.\n * @param _unlockDuration The unlock duration in number of blocks.\n */\n function setUnlockDuration(uint256 _unlockDuration) external onlyOwner {\n if (_unlockDuration == 0) {\n revert UnlockDurationCannotBeZero();\n }\n\n unlockDuration = _unlockDuration;\n emit UnlockDurationUpdated(_unlockDuration);\n }\n\n /**\n * @notice Sets the minimum stake proportion for Nodes. Only callable by\n * the owner.\n * @param _minimumStakeProportion The minimum stake proportion in SOLO.\n */\n function setMinimumStakeProportion(uint32 _minimumStakeProportion) external onlyOwner {\n minimumStakeProportion = _minimumStakeProportion;\n emit MinimumStakeProportionUpdated(_minimumStakeProportion);\n }\n\n /**\n * @notice Called by Nodes and delegated stakers to add stake.\n * This function will fail under the following conditions:\n * - If the Node address is invalid\n * - If the specified stake value is zero\n * - If the additional stake causes the Node to fail to meet the\n * minimum stake proportion requirement.\n * @param amount The amount of stake to add in SOLO.\n * @param stakee The address of the staked Node.\n */\n function addStake(uint256 amount, address stakee) external {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n if (amount == 0) {\n revert CannotStakeZeroAmount();\n }\n\n _addStake(amount, stakee);\n SafeERC20.safeTransferFrom(_token, msg.sender, address(this), amount);\n }\n\n function _addStake(uint256 amount, address stakee) internal {\n // automatically move any pending rewards generated by their existing stake\n _rewardsManager.updatePendingRewards(stakee, msg.sender);\n\n uint256 currentEpochId = _epochsManager.currentIteration();\n\n Stake storage stake = stakes[stakee];\n\n uint256 currentStake = getCurrentStakerAmount(stakee, msg.sender);\n\n stake.stakeEntries[msg.sender] = StakeEntry(\n currentStake + amount,\n block.number,\n currentEpochId\n );\n\n stake.totalManagedStake = stake.totalManagedStake + amount;\n totalManagedStake = totalManagedStake + amount;\n }\n\n /**\n * @notice Call this function to begin the unlocking process. Calling this\n * will trigger an automatic claim of any outstanding staking rewards. Any\n * stake that was already in the unlocking phase will have the specified\n * amount added to it, and its duration refreshed. This function will fail\n * under the following conditions:\n * - If no stake exists for the caller\n * - If the unlock amount is zero\n * - If the unlock amount is more than what is staked\n * Note: If calling as a Node, this function will *not* revert if it causes\n * the Node to fail to meet the minimum stake proportion. However it will still\n * prevent the Node from participating in the network until the minimum is met\n * again.\n * @param amount The amount of stake to unlock in SOLO.\n * @param stakee The address of the staked Node.\n */\n function unlockStake(uint256 amount, address stakee) external returns (uint256) {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n if (amount == 0) {\n revert CannotUnlockZeroAmount();\n }\n\n uint256 currentStake = getCurrentStakerAmount(stakee, msg.sender);\n\n if (currentStake == 0) {\n revert NoStakeToUnlock();\n }\n if (currentStake < amount) {\n revert CannotUnlockMoreThanStaked(currentStake, amount);\n }\n\n // automatically move any pending rewards generated by their existing stake\n _rewardsManager.updatePendingRewards(stakee, msg.sender);\n\n uint256 currentEpochId = _epochsManager.currentIteration();\n\n Stake storage stake = stakes[stakee];\n\n stake.stakeEntries[msg.sender] = StakeEntry(\n currentStake - amount,\n block.number,\n currentEpochId\n );\n\n stake.totalManagedStake = stake.totalManagedStake - amount;\n totalManagedStake = totalManagedStake - amount;\n\n bytes32 key = getKey(stakee, msg.sender);\n\n // Keep track of when the stake can be withdrawn\n Unlock storage unlock = unlockings[key];\n\n uint256 unlockAt = block.number + unlockDuration;\n if (unlock.unlockAt < unlockAt) {\n unlock.unlockAt = unlockAt;\n }\n\n unlock.amount = unlock.amount + amount;\n\n return unlockAt;\n }\n\n /**\n * @notice Call this function to withdraw stake that has finished unlocking.\n * This will fail if the stake has not yet unlocked.\n * @param stakee The address of the staked Node.\n */\n function withdrawStake(address stakee) external {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n\n bytes32 key = getKey(stakee, msg.sender);\n\n Unlock storage unlock = unlockings[key];\n\n if (unlock.unlockAt >= block.number) {\n revert StakeNotYetUnlocked();\n }\n\n uint256 amount = unlock.amount;\n\n delete unlockings[key];\n\n SafeERC20.safeTransfer(_token, msg.sender, amount);\n }\n\n /**\n * @notice Call this function to cancel any stake that is in the process\n * of unlocking. As this essentially adds back stake to the Node, this\n * will trigger an automatic claim of any outstanding staking rewards.\n * If the specified amount to cancel is greater than the stake that is\n * currently being unlocked, it will cancel the maximum stake possible.\n * @param amount The amount of unlocking stake to cancel in SOLO.\n * @param stakee The address of the staked Node.\n */\n function cancelUnlocking(uint256 amount, address stakee) external {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n if (amount == 0) {\n revert CannotCancelUnlockZeroAmount();\n }\n\n bytes32 key = getKey(stakee, msg.sender);\n\n Unlock storage unlock = unlockings[key];\n\n if (amount >= unlock.amount) {\n amount = unlock.amount;\n delete unlockings[key];\n } else {\n unlock.amount = unlock.amount - amount;\n }\n\n _addStake(amount, stakee);\n }\n\n /**\n * @notice This function determines the staking capacity of\n * a Seeker based on its power level. The method will revert if\n * the Seeker's power level has not been registered with the oracle.\n *\n * Currently the algorithm is as follows:\n * staking_capacity = seeker_power * seeker_power_multiplier;\n */\n function calculateCapacityFromSeekerPower(uint256 seekerId) external view returns (uint256) {\n uint256 seekerPower = _seekerPowerOracle.getSeekerPower(seekerId);\n if (seekerPower == 0) {\n revert SeekerPowerNotRegistered(seekerId);\n }\n\n // If the Seeker Power is already\n // at the maximum sylo, then we just return the max sylo value directly.\n if (seekerPower >= SyloUtils.MAX_SYLO) {\n return SyloUtils.MAX_SYLO;\n }\n\n uint256 capacity = seekerPower * seekerPowerMultiplier;\n\n return capacity > SyloUtils.MAX_SYLO ? SyloUtils.MAX_SYLO : capacity;\n }\n\n /**\n * @notice This function can be used to a determine a Node's staking capacity,\n * based on the minimum stake proportion constant.\n * @param stakee The address of the staked Node.\n */\n function calculateCapacityFromMinStakingProportion(address stakee) public view returns (uint256) {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n\n Stake storage stake = stakes[stakee];\n\n uint256 currentlyOwnedStake = stake.stakeEntries[stakee].amount;\n return (currentlyOwnedStake * SyloUtils.PERCENTAGE_DENOMINATOR) /\n minimumStakeProportion;\n }\n\n /**\n * @notice This function should be called by clients to determine how much\n * additional delegated stake can be allocated to a Node via an addStake or\n * cancelUnlocking call. This is useful to avoid a revert due to\n * the minimum stake proportion requirement not being met from the additional stake.\n * @param stakee The address of the staked Node.\n */\n function calculateMaxAdditionalDelegatedStake(address stakee) external view returns (uint256) {\n uint256 totalMaxStake = calculateCapacityFromMinStakingProportion(stakee);\n\n Stake storage stake = stakes[stakee];\n\n if (totalMaxStake < stake.totalManagedStake) {\n revert StakeCapacityReached(totalMaxStake, stake.totalManagedStake);\n }\n\n return totalMaxStake - stake.totalManagedStake;\n }\n\n /**\n * @notice Retrieve the key used to index a stake entry. The key is a hash\n * which takes both address of the Node and the staker as input.\n * @param stakee The address of the staked Node.\n * @param staker The address of the staker.\n * @return A byte-array representing the key.\n */\n function getKey(address stakee, address staker) public pure returns (bytes32) {\n return keccak256(abi.encodePacked(stakee, staker));\n }\n\n /**\n * @notice Retrieve the total stake being managed by this contract.\n * @return The total amount of managed stake in SOLO.\n */\n function getTotalManagedStake() external view returns (uint256) {\n return totalManagedStake;\n }\n\n /**\n * @notice Retrieve a stake entry.\n * @param stakee The address of the staked Node.\n * @param staker The address of the staker.\n * @return The stake entry.\n */\n function getStakeEntry(\n address stakee,\n address staker\n ) external view returns (StakeEntry memory) {\n return stakes[stakee].stakeEntries[staker];\n }\n\n /**\n * @notice Retrieve the total amount of SOLO staked against a Node.\n * @param stakee The address of the staked Node.\n * @return The amount of staked SOLO.\n */\n function getStakeeTotalManagedStake(address stakee) external view returns (uint256) {\n return stakes[stakee].totalManagedStake;\n }\n\n /**\n * @notice Check if a Node is meeting the minimum stake proportion requirement.\n * @param stakee The address of the staked Node.\n * @return True if the Node is meeting minimum stake proportion requirement.\n */\n function checkMinimumStakeProportion(address stakee) public view returns (bool) {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n\n Stake storage stake = stakes[stakee];\n\n uint256 currentlyOwnedStake = stake.stakeEntries[stakee].amount;\n uint32 ownedStakeProportion = SyloUtils.asPerc(\n SafeCast.toUint128(currentlyOwnedStake),\n stake.totalManagedStake\n );\n\n return ownedStakeProportion >= minimumStakeProportion;\n }\n\n /**\n * @notice Retrieve the current amount of SOLO staked against a Node by\n * a specified staker.\n * @param stakee The address of the staked Node.\n * @param staker The address of the staker.\n * @return The amount of staked SOLO.\n */\n function getCurrentStakerAmount(address stakee, address staker) public view returns (uint256) {\n return stakes[stakee].stakeEntries[staker].amount;\n }\n}\n" + }, + "contracts/SyloToken.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract SyloToken is ERC20 {\n constructor() ERC20(\"Sylo\", \"SYLO\") {\n _mint(msg.sender, 10_000_000_000 ether);\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/deployments/porcini-dev/solcInputs/61c534572f64110305c1d307d9b45348.json b/deployments/porcini-dev/solcInputs/61c534572f64110305c1d307d9b45348.json new file mode 100644 index 00000000..91d1b8ea --- /dev/null +++ b/deployments/porcini-dev/solcInputs/61c534572f64110305c1d307d9b45348.json @@ -0,0 +1,161 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./OwnableUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership} and {acceptOwnership}.\n *\n * This module is used through inheritance. It will make available all functions\n * from parent (Ownable).\n */\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\n function __Ownable2Step_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable2Step_init_unchained() internal onlyInitializing {\n }\n address private _pendingOwner;\n\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Returns the address of the pending owner.\n */\n function pendingOwner() public view virtual returns (address) {\n return _pendingOwner;\n }\n\n /**\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual override onlyOwner {\n _pendingOwner = newOwner;\n emit OwnershipTransferStarted(owner(), newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual override {\n delete _pendingOwner;\n super._transferOwnership(newOwner);\n }\n\n /**\n * @dev The new owner accepts the ownership transfer.\n */\n function acceptOwnership() public virtual {\n address sender = _msgSender();\n require(pendingOwner() == sender, \"Ownable2Step: caller is not the new owner\");\n _transferOwnership(sender);\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/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n /**\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/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/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/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/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/extensions/IERC20Permit.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 IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/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/ERC20/utils/SafeERC20.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 \"../IERC20.sol\";\nimport \"../extensions/IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.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(IERC20 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(IERC20 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(IERC20 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(IERC20 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(IERC20 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 IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n 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(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\n }\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/cryptography/ECDSA.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 \"../Strings.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 ECDSA {\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\", Strings.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/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/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/math/Math.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 Math {\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/utils/math/SafeCast.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n *\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\n * all math on `uint256` and `int256` and then downcasting.\n */\nlibrary SafeCast {\n /**\n * @dev Returns the downcasted uint248 from uint256, reverting on\n * overflow (when the input is greater than largest uint248).\n *\n * Counterpart to Solidity's `uint248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n *\n * _Available since v4.7._\n */\n function toUint248(uint256 value) internal pure returns (uint248) {\n require(value <= type(uint248).max, \"SafeCast: value doesn't fit in 248 bits\");\n return uint248(value);\n }\n\n /**\n * @dev Returns the downcasted uint240 from uint256, reverting on\n * overflow (when the input is greater than largest uint240).\n *\n * Counterpart to Solidity's `uint240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n *\n * _Available since v4.7._\n */\n function toUint240(uint256 value) internal pure returns (uint240) {\n require(value <= type(uint240).max, \"SafeCast: value doesn't fit in 240 bits\");\n return uint240(value);\n }\n\n /**\n * @dev Returns the downcasted uint232 from uint256, reverting on\n * overflow (when the input is greater than largest uint232).\n *\n * Counterpart to Solidity's `uint232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n *\n * _Available since v4.7._\n */\n function toUint232(uint256 value) internal pure returns (uint232) {\n require(value <= type(uint232).max, \"SafeCast: value doesn't fit in 232 bits\");\n return uint232(value);\n }\n\n /**\n * @dev Returns the downcasted uint224 from uint256, reverting on\n * overflow (when the input is greater than largest uint224).\n *\n * Counterpart to Solidity's `uint224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n *\n * _Available since v4.2._\n */\n function toUint224(uint256 value) internal pure returns (uint224) {\n require(value <= type(uint224).max, \"SafeCast: value doesn't fit in 224 bits\");\n return uint224(value);\n }\n\n /**\n * @dev Returns the downcasted uint216 from uint256, reverting on\n * overflow (when the input is greater than largest uint216).\n *\n * Counterpart to Solidity's `uint216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n *\n * _Available since v4.7._\n */\n function toUint216(uint256 value) internal pure returns (uint216) {\n require(value <= type(uint216).max, \"SafeCast: value doesn't fit in 216 bits\");\n return uint216(value);\n }\n\n /**\n * @dev Returns the downcasted uint208 from uint256, reverting on\n * overflow (when the input is greater than largest uint208).\n *\n * Counterpart to Solidity's `uint208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n *\n * _Available since v4.7._\n */\n function toUint208(uint256 value) internal pure returns (uint208) {\n require(value <= type(uint208).max, \"SafeCast: value doesn't fit in 208 bits\");\n return uint208(value);\n }\n\n /**\n * @dev Returns the downcasted uint200 from uint256, reverting on\n * overflow (when the input is greater than largest uint200).\n *\n * Counterpart to Solidity's `uint200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n *\n * _Available since v4.7._\n */\n function toUint200(uint256 value) internal pure returns (uint200) {\n require(value <= type(uint200).max, \"SafeCast: value doesn't fit in 200 bits\");\n return uint200(value);\n }\n\n /**\n * @dev Returns the downcasted uint192 from uint256, reverting on\n * overflow (when the input is greater than largest uint192).\n *\n * Counterpart to Solidity's `uint192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n *\n * _Available since v4.7._\n */\n function toUint192(uint256 value) internal pure returns (uint192) {\n require(value <= type(uint192).max, \"SafeCast: value doesn't fit in 192 bits\");\n return uint192(value);\n }\n\n /**\n * @dev Returns the downcasted uint184 from uint256, reverting on\n * overflow (when the input is greater than largest uint184).\n *\n * Counterpart to Solidity's `uint184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n *\n * _Available since v4.7._\n */\n function toUint184(uint256 value) internal pure returns (uint184) {\n require(value <= type(uint184).max, \"SafeCast: value doesn't fit in 184 bits\");\n return uint184(value);\n }\n\n /**\n * @dev Returns the downcasted uint176 from uint256, reverting on\n * overflow (when the input is greater than largest uint176).\n *\n * Counterpart to Solidity's `uint176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n *\n * _Available since v4.7._\n */\n function toUint176(uint256 value) internal pure returns (uint176) {\n require(value <= type(uint176).max, \"SafeCast: value doesn't fit in 176 bits\");\n return uint176(value);\n }\n\n /**\n * @dev Returns the downcasted uint168 from uint256, reverting on\n * overflow (when the input is greater than largest uint168).\n *\n * Counterpart to Solidity's `uint168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n *\n * _Available since v4.7._\n */\n function toUint168(uint256 value) internal pure returns (uint168) {\n require(value <= type(uint168).max, \"SafeCast: value doesn't fit in 168 bits\");\n return uint168(value);\n }\n\n /**\n * @dev Returns the downcasted uint160 from uint256, reverting on\n * overflow (when the input is greater than largest uint160).\n *\n * Counterpart to Solidity's `uint160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n *\n * _Available since v4.7._\n */\n function toUint160(uint256 value) internal pure returns (uint160) {\n require(value <= type(uint160).max, \"SafeCast: value doesn't fit in 160 bits\");\n return uint160(value);\n }\n\n /**\n * @dev Returns the downcasted uint152 from uint256, reverting on\n * overflow (when the input is greater than largest uint152).\n *\n * Counterpart to Solidity's `uint152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n *\n * _Available since v4.7._\n */\n function toUint152(uint256 value) internal pure returns (uint152) {\n require(value <= type(uint152).max, \"SafeCast: value doesn't fit in 152 bits\");\n return uint152(value);\n }\n\n /**\n * @dev Returns the downcasted uint144 from uint256, reverting on\n * overflow (when the input is greater than largest uint144).\n *\n * Counterpart to Solidity's `uint144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n *\n * _Available since v4.7._\n */\n function toUint144(uint256 value) internal pure returns (uint144) {\n require(value <= type(uint144).max, \"SafeCast: value doesn't fit in 144 bits\");\n return uint144(value);\n }\n\n /**\n * @dev Returns the downcasted uint136 from uint256, reverting on\n * overflow (when the input is greater than largest uint136).\n *\n * Counterpart to Solidity's `uint136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n *\n * _Available since v4.7._\n */\n function toUint136(uint256 value) internal pure returns (uint136) {\n require(value <= type(uint136).max, \"SafeCast: value doesn't fit in 136 bits\");\n return uint136(value);\n }\n\n /**\n * @dev Returns the downcasted uint128 from uint256, reverting on\n * overflow (when the input is greater than largest uint128).\n *\n * Counterpart to Solidity's `uint128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v2.5._\n */\n function toUint128(uint256 value) internal pure returns (uint128) {\n require(value <= type(uint128).max, \"SafeCast: value doesn't fit in 128 bits\");\n return uint128(value);\n }\n\n /**\n * @dev Returns the downcasted uint120 from uint256, reverting on\n * overflow (when the input is greater than largest uint120).\n *\n * Counterpart to Solidity's `uint120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n *\n * _Available since v4.7._\n */\n function toUint120(uint256 value) internal pure returns (uint120) {\n require(value <= type(uint120).max, \"SafeCast: value doesn't fit in 120 bits\");\n return uint120(value);\n }\n\n /**\n * @dev Returns the downcasted uint112 from uint256, reverting on\n * overflow (when the input is greater than largest uint112).\n *\n * Counterpart to Solidity's `uint112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n *\n * _Available since v4.7._\n */\n function toUint112(uint256 value) internal pure returns (uint112) {\n require(value <= type(uint112).max, \"SafeCast: value doesn't fit in 112 bits\");\n return uint112(value);\n }\n\n /**\n * @dev Returns the downcasted uint104 from uint256, reverting on\n * overflow (when the input is greater than largest uint104).\n *\n * Counterpart to Solidity's `uint104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n *\n * _Available since v4.7._\n */\n function toUint104(uint256 value) internal pure returns (uint104) {\n require(value <= type(uint104).max, \"SafeCast: value doesn't fit in 104 bits\");\n return uint104(value);\n }\n\n /**\n * @dev Returns the downcasted uint96 from uint256, reverting on\n * overflow (when the input is greater than largest uint96).\n *\n * Counterpart to Solidity's `uint96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n *\n * _Available since v4.2._\n */\n function toUint96(uint256 value) internal pure returns (uint96) {\n require(value <= type(uint96).max, \"SafeCast: value doesn't fit in 96 bits\");\n return uint96(value);\n }\n\n /**\n * @dev Returns the downcasted uint88 from uint256, reverting on\n * overflow (when the input is greater than largest uint88).\n *\n * Counterpart to Solidity's `uint88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n *\n * _Available since v4.7._\n */\n function toUint88(uint256 value) internal pure returns (uint88) {\n require(value <= type(uint88).max, \"SafeCast: value doesn't fit in 88 bits\");\n return uint88(value);\n }\n\n /**\n * @dev Returns the downcasted uint80 from uint256, reverting on\n * overflow (when the input is greater than largest uint80).\n *\n * Counterpart to Solidity's `uint80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n *\n * _Available since v4.7._\n */\n function toUint80(uint256 value) internal pure returns (uint80) {\n require(value <= type(uint80).max, \"SafeCast: value doesn't fit in 80 bits\");\n return uint80(value);\n }\n\n /**\n * @dev Returns the downcasted uint72 from uint256, reverting on\n * overflow (when the input is greater than largest uint72).\n *\n * Counterpart to Solidity's `uint72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n *\n * _Available since v4.7._\n */\n function toUint72(uint256 value) internal pure returns (uint72) {\n require(value <= type(uint72).max, \"SafeCast: value doesn't fit in 72 bits\");\n return uint72(value);\n }\n\n /**\n * @dev Returns the downcasted uint64 from uint256, reverting on\n * overflow (when the input is greater than largest uint64).\n *\n * Counterpart to Solidity's `uint64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v2.5._\n */\n function toUint64(uint256 value) internal pure returns (uint64) {\n require(value <= type(uint64).max, \"SafeCast: value doesn't fit in 64 bits\");\n return uint64(value);\n }\n\n /**\n * @dev Returns the downcasted uint56 from uint256, reverting on\n * overflow (when the input is greater than largest uint56).\n *\n * Counterpart to Solidity's `uint56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n *\n * _Available since v4.7._\n */\n function toUint56(uint256 value) internal pure returns (uint56) {\n require(value <= type(uint56).max, \"SafeCast: value doesn't fit in 56 bits\");\n return uint56(value);\n }\n\n /**\n * @dev Returns the downcasted uint48 from uint256, reverting on\n * overflow (when the input is greater than largest uint48).\n *\n * Counterpart to Solidity's `uint48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n *\n * _Available since v4.7._\n */\n function toUint48(uint256 value) internal pure returns (uint48) {\n require(value <= type(uint48).max, \"SafeCast: value doesn't fit in 48 bits\");\n return uint48(value);\n }\n\n /**\n * @dev Returns the downcasted uint40 from uint256, reverting on\n * overflow (when the input is greater than largest uint40).\n *\n * Counterpart to Solidity's `uint40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n *\n * _Available since v4.7._\n */\n function toUint40(uint256 value) internal pure returns (uint40) {\n require(value <= type(uint40).max, \"SafeCast: value doesn't fit in 40 bits\");\n return uint40(value);\n }\n\n /**\n * @dev Returns the downcasted uint32 from uint256, reverting on\n * overflow (when the input is greater than largest uint32).\n *\n * Counterpart to Solidity's `uint32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v2.5._\n */\n function toUint32(uint256 value) internal pure returns (uint32) {\n require(value <= type(uint32).max, \"SafeCast: value doesn't fit in 32 bits\");\n return uint32(value);\n }\n\n /**\n * @dev Returns the downcasted uint24 from uint256, reverting on\n * overflow (when the input is greater than largest uint24).\n *\n * Counterpart to Solidity's `uint24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n *\n * _Available since v4.7._\n */\n function toUint24(uint256 value) internal pure returns (uint24) {\n require(value <= type(uint24).max, \"SafeCast: value doesn't fit in 24 bits\");\n return uint24(value);\n }\n\n /**\n * @dev Returns the downcasted uint16 from uint256, reverting on\n * overflow (when the input is greater than largest uint16).\n *\n * Counterpart to Solidity's `uint16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v2.5._\n */\n function toUint16(uint256 value) internal pure returns (uint16) {\n require(value <= type(uint16).max, \"SafeCast: value doesn't fit in 16 bits\");\n return uint16(value);\n }\n\n /**\n * @dev Returns the downcasted uint8 from uint256, reverting on\n * overflow (when the input is greater than largest uint8).\n *\n * Counterpart to Solidity's `uint8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n *\n * _Available since v2.5._\n */\n function toUint8(uint256 value) internal pure returns (uint8) {\n require(value <= type(uint8).max, \"SafeCast: value doesn't fit in 8 bits\");\n return uint8(value);\n }\n\n /**\n * @dev Converts a signed int256 into an unsigned uint256.\n *\n * Requirements:\n *\n * - input must be greater than or equal to 0.\n *\n * _Available since v3.0._\n */\n function toUint256(int256 value) internal pure returns (uint256) {\n require(value >= 0, \"SafeCast: value must be positive\");\n return uint256(value);\n }\n\n /**\n * @dev Returns the downcasted int248 from int256, reverting on\n * overflow (when the input is less than smallest int248 or\n * greater than largest int248).\n *\n * Counterpart to Solidity's `int248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n *\n * _Available since v4.7._\n */\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\n downcasted = int248(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 248 bits\");\n }\n\n /**\n * @dev Returns the downcasted int240 from int256, reverting on\n * overflow (when the input is less than smallest int240 or\n * greater than largest int240).\n *\n * Counterpart to Solidity's `int240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n *\n * _Available since v4.7._\n */\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\n downcasted = int240(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 240 bits\");\n }\n\n /**\n * @dev Returns the downcasted int232 from int256, reverting on\n * overflow (when the input is less than smallest int232 or\n * greater than largest int232).\n *\n * Counterpart to Solidity's `int232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n *\n * _Available since v4.7._\n */\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\n downcasted = int232(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 232 bits\");\n }\n\n /**\n * @dev Returns the downcasted int224 from int256, reverting on\n * overflow (when the input is less than smallest int224 or\n * greater than largest int224).\n *\n * Counterpart to Solidity's `int224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n *\n * _Available since v4.7._\n */\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\n downcasted = int224(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 224 bits\");\n }\n\n /**\n * @dev Returns the downcasted int216 from int256, reverting on\n * overflow (when the input is less than smallest int216 or\n * greater than largest int216).\n *\n * Counterpart to Solidity's `int216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n *\n * _Available since v4.7._\n */\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\n downcasted = int216(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 216 bits\");\n }\n\n /**\n * @dev Returns the downcasted int208 from int256, reverting on\n * overflow (when the input is less than smallest int208 or\n * greater than largest int208).\n *\n * Counterpart to Solidity's `int208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n *\n * _Available since v4.7._\n */\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\n downcasted = int208(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 208 bits\");\n }\n\n /**\n * @dev Returns the downcasted int200 from int256, reverting on\n * overflow (when the input is less than smallest int200 or\n * greater than largest int200).\n *\n * Counterpart to Solidity's `int200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n *\n * _Available since v4.7._\n */\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\n downcasted = int200(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 200 bits\");\n }\n\n /**\n * @dev Returns the downcasted int192 from int256, reverting on\n * overflow (when the input is less than smallest int192 or\n * greater than largest int192).\n *\n * Counterpart to Solidity's `int192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n *\n * _Available since v4.7._\n */\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\n downcasted = int192(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 192 bits\");\n }\n\n /**\n * @dev Returns the downcasted int184 from int256, reverting on\n * overflow (when the input is less than smallest int184 or\n * greater than largest int184).\n *\n * Counterpart to Solidity's `int184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n *\n * _Available since v4.7._\n */\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\n downcasted = int184(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 184 bits\");\n }\n\n /**\n * @dev Returns the downcasted int176 from int256, reverting on\n * overflow (when the input is less than smallest int176 or\n * greater than largest int176).\n *\n * Counterpart to Solidity's `int176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n *\n * _Available since v4.7._\n */\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\n downcasted = int176(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 176 bits\");\n }\n\n /**\n * @dev Returns the downcasted int168 from int256, reverting on\n * overflow (when the input is less than smallest int168 or\n * greater than largest int168).\n *\n * Counterpart to Solidity's `int168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n *\n * _Available since v4.7._\n */\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\n downcasted = int168(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 168 bits\");\n }\n\n /**\n * @dev Returns the downcasted int160 from int256, reverting on\n * overflow (when the input is less than smallest int160 or\n * greater than largest int160).\n *\n * Counterpart to Solidity's `int160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n *\n * _Available since v4.7._\n */\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\n downcasted = int160(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 160 bits\");\n }\n\n /**\n * @dev Returns the downcasted int152 from int256, reverting on\n * overflow (when the input is less than smallest int152 or\n * greater than largest int152).\n *\n * Counterpart to Solidity's `int152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n *\n * _Available since v4.7._\n */\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\n downcasted = int152(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 152 bits\");\n }\n\n /**\n * @dev Returns the downcasted int144 from int256, reverting on\n * overflow (when the input is less than smallest int144 or\n * greater than largest int144).\n *\n * Counterpart to Solidity's `int144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n *\n * _Available since v4.7._\n */\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\n downcasted = int144(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 144 bits\");\n }\n\n /**\n * @dev Returns the downcasted int136 from int256, reverting on\n * overflow (when the input is less than smallest int136 or\n * greater than largest int136).\n *\n * Counterpart to Solidity's `int136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n *\n * _Available since v4.7._\n */\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\n downcasted = int136(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 136 bits\");\n }\n\n /**\n * @dev Returns the downcasted int128 from int256, reverting on\n * overflow (when the input is less than smallest int128 or\n * greater than largest int128).\n *\n * Counterpart to Solidity's `int128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v3.1._\n */\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\n downcasted = int128(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 128 bits\");\n }\n\n /**\n * @dev Returns the downcasted int120 from int256, reverting on\n * overflow (when the input is less than smallest int120 or\n * greater than largest int120).\n *\n * Counterpart to Solidity's `int120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n *\n * _Available since v4.7._\n */\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\n downcasted = int120(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 120 bits\");\n }\n\n /**\n * @dev Returns the downcasted int112 from int256, reverting on\n * overflow (when the input is less than smallest int112 or\n * greater than largest int112).\n *\n * Counterpart to Solidity's `int112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n *\n * _Available since v4.7._\n */\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\n downcasted = int112(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 112 bits\");\n }\n\n /**\n * @dev Returns the downcasted int104 from int256, reverting on\n * overflow (when the input is less than smallest int104 or\n * greater than largest int104).\n *\n * Counterpart to Solidity's `int104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n *\n * _Available since v4.7._\n */\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\n downcasted = int104(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 104 bits\");\n }\n\n /**\n * @dev Returns the downcasted int96 from int256, reverting on\n * overflow (when the input is less than smallest int96 or\n * greater than largest int96).\n *\n * Counterpart to Solidity's `int96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n *\n * _Available since v4.7._\n */\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\n downcasted = int96(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 96 bits\");\n }\n\n /**\n * @dev Returns the downcasted int88 from int256, reverting on\n * overflow (when the input is less than smallest int88 or\n * greater than largest int88).\n *\n * Counterpart to Solidity's `int88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n *\n * _Available since v4.7._\n */\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\n downcasted = int88(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 88 bits\");\n }\n\n /**\n * @dev Returns the downcasted int80 from int256, reverting on\n * overflow (when the input is less than smallest int80 or\n * greater than largest int80).\n *\n * Counterpart to Solidity's `int80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n *\n * _Available since v4.7._\n */\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\n downcasted = int80(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 80 bits\");\n }\n\n /**\n * @dev Returns the downcasted int72 from int256, reverting on\n * overflow (when the input is less than smallest int72 or\n * greater than largest int72).\n *\n * Counterpart to Solidity's `int72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n *\n * _Available since v4.7._\n */\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\n downcasted = int72(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 72 bits\");\n }\n\n /**\n * @dev Returns the downcasted int64 from int256, reverting on\n * overflow (when the input is less than smallest int64 or\n * greater than largest int64).\n *\n * Counterpart to Solidity's `int64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v3.1._\n */\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\n downcasted = int64(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 64 bits\");\n }\n\n /**\n * @dev Returns the downcasted int56 from int256, reverting on\n * overflow (when the input is less than smallest int56 or\n * greater than largest int56).\n *\n * Counterpart to Solidity's `int56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n *\n * _Available since v4.7._\n */\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\n downcasted = int56(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 56 bits\");\n }\n\n /**\n * @dev Returns the downcasted int48 from int256, reverting on\n * overflow (when the input is less than smallest int48 or\n * greater than largest int48).\n *\n * Counterpart to Solidity's `int48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n *\n * _Available since v4.7._\n */\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\n downcasted = int48(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 48 bits\");\n }\n\n /**\n * @dev Returns the downcasted int40 from int256, reverting on\n * overflow (when the input is less than smallest int40 or\n * greater than largest int40).\n *\n * Counterpart to Solidity's `int40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n *\n * _Available since v4.7._\n */\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\n downcasted = int40(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 40 bits\");\n }\n\n /**\n * @dev Returns the downcasted int32 from int256, reverting on\n * overflow (when the input is less than smallest int32 or\n * greater than largest int32).\n *\n * Counterpart to Solidity's `int32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v3.1._\n */\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\n downcasted = int32(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 32 bits\");\n }\n\n /**\n * @dev Returns the downcasted int24 from int256, reverting on\n * overflow (when the input is less than smallest int24 or\n * greater than largest int24).\n *\n * Counterpart to Solidity's `int24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n *\n * _Available since v4.7._\n */\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\n downcasted = int24(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 24 bits\");\n }\n\n /**\n * @dev Returns the downcasted int16 from int256, reverting on\n * overflow (when the input is less than smallest int16 or\n * greater than largest int16).\n *\n * Counterpart to Solidity's `int16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v3.1._\n */\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\n downcasted = int16(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 16 bits\");\n }\n\n /**\n * @dev Returns the downcasted int8 from int256, reverting on\n * overflow (when the input is less than smallest int8 or\n * greater than largest int8).\n *\n * Counterpart to Solidity's `int8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n *\n * _Available since v3.1._\n */\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\n downcasted = int8(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 8 bits\");\n }\n\n /**\n * @dev Converts an unsigned uint256 into a signed int256.\n *\n * Requirements:\n *\n * - input must be less than or equal to maxInt256.\n *\n * _Available since v3.0._\n */\n function toInt256(uint256 value) internal pure returns (int256) {\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\n require(value <= uint256(type(int256).max), \"SafeCast: value doesn't fit in an int256\");\n return int256(value);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SignedMath.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 SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.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/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\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 = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _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(SignedMath.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n 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" + }, + "abdk-libraries-solidity/ABDKMath64x64.sol": { + "content": "// SPDX-License-Identifier: BSD-4-Clause\n/*\n * ABDK Math 64.64 Smart Contract Library. Copyright Ā© 2019 by ABDK Consulting.\n * Author: Mikhail Vladimirov \n */\npragma solidity ^0.8.0;\n\n/**\n * Smart contract library of mathematical functions operating with signed\n * 64.64-bit fixed point numbers. Signed 64.64-bit fixed point number is\n * basically a simple fraction whose numerator is signed 128-bit integer and\n * denominator is 2^64. As long as denominator is always the same, there is no\n * need to store it, thus in Solidity signed 64.64-bit fixed point numbers are\n * represented by int128 type holding only the numerator.\n */\nlibrary ABDKMath64x64 {\n /*\n * Minimum value signed 64.64-bit fixed point number may have. \n */\n int128 private constant MIN_64x64 = -0x80000000000000000000000000000000;\n\n /*\n * Maximum value signed 64.64-bit fixed point number may have. \n */\n int128 private constant MAX_64x64 = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;\n\n /**\n * Convert signed 256-bit integer number into signed 64.64-bit fixed point\n * number. Revert on overflow.\n *\n * @param x signed 256-bit integer number\n * @return signed 64.64-bit fixed point number\n */\n function fromInt (int256 x) internal pure returns (int128) {\n unchecked {\n require (x >= -0x8000000000000000 && x <= 0x7FFFFFFFFFFFFFFF);\n return int128 (x << 64);\n }\n }\n\n /**\n * Convert signed 64.64 fixed point number into signed 64-bit integer number\n * rounding down.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64-bit integer number\n */\n function toInt (int128 x) internal pure returns (int64) {\n unchecked {\n return int64 (x >> 64);\n }\n }\n\n /**\n * Convert unsigned 256-bit integer number into signed 64.64-bit fixed point\n * number. Revert on overflow.\n *\n * @param x unsigned 256-bit integer number\n * @return signed 64.64-bit fixed point number\n */\n function fromUInt (uint256 x) internal pure returns (int128) {\n unchecked {\n require (x <= 0x7FFFFFFFFFFFFFFF);\n return int128 (int256 (x << 64));\n }\n }\n\n /**\n * Convert signed 64.64 fixed point number into unsigned 64-bit integer\n * number rounding down. Revert on underflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @return unsigned 64-bit integer number\n */\n function toUInt (int128 x) internal pure returns (uint64) {\n unchecked {\n require (x >= 0);\n return uint64 (uint128 (x >> 64));\n }\n }\n\n /**\n * Convert signed 128.128 fixed point number into signed 64.64-bit fixed point\n * number rounding down. Revert on overflow.\n *\n * @param x signed 128.128-bin fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function from128x128 (int256 x) internal pure returns (int128) {\n unchecked {\n int256 result = x >> 64;\n require (result >= MIN_64x64 && result <= MAX_64x64);\n return int128 (result);\n }\n }\n\n /**\n * Convert signed 64.64 fixed point number into signed 128.128 fixed point\n * number.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 128.128 fixed point number\n */\n function to128x128 (int128 x) internal pure returns (int256) {\n unchecked {\n return int256 (x) << 64;\n }\n }\n\n /**\n * Calculate x + y. Revert on overflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @param y signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function add (int128 x, int128 y) internal pure returns (int128) {\n unchecked {\n int256 result = int256(x) + y;\n require (result >= MIN_64x64 && result <= MAX_64x64);\n return int128 (result);\n }\n }\n\n /**\n * Calculate x - y. Revert on overflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @param y signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function sub (int128 x, int128 y) internal pure returns (int128) {\n unchecked {\n int256 result = int256(x) - y;\n require (result >= MIN_64x64 && result <= MAX_64x64);\n return int128 (result);\n }\n }\n\n /**\n * Calculate x * y rounding down. Revert on overflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @param y signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function mul (int128 x, int128 y) internal pure returns (int128) {\n unchecked {\n int256 result = int256(x) * y >> 64;\n require (result >= MIN_64x64 && result <= MAX_64x64);\n return int128 (result);\n }\n }\n\n /**\n * Calculate x * y rounding towards zero, where x is signed 64.64 fixed point\n * number and y is signed 256-bit integer number. Revert on overflow.\n *\n * @param x signed 64.64 fixed point number\n * @param y signed 256-bit integer number\n * @return signed 256-bit integer number\n */\n function muli (int128 x, int256 y) internal pure returns (int256) {\n unchecked {\n if (x == MIN_64x64) {\n require (y >= -0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF &&\n y <= 0x1000000000000000000000000000000000000000000000000);\n return -y << 63;\n } else {\n bool negativeResult = false;\n if (x < 0) {\n x = -x;\n negativeResult = true;\n }\n if (y < 0) {\n y = -y; // We rely on overflow behavior here\n negativeResult = !negativeResult;\n }\n uint256 absoluteResult = mulu (x, uint256 (y));\n if (negativeResult) {\n require (absoluteResult <=\n 0x8000000000000000000000000000000000000000000000000000000000000000);\n return -int256 (absoluteResult); // We rely on overflow behavior here\n } else {\n require (absoluteResult <=\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\n return int256 (absoluteResult);\n }\n }\n }\n }\n\n /**\n * Calculate x * y rounding down, where x is signed 64.64 fixed point number\n * and y is unsigned 256-bit integer number. Revert on overflow.\n *\n * @param x signed 64.64 fixed point number\n * @param y unsigned 256-bit integer number\n * @return unsigned 256-bit integer number\n */\n function mulu (int128 x, uint256 y) internal pure returns (uint256) {\n unchecked {\n if (y == 0) return 0;\n\n require (x >= 0);\n\n uint256 lo = (uint256 (int256 (x)) * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) >> 64;\n uint256 hi = uint256 (int256 (x)) * (y >> 128);\n\n require (hi <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\n hi <<= 64;\n\n require (hi <=\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - lo);\n return hi + lo;\n }\n }\n\n /**\n * Calculate x / y rounding towards zero. Revert on overflow or when y is\n * zero.\n *\n * @param x signed 64.64-bit fixed point number\n * @param y signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function div (int128 x, int128 y) internal pure returns (int128) {\n unchecked {\n require (y != 0);\n int256 result = (int256 (x) << 64) / y;\n require (result >= MIN_64x64 && result <= MAX_64x64);\n return int128 (result);\n }\n }\n\n /**\n * Calculate x / y rounding towards zero, where x and y are signed 256-bit\n * integer numbers. Revert on overflow or when y is zero.\n *\n * @param x signed 256-bit integer number\n * @param y signed 256-bit integer number\n * @return signed 64.64-bit fixed point number\n */\n function divi (int256 x, int256 y) internal pure returns (int128) {\n unchecked {\n require (y != 0);\n\n bool negativeResult = false;\n if (x < 0) {\n x = -x; // We rely on overflow behavior here\n negativeResult = true;\n }\n if (y < 0) {\n y = -y; // We rely on overflow behavior here\n negativeResult = !negativeResult;\n }\n uint128 absoluteResult = divuu (uint256 (x), uint256 (y));\n if (negativeResult) {\n require (absoluteResult <= 0x80000000000000000000000000000000);\n return -int128 (absoluteResult); // We rely on overflow behavior here\n } else {\n require (absoluteResult <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\n return int128 (absoluteResult); // We rely on overflow behavior here\n }\n }\n }\n\n /**\n * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit\n * integer numbers. Revert on overflow or when y is zero.\n *\n * @param x unsigned 256-bit integer number\n * @param y unsigned 256-bit integer number\n * @return signed 64.64-bit fixed point number\n */\n function divu (uint256 x, uint256 y) internal pure returns (int128) {\n unchecked {\n require (y != 0);\n uint128 result = divuu (x, y);\n require (result <= uint128 (MAX_64x64));\n return int128 (result);\n }\n }\n\n /**\n * Calculate -x. Revert on overflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function neg (int128 x) internal pure returns (int128) {\n unchecked {\n require (x != MIN_64x64);\n return -x;\n }\n }\n\n /**\n * Calculate |x|. Revert on overflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function abs (int128 x) internal pure returns (int128) {\n unchecked {\n require (x != MIN_64x64);\n return x < 0 ? -x : x;\n }\n }\n\n /**\n * Calculate 1 / x rounding towards zero. Revert on overflow or when x is\n * zero.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function inv (int128 x) internal pure returns (int128) {\n unchecked {\n require (x != 0);\n int256 result = int256 (0x100000000000000000000000000000000) / x;\n require (result >= MIN_64x64 && result <= MAX_64x64);\n return int128 (result);\n }\n }\n\n /**\n * Calculate arithmetics average of x and y, i.e. (x + y) / 2 rounding down.\n *\n * @param x signed 64.64-bit fixed point number\n * @param y signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function avg (int128 x, int128 y) internal pure returns (int128) {\n unchecked {\n return int128 ((int256 (x) + int256 (y)) >> 1);\n }\n }\n\n /**\n * Calculate geometric average of x and y, i.e. sqrt (x * y) rounding down.\n * Revert on overflow or in case x * y is negative.\n *\n * @param x signed 64.64-bit fixed point number\n * @param y signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function gavg (int128 x, int128 y) internal pure returns (int128) {\n unchecked {\n int256 m = int256 (x) * int256 (y);\n require (m >= 0);\n require (m <\n 0x4000000000000000000000000000000000000000000000000000000000000000);\n return int128 (sqrtu (uint256 (m)));\n }\n }\n\n /**\n * Calculate x^y assuming 0^0 is 1, where x is signed 64.64 fixed point number\n * and y is unsigned 256-bit integer number. Revert on overflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @param y uint256 value\n * @return signed 64.64-bit fixed point number\n */\n function pow (int128 x, uint256 y) internal pure returns (int128) {\n unchecked {\n bool negative = x < 0 && y & 1 == 1;\n\n uint256 absX = uint128 (x < 0 ? -x : x);\n uint256 absResult;\n absResult = 0x100000000000000000000000000000000;\n\n if (absX <= 0x10000000000000000) {\n absX <<= 63;\n while (y != 0) {\n if (y & 0x1 != 0) {\n absResult = absResult * absX >> 127;\n }\n absX = absX * absX >> 127;\n\n if (y & 0x2 != 0) {\n absResult = absResult * absX >> 127;\n }\n absX = absX * absX >> 127;\n\n if (y & 0x4 != 0) {\n absResult = absResult * absX >> 127;\n }\n absX = absX * absX >> 127;\n\n if (y & 0x8 != 0) {\n absResult = absResult * absX >> 127;\n }\n absX = absX * absX >> 127;\n\n y >>= 4;\n }\n\n absResult >>= 64;\n } else {\n uint256 absXShift = 63;\n if (absX < 0x1000000000000000000000000) { absX <<= 32; absXShift -= 32; }\n if (absX < 0x10000000000000000000000000000) { absX <<= 16; absXShift -= 16; }\n if (absX < 0x1000000000000000000000000000000) { absX <<= 8; absXShift -= 8; }\n if (absX < 0x10000000000000000000000000000000) { absX <<= 4; absXShift -= 4; }\n if (absX < 0x40000000000000000000000000000000) { absX <<= 2; absXShift -= 2; }\n if (absX < 0x80000000000000000000000000000000) { absX <<= 1; absXShift -= 1; }\n\n uint256 resultShift = 0;\n while (y != 0) {\n require (absXShift < 64);\n\n if (y & 0x1 != 0) {\n absResult = absResult * absX >> 127;\n resultShift += absXShift;\n if (absResult > 0x100000000000000000000000000000000) {\n absResult >>= 1;\n resultShift += 1;\n }\n }\n absX = absX * absX >> 127;\n absXShift <<= 1;\n if (absX >= 0x100000000000000000000000000000000) {\n absX >>= 1;\n absXShift += 1;\n }\n\n y >>= 1;\n }\n\n require (resultShift < 64);\n absResult >>= 64 - resultShift;\n }\n int256 result = negative ? -int256 (absResult) : int256 (absResult);\n require (result >= MIN_64x64 && result <= MAX_64x64);\n return int128 (result);\n }\n }\n\n /**\n * Calculate sqrt (x) rounding down. Revert if x < 0.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function sqrt (int128 x) internal pure returns (int128) {\n unchecked {\n require (x >= 0);\n return int128 (sqrtu (uint256 (int256 (x)) << 64));\n }\n }\n\n /**\n * Calculate binary logarithm of x. Revert if x <= 0.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function log_2 (int128 x) internal pure returns (int128) {\n unchecked {\n require (x > 0);\n\n int256 msb = 0;\n int256 xc = x;\n if (xc >= 0x10000000000000000) { xc >>= 64; msb += 64; }\n if (xc >= 0x100000000) { xc >>= 32; msb += 32; }\n if (xc >= 0x10000) { xc >>= 16; msb += 16; }\n if (xc >= 0x100) { xc >>= 8; msb += 8; }\n if (xc >= 0x10) { xc >>= 4; msb += 4; }\n if (xc >= 0x4) { xc >>= 2; msb += 2; }\n if (xc >= 0x2) msb += 1; // No need to shift xc anymore\n\n int256 result = msb - 64 << 64;\n uint256 ux = uint256 (int256 (x)) << uint256 (127 - msb);\n for (int256 bit = 0x8000000000000000; bit > 0; bit >>= 1) {\n ux *= ux;\n uint256 b = ux >> 255;\n ux >>= 127 + b;\n result += bit * int256 (b);\n }\n\n return int128 (result);\n }\n }\n\n /**\n * Calculate natural logarithm of x. Revert if x <= 0.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function ln (int128 x) internal pure returns (int128) {\n unchecked {\n require (x > 0);\n\n return int128 (int256 (\n uint256 (int256 (log_2 (x))) * 0xB17217F7D1CF79ABC9E3B39803F2F6AF >> 128));\n }\n }\n\n /**\n * Calculate binary exponent of x. Revert on overflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function exp_2 (int128 x) internal pure returns (int128) {\n unchecked {\n require (x < 0x400000000000000000); // Overflow\n\n if (x < -0x400000000000000000) return 0; // Underflow\n\n uint256 result = 0x80000000000000000000000000000000;\n\n if (x & 0x8000000000000000 > 0)\n result = result * 0x16A09E667F3BCC908B2FB1366EA957D3E >> 128;\n if (x & 0x4000000000000000 > 0)\n result = result * 0x1306FE0A31B7152DE8D5A46305C85EDEC >> 128;\n if (x & 0x2000000000000000 > 0)\n result = result * 0x1172B83C7D517ADCDF7C8C50EB14A791F >> 128;\n if (x & 0x1000000000000000 > 0)\n result = result * 0x10B5586CF9890F6298B92B71842A98363 >> 128;\n if (x & 0x800000000000000 > 0)\n result = result * 0x1059B0D31585743AE7C548EB68CA417FD >> 128;\n if (x & 0x400000000000000 > 0)\n result = result * 0x102C9A3E778060EE6F7CACA4F7A29BDE8 >> 128;\n if (x & 0x200000000000000 > 0)\n result = result * 0x10163DA9FB33356D84A66AE336DCDFA3F >> 128;\n if (x & 0x100000000000000 > 0)\n result = result * 0x100B1AFA5ABCBED6129AB13EC11DC9543 >> 128;\n if (x & 0x80000000000000 > 0)\n result = result * 0x10058C86DA1C09EA1FF19D294CF2F679B >> 128;\n if (x & 0x40000000000000 > 0)\n result = result * 0x1002C605E2E8CEC506D21BFC89A23A00F >> 128;\n if (x & 0x20000000000000 > 0)\n result = result * 0x100162F3904051FA128BCA9C55C31E5DF >> 128;\n if (x & 0x10000000000000 > 0)\n result = result * 0x1000B175EFFDC76BA38E31671CA939725 >> 128;\n if (x & 0x8000000000000 > 0)\n result = result * 0x100058BA01FB9F96D6CACD4B180917C3D >> 128;\n if (x & 0x4000000000000 > 0)\n result = result * 0x10002C5CC37DA9491D0985C348C68E7B3 >> 128;\n if (x & 0x2000000000000 > 0)\n result = result * 0x1000162E525EE054754457D5995292026 >> 128;\n if (x & 0x1000000000000 > 0)\n result = result * 0x10000B17255775C040618BF4A4ADE83FC >> 128;\n if (x & 0x800000000000 > 0)\n result = result * 0x1000058B91B5BC9AE2EED81E9B7D4CFAB >> 128;\n if (x & 0x400000000000 > 0)\n result = result * 0x100002C5C89D5EC6CA4D7C8ACC017B7C9 >> 128;\n if (x & 0x200000000000 > 0)\n result = result * 0x10000162E43F4F831060E02D839A9D16D >> 128;\n if (x & 0x100000000000 > 0)\n result = result * 0x100000B1721BCFC99D9F890EA06911763 >> 128;\n if (x & 0x80000000000 > 0)\n result = result * 0x10000058B90CF1E6D97F9CA14DBCC1628 >> 128;\n if (x & 0x40000000000 > 0)\n result = result * 0x1000002C5C863B73F016468F6BAC5CA2B >> 128;\n if (x & 0x20000000000 > 0)\n result = result * 0x100000162E430E5A18F6119E3C02282A5 >> 128;\n if (x & 0x10000000000 > 0)\n result = result * 0x1000000B1721835514B86E6D96EFD1BFE >> 128;\n if (x & 0x8000000000 > 0)\n result = result * 0x100000058B90C0B48C6BE5DF846C5B2EF >> 128;\n if (x & 0x4000000000 > 0)\n result = result * 0x10000002C5C8601CC6B9E94213C72737A >> 128;\n if (x & 0x2000000000 > 0)\n result = result * 0x1000000162E42FFF037DF38AA2B219F06 >> 128;\n if (x & 0x1000000000 > 0)\n result = result * 0x10000000B17217FBA9C739AA5819F44F9 >> 128;\n if (x & 0x800000000 > 0)\n result = result * 0x1000000058B90BFCDEE5ACD3C1CEDC823 >> 128;\n if (x & 0x400000000 > 0)\n result = result * 0x100000002C5C85FE31F35A6A30DA1BE50 >> 128;\n if (x & 0x200000000 > 0)\n result = result * 0x10000000162E42FF0999CE3541B9FFFCF >> 128;\n if (x & 0x100000000 > 0)\n result = result * 0x100000000B17217F80F4EF5AADDA45554 >> 128;\n if (x & 0x80000000 > 0)\n result = result * 0x10000000058B90BFBF8479BD5A81B51AD >> 128;\n if (x & 0x40000000 > 0)\n result = result * 0x1000000002C5C85FDF84BD62AE30A74CC >> 128;\n if (x & 0x20000000 > 0)\n result = result * 0x100000000162E42FEFB2FED257559BDAA >> 128;\n if (x & 0x10000000 > 0)\n result = result * 0x1000000000B17217F7D5A7716BBA4A9AE >> 128;\n if (x & 0x8000000 > 0)\n result = result * 0x100000000058B90BFBE9DDBAC5E109CCE >> 128;\n if (x & 0x4000000 > 0)\n result = result * 0x10000000002C5C85FDF4B15DE6F17EB0D >> 128;\n if (x & 0x2000000 > 0)\n result = result * 0x1000000000162E42FEFA494F1478FDE05 >> 128;\n if (x & 0x1000000 > 0)\n result = result * 0x10000000000B17217F7D20CF927C8E94C >> 128;\n if (x & 0x800000 > 0)\n result = result * 0x1000000000058B90BFBE8F71CB4E4B33D >> 128;\n if (x & 0x400000 > 0)\n result = result * 0x100000000002C5C85FDF477B662B26945 >> 128;\n if (x & 0x200000 > 0)\n result = result * 0x10000000000162E42FEFA3AE53369388C >> 128;\n if (x & 0x100000 > 0)\n result = result * 0x100000000000B17217F7D1D351A389D40 >> 128;\n if (x & 0x80000 > 0)\n result = result * 0x10000000000058B90BFBE8E8B2D3D4EDE >> 128;\n if (x & 0x40000 > 0)\n result = result * 0x1000000000002C5C85FDF4741BEA6E77E >> 128;\n if (x & 0x20000 > 0)\n result = result * 0x100000000000162E42FEFA39FE95583C2 >> 128;\n if (x & 0x10000 > 0)\n result = result * 0x1000000000000B17217F7D1CFB72B45E1 >> 128;\n if (x & 0x8000 > 0)\n result = result * 0x100000000000058B90BFBE8E7CC35C3F0 >> 128;\n if (x & 0x4000 > 0)\n result = result * 0x10000000000002C5C85FDF473E242EA38 >> 128;\n if (x & 0x2000 > 0)\n result = result * 0x1000000000000162E42FEFA39F02B772C >> 128;\n if (x & 0x1000 > 0)\n result = result * 0x10000000000000B17217F7D1CF7D83C1A >> 128;\n if (x & 0x800 > 0)\n result = result * 0x1000000000000058B90BFBE8E7BDCBE2E >> 128;\n if (x & 0x400 > 0)\n result = result * 0x100000000000002C5C85FDF473DEA871F >> 128;\n if (x & 0x200 > 0)\n result = result * 0x10000000000000162E42FEFA39EF44D91 >> 128;\n if (x & 0x100 > 0)\n result = result * 0x100000000000000B17217F7D1CF79E949 >> 128;\n if (x & 0x80 > 0)\n result = result * 0x10000000000000058B90BFBE8E7BCE544 >> 128;\n if (x & 0x40 > 0)\n result = result * 0x1000000000000002C5C85FDF473DE6ECA >> 128;\n if (x & 0x20 > 0)\n result = result * 0x100000000000000162E42FEFA39EF366F >> 128;\n if (x & 0x10 > 0)\n result = result * 0x1000000000000000B17217F7D1CF79AFA >> 128;\n if (x & 0x8 > 0)\n result = result * 0x100000000000000058B90BFBE8E7BCD6D >> 128;\n if (x & 0x4 > 0)\n result = result * 0x10000000000000002C5C85FDF473DE6B2 >> 128;\n if (x & 0x2 > 0)\n result = result * 0x1000000000000000162E42FEFA39EF358 >> 128;\n if (x & 0x1 > 0)\n result = result * 0x10000000000000000B17217F7D1CF79AB >> 128;\n\n result >>= uint256 (int256 (63 - (x >> 64)));\n require (result <= uint256 (int256 (MAX_64x64)));\n\n return int128 (int256 (result));\n }\n }\n\n /**\n * Calculate natural exponent of x. Revert on overflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function exp (int128 x) internal pure returns (int128) {\n unchecked {\n require (x < 0x400000000000000000); // Overflow\n\n if (x < -0x400000000000000000) return 0; // Underflow\n\n return exp_2 (\n int128 (int256 (x) * 0x171547652B82FE1777D0FFDA0D23A7D12 >> 128));\n }\n }\n\n /**\n * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit\n * integer numbers. Revert on overflow or when y is zero.\n *\n * @param x unsigned 256-bit integer number\n * @param y unsigned 256-bit integer number\n * @return unsigned 64.64-bit fixed point number\n */\n function divuu (uint256 x, uint256 y) private pure returns (uint128) {\n unchecked {\n require (y != 0);\n\n uint256 result;\n\n if (x <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)\n result = (x << 64) / y;\n else {\n uint256 msb = 192;\n uint256 xc = x >> 192;\n if (xc >= 0x100000000) { xc >>= 32; msb += 32; }\n if (xc >= 0x10000) { xc >>= 16; msb += 16; }\n if (xc >= 0x100) { xc >>= 8; msb += 8; }\n if (xc >= 0x10) { xc >>= 4; msb += 4; }\n if (xc >= 0x4) { xc >>= 2; msb += 2; }\n if (xc >= 0x2) msb += 1; // No need to shift xc anymore\n\n result = (x << 255 - msb) / ((y - 1 >> msb - 191) + 1);\n require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\n\n uint256 hi = result * (y >> 128);\n uint256 lo = result * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\n\n uint256 xh = x >> 192;\n uint256 xl = x << 64;\n\n if (xl < lo) xh -= 1;\n xl -= lo; // We rely on overflow behavior here\n lo = hi << 128;\n if (xl < lo) xh -= 1;\n xl -= lo; // We rely on overflow behavior here\n\n result += xh == hi >> 128 ? xl / y : 1;\n }\n\n require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\n return uint128 (result);\n }\n }\n\n /**\n * Calculate sqrt (x) rounding down, where x is unsigned 256-bit integer\n * number.\n *\n * @param x unsigned 256-bit integer number\n * @return unsigned 128-bit integer number\n */\n function sqrtu (uint256 x) private pure returns (uint128) {\n unchecked {\n if (x == 0) return 0;\n else {\n uint256 xx = x;\n uint256 r = 1;\n if (xx >= 0x100000000000000000000000000000000) { xx >>= 128; r <<= 64; }\n if (xx >= 0x10000000000000000) { xx >>= 64; r <<= 32; }\n if (xx >= 0x100000000) { xx >>= 32; r <<= 16; }\n if (xx >= 0x10000) { xx >>= 16; r <<= 8; }\n if (xx >= 0x100) { xx >>= 8; r <<= 4; }\n if (xx >= 0x10) { xx >>= 4; r <<= 2; }\n if (xx >= 0x4) { r <<= 1; }\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1; // Seven iterations should be enough\n uint256 r1 = x / r;\n return uint128 (r < r1 ? r : r1);\n }\n }\n }\n}\n" + }, + "contracts/AuthorizedAccounts.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nimport \"./interfaces/IAuthorizedAccounts.sol\";\n\n/**\n * @notice Manages authorized accounts with limited permissions on behalf of main account\n * these authorized accounts are allowed to perform some certain actions in the Sylo network\n * in order to reduce the works for main account\n */\ncontract AuthorizedAccounts is\n IAuthorizedAccounts,\n Initializable,\n Ownable2StepUpgradeable,\n ERC165\n{\n /**\n * @notice Tracks authorized accounts for every main account\n */\n mapping(address => AuthorizedAccount[]) public authorizedAccounts;\n\n event PermissionsAdded(\n address indexed main,\n address indexed authorized,\n Permission[] permissions\n );\n\n event PermissionsRemoved(\n address indexed main,\n address indexed authorized,\n Permission[] permissions\n );\n\n error AuthorizedAccountCannotBeZeroAddress();\n error MainAccountCannotBeZeroAddress();\n error AtBlockNumberCannotBeZero();\n error AccountAlreadyAuthorized();\n error AccountDoesNotExist();\n\n function initialize() external initializer {\n Ownable2StepUpgradeable.__Ownable2Step_init();\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAuthorizedAccounts).interfaceId;\n }\n\n /**\n * @notice Adds new authorized accounts with certain permissions.\n * This will revert if the account has already existed.\n * @param authorized The address that the main account wants to authorize\n * @param permissions The list of permissions that the authorized account\n * can perform within the Sylo network.\n */\n function authorizeAccount(address authorized, Permission[] calldata permissions) external {\n if (authorized == address(0)) {\n revert AuthorizedAccountCannotBeZeroAddress();\n }\n\n // check if account has already been authorized\n AuthorizedAccount[] storage authAccounts = authorizedAccounts[msg.sender];\n for (uint i; i < authAccounts.length; ++i) {\n if (authAccounts[i].account == authorized) {\n if (authAccounts[i].authorizedAt != 0) {\n revert AccountAlreadyAuthorized();\n }\n\n authAccounts[i].authorizedAt = block.number;\n return _addPermissions(authorized, authAccounts[i], permissions);\n }\n }\n\n // add new authorized account to the list\n authAccounts.push();\n AuthorizedAccount storage newAccount = authAccounts[authAccounts.length - 1];\n newAccount.account = authorized;\n newAccount.authorizedAt = block.number;\n\n _addPermissions(authorized, newAccount, permissions);\n }\n\n /**\n * @notice Removes all permissions of a specific authorized account\n * associated with the msg.sender, and sets the account's authorizedAt to 0.\n * Note: It does not remove the authorized account from the list.\n * This will revert if the account does not exist.\n * @param authorized The address of the authorized account\n */\n function unauthorizeAccount(address authorized) external {\n if (authorized == address(0)) {\n revert AuthorizedAccountCannotBeZeroAddress();\n }\n\n AuthorizedAccount[] storage authAccounts = authorizedAccounts[msg.sender];\n for (uint i; i < authAccounts.length; ++i) {\n if (authAccounts[i].account == authorized) {\n delete authAccounts[i].authorizedAt;\n return _removePermissions(authorized, authAccounts[i], getAllPermissions());\n }\n }\n\n revert AccountDoesNotExist();\n }\n\n /**\n * @notice Adds new permissions to a specific authorized account.\n * - Adding permissions that don't exist in the Permission enum will return\n * with panic code 0x21 (convert a value that is too big or negative into an enum type).\n * - Adding duplicate permissions will update the permissions' authorizedAt value.\n * - Adding permissions that were previously unauthorized will update\n * the authorizedAt and unauthorizedAt values (refer to the comment in\n * IAuthorizedAccount -> AuthorizedPermission struct).\n * This will revert if the account does not exist.\n * @param authorized The authorized account address\n * @param permissions The new permissions will be added to the authorized account\n */\n function addPermissions(address authorized, Permission[] calldata permissions) external {\n if (authorized == address(0)) {\n revert AuthorizedAccountCannotBeZeroAddress();\n }\n\n AuthorizedAccount[] storage authAccounts = authorizedAccounts[msg.sender];\n for (uint i; i < authAccounts.length; ++i) {\n if (authAccounts[i].account == authorized) {\n return _addPermissions(authorized, authAccounts[i], permissions);\n }\n }\n\n revert AccountDoesNotExist();\n }\n\n function _addPermissions(\n address authorized,\n AuthorizedAccount storage authAccount,\n Permission[] memory permissions\n ) private {\n for (uint i; i < permissions.length; ++i) {\n bool exists;\n for (uint j; j < authAccount.permissions.length; ++j) {\n AuthorizedPermission storage authPermission = authAccount.permissions[j];\n if (permissions[i] == authPermission.permission) {\n exists = true;\n authPermission.authorizedAt = block.number;\n\n // make sure unauthorizedAt is not greater than authorizedAt\n // (refer to the comment in IAuthorizedAccount -> AuthorizedPermission struct)\n if (authPermission.unauthorizedAt > authPermission.authorizedAt) {\n authPermission.unauthorizedAt = authPermission.authorizedAt;\n }\n break;\n }\n }\n if (!exists) {\n authAccount.permissions.push(\n AuthorizedPermission({\n permission: permissions[i],\n authorizedAt: block.number,\n unauthorizedAt: 0\n })\n );\n }\n }\n\n emit PermissionsAdded(msg.sender, authorized, permissions);\n }\n\n /**\n * @notice Removes permissions of specific authorized account.\n * - Removing permissions that don't exist in the Permission enum will return\n * with panic code 0x21 (convert a value that is too big or negative into an enum type).\n * - Removing duplicate/authorized permissions will update the permissions'\n * unauthorizedAt value.\n * This will revert if the account does not exist.\n * @param authorized The address of authorized account\n * @param permissions The list of permissions will be removed\n */\n function removePermissions(address authorized, Permission[] calldata permissions) external {\n if (authorized == address(0)) {\n revert AuthorizedAccountCannotBeZeroAddress();\n }\n\n AuthorizedAccount[] storage authAccounts = authorizedAccounts[msg.sender];\n for (uint i; i < authAccounts.length; ++i) {\n if (authAccounts[i].account == authorized) {\n return _removePermissions(authorized, authAccounts[i], permissions);\n }\n }\n\n revert AccountDoesNotExist();\n }\n\n function _removePermissions(\n address authorized,\n AuthorizedAccount storage authAccount,\n Permission[] memory permissions\n ) private {\n for (uint i; i < permissions.length; ++i) {\n for (uint j; j < authAccount.permissions.length; ++j) {\n if (permissions[i] == authAccount.permissions[j].permission) {\n // only update unauthorizedAt if the permission is authorized\n if (\n authAccount.permissions[j].authorizedAt >=\n authAccount.permissions[j].unauthorizedAt\n ) {\n authAccount.permissions[j].unauthorizedAt = block.number + 1;\n }\n break;\n }\n }\n }\n\n emit PermissionsRemoved(msg.sender, authorized, permissions);\n }\n\n /**\n * @notice Validates permission of an authorized account associated with the main account.\n *\n * @param main The address of main account\n * @param authorized The address of authorized account\n * @param permission The permission needs to be verified with the authorized account\n * @param atBlock The block number to check if the permission is valid between\n * the permission's authorizedAt and unauthorizedAt period. It is added later to prevent\n * the timing attack. E.g. If the main account authorizes the PersonalSign permission at\n * block 1, creates a ticket at block 2, then unauthorizes the permission at block 3, the\n * ticket will be invalid and cannot be redeemed. To avoid this, the `atBlock` param is\n * needed to check if the permission is authorized between its authorizedAt and unauthorizedAt\n * duration.\n *\n * @return boolean value\n */\n function validatePermission(\n address main,\n address authorized,\n Permission permission,\n uint256 atBlock\n ) external view returns (bool) {\n if (main == address(0)) {\n revert MainAccountCannotBeZeroAddress();\n }\n\n if (authorized == address(0)) {\n revert AuthorizedAccountCannotBeZeroAddress();\n }\n\n if (atBlock == 0) {\n revert AtBlockNumberCannotBeZero();\n }\n\n AuthorizedAccount[] storage authAccounts = authorizedAccounts[main];\n\n for (uint i = 0; i < authAccounts.length; ++i) {\n if (authAccounts[i].account == authorized) {\n for (uint j = 0; j < authAccounts[i].permissions.length; ++j) {\n if (authAccounts[i].permissions[j].permission == permission) {\n uint256 authorizedAt = authAccounts[i].permissions[j].authorizedAt;\n uint256 unauthorizedAt = authAccounts[i].permissions[j].unauthorizedAt;\n\n bool isPermissionUnauthorized = authorizedAt > 0 &&\n authorizedAt < unauthorizedAt;\n if (isPermissionUnauthorized) {\n // the permission was previously valid, so we check that\n // the `atBlock` is referencing a time when the permission was valid\n return authorizedAt <= atBlock && atBlock < unauthorizedAt;\n }\n\n // otherwise just check if the permission was authorized before the\n // atBlock\n return authorizedAt > 0 && authorizedAt <= atBlock;\n }\n }\n }\n }\n\n return false;\n }\n\n /**\n * @notice Get all authorized accounts associated with a given account\n * @param main The address of main account\n * @return An array of authorized accounts\n */\n function getAuthorizedAccounts(\n address main\n ) external view returns (AuthorizedAccount[] memory) {\n if (main == address(0)) {\n revert MainAccountCannotBeZeroAddress();\n }\n\n return authorizedAccounts[main];\n }\n\n function getAllPermissions() internal pure returns (Permission[] memory) {\n Permission[] memory permissions = new Permission[](1);\n permissions[0] = Permission.PersonalSign;\n return permissions;\n }\n}\n" + }, + "contracts/epochs/EpochsManager.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\n\nimport \"../Registries.sol\";\nimport \"../staking/Directory.sol\";\nimport \"../interfaces/epochs/IEpochsManager.sol\";\nimport \"../payments/ticketing/TicketingParameters.sol\";\n\ncontract EpochsManager is IEpochsManager, Initializable, Ownable2StepUpgradeable, ERC165 {\n Directory public _directory;\n\n Registries public _registries;\n\n IERC721 public _rootSeekers;\n\n TicketingParameters public _ticketingParameters;\n\n /**\n * @notice Track seekers that have joined for a specific epoch.\n */\n mapping(uint256 => mapping(uint256 => address)) public activeSeekers;\n\n // Define all Epoch specific parameters here.\n // When initializing an epoch, these parameters are read,\n // along with parameters from the other contracts to create the\n // new epoch.\n\n /**\n * @notice A mapping of all epochs that have been initialized.\n */\n mapping(uint256 => Epoch) public epochs;\n\n /**\n * @notice The block number since the first epoch can be initialized.\n */\n uint256 public initialEpoch;\n\n /**\n * @notice The duration in blocks an epoch will last for.\n */\n uint256 public epochDuration;\n\n /**\n * @notice The value of the integer used as the current\n * epoch's identifier. This value is incremented as each epoch\n * is initialized.\n */\n uint256 public currentIteration;\n\n event NewEpoch(uint256 indexed epochId);\n event EpochJoined(uint256 indexed epochId, address indexed node, uint256 indexed seekerId);\n event InitialEpochUpdated(uint256 initialEpoch);\n event EpochDurationUpdated(uint256 epochDuration);\n\n error SeekerOwnerMismatch();\n error InitialEpochCannotBeZero();\n error EpochDurationCannotBeZero();\n error DirectoryCannotBeZeroAddress();\n error RegistriesCannotBeZeroAddress();\n error RootSeekerCannotBeZeroAddress();\n error EpochHasNotEnded(uint256 epochId);\n error SeekerAccountCannotBeZeroAddress();\n error TicketingParametersCannotBeZeroAddress();\n error SeekerAlreadyJoinedEpoch(uint256 epochId, uint256 seekerId);\n error InitialEpochNotYetReady(uint256 expectedBlock, uint256 currentBlock);\n\n function initialize(\n IERC721 rootSeekers,\n Directory directory,\n Registries registries,\n TicketingParameters ticketingParameters,\n uint256 _initialEpoch,\n uint256 _epochDuration\n ) external initializer {\n if (address(rootSeekers) == address(0)) {\n revert RootSeekerCannotBeZeroAddress();\n }\n\n SyloUtils.validateContractInterface(\n \"Directory\",\n address(directory),\n type(IDirectory).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"Registries\",\n address(registries),\n type(IRegistries).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"TicketingParameters\",\n address(ticketingParameters),\n type(ITicketingParameters).interfaceId\n );\n\n Ownable2StepUpgradeable.__Ownable2Step_init();\n\n _rootSeekers = rootSeekers;\n _directory = directory;\n _registries = registries;\n _ticketingParameters = ticketingParameters;\n\n initialEpoch = _initialEpoch;\n epochDuration = _epochDuration;\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IEpochsManager).interfaceId;\n }\n\n /**\n * @notice Call this to initialize the next epoch. On success, a `NewEpoch` event\n * will be emitted.\n * @dev The function will read the current set of network parameters, and store\n * the parameters in a new Epoch struct. The end block of the current epoch\n * will also be set to a non-zero value.\n */\n function initializeEpoch() external returns (uint256) {\n if (currentIteration == 0 && initialEpoch > block.number) {\n revert InitialEpochNotYetReady(initialEpoch, block.number);\n }\n\n Epoch storage current = epochs[currentIteration];\n\n uint256 end = current.startBlock + current.duration;\n if (end > block.number) {\n revert EpochHasNotEnded(currentIteration);\n }\n\n (\n uint256 faceValue,\n uint128 baseLiveWinProb,\n uint128 expiredWinProb,\n uint256 ticketDuration,\n uint16 decayRate\n ) = _ticketingParameters.getTicketingParameters();\n\n uint256 nextEpochId = getNextEpochId();\n\n epochs[nextEpochId] = Epoch(\n block.number,\n epochDuration,\n 0,\n _registries.defaultPayoutPercentage(),\n decayRate,\n faceValue,\n baseLiveWinProb,\n expiredWinProb,\n ticketDuration\n );\n\n current.endBlock = block.number;\n\n currentIteration = nextEpochId;\n\n _directory.setCurrentDirectory(nextEpochId);\n\n emit NewEpoch(nextEpochId);\n\n return nextEpochId;\n }\n\n /**\n * @notice Set the first epoch starting block. Only callable by the owner.\n * @param _initialEpoch The block number when the first epoch can be initialized.\n */\n function setInitialEpoch(uint256 _initialEpoch) external onlyOwner {\n if (_initialEpoch == 0) {\n revert InitialEpochCannotBeZero();\n }\n initialEpoch = _initialEpoch;\n emit InitialEpochUpdated(_initialEpoch);\n }\n\n /**\n * @notice Set the epoch duration. Will take effect in the next epoch. Only\n * callable by the owner.\n * @param _epochDuration The epoch duration in number of blocks.\n */\n function setEpochDuration(uint256 _epochDuration) external onlyOwner {\n if (_epochDuration == 0) {\n revert EpochDurationCannotBeZero();\n }\n epochDuration = _epochDuration;\n emit EpochDurationUpdated(epochDuration);\n }\n\n /**\n * @notice Retrieve the parameters for the current epoch.\n * @return The current Epoch parameters.\n */\n function getCurrentActiveEpoch() external view returns (uint256, Epoch memory) {\n return (currentIteration, epochs[currentIteration]);\n }\n\n /**\n * @notice Nodes should call this to join the next epoch. It will\n * initialize the next reward pool and set the stake for the next directory.\n * @dev This is a proxy function for `initalizeNextRewardPool` and\n * `joinNextDirectory`.\n */\n function joinNextEpoch() external {\n Registries.Registry memory registry = _registries.getRegistry(msg.sender);\n\n // validate the node's seeker ownership\n if (registry.seekerAccount == address(0)) {\n revert SeekerAccountCannotBeZeroAddress();\n }\n\n uint256 seekerId = registry.seekerId;\n\n address owner = _rootSeekers.ownerOf(seekerId);\n if (registry.seekerAccount != owner) {\n revert SeekerOwnerMismatch();\n }\n\n uint256 nextEpoch = getNextEpochId();\n if (activeSeekers[nextEpoch][seekerId] != address(0)) {\n revert SeekerAlreadyJoinedEpoch(nextEpoch, seekerId);\n }\n\n activeSeekers[nextEpoch][seekerId] = msg.sender;\n\n _directory._rewardsManager().initializeNextRewardPool(msg.sender);\n _directory.joinNextDirectory(msg.sender, seekerId);\n\n emit EpochJoined(nextEpoch, msg.sender, seekerId);\n }\n\n /**\n * @notice Retrieve the epoch parameter for the given id.\n * @param epochId The id of the epoch to retrieve.\n * @return The epoch parameters associated with the id.\n */\n function getEpoch(uint256 epochId) external view returns (Epoch memory) {\n return epochs[epochId];\n }\n\n /**\n * @notice Retrieve the integer value that will be used for the\n * next epoch id.\n * @return The next epoch id identifier.\n */\n function getNextEpochId() public view returns (uint256) {\n return currentIteration + 1;\n }\n}\n" + }, + "contracts/interfaces/epochs/IEpochsManager.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface IEpochsManager {\n /**\n * @dev This struct will hold all network parameters that will be static\n * for the entire epoch. This value will be stored in a mapping, where the\n * key is the current epoch id.\n */\n struct Epoch {\n // time related variables\n uint256 startBlock; // Block the epoch was initialized\n uint256 duration; // Minimum time epoch will be alive measured in number of blocks\n uint256 endBlock; // Block the epoch ended (and when the next epoch was initialized)\n // Zero here represents the epoch has not yet ended.\n\n // registry variables\n uint16 defaultPayoutPercentage;\n // ticketing variables\n uint16 decayRate;\n uint256 faceValue;\n uint128 baseLiveWinProb;\n uint128 expiredWinProb;\n uint256 ticketDuration;\n }\n\n function initializeEpoch() external returns (uint256);\n\n function setEpochDuration(uint256 _epochDuration) external;\n\n function getCurrentActiveEpoch() external view returns (uint256, Epoch memory);\n\n function joinNextEpoch() external;\n\n function getEpoch(uint256 epochId) external view returns (Epoch memory);\n\n function getNextEpochId() external view returns (uint256);\n}\n" + }, + "contracts/interfaces/IAuthorizedAccounts.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface IAuthorizedAccounts {\n enum Permission {\n // PersonalSign permission allows the authorized account to\n // sign on behalf of the sending account.\n PersonalSign\n }\n\n /**\n * @dev This type will hold the permission type and the block number from\n * which the permission was set to be authorized and unauthorized.\n * The permission is authorized when authorizedAt >= unauthorizedAt.\n *\n * Note: authorizedAt and unauthorizedAt won't be set to 0 when the permission\n * is updated, because they are both needed when validating the permission.\n */\n struct AuthorizedPermission {\n // Permission type\n Permission permission;\n // Block number from which the permission was set to be authorized.\n // If the transaction is called in block 1, the permission is\n // authorized from block 1 (authorizedAt = block.number).\n uint256 authorizedAt;\n // Block number from which the permission was set to be unauthorized.\n // If the transaction is called in block 1, the permission is\n // unauthorized from block 2 (unauthorizedAt = block.number + 1)\n // unauthorizedAt is set that way to avoid the case where the\n // permission is authorized and unauthorized in the same block:\n // E.g. addPermission is called => authorizedAt = 1\n // removePermission is called => unauthorizedAt = 1\n // => We cannot tell if the permission is authorized or not.\n // E.g. addPermission is called => authorizedAt = 1\n // removePermission is called => unauthorizedAt = 2\n // addPermission is called => authorizedAt = 1 AND update unauthorizedAt = authorizedAt = 1\n // => The permission is authorized when authorizedAt >= unauthorizedAt\n uint256 unauthorizedAt;\n }\n\n struct AuthorizedAccount {\n // The authorized account\n address account;\n // Block number at which the account was authorized.\n // If the transaction is called in block 1, the account is\n // authorized at block 1 (authorizedAt = block.number).\n // If the account is unauthorized, authorizedAt will be set to 0.\n uint256 authorizedAt;\n // Permission list\n AuthorizedPermission[] permissions;\n }\n\n function authorizeAccount(address authorized, Permission[] calldata permissions) external;\n\n function unauthorizeAccount(address authorized) external;\n\n function addPermissions(address authorized, Permission[] calldata permissions) external;\n\n function removePermissions(\n address authorized,\n Permission[] calldata permissionsToRemove\n ) external;\n\n function validatePermission(\n address main,\n address authorized,\n Permission permission,\n uint256 atBlock\n ) external returns (bool);\n\n function getAuthorizedAccounts(\n address main\n ) external view returns (AuthorizedAccount[] memory);\n}\n" + }, + "contracts/interfaces/IFuturePassRegistrar.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface IFuturePassRegistrar {\n function futurepassOf(address owner) external view returns (address);\n\n function create(address owner) external returns (address);\n}\n" + }, + "contracts/interfaces/IRegistries.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface IRegistries {\n struct Registry {\n // Percentage of a tickets value that will be rewarded to\n // delegated stakers expressed as a fraction of 10000.\n // This value is currently locked to the default payout percentage\n // until epochs are implemented.\n uint16 payoutPercentage;\n // Public http/s endpoint to retrieve additional metadata\n // about the node.\n // The current metadata schema is as follows:\n // { name: string, multiaddrs: string[] }\n string publicEndpoint;\n // The account which owns a seeker that will be used to\n // operate the Node for this registry.\n address seekerAccount;\n // The id of the seeker used to operate the node. The owner\n // of this id should be the seeker account.\n uint256 seekerId;\n }\n\n function register(string calldata publicEndpoint) external;\n\n function setDefaultPayoutPercentage(uint16 _defaultPayoutPercentage) external;\n\n function setSeekerAccount(\n address seekerAccount,\n uint256 seekerId,\n bytes32 nonce,\n bytes calldata signature\n ) external;\n\n function revokeSeekerAccount(address node) external;\n\n function getRegistry(address account) external view returns (Registry memory);\n\n function getNodes() external view returns (address[] memory);\n\n function getRegistries(\n uint256 start,\n uint256 end\n ) external view returns (address[] memory, Registry[] memory);\n\n function getTotalNodes() external view returns (uint256);\n}\n" + }, + "contracts/interfaces/ISeekerPowerOracle.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface ISeekerPowerOracle {\n function setOracle(address oracle) external;\n\n function registerSeekerPowerRestricted(uint256 seekerId, uint256 power) external;\n\n function registerSeekerPower(\n uint256 seekerId,\n uint256 power,\n bytes32 nonce,\n bytes calldata proof\n ) external;\n\n function getSeekerPower(uint256 seekerId) external view returns (uint256);\n\n function getProofMessage(\n uint256 seekerId,\n uint256 power,\n bytes32 nonce\n ) external pure returns (bytes memory);\n}\n" + }, + "contracts/interfaces/payments/ISyloTicketing.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface ISyloTicketing {\n struct Deposit {\n uint256 escrow; // Balance of users escrow\n uint256 penalty; // Balance of users penalty\n uint256 unlockAt; // Block number a user can withdraw their balances\n }\n\n struct User {\n address main; // Main address of the ticket sender or receiver\n address delegated; // Delegated address used to sign and redeem tickets\n }\n\n struct Ticket {\n uint256 epochId; // The epoch this ticket is associated with\n User sender; // Ticket sender's main and delegated addresses\n User receiver; // Ticket receiver's main and delegated addresses\n address redeemer; // Address of the intended recipient\n uint256 generationBlock; // Block number the ticket was generated\n bytes32 redeemerCommit; // Hash of the secret random number of the redeemer\n }\n\n // A type of ticket that does not explicit state the receiver address.\n struct MultiReceiverTicket {\n uint256 epochId; // The epoch this ticket is associated with\n User sender; // Ticket sender's main and delegated addresses\n address redeemer; // Address of the intended recipient\n uint256 generationBlock; // Block number the ticket was generated\n bytes32 redeemerCommit; // Hash of the secret random number of the redeemer\n }\n\n function setUnlockDuration(uint256 _unlockDuration) external;\n\n function depositEscrow(uint256 amount, address account) external;\n\n function depositPenalty(uint256 amount, address account) external;\n\n function unlockDeposits() external returns (uint256);\n\n function lockDeposits() external;\n\n function withdraw() external;\n\n function redeem(\n Ticket calldata ticket,\n uint256 redeemerRand,\n bytes calldata senderSig,\n bytes calldata receiverSig\n ) external;\n\n function redeemMultiReceiver(\n MultiReceiverTicket calldata ticket,\n uint256 redeemerRand,\n User calldata receiver,\n bytes calldata senderSig,\n bytes calldata receiverSig\n ) external;\n}\n" + }, + "contracts/interfaces/payments/ticketing/IRewardsManager.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface IRewardsManager {\n /**\n * @dev This type will hold the necessary information for delegated stakers\n * to make reward claims against their Node. Every Node will initialize\n * and store a new Reward Pool for each epoch they participate in.\n */\n struct RewardPool {\n // Tracks the balance of the reward pool owed to the stakers\n uint256 stakersRewardTotal;\n // Tracks the block number this reward pool was initialized\n uint256 initializedAt;\n // The total active stake for the node for will be the sum of the\n // stakes owned by its delegators and the node's own stake.\n uint256 totalActiveStake;\n // track the cumulative reward factor as of the time the first ticket\n // for this pool was redeemed\n int128 initialCumulativeRewardFactor;\n }\n\n struct LastClaim {\n // The epoch the claim was made.\n uint256 claimedAt;\n // The stake at the time the claim was made. This is tracked as\n // rewards can only be claimed after an epoch has ended, but the\n // user's stake may have changed by then. This field tracks the\n // staking value before the change so the reward for that epoch\n // can be manually calculated.\n uint256 stake;\n }\n\n function getRewardPool(\n uint256 epochId,\n address stakee\n ) external view returns (RewardPool memory);\n\n function getRewardPoolKey(uint256 epochId, address stakee) external pure returns (bytes32);\n\n function getRewardPoolStakersTotal(\n uint256 epochId,\n address stakee\n ) external view returns (uint256);\n\n function getRewardPoolActiveStake(\n uint256 epochId,\n address stakee\n ) external view returns (uint256);\n\n function getPendingRewards(address stakee) external view returns (uint256);\n\n function getLastClaim(address stakee, address staker) external view returns (LastClaim memory);\n\n function getTotalEpochRewards(uint256 epochId) external view returns (uint256);\n\n function getTotalEpochStakingRewards(uint256 epochId) external view returns (uint256);\n\n function initializeNextRewardPool(address stakee) external;\n\n function incrementRewardPool(address stakee, uint256 amount) external;\n\n function claimStakingRewards(address stakee) external returns (uint256);\n\n function updatePendingRewards(address stakee, address staker) external;\n}\n" + }, + "contracts/interfaces/payments/ticketing/ITicketingParameters.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface ITicketingParameters {\n function setFaceValue(uint256 _faceValue) external;\n\n function setBaseLiveWinProb(uint128 _baseLiveWinProb) external;\n\n function setExpiredWinProb(uint128 _expiredWinProb) external;\n\n function setDecayRate(uint16 _decayRate) external;\n\n function setTicketDuration(uint256 _ticketDuration) external;\n\n function getTicketingParameters()\n external\n view\n returns (uint256, uint128, uint128, uint256, uint16);\n}\n" + }, + "contracts/interfaces/staking/IDirectory.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface IDirectory {\n /**\n * @dev A DirectoryEntry will be stored for every node that joins the\n * network in a specific epoch. The entry will contain the stakee's\n * address, and a boundary value which is a sum of the current directory's\n * total stake, and the current stakee's total stake.\n */\n struct DirectoryEntry {\n address stakee;\n uint256 boundary;\n }\n\n /**\n * @dev An EpochDirectory will be stored for every epoch. The\n * directory will be constructed piece by piece as Nodes join,\n * each adding their own directory entry based on their current\n * stake value.\n */\n struct EpochDirectory {\n DirectoryEntry[] entries;\n mapping(address => uint256) stakes;\n uint256 totalStake;\n }\n\n function setCurrentDirectory(uint256 epochId) external;\n\n function joinNextDirectory(address stakee, uint256 seekerId) external;\n\n function scan(uint128 point) external view returns (address stakee);\n\n function scanWithEpochId(\n uint128 point,\n uint256 epochId\n ) external view returns (address stakee);\n\n function getTotalStakeForStakee(\n uint256 epochId,\n address stakee\n ) external view returns (uint256);\n\n function getTotalStake(uint256 epochId) external view returns (uint256);\n\n function getEntries(\n uint256 epochId\n ) external view returns (address[] memory, uint256[] memory);\n}\n" + }, + "contracts/interfaces/staking/IStakingManager.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface IStakingManager {\n /**\n * For every Node, there will be a mapping of the staker to a\n * StakeEntry. The stake entry tracks the amount of stake in SOLO,\n * and also when the stake was updated.\n */\n struct StakeEntry {\n uint256 amount;\n // Block number this entry was updated at\n uint256 updatedAt;\n // Epoch this entry was updated. The stake will become active\n // in the following epoch\n uint256 epochId;\n }\n\n /**\n * Every Node must have stake in order to participate in the Epoch.\n * Stake can be provided by the Node itself or by other accounts in\n * the network.\n */\n struct Stake {\n // Track each stake entry associated to a node\n mapping(address => StakeEntry) stakeEntries;\n // The total stake held by this contract for a node,\n // which will be the sum of all addStake and unlockStake calls\n uint256 totalManagedStake;\n }\n\n /**\n * This struct will track stake that is in the process of unlocking.\n */\n struct Unlock {\n uint256 amount; // Amount of stake unlocking\n uint256 unlockAt; // Block number the stake becomes withdrawable\n }\n\n function setUnlockDuration(uint256 _unlockDuration) external;\n\n function setMinimumStakeProportion(uint16 _minimumStakeProportion) external;\n\n function addStake(uint256 amount, address stakee) external;\n\n function unlockStake(uint256 amount, address stakee) external returns (uint256);\n\n function withdrawStake(address stakee) external;\n\n function cancelUnlocking(uint256 amount, address stakee) external;\n\n function calculateCapacityFromSeekerPower(uint256 seekerId) external view returns (uint256);\n\n function calculateMaxAdditionalDelegatedStake(address stakee) external view returns (uint256);\n\n function getTotalManagedStake() external view returns (uint256);\n\n function getStakeEntry(\n address stakee,\n address staker\n ) external view returns (StakeEntry memory);\n\n function getStakeeTotalManagedStake(address stakee) external view returns (uint256);\n}\n" + }, + "contracts/libraries/Manageable.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an list of public managers who may be added or removed.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyManager`, which can be applied to your functions to restrict their use to\n * other contracts which have explicitly been added.\n */\nabstract contract Manageable is Ownable2StepUpgradeable {\n /**\n * @dev Tracks the managers added to this contract, where they key is the\n * address of the managing contract, and the value is the block the manager was added in.\n * We use this mapping to restrict access to those functions in a similar\n * fashion to the onlyOwner construct.\n */\n mapping(address => uint256) public managers;\n\n error OnlyManagers();\n error ManagerCannotBeZeroAddress();\n\n /**\n * @notice Adds a manager to this contract. Only callable by the owner.\n * @param manager The address of the manager contract.\n */\n function addManager(address manager) external onlyOwner {\n if (manager == address(0)) {\n revert ManagerCannotBeZeroAddress();\n }\n managers[manager] = block.number;\n }\n\n /**\n * @notice Removes a manager from this contract. Only callable by the owner.\n * @param manager The address of the manager contract.\n */\n function removeManager(address manager) external onlyOwner {\n delete managers[manager];\n }\n\n /**\n * @dev This modifier allows us to specify that certain contracts have\n * special privileges to call restricted functions.\n */\n modifier onlyManager() {\n if (managers[msg.sender] == 0) {\n revert OnlyManagers();\n }\n _;\n }\n\n // Reserve storage slots for future variables\n uint256[49] private __gap;\n}\n" + }, + "contracts/libraries/SyloUtils.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nerror ContractNameCannotBeEmpty();\nerror InterfaceIdCannotBeZeroBytes();\nerror TargetContractCannotBeZeroAddress(string name);\nerror TargetNotSupportInterface(string name, bytes4 interfaceId);\n\nlibrary SyloUtils {\n /**\n * @dev Percentages are expressed as a ratio where 10000 is the denominator.\n * A large denominator allows for more precision, e.g representing 12.5%\n * can be done as 1250 / 10000\n */\n uint16 public constant PERCENTAGE_DENOMINATOR = 10000;\n\n /**\n * @dev Multiply a value by a given percentage. Converts the provided\n * uint128 value to uint256 to avoid any reverts on overflow.\n * @param value The value to multiply.\n * @param percentage The percentage, as a ratio of 10000.\n */\n function percOf(uint128 value, uint16 percentage) internal pure returns (uint256) {\n return (uint256(value) * percentage) / PERCENTAGE_DENOMINATOR;\n }\n\n /**\n * @dev Return a fraction as a percentage.\n * @param numerator The numerator limited to a uint128 value to prevent\n * phantom overflow.\n * @param denominator The denominator.\n * @return The percentage, as a ratio of 10000.\n */\n function asPerc(uint128 numerator, uint256 denominator) internal pure returns (uint16) {\n return SafeCast.toUint16((uint256(numerator) * PERCENTAGE_DENOMINATOR) / denominator);\n }\n\n /**\n * @dev Validate that a contract implements a given interface.\n * @param name The name of the contract, used in error messages.\n * @param target The address of the contract.\n * @param interfaceId The interface ID to check.\n */\n function validateContractInterface(\n string memory name,\n address target,\n bytes4 interfaceId\n ) internal view {\n if (bytes(name).length == 0) {\n revert ContractNameCannotBeEmpty();\n }\n if (target == address(0)) {\n revert TargetContractCannotBeZeroAddress(name);\n }\n if (interfaceId == bytes4(0)) {\n revert InterfaceIdCannotBeZeroBytes();\n }\n if (!ERC165(target).supportsInterface(interfaceId)) {\n revert TargetNotSupportInterface(name, interfaceId);\n }\n }\n}\n" + }, + "contracts/payments/SyloTicketing.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\n\nimport \"../Registries.sol\";\nimport \"../staking/Directory.sol\";\nimport \"../libraries/SyloUtils.sol\";\nimport \"../epochs/EpochsManager.sol\";\nimport \"../staking/StakingManager.sol\";\nimport \"./ticketing/RewardsManager.sol\";\nimport \"../AuthorizedAccounts.sol\";\nimport \"../interfaces/payments/ISyloTicketing.sol\";\nimport \"../interfaces/IFuturePassRegistrar.sol\";\n\n/**\n * @notice The SyloTicketing contract manages the Probabilistic\n * Micro-Payment Ticketing system that pays Nodes for providing the\n * Event Relay service.\n */\ncontract SyloTicketing is ISyloTicketing, Initializable, Ownable2StepUpgradeable, ERC165 {\n /** ERC20 Sylo token contract.*/\n IERC20 public _token;\n\n /** Sylo Registries contract */\n Registries public _registries;\n\n /** Sylo Staking Manager contract */\n StakingManager public _stakingManager;\n\n /** Sylo Directory contract */\n Directory public _directory;\n\n /** Rewards Manager contract */\n RewardsManager public _rewardsManager;\n\n /**\n * @notice Sylo Epochs Manager.\n * @dev The ticketing parameters used when redeeming tickets\n * will be read from this contract.\n */\n EpochsManager public _epochsManager;\n\n /**\n * @notice Sylo Authorized Accounts.\n */\n AuthorizedAccounts public _authorizedAccounts;\n\n /**\n * @notice Futurepass Registrar Pre-compile.\n */\n IFuturePassRegistrar public _futurepassRegistrar;\n\n /**\n * @notice The number of blocks a user must wait after calling \"unlock\"\n * before they can withdraw their funds.\n */\n uint256 public unlockDuration;\n\n /** @notice Mapping of user deposits */\n mapping(address => Deposit) public deposits;\n\n /** @notice Mapping of ticket hashes, used to check if a ticket has been redeemed */\n mapping(bytes32 => bool) public usedTickets;\n\n event UnlockDurationUpdated(uint256 unlockDuration);\n event SenderPenaltyBurnt(address sender);\n event Redemption(\n uint256 indexed epochId,\n address indexed redeemer,\n address indexed sender,\n address receiver,\n uint256 generationBlock,\n uint256 amount\n );\n event MultiReceiverRedemption(\n uint256 indexed epochId,\n address indexed redeemer,\n address indexed sender,\n address receiver,\n uint256 generationBlock,\n uint256 amount\n );\n\n error NoEsrowAndPenalty();\n error UnlockingInProcess();\n error UnlockingNotInProcess();\n error UnlockingNotCompleted();\n error EscrowAmountCannotBeZero();\n error PenaltyAmountCannotBeZero();\n error UnlockDurationCannotBeZero();\n error AccountCannotBeZeroAddress();\n error InvalidSenderSigningPermission();\n error InvalidReceiverSigningPermission();\n\n error TicketNotWinning();\n error MissingFuturepassAccount(address receiver);\n error TicketAlreadyUsed();\n error TicketEpochNotFound();\n error TicketAlreadyRedeemed();\n error RedeemerCommitMismatch();\n error InvalidSenderSignature();\n error InvalidReceiverSignature();\n error TokenCannotBeZeroAddress();\n error TicketNotCreatedInTheEpoch();\n error TicketCannotBeFromFutureBlock();\n error TicketSenderCannotBeZeroAddress();\n error TicketReceiverCannotBeZeroAddress();\n error TicketRedeemerCannotBeZeroAddress();\n error RedeemerMustHaveJoinedEpoch(uint256 epochId);\n\n function initialize(\n IERC20 token,\n Registries registries,\n StakingManager stakingManager,\n Directory directory,\n EpochsManager epochsManager,\n RewardsManager rewardsManager,\n AuthorizedAccounts authorizedAccounts,\n IFuturePassRegistrar futurepassRegistrar,\n uint256 _unlockDuration\n ) external initializer {\n if (address(token) == address(0)) {\n revert TokenCannotBeZeroAddress();\n }\n\n SyloUtils.validateContractInterface(\n \"Registries\",\n address(registries),\n type(IRegistries).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"StakingManager\",\n address(stakingManager),\n type(IStakingManager).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"Directory\",\n address(directory),\n type(IDirectory).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"EpochsManager\",\n address(epochsManager),\n type(IEpochsManager).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"RewardsManager\",\n address(rewardsManager),\n type(IRewardsManager).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"AuthorizedAccounts\",\n address(authorizedAccounts),\n type(IAuthorizedAccounts).interfaceId\n );\n\n if (_unlockDuration == 0) {\n revert UnlockDurationCannotBeZero();\n }\n\n Ownable2StepUpgradeable.__Ownable2Step_init();\n\n _token = token;\n _registries = registries;\n _stakingManager = stakingManager;\n _directory = directory;\n _epochsManager = epochsManager;\n _rewardsManager = rewardsManager;\n _authorizedAccounts = authorizedAccounts;\n _futurepassRegistrar = futurepassRegistrar;\n\n unlockDuration = _unlockDuration;\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(ISyloTicketing).interfaceId;\n }\n\n /**\n * @notice Set the unlock duration for deposits. Only callable\n * by the owner.\n * @param _unlockDuration The unlock duration in blocks.\n */\n function setUnlockDuration(uint256 _unlockDuration) external onlyOwner {\n if (_unlockDuration == 0) {\n revert UnlockDurationCannotBeZero();\n }\n\n unlockDuration = _unlockDuration;\n emit UnlockDurationUpdated(_unlockDuration);\n }\n\n /**\n * @notice Use this function to deposit funds into the\n * escrow. This will fail if the deposit is currently being\n * unlocked.\n * @param amount The amount in SOLO to add to the escrow.\n * @param account The address of the account holding the escrow.\n */\n function depositEscrow(uint256 amount, address account) external {\n if (amount == 0) {\n revert EscrowAmountCannotBeZero();\n }\n if (account == address(0)) {\n revert AccountCannotBeZeroAddress();\n }\n\n Deposit storage deposit = getDeposit(account);\n if (deposit.unlockAt != 0) {\n revert UnlockingInProcess();\n }\n\n deposit.escrow = deposit.escrow + amount;\n\n SafeERC20.safeTransferFrom(_token, msg.sender, address(this), amount);\n }\n\n /**\n * @notice Use this function to deposit funds into the\n * penalty. This will fail if the deposit is currently being\n * unlocked.\n * @param amount The amount in SOLO to add to the escrow.\n * @param account The address of the account holding the penalty.\n */\n function depositPenalty(uint256 amount, address account) external {\n if (amount == 0) {\n revert PenaltyAmountCannotBeZero();\n }\n if (account == address(0)) {\n revert AccountCannotBeZeroAddress();\n }\n\n Deposit storage deposit = getDeposit(account);\n if (deposit.unlockAt != 0) {\n revert UnlockingInProcess();\n }\n\n deposit.penalty = deposit.penalty + amount;\n\n SafeERC20.safeTransferFrom(_token, msg.sender, address(this), amount);\n }\n\n /**\n * @notice Call this function to begin unlocking deposits. This function\n * will fail if no deposit exists, or if the unlock process has\n * already begun.\n */\n function unlockDeposits() external returns (uint256) {\n Deposit storage deposit = getDeposit(msg.sender);\n\n if (deposit.escrow == 0 && deposit.penalty == 0) {\n revert NoEsrowAndPenalty();\n }\n if (deposit.unlockAt != 0) {\n revert UnlockingInProcess();\n }\n\n deposit.unlockAt = block.number + unlockDuration;\n\n return deposit.unlockAt;\n }\n\n /**\n * @notice Call this function to cancel any deposit that is in the\n * unlocking process.\n */\n function lockDeposits() external {\n Deposit storage deposit = getDeposit(msg.sender);\n if (deposit.unlockAt == 0) {\n revert UnlockingNotInProcess();\n }\n\n delete deposit.unlockAt;\n }\n\n /**\n * @notice Call this function once the unlock duration has\n * elapsed in order to transfer the unlocked tokens to the caller's account.\n */\n function withdraw() external {\n return withdrawTo(msg.sender);\n }\n\n /**\n * @notice Call this function once the unlock duration has\n * elapsed in order to transfer the unlocked tokens to the specified\n * account.\n * @param account The address of the account the tokens should be\n * transferred to.\n */\n function withdrawTo(address account) public {\n Deposit memory deposit = getDeposit(msg.sender);\n if (deposit.unlockAt == 0) {\n revert UnlockingNotInProcess();\n }\n if (deposit.unlockAt >= block.number) {\n revert UnlockingNotCompleted();\n }\n\n uint256 amount = deposit.escrow + deposit.penalty;\n\n // Reset deposit values to 0\n delete deposits[msg.sender];\n\n SafeERC20.safeTransfer(_token, account, amount);\n }\n\n /**\n * @notice Nodes should call this function on completing an event\n * delivery. This function will fail if the ticket is invalid or if the\n * ticket is not a winner. Clients should calculate if the ticket is a\n * winner locally, but can also use the public view functions:\n * `requireValidWinningTicket` and `isWinningTicket` to check that a ticket\n * is winning.\n * @param ticket The ticket issued by the sender.\n * @param redeemerRand The redeemer random value, generated by the Node prior\n * to performing the event relay.\n * @param senderSig The signature of the sender of the ticket.\n * @param receiverSig The signature of the redeemer of the ticket.\n */\n function redeem(\n Ticket calldata ticket,\n uint256 redeemerRand,\n bytes calldata senderSig,\n bytes calldata receiverSig\n ) external {\n EpochsManager.Epoch memory epoch = _epochsManager.getEpoch(ticket.epochId);\n if (ticket.generationBlock > block.number) {\n revert TicketCannotBeFromFutureBlock();\n }\n\n bytes32 ticketHash = requireValidWinningTicket(\n ticket,\n redeemerRand,\n senderSig,\n receiverSig\n );\n\n usedTickets[ticketHash] = true;\n\n uint256 directoryStake = _directory.getTotalStakeForStakee(\n ticket.epochId,\n ticket.redeemer\n );\n if (directoryStake == 0) {\n revert RedeemerMustHaveJoinedEpoch(ticket.epochId);\n }\n\n _redeem(epoch, ticket);\n }\n\n /**\n * @notice Nodes should call this function on completing a one-to-many event\n * delivery. This function will fail if the ticket is invalid or if the\n * ticket is not a winner. Additionally, the specified receiver must have\n * a valid futurepass account associated with it. Clients should calculate\n * if the ticket is a winner locally, but can also use the public view\n * functions:\n * `requireValidWinningMultiReceiverTicket` and `isWinningTicket` to check\n * that a ticket is winning.\n * @param ticket The ticket issued by the sender.\n * @param redeemerRand The redeemer random value, generated by the Node prior\n * to performing the event relay.\n * @param receiver A valid receiver of the the relay.\n * @param senderSig The signature of the sender of the ticket.\n * @param receiverSig The signature of the redeemer of the ticket.\n */\n function redeemMultiReceiver(\n MultiReceiverTicket calldata ticket,\n uint256 redeemerRand,\n User calldata receiver,\n bytes calldata senderSig,\n bytes calldata receiverSig\n ) external {\n EpochsManager.Epoch memory epoch = _epochsManager.getEpoch(ticket.epochId);\n if (ticket.generationBlock > block.number) {\n revert TicketCannotBeFromFutureBlock();\n }\n\n (, bytes32 ticketReceiverHash) = requireValidWinningMultiReceiverTicket(\n ticket,\n receiver,\n redeemerRand,\n senderSig,\n receiverSig\n );\n\n usedTickets[ticketReceiverHash] = true;\n\n uint256 directoryStake = _directory.getTotalStakeForStakee(\n ticket.epochId,\n ticket.redeemer\n );\n if (directoryStake == 0) {\n revert RedeemerMustHaveJoinedEpoch(ticket.epochId);\n }\n\n _redeemMultiReceiver(epoch, ticket, receiver.main);\n }\n\n function _redeem(EpochsManager.Epoch memory epoch, Ticket calldata ticket) internal {\n uint256 rewardAmount = rewardRedeemer(epoch, ticket.sender, ticket.redeemer);\n\n emit Redemption(\n ticket.epochId,\n ticket.redeemer,\n ticket.sender.main,\n ticket.receiver.main,\n ticket.generationBlock,\n rewardAmount\n );\n }\n\n function _redeemMultiReceiver(\n EpochsManager.Epoch memory epoch,\n MultiReceiverTicket calldata ticket,\n address receiver\n ) internal {\n uint256 rewardAmount = rewardRedeemer(epoch, ticket.sender, ticket.redeemer);\n\n emit MultiReceiverRedemption(\n ticket.epochId,\n ticket.redeemer,\n ticket.sender.main,\n receiver,\n ticket.generationBlock,\n rewardAmount\n );\n }\n\n function rewardRedeemer(\n EpochsManager.Epoch memory epoch,\n User calldata sender,\n address redeemer\n ) internal returns (uint256) {\n Deposit storage deposit = getDeposit(sender.main);\n\n uint256 amount;\n\n if (epoch.faceValue > deposit.escrow) {\n amount = deposit.escrow;\n incrementRewardPool(redeemer, deposit, amount);\n SafeERC20.safeTransfer(\n _token,\n address(0x000000000000000000000000000000000000dEaD),\n deposit.penalty\n );\n\n delete deposit.penalty;\n emit SenderPenaltyBurnt(sender.main);\n } else {\n amount = epoch.faceValue;\n incrementRewardPool(redeemer, deposit, amount);\n }\n\n return amount;\n }\n\n /**\n * @notice Call this function to check if a ticket is valid and is\n * a winning ticket. It will fail if the ticket is invalid or is not\n * a winner. A ticket is invalid if:\n * - The sender or redeemer addresses are null\n * - The ticket has already been redeemed.\n * - The secret random value of the sender does not match the commit\n * in the ticket.\n * - The signatures are invalid.\n * @param ticket The ticket issued by the sender.\n * @param redeemerRand The redeemer random value, generated by the Node prior\n * to performing the event relay.\n * @param senderSig The signature of the sender of the ticket.\n * @param receiverSig The signature of the redeemer of the ticket.\n * @return ticketHash The hash of the ticket. Should match the hash generated\n * by `getTicketHash`.\n */\n function requireValidWinningTicket(\n Ticket memory ticket,\n uint256 redeemerRand,\n bytes calldata senderSig,\n bytes calldata receiverSig\n ) public view returns (bytes32 ticketHash) {\n if (ticket.sender.main == address(0)) {\n revert TicketSenderCannotBeZeroAddress();\n }\n if (ticket.receiver.main == address(0)) {\n revert TicketReceiverCannotBeZeroAddress();\n }\n if (ticket.redeemer == address(0)) {\n revert TicketRedeemerCannotBeZeroAddress();\n }\n\n ticketHash = getTicketHash(ticket);\n if (usedTickets[ticketHash]) {\n revert TicketAlreadyRedeemed();\n }\n\n // validate the redeemer has knowledge of the redeemer rand\n if (createCommit(ticket.generationBlock, redeemerRand) != ticket.redeemerCommit) {\n revert RedeemerCommitMismatch();\n }\n\n if (!hasSigningPermission(ticket.sender, ticket.generationBlock)) {\n revert InvalidSenderSigningPermission();\n }\n if (!hasSigningPermission(ticket.receiver, ticket.generationBlock)) {\n revert InvalidReceiverSigningPermission();\n }\n\n if (!isValidTicketSig(ticket.sender, senderSig, ticketHash)) {\n revert InvalidSenderSignature();\n }\n if (!isValidTicketSig(ticket.receiver, receiverSig, ticketHash)) {\n revert InvalidReceiverSignature();\n }\n\n if (\n !isWinningTicket(\n senderSig,\n receiverSig,\n ticket.epochId,\n ticket.generationBlock,\n redeemerRand\n )\n ) {\n revert TicketNotWinning();\n }\n }\n\n /**\n * @notice Call this function to check if a multi receiver ticket is valid and is\n * a winning ticket. It will fail if the ticket is invalid or is not\n * a winner. A ticket is invalid if:\n * - The sender, receiver or redeemer addresses are null\n * - The receiver does not have a valid futurepass account\n * - The ticket has already been redeemed.\n * - The secret random value of the redeemer does not match the commit\n * in the ticket.\n * - The signatures are invalid.\n * @param ticket The ticket issued by the sender.\n * @param receiver The receiver associated with the ticket.\n * @param redeemerRand The redeemer random value, generated by the Node prior\n * to performing the event relay.\n * @param senderSig The signature of the sender of the ticket.\n * @param receiverSig The signature of the redeemer of the ticket.\n */\n function requireValidWinningMultiReceiverTicket(\n MultiReceiverTicket memory ticket,\n User calldata receiver,\n uint256 redeemerRand,\n bytes calldata senderSig,\n bytes calldata receiverSig\n ) public view returns (bytes32 ticketHash, bytes32 ticketReceiverHash) {\n if (ticket.sender.main == address(0)) {\n revert TicketSenderCannotBeZeroAddress();\n }\n if (receiver.main == address(0)) {\n revert TicketReceiverCannotBeZeroAddress();\n }\n if (ticket.redeemer == address(0)) {\n revert TicketRedeemerCannotBeZeroAddress();\n }\n\n address futurepassAccount = _futurepassRegistrar.futurepassOf(receiver.main);\n if (futurepassAccount == address(0)) {\n revert MissingFuturepassAccount(receiver.main);\n }\n\n // There are two hashes create. The first hash is signed by the\n // sender and receiver, and is primarily used to validate these actors\n // agreed on the contents of the ticket.\n // The second hash is to prevent re-use. In a multi-receiver context,\n // the same ticket can be re-used amongst many receiver, but should\n // only be used ONCE per futurepass account. Thus the second hash\n // additionally appends the futurepass address as well.\n ticketHash = getMultiReceiverTicketHash(ticket);\n ticketReceiverHash = keccak256(abi.encodePacked(ticketHash, futurepassAccount));\n if (usedTickets[ticketReceiverHash]) {\n revert TicketAlreadyRedeemed();\n }\n\n // validate the redeemer has knowledge of the redeemer rand\n if (createCommit(ticket.generationBlock, redeemerRand) != ticket.redeemerCommit) {\n revert RedeemerCommitMismatch();\n }\n\n if (!hasSigningPermission(ticket.sender, ticket.generationBlock)) {\n revert InvalidSenderSigningPermission();\n }\n if (!hasSigningPermission(receiver, ticket.generationBlock)) {\n revert InvalidReceiverSigningPermission();\n }\n\n if (!isValidTicketSig(ticket.sender, senderSig, ticketHash)) {\n revert InvalidSenderSignature();\n }\n if (!isValidTicketSig(receiver, receiverSig, ticketHash)) {\n revert InvalidReceiverSignature();\n }\n\n if (\n !isWinningTicket(\n senderSig,\n receiverSig,\n ticket.epochId,\n ticket.generationBlock,\n redeemerRand\n )\n ) {\n revert TicketNotWinning();\n }\n\n return (ticketHash, ticketReceiverHash);\n }\n\n function hasSigningPermission(\n User memory user,\n uint256 generationBlock\n ) internal view returns (bool) {\n if (user.delegated == address(0)) {\n return true;\n }\n\n IAuthorizedAccounts.Permission permission = IAuthorizedAccounts.Permission.PersonalSign;\n return\n _authorizedAccounts.validatePermission(\n user.main,\n user.delegated,\n permission,\n generationBlock\n );\n }\n\n function createCommit(uint256 generationBlock, uint256 rand) public pure returns (bytes32) {\n return keccak256(abi.encodePacked(keccak256(abi.encodePacked(generationBlock, rand))));\n }\n\n function getDeposit(address account) private view returns (Deposit storage) {\n return deposits[account];\n }\n\n function isValidTicketSig(\n User memory user,\n bytes memory sig,\n bytes32 ticketHash\n ) internal pure returns (bool) {\n address signer = address(0);\n if (user.delegated != address(0)) {\n signer = user.delegated;\n } else {\n signer = user.main;\n }\n bytes32 ethHash = ECDSA.toEthSignedMessageHash(ticketHash);\n return ECDSA.recover(ethHash, sig) == signer;\n }\n\n /**\n * @notice Use this function to check if a ticket is winning.\n * @param senderSig The signature of the sender of the ticket.\n * @param receiverSig The signature of the receiver of the ticket.\n * @param epochId The epochId of the ticket.\n * @param generationBlock The generationBlock of the ticket.\n * @param redeemerRand The redeemer random value, generated by the Node prior\n * to performing the event relay.\n * @return True if a ticket is a winner.\n */\n function isWinningTicket(\n bytes memory senderSig,\n bytes memory receiverSig,\n uint256 epochId,\n uint256 generationBlock,\n uint256 redeemerRand\n ) public view returns (bool) {\n uint256 winProb = calculateWinningProbability(epochId, generationBlock);\n // bitshift the winProb to a 256 bit value to allow comparison to a 32 byte hash\n uint256 prob = (uint256(winProb) << 128) | uint256(winProb);\n return uint256(keccak256(abi.encodePacked(senderSig, receiverSig, redeemerRand))) < prob;\n }\n\n /**\n * @notice This function calculates the probability of a ticket winning at\n * the block that this function was called. A ticket's winning probability\n * will decay every block since its issuance. The amount of decay will depend\n * on the decay rate parameter of the epoch the ticket was generated in.\n * @param epochId The epochId of the ticket.\n * @param generationBlock The generationBlock of the ticket.\n */\n function calculateWinningProbability(\n uint256 epochId,\n uint256 generationBlock\n ) public view returns (uint128) {\n EpochsManager.Epoch memory epoch = _epochsManager.getEpoch(epochId);\n if (epoch.startBlock == 0) {\n revert TicketEpochNotFound();\n }\n\n if (\n generationBlock < epoch.startBlock ||\n (epoch.endBlock > 0 && generationBlock >= epoch.endBlock)\n ) {\n revert TicketNotCreatedInTheEpoch();\n }\n\n uint256 elapsedDuration = block.number - generationBlock;\n\n // Ticket has completely expired\n if (elapsedDuration >= epoch.ticketDuration) {\n return 0;\n }\n\n uint256 maxDecayValue = SyloUtils.percOf(epoch.baseLiveWinProb, epoch.decayRate);\n\n // determine the amount of probability that has actually decayed\n // by multiplying the maximum decay value against ratio of the tickets elapsed duration\n // vs the actual ticket duration. The max decay value is calculated from a fraction of a\n // uint128 value so we cannot phantom overflow here\n uint256 decayedProbability = (maxDecayValue * elapsedDuration) / epoch.ticketDuration;\n\n // calculate the remaining probability by subtracting the decayed probability\n // from the base\n return epoch.baseLiveWinProb - SafeCast.toUint128(decayedProbability);\n }\n\n /**\n * @notice Returns the hash of the ticket. Takes all fields in a ticket\n * as inputs to the hash.\n * @return A byte-array representing the hash.\n */\n function getTicketHash(Ticket memory ticket) public pure returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(\n ticket.epochId,\n ticket.sender.main,\n ticket.receiver.main,\n ticket.redeemer,\n ticket.generationBlock,\n ticket.redeemerCommit\n )\n );\n }\n\n /**\n * @notice Returns the hash of a multi receiver ticket. Takes all fields in\n * a ticket as inputs to the hash, as well as a specific receiver.\n * @return A byte-array representing the hash.\n */\n function getMultiReceiverTicketHash(\n MultiReceiverTicket memory ticket\n ) public pure returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(\n ticket.epochId,\n ticket.sender.main,\n ticket.redeemer,\n ticket.generationBlock,\n ticket.redeemerCommit\n )\n );\n }\n\n function incrementRewardPool(\n address stakee,\n Deposit storage deposit,\n uint256 amount\n ) internal {\n deposit.escrow = deposit.escrow - amount;\n\n SafeERC20.safeTransfer(_token, address(_rewardsManager), amount);\n _rewardsManager.incrementRewardPool(stakee, amount);\n }\n}\n" + }, + "contracts/payments/ticketing/RewardsManager.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"abdk-libraries-solidity/ABDKMath64x64.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\n\nimport \"../../libraries/SyloUtils.sol\";\nimport \"../../libraries/Manageable.sol\";\nimport \"../../epochs/EpochsManager.sol\";\nimport \"../../staking/StakingManager.sol\";\nimport \"../../interfaces/epochs/IEpochsManager.sol\";\nimport \"../../interfaces/staking/IStakingManager.sol\";\nimport \"../../interfaces/payments/ticketing/IRewardsManager.sol\";\n\n/**\n * @notice Handles epoch based reward pools that are incremented from redeeming tickets.\n * Nodes use this contract to set up their reward pool for the next epoch,\n * and stakers use this contract to track and claim staking rewards.\n * @dev After deployment, the SyloTicketing contract should be\n * set up as a manager to be able to call certain restricted functions.\n */\ncontract RewardsManager is IRewardsManager, Initializable, Manageable, ERC165 {\n uint256 internal constant ONE_SYLO = 1 ether;\n\n // 64x64 Fixed point representation of 1 SYLO (10**18 >> 64)\n int128 internal constant ONE_SYLO_FIXED = 18446744073709551616000000000000000000;\n\n uint256 internal constant MAX_INT64 = 9223372036854775807;\n\n /** ERC20 Sylo token contract. */\n IERC20 public _token;\n\n /** Sylo Staking Manager contract. */\n StakingManager public _stakingManager;\n\n /** Sylo Epochs Manager. */\n EpochsManager public _epochsManager;\n\n /**\n * @dev Each node will manage a cumulative reward factor (CRF) that is incremented\n * whenever a ticket is redeemed. This factor acts as a single value\n * that can be used to calculate any particular staker's reward share. This\n * prevents the need to individually track each staker's proportion, and also allows\n * a claim calculation to be performed without iterating through every epoch.\n *\n * The CRF is calculated as CRF = CRF + Reward / TotalStake.\n */\n mapping(address => int128) private cumulativeRewardFactors;\n\n /**\n * @notice Tracks the last epoch a delegated staker made a reward claim in.\n * The key to this mapping is a hash of the Node's address and the delegated\n * stakers address.\n */\n mapping(bytes32 => LastClaim) public lastClaims;\n\n /**\n * @notice Tracks each Nodes total pending rewards in SOLOs. This\n * value is accumulated as Node's redeem tickets. Rewards are pending if the\n * distribution amongst the stakers has not been accounted for yet. Pending rewards\n * are transferred to unclaimed rewards once the the staker's share has been\n * calculated.\n */\n mapping(address => uint256) public pendingRewards;\n\n /**\n * @notice Tracks rewards for stakers after the stakers share has been calculated,\n * but has not actually been claimed by the staker.\n * The node fee reward is also added to the node's unclaimedStakingRewards.\n */\n mapping(bytes32 => uint256) public unclaimedStakingRewards;\n\n /**\n * @notice Tracks each Node's most recently active reward pool\n */\n mapping(address => uint256) public latestActiveRewardPools;\n\n /**\n * @notice Tracks total accumulated rewards in each epoch\n */\n mapping(uint256 => uint256) public totalEpochRewards;\n\n /**\n * @notice Tracks total accumulated staking rewards in each epoch\n */\n mapping(uint256 => uint256) public totalEpochStakingRewards;\n\n /**\n * @notice Tracks each reward pool initialized by a Node. The key to this map\n * is derived from the epochId and the Node's address.\n */\n mapping(bytes32 => RewardPool) public rewardPools;\n\n error NoRewardToClaim();\n error AmountCannotBeZero();\n error RewardPoolNotExist();\n error RewardPoolAlreadyExist();\n error DoNotAllowZeroAddress();\n error TokenCannotBeZeroAddress();\n error NoStakeToCreateRewardPool();\n error StakeeCannotBeZeroAddress();\n error StakerCannotBeZeroAddress();\n error StakerKeyCannotBeZeroBytes();\n error InvalidFixedPointResult();\n\n function initialize(\n IERC20 token,\n StakingManager stakingManager,\n EpochsManager epochsManager\n ) external initializer {\n if (address(token) == address(0)) {\n revert TokenCannotBeZeroAddress();\n }\n\n SyloUtils.validateContractInterface(\n \"StakingManager\",\n address(stakingManager),\n type(IStakingManager).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"EpochsManager\",\n address(epochsManager),\n type(IEpochsManager).interfaceId\n );\n\n Ownable2StepUpgradeable.__Ownable2Step_init();\n\n _token = token;\n _epochsManager = epochsManager;\n _stakingManager = stakingManager;\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IRewardsManager).interfaceId;\n }\n\n /**\n * @notice Returns the key used to index a reward pool. The key is a hash of\n * the epochId and Node's address.\n * @param epochId The epoch ID the reward pool was created in.\n * @param stakee The address of the Node.\n * @return A byte-array representing the reward pool key.\n */\n function getRewardPoolKey(uint256 epochId, address stakee) public pure returns (bytes32) {\n return keccak256(abi.encodePacked(epochId, stakee));\n }\n\n /**\n * @notice Returns the key used to index staking claims. The key is a hash of\n * the Node's address and the staker's address.\n * @param stakee The address of the Node.\n * @param staker The address of the stake.\n * @return A byte-array representing the key.\n */\n function getStakerKey(address stakee, address staker) public pure returns (bytes32) {\n return keccak256(abi.encodePacked(stakee, staker));\n }\n\n /**\n * @notice Retrieve the reward pool initialized by the given node, at the specified\n * epoch.\n * @param epochId The ID of the epoch the reward pool was initialized in.\n * @param stakee The address of the Node.\n * @return The reward pool.\n */\n function getRewardPool(\n uint256 epochId,\n address stakee\n ) external view returns (RewardPool memory) {\n return rewardPools[getRewardPoolKey(epochId, stakee)];\n }\n\n /**\n * @notice Retrieve the total accumulated reward that will be distributed to a Node's\n * delegated stakers for a given epoch.\n * @param epochId The ID of the epoch the reward pool was initialized in.\n * @param stakee The address of the Node.\n * @return The total accumulated staker reward in SOLO.\n */\n function getRewardPoolStakersTotal(\n uint256 epochId,\n address stakee\n ) external view returns (uint256) {\n return rewardPools[getRewardPoolKey(epochId, stakee)].stakersRewardTotal;\n }\n\n /**\n * @notice Retrieve the total active stake that will be used for a Node's reward\n * pool in a given epoch.\n * @param epochId The ID of the epoch the reward pool was initialized in.\n * @param stakee The address of the Node.\n * @return The total active stake for that reward pool in SOLO.\n */\n function getRewardPoolActiveStake(\n uint256 epochId,\n address stakee\n ) external view returns (uint256) {\n return rewardPools[getRewardPoolKey(epochId, stakee)].totalActiveStake;\n }\n\n /**\n * @notice Retrieve the total pending staking reward allocated to a Node's\n * stakers.\n * @param stakee The address of the Node.\n * @return The total pending staking reward in SOLO.\n */\n function getPendingRewards(address stakee) external view returns (uint256) {\n return pendingRewards[stakee];\n }\n\n /**\n * @notice Retrieves the ID of the epoch in which a staker last made their\n * staking claim.\n * @param stakee The address of the Node.\n * @param staker The address of the staker.\n * @return The ID of the epoch.\n */\n function getLastClaim(\n address stakee,\n address staker\n ) external view returns (LastClaim memory) {\n return lastClaims[getStakerKey(stakee, staker)];\n }\n\n /**\n * @notice Retrieves the total accumulated rewards for a specific epoch.\n * @param epochId The epoch id.\n * @return The total reward in that epoch, including staking rewards and fee\n * reward.\n */\n function getTotalEpochRewards(uint256 epochId) external view returns (uint256) {\n return totalEpochRewards[epochId];\n }\n\n /**\n * @notice Retrieves the total accumulated rewards for stakers in a specific epoch.\n * @param epochId The epoch id.\n * @return The total staking reward in that epoch.\n */\n function getTotalEpochStakingRewards(uint256 epochId) external view returns (uint256) {\n return totalEpochStakingRewards[epochId];\n }\n\n /**\n * @notice This is used by Nodes to initialize their reward pool for\n * the next epoch. This function will revert if the caller has no stake, or\n * if the reward pool has already been initialized. The total active stake\n * for the next reward pool is calculated by summing up the total managed\n * stake held by the RewardsManager contract.\n */\n function initializeNextRewardPool(address stakee) external onlyManager {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n\n uint256 nextEpochId = _epochsManager.getNextEpochId();\n\n RewardPool storage nextRewardPool = rewardPools[getRewardPoolKey(nextEpochId, stakee)];\n if (nextRewardPool.initializedAt != 0) {\n revert RewardPoolAlreadyExist();\n }\n\n uint256 totalStake = _stakingManager.getStakeeTotalManagedStake(stakee);\n if (totalStake == 0) {\n revert NoStakeToCreateRewardPool();\n }\n\n nextRewardPool.totalActiveStake = totalStake;\n\n nextRewardPool.initializedAt = block.number;\n }\n\n /**\n * @dev This function should be called by the Ticketing contract when a\n * ticket is successfully redeemed. The face value of the ticket\n * should be split between incrementing the node's reward balance,\n * and the reward balance for the node's delegated stakers. The face value\n * will be added to the current reward pool's balance. This function will\n * fail if the Ticketing contract has not been set as a manager.\n * @param stakee The address of the Node.\n * @param amount The face value of the ticket in SOLO.\n */\n function incrementRewardPool(address stakee, uint256 amount) external onlyManager {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n if (amount == 0) {\n revert AmountCannotBeZero();\n }\n\n (uint256 epochId, IEpochsManager.Epoch memory currentEpoch) = _epochsManager\n .getCurrentActiveEpoch();\n\n RewardPool storage rewardPool = rewardPools[getRewardPoolKey(epochId, stakee)];\n if (rewardPool.initializedAt == 0) {\n revert RewardPoolNotExist();\n }\n\n // Update the latest active reward pool for the node to be this pool\n if (latestActiveRewardPools[stakee] < epochId) {\n latestActiveRewardPools[stakee] = epochId;\n }\n\n uint256 stakersReward = SyloUtils.percOf(\n SafeCast.toUint128(amount),\n currentEpoch.defaultPayoutPercentage\n );\n\n // transfer the node's fee reward to it's unclaimed reward value\n unclaimedStakingRewards[getStakerKey(stakee, stakee)] =\n unclaimedStakingRewards[getStakerKey(stakee, stakee)] +\n (amount - stakersReward);\n\n // update the value of the reward owed to the stakers\n pendingRewards[stakee] = pendingRewards[stakee] + stakersReward;\n\n // if this is the first ticket redeemed for this reward, set the initial\n // CRF value for this pool\n if (rewardPool.stakersRewardTotal == 0) {\n rewardPool.initialCumulativeRewardFactor = cumulativeRewardFactors[stakee];\n }\n\n rewardPool.stakersRewardTotal = rewardPool.stakersRewardTotal + stakersReward;\n\n // We preemptively prevent an overflow revert with the abdk library.\n // Dividing the stakers reward with the pool's total active\n // stake may produce a value that is greater than the maximum possible\n // 64.64 fixed point value.\n // This error is incredibly niche and unlikely to happen, so we just\n // revert here as well (with a named error) and remediation involves\n // just increasing the amount of stake a node has.\n if (rewardPool.totalActiveStake * MAX_INT64 < stakersReward) {\n revert InvalidFixedPointResult();\n }\n\n cumulativeRewardFactors[stakee] = ABDKMath64x64.add(\n cumulativeRewardFactors[stakee],\n ABDKMath64x64.div(\n toFixedPointSYLO(stakersReward),\n toFixedPointSYLO(rewardPool.totalActiveStake)\n )\n );\n\n totalEpochRewards[epochId] = totalEpochRewards[epochId] + amount;\n totalEpochStakingRewards[epochId] = totalEpochStakingRewards[epochId] + stakersReward;\n }\n\n /**\n * @dev This function utilizes the cumulative reward factors, and the staker's\n * value in stake to calculate the staker's share of the pending reward.\n */\n function calculatePendingClaim(\n bytes32 stakerKey,\n address stakee,\n address staker\n ) internal view returns (uint256) {\n uint256 claim = calculateInitialClaim(stakerKey, stakee);\n\n // find the first reward pool where their stake was active and had\n // generated rewards\n uint256 activeAt;\n RewardPool memory initialActivePool;\n\n uint256 currentEpochId = _epochsManager.currentIteration();\n\n for (uint256 i = lastClaims[stakerKey].claimedAt + 1; i < currentEpochId; ++i) {\n initialActivePool = rewardPools[getRewardPoolKey(i, stakee)];\n // check if node initialized a reward pool for this epoch and\n // gained rewards\n if (initialActivePool.initializedAt > 0 && initialActivePool.stakersRewardTotal > 0) {\n activeAt = i;\n break;\n }\n }\n\n if (activeAt == 0) {\n return claim;\n }\n\n IStakingManager.StakeEntry memory stakeEntry = _stakingManager.getStakeEntry(\n stakee,\n staker\n );\n\n // We convert the staker amount to SYLO as the maximum uint256 value that\n // can be used for the fixed point representation is 2^64-1.\n int128 initialStake = toFixedPointSYLO(stakeEntry.amount);\n\n int128 initialCumulativeRewardFactor = initialActivePool.initialCumulativeRewardFactor;\n\n int128 finalCumulativeRewardFactor = getFinalCumulativeRewardFactor(\n stakee,\n currentEpochId\n );\n\n return\n claim +\n fromFixedPointSYLO(\n ABDKMath64x64.mul(\n initialStake,\n ABDKMath64x64.sub(finalCumulativeRewardFactor, initialCumulativeRewardFactor)\n )\n );\n }\n\n /**\n * Manually calculates the reward claim for the first epoch the claim is being\n * made for. This manual calculation is necessary as claims are only made up\n * to the previous epoch.\n */\n function calculateInitialClaim(\n bytes32 stakerKey,\n address stakee\n ) internal view returns (uint256) {\n LastClaim memory lastClaim = lastClaims[stakerKey];\n\n // if we have already made a claim up to the previous epoch, then\n // there is no need to calculate the initial claim\n if (_epochsManager.currentIteration() == lastClaim.claimedAt) {\n return 0;\n }\n\n RewardPool memory firstRewardPool = rewardPools[\n getRewardPoolKey(lastClaim.claimedAt, stakee)\n ];\n\n // if there was no reward pool initialized for the first epoch,\n // then there is no need to calculate the initial claim\n if (firstRewardPool.totalActiveStake == 0) {\n return 0;\n }\n\n return\n (firstRewardPool.stakersRewardTotal * lastClaim.stake) /\n firstRewardPool.totalActiveStake;\n }\n\n /**\n * Determines the cumulative reward factor to use for claim calculations. The\n * CRF will depend on when the Node last initialized a reward pool, and also when\n * the staker last made their claim.\n */\n function getFinalCumulativeRewardFactor(\n address stakee,\n uint256 currentEpochId\n ) internal view returns (int128) {\n int128 finalCumulativeRewardFactor;\n\n // Get the cumulative reward factor for the Node\n // for the start of this epoch, since we only perform\n // calculations up to the end of the previous epoch.\n if (latestActiveRewardPools[stakee] < currentEpochId) {\n // If the Node has not been active, then the final\n // cumulative reward factor will just be the current one.\n finalCumulativeRewardFactor = cumulativeRewardFactors[stakee];\n } else {\n // We are calculating the claim for an active epoch, the\n // final cumulative reward factor will be taken from the start of this\n // epoch (end of previous epoch).\n RewardPool storage latestRewardPool = rewardPools[\n getRewardPoolKey(latestActiveRewardPools[stakee], stakee)\n ];\n finalCumulativeRewardFactor = latestRewardPool.initialCumulativeRewardFactor;\n }\n\n return finalCumulativeRewardFactor;\n }\n\n /**\n * @notice Call this function to calculate the total reward owed to a staker.\n * This value will include all epochs since the last claim was made up to\n * the previous epoch. This will also add any pending rewards to the\n * final value as well.\n * @dev This function will utilize the cumulative reward factor to perform the\n * calculation, keeping the gas cost scaling of this function to a constant value.\n * @param stakee The address of the Node.\n * @param staker The address of the staker.\n * @return The value of the reward owed to the staker in SOLO.\n */\n function calculateStakerClaim(address stakee, address staker) public view returns (uint256) {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n if (staker == address(0)) {\n revert StakerCannotBeZeroAddress();\n }\n\n bytes32 stakerKey = getStakerKey(stakee, staker);\n uint256 pendingClaim = calculatePendingClaim(stakerKey, stakee, staker);\n\n return pendingClaim + unclaimedStakingRewards[stakerKey];\n }\n\n /**\n * Helper function to convert a uint256 value in SOLOs to a 64.64 fixed point\n * representation in SYLOs while avoiding any possibility of overflow.\n * Any remainders from converting SOLO to SYLO is explicitly handled to mitigate\n * precision loss. The error when using this function is [-1/2^64, 0].\n */\n function toFixedPointSYLO(uint256 amount) internal pure returns (int128) {\n int128 fullSylos = ABDKMath64x64.fromUInt(amount / ONE_SYLO);\n int128 fracSylos = ABDKMath64x64.fromUInt(amount % ONE_SYLO); // remainder\n\n return ABDKMath64x64.add(fullSylos, ABDKMath64x64.div(fracSylos, ONE_SYLO_FIXED));\n }\n\n /**\n * Helper function to convert a 64.64 fixed point value in SYLOs to a uint256\n * representation in SOLOs while avoiding any possibility of overflow.\n */\n function fromFixedPointSYLO(int128 amount) internal pure returns (uint256) {\n uint256 fullSylos = ABDKMath64x64.toUInt(amount);\n uint256 fullSolos = fullSylos * ONE_SYLO;\n\n // calculate the value lost when converting the fixed point amount to a uint\n int128 fracSylos = ABDKMath64x64.sub(amount, ABDKMath64x64.fromUInt(fullSylos));\n uint256 fracSolos = ABDKMath64x64.toUInt(ABDKMath64x64.mul(fracSylos, ONE_SYLO_FIXED));\n\n return fullSolos + fracSolos;\n }\n\n /**\n * @notice Call this function to claim rewards as a staker. The\n * SYLO tokens will be transferred to the caller's account. This function will\n * fail if there exists no reward to claim. Note: Calling this will remove\n * the current unclaimed reward from being used as stake in the next round.\n * @param stakee The address of the Node to claim against.\n */\n function claimStakingRewards(address stakee) external returns (uint256) {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n\n bytes32 stakerKey = getStakerKey(stakee, msg.sender);\n uint256 pendingReward = calculatePendingClaim(stakerKey, stakee, msg.sender);\n\n uint256 totalClaim = pendingReward + unclaimedStakingRewards[stakerKey];\n if (totalClaim == 0) {\n revert NoRewardToClaim();\n }\n\n delete unclaimedStakingRewards[stakerKey];\n pendingRewards[stakee] = pendingRewards[stakee] - pendingReward;\n\n updateLastClaim(stakee, msg.sender);\n\n SafeERC20.safeTransfer(_token, msg.sender, totalClaim);\n\n return totalClaim;\n }\n\n /**\n * @notice This is called by the staking manager to transfer pending rewards\n * to unclaimed rewards for a staker. This is required as the last used CRF\n * needs to be updated whenever stake changes.\n */\n function updatePendingRewards(address stakee, address staker) external onlyManager {\n bytes32 stakerKey = getStakerKey(stakee, staker);\n uint256 pendingReward = calculatePendingClaim(stakerKey, stakee, staker);\n\n pendingRewards[stakee] = pendingRewards[stakee] - pendingReward;\n\n unclaimedStakingRewards[stakerKey] = unclaimedStakingRewards[stakerKey] + pendingReward;\n\n updateLastClaim(stakee, staker);\n }\n\n function updateLastClaim(address stakee, address staker) internal {\n IStakingManager.StakeEntry memory stakeEntry = _stakingManager.getStakeEntry(\n stakee,\n staker\n );\n lastClaims[getStakerKey(stakee, staker)] = LastClaim(\n _epochsManager.currentIteration(),\n stakeEntry.amount\n );\n }\n}\n" + }, + "contracts/payments/ticketing/TicketingParameters.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\n\nimport \"../../libraries/SyloUtils.sol\";\nimport \"../../interfaces/payments/ticketing/ITicketingParameters.sol\";\n\n/**\n * @dev Persists the parameters for the ticketing mechanism. This contract is\n * read by the EpochManager. Extracting the parameters into another\n * contract is necessary to avoid a cyclic dependency between the ticketing\n * and epoch contracts.\n */\ncontract TicketingParameters is\n ITicketingParameters,\n Initializable,\n Ownable2StepUpgradeable,\n ERC165\n{\n /** @notice The value of a winning ticket in SOLO. */\n uint256 public faceValue;\n\n /**\n * @notice The probability of a ticket winning during the start of its lifetime.\n * This is a uint128 value representing the numerator in the probability\n * ratio where 2^128 - 1 is the denominator.\n */\n uint128 public baseLiveWinProb;\n\n /**\n * @notice The probability of a ticket winning after it has expired.\n * This is a uint128 value representing the numerator in the probability\n * ratio where 2^128 - 1 is the denominator. Note: Redeeming expired\n * tickets is currently not supported.\n */\n uint128 public expiredWinProb;\n\n /**\n * @notice The length in blocks before a ticket is considered expired.\n * The default initialization value is 80,000. This equates\n * to roughly two weeks (15s per block).\n */\n uint256 public ticketDuration;\n\n /**\n * @notice A percentage value representing the proportion of the base win\n * probability that will be decayed once a ticket has expired.\n * Example: 80% decayRate indicates that a ticket will decay down to 20% of its\n * base win probability upon reaching the block before its expiry.\n * The value is expressed as a fraction of 10000.\n */\n uint16 public decayRate;\n\n event FaceValueUpdated(uint256 faceValue);\n event BaseLiveWinProbUpdated(uint128 baseLiveWinprob);\n event ExpiredWinProbUpdated(uint128 expiredWinProb);\n event TicketDurationUpdated(uint256 ticketDuration);\n event DecayRateUpdated(uint16 decayRate);\n\n error FaceValueCannotBeZero();\n error TicketDurationCannotBeZero();\n\n function initialize(\n uint256 _faceValue,\n uint128 _baseLiveWinProb,\n uint128 _expiredWinProb,\n uint16 _decayRate,\n uint256 _ticketDuration\n ) external initializer {\n if (_faceValue == 0) {\n revert FaceValueCannotBeZero();\n }\n if (_ticketDuration == 0) {\n revert TicketDurationCannotBeZero();\n }\n\n Ownable2StepUpgradeable.__Ownable2Step_init();\n\n faceValue = _faceValue;\n baseLiveWinProb = _baseLiveWinProb;\n expiredWinProb = _expiredWinProb;\n decayRate = _decayRate;\n ticketDuration = _ticketDuration;\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(ITicketingParameters).interfaceId;\n }\n\n /**\n * @notice Set the face value for tickets in SOLO. Only callable by\n * the contract owner.\n * @param _faceValue The face value to set in SOLO.\n */\n function setFaceValue(uint256 _faceValue) external onlyOwner {\n if (_faceValue == 0) {\n revert FaceValueCannotBeZero();\n }\n\n faceValue = _faceValue;\n emit FaceValueUpdated(_faceValue);\n }\n\n /**\n * @notice Set the base live win probability of a ticket. Only callable by\n * the contract owner.\n * @param _baseLiveWinProb The probability represented as a value\n * between 0 to 2**128 - 1.\n */\n function setBaseLiveWinProb(uint128 _baseLiveWinProb) external onlyOwner {\n baseLiveWinProb = _baseLiveWinProb;\n emit BaseLiveWinProbUpdated(_baseLiveWinProb);\n }\n\n /**\n * @notice Set the expired win probability of a ticket. Only callable by\n * the contract owner.\n * @param _expiredWinProb The probability represented as a value\n * between 0 to 2**128 - 1.\n */\n function setExpiredWinProb(uint128 _expiredWinProb) external onlyOwner {\n expiredWinProb = _expiredWinProb;\n emit ExpiredWinProbUpdated(_expiredWinProb);\n }\n\n /**\n * @notice Set the decay rate of a ticket. Only callable by the\n * the contract owner.\n * @param _decayRate The decay rate as a percentage, where the\n * denominator is 10000.\n */\n function setDecayRate(uint16 _decayRate) external onlyOwner {\n decayRate = _decayRate;\n emit DecayRateUpdated(_decayRate);\n }\n\n /**\n * @notice Set the ticket duration of a ticket. Only callable by the\n * contract owner.\n * @param _ticketDuration The duration of a ticket in number of blocks.\n */\n function setTicketDuration(uint256 _ticketDuration) external onlyOwner {\n if (_ticketDuration == 0) {\n revert TicketDurationCannotBeZero();\n }\n\n ticketDuration = _ticketDuration;\n emit TicketDurationUpdated(_ticketDuration);\n }\n\n /**\n * @notice Retrieve the current ticketing parameters.\n * @return faceValue The face value of a ticket in SOLO.\n * @return baseLiveWinProb The base live win probability of a ticket.\n * @return expiredWinProb The expired win probability of a ticket.\n * @return ticketDuration The duration of a ticket in number of blocks.\n * @return decayRate The decay rate of a ticket.\n */\n function getTicketingParameters()\n external\n view\n returns (uint256, uint128, uint128, uint256, uint16)\n {\n return (faceValue, baseLiveWinProb, expiredWinProb, ticketDuration, decayRate);\n }\n}\n" + }, + "contracts/Registries.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\n\nimport \"./libraries/SyloUtils.sol\";\nimport \"./interfaces/IRegistries.sol\";\n\n/**\n * @notice This contract manages Registries for Nodes. A Registry is a\n * set of parameters configured by the Node itself. A Node is required\n * to have a valid Registry to be able to participate in the network.\n */\ncontract Registries is IRegistries, Initializable, Ownable2StepUpgradeable, IERC165 {\n using ECDSA for bytes32;\n\n /**\n * @notice ERC721 contract for bridged Seekers. Used for verifying ownership\n * of a seeker.\n */\n IERC721 public _rootSeekers;\n\n /**\n * @notice Tracks each Node's registry.\n */\n mapping(address => IRegistries.Registry) public registries;\n\n /**\n * @notice Tracks the node address that each seeker id is registered with\n */\n mapping(uint256 => address) public seekerRegistration;\n\n /**\n * @notice Tracks the address of every registered node.\n */\n address[] public nodes;\n\n /**\n * @notice Tracks nonces used when registering the seeker account\n * to prevent signature re-use.\n */\n mapping(bytes32 => address) private signatureNonces;\n\n /**\n * @notice Payout percentage refers to the portion of a tickets reward\n * that will be allocated to the Node's stakers. This is global, and is\n * currently set for all Nodes.\n */\n uint16 public defaultPayoutPercentage;\n\n event DefaultPayoutPercentageUpdated(uint16 defaultPayoutPercentage);\n\n error NonceCannotBeReused();\n error EndMustBeGreaterThanStart();\n error PercentageCannotExceed10000();\n error PublicEndpointCannotBeEmpty();\n error SeekerAccountMustOwnSeekerId();\n error SeekerAccountMustBeMsgSender();\n error ProofNotSignedBySeekerAccount();\n error RootSeekersCannotBeZeroAddress();\n error SeekerAccountCannotBeZeroAddress();\n error EndCannotExceedNumberOfNodes(uint256 nodeLength);\n\n function initialize(\n IERC721 rootSeekers,\n uint16 _defaultPayoutPercentage\n ) external initializer {\n if (address(rootSeekers) == address(0)) {\n revert RootSeekersCannotBeZeroAddress();\n }\n if (_defaultPayoutPercentage > 10000) {\n revert PercentageCannotExceed10000();\n }\n\n Ownable2StepUpgradeable.__Ownable2Step_init();\n\n _rootSeekers = rootSeekers;\n defaultPayoutPercentage = _defaultPayoutPercentage;\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IRegistries).interfaceId;\n }\n\n /**\n * @notice Set the global default payout percentage value. Only callable\n * by the owner.\n * @param _defaultPayoutPercentage The payout percentage as a value where the\n * denominator is 10000.\n */\n function setDefaultPayoutPercentage(uint16 _defaultPayoutPercentage) external onlyOwner {\n if (_defaultPayoutPercentage > 10000) {\n revert PercentageCannotExceed10000();\n }\n\n defaultPayoutPercentage = _defaultPayoutPercentage;\n emit DefaultPayoutPercentageUpdated(_defaultPayoutPercentage);\n }\n\n /**\n * @notice Call this as a Node to set or update your Registry entry.\n * @param publicEndpoint The public endpoint of your Node. Essential for\n * clients to be able to retrieve additional information, such as\n * an address to establish a p2p connection.\n */\n function register(string calldata publicEndpoint) external {\n if (bytes(publicEndpoint).length == 0) {\n revert PublicEndpointCannotBeEmpty();\n }\n\n // This is the nodes first registration\n if (bytes(registries[msg.sender].publicEndpoint).length == 0) {\n nodes.push(msg.sender);\n }\n\n registries[msg.sender].publicEndpoint = publicEndpoint;\n }\n\n function setSeekerAccount(\n address seekerAccount,\n uint256 seekerId,\n bytes32 nonce,\n bytes calldata signature\n ) external {\n if (seekerAccount == address(0)) {\n revert SeekerAccountCannotBeZeroAddress();\n }\n if (signatureNonces[nonce] != address(0)) {\n revert NonceCannotBeReused();\n }\n\n bytes memory proofMessage = getProofMessage(seekerId, msg.sender, nonce);\n bytes32 ethProof = ECDSA.toEthSignedMessageHash(proofMessage);\n\n if (ECDSA.recover(ethProof, signature) != seekerAccount) {\n revert ProofNotSignedBySeekerAccount();\n }\n\n // Now verify the seeker account actually owns the seeker\n address owner = _rootSeekers.ownerOf(seekerId);\n\n if (seekerAccount != owner) {\n revert SeekerAccountMustOwnSeekerId();\n }\n\n delete registries[seekerRegistration[seekerId]].seekerId;\n delete registries[seekerRegistration[seekerId]].seekerAccount;\n\n registries[msg.sender].seekerAccount = seekerAccount;\n registries[msg.sender].seekerId = seekerId;\n\n seekerRegistration[seekerId] = msg.sender;\n\n signatureNonces[nonce] = seekerAccount;\n }\n\n function revokeSeekerAccount(address node) external {\n Registry storage registry = registries[node];\n\n if (registry.seekerAccount != msg.sender) {\n revert SeekerAccountMustBeMsgSender();\n }\n\n delete registry.seekerAccount;\n delete seekerRegistration[registry.seekerId];\n delete registry.seekerId;\n }\n\n /**\n * @notice Retrieve the registry associated with a Node.\n * @param account The address of the Node.\n * @return The Node's Registry.\n */\n function getRegistry(address account) external view returns (Registry memory) {\n return registries[account];\n }\n\n /**\n * @notice Retrieve all registered nodes.\n * @return An array of node addresses.\n */\n function getNodes() external view returns (address[] memory) {\n return nodes;\n }\n\n /**\n * @notice Retrieves a list of registries. Takes in a\n * a start and end indices to allow pagination.\n * @param start The start index which is inclusive.\n * @param end The end index which is exclusive.\n * @return An array of Registries.\n */\n function getRegistries(\n uint256 start,\n uint256 end\n ) external view returns (address[] memory, Registry[] memory) {\n uint256 nodesLength = nodes.length;\n\n if (end <= start) {\n revert EndMustBeGreaterThanStart();\n }\n if (end > nodesLength) {\n revert EndCannotExceedNumberOfNodes(nodesLength);\n }\n\n address[] memory _nodes = new address[](end - start);\n Registry[] memory _registries = new Registry[](_nodes.length);\n\n for (uint256 i = start; i < end; ++i) {\n _nodes[i - start] = nodes[i];\n _registries[i - start] = registries[nodes[i]];\n }\n\n return (_nodes, _registries);\n }\n\n /**\n * @notice Returns the total number of registered nodes.\n * @return The number of registered nodes.\n */\n function getTotalNodes() external view returns (uint256) {\n return nodes.length;\n }\n\n /**\n * @notice Helper function for deriving the proof message used to\n * validate seeker ownership.\n * @param seekerId The tokenId of the seeker used for operation.\n * @param node The address of the node which that will be operated\n * by the specified seeker.\n * @param nonce The nonce used for this message.\n */\n function getProofMessage(\n uint256 seekerId,\n address node,\n bytes32 nonce\n ) public pure returns (bytes memory) {\n return\n abi.encodePacked(\n unicode\"šŸ¤– Hi frend! šŸ¤–\\n\\nšŸ“œ Signing this message proves that you're the owner of this Seeker NFT and allows your Seeker to be used to operate your Seeker's Node. It's a simple but important step to ensure smooth operation.\\n\\nThis request will not trigger a blockchain transaction or cost any gas fees.\\n\\nšŸ”„ Your node's address: \",\n Strings.toHexString(uint256(uint160(node)), 20),\n unicode\"\\n\\nšŸ†” Your seeker id: \",\n Strings.toString(seekerId),\n unicode\"\\n\\nšŸ“¦ A unique random value which secures this message: \",\n Strings.toHexString(uint256(nonce), 32)\n );\n }\n}\n" + }, + "contracts/SeekerPowerOracle.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nimport \"./interfaces/ISeekerPowerOracle.sol\";\n\n/**\n * @notice Acts as a source of information for Seeker Powers. Allows setting\n * a Seeker's power level via a restricted oracle account call. Seeker Power can also\n * be set by any account if the correct Oracle signature proof is provided.\n */\ncontract SeekerPowerOracle is ISeekerPowerOracle, Initializable, Ownable2StepUpgradeable, ERC165 {\n /**\n * @notice The oracle account. This contract accepts any attestations of\n * Seeker power that have been signed by this account.\n */\n address public oracle;\n\n /**\n * @notice Tracks nonce used when register the Seeker power to\n * prevent signature re-use.\n */\n mapping(bytes32 => address) private proofNonces;\n\n /**\n * @notice Tracks the set of Seeker Power levels.\n */\n mapping(uint256 => uint256) public seekerPowers;\n\n event SeekerPowerUpdated(uint256 indexed seekerId, uint256 indexed power);\n\n error UnauthorizedRegisterSeekerPowerCall();\n error NonceCannotBeReused();\n\n function initialize(address _oracle) external initializer {\n Ownable2StepUpgradeable.__Ownable2Step_init();\n\n oracle = _oracle;\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(ISeekerPowerOracle).interfaceId;\n }\n\n /**\n * @notice Sets the oracle account.\n * @param _oracle The oracle account.\n */\n function setOracle(address _oracle) external onlyOwner {\n oracle = _oracle;\n }\n\n /**\n * @notice Registers a Seeker's power level. Only callable by the\n * owner or the oracle account.\n * @param seekerId The id of the Seeker.\n * @param power The power level of the Seeker.\n */\n function registerSeekerPowerRestricted(uint256 seekerId, uint256 power) external {\n if (msg.sender != oracle) {\n revert UnauthorizedRegisterSeekerPowerCall();\n }\n\n seekerPowers[seekerId] = power;\n emit SeekerPowerUpdated(seekerId, power);\n }\n\n /**\n * @notice Registers a Seeker's power level. Callable by any account\n * but requires a proof signed by the oracle.\n * @param seekerId The id of the Seeker.\n * @param power The power level of the Seeker.\n */\n function registerSeekerPower(\n uint256 seekerId,\n uint256 power,\n bytes32 nonce,\n bytes calldata proof\n ) external {\n if (proofNonces[nonce] != address(0)) {\n revert NonceCannotBeReused();\n }\n\n bytes memory proofMessage = getProofMessage(seekerId, power, nonce);\n bytes32 ecdsaHash = ECDSA.toEthSignedMessageHash(proofMessage);\n\n if (ECDSA.recover(ecdsaHash, proof) != oracle) {\n revert UnauthorizedRegisterSeekerPowerCall();\n }\n\n seekerPowers[seekerId] = power;\n proofNonces[nonce] = oracle;\n\n emit SeekerPowerUpdated(seekerId, power);\n }\n\n /**\n * @notice Retrieves a Seeker's stored power level.\n * @param seekerId The id of the Seeker.\n */\n function getSeekerPower(uint256 seekerId) external view returns (uint256) {\n return seekerPowers[seekerId];\n }\n\n /**\n * @notice Constructs a proof message for the oracle to sign.\n * @param seekerId The id of the Seeker.\n * @param power The power level of the Seeker.\n */\n function getProofMessage(\n uint256 seekerId,\n uint256 power,\n bytes32 nonce\n ) public pure returns (bytes memory) {\n return\n abi.encodePacked(\n Strings.toString(seekerId),\n \":\",\n Strings.toString(power),\n \":\",\n Strings.toHexString(uint256(nonce), 32)\n );\n }\n}\n" + }, + "contracts/staking/Directory.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"./StakingManager.sol\";\nimport \"../libraries/SyloUtils.sol\";\nimport \"../libraries/Manageable.sol\";\nimport \"../interfaces/staking/IDirectory.sol\";\nimport \"../payments/ticketing/RewardsManager.sol\";\n\n/**\n * @notice The Directory contract constructs and manages a structure holding the current stakes,\n * which is queried against using the scan function. The scan function allows submitting\n * random points which will return a staked node's address in proportion to the stake it has.\n */\ncontract Directory is IDirectory, Initializable, Manageable, IERC165 {\n /** Sylo Staking Manager contract */\n StakingManager public _stakingManager;\n\n /** Sylo Rewards Manager contract */\n RewardsManager public _rewardsManager;\n\n /**\n * @notice The epoch ID of the current directory.\n */\n uint256 public currentDirectory;\n\n /**\n * @notice Tracks every directory, which will be indexed by an epoch ID\n */\n mapping(uint256 => EpochDirectory) public directories;\n\n event CurrentDirectoryUpdated(uint256 indexed currentDirectory);\n\n error NoStakeToJoinEpoch();\n error StakeeAlreadyJoinedEpoch();\n error StakeeCannotBeZeroAddress();\n error NoJoiningStakeToJoinEpoch();\n\n function initialize(\n StakingManager stakingManager,\n RewardsManager rewardsManager\n ) external initializer {\n SyloUtils.validateContractInterface(\n \"StakingManager\",\n address(stakingManager),\n type(IStakingManager).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"RewardsManager\",\n address(rewardsManager),\n type(IRewardsManager).interfaceId\n );\n\n Ownable2StepUpgradeable.__Ownable2Step_init();\n\n _stakingManager = stakingManager;\n _rewardsManager = rewardsManager;\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IDirectory).interfaceId;\n }\n\n /**\n * @notice This function should be called when a new epoch is initialized.\n * This will set the current directory to the specified epoch. This is only\n * callable by the owner of this contract, which should be the EpochsManager\n * contract.\n * @dev After deployment, the EpochsManager should immediately be set as\n * the owner.\n * @param epochId The ID of the specified epoch.\n */\n function setCurrentDirectory(uint256 epochId) external onlyManager {\n currentDirectory = epochId;\n emit CurrentDirectoryUpdated(epochId);\n }\n\n /**\n * @notice This function is called by the epochs manager as a prerequisite to when the node joins the next epoch.\n * @param stakee The address of the node.\n * @param seekerId The seekerId of the Seeker that the node is\n * registered with when joining the epoch. It is used to determine the nodes\n * staking capacity based on its seeker power.\n *\n * @dev This will construct the directory as nodes join. The directory is constructed\n * by creating a boundary value which is a sum of the current directory's total stake, and\n * the current stakee's total stake, and pushing the new boundary into the entries array.\n * The previous boundary and the current boundary essentially create a range, where if a\n * random point were to fall within that range, it would belong to the respective stakee.\n * The boundary value grows in size as each stakee joins, thus the directory array\n * always remains sorted. This allows us to perform a binary search on the directory.\n *\n * Example\n *\n * Stakes: [ Alice/20, Bob/10, Carl/40, Dave/25 ]\n * TotalStake: 95\n *\n * EpochDirectory:\n *\n * |-----------|------|----------------|--------|\n * Alice/20 Bob/30 Carl/70 Dave/95\n */\n function joinNextDirectory(address stakee, uint256 seekerId) external onlyManager {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n\n uint256 nextEpochId = currentDirectory + 1;\n\n uint256 totalStake = _stakingManager.getStakeeTotalManagedStake(stakee);\n if (totalStake == 0) {\n revert NoStakeToJoinEpoch();\n }\n\n uint256 seekerStakingCapacity = _stakingManager.calculateCapacityFromSeekerPower(seekerId);\n\n // we take the minimum value between the total stake and the current\n // staking capacity\n if (totalStake > seekerStakingCapacity) {\n totalStake = seekerStakingCapacity;\n }\n\n uint256 currentStake = _stakingManager.getCurrentStakerAmount(stakee, stakee);\n\n uint16 ownedStakeProportion = SyloUtils.asPerc(\n SafeCast.toUint128(currentStake),\n totalStake\n );\n\n uint16 minimumStakeProportion = _stakingManager.minimumStakeProportion();\n\n uint256 joiningStake;\n if (ownedStakeProportion >= minimumStakeProportion) {\n joiningStake = totalStake;\n } else {\n // if the node is below the minimum stake proportion, then we reduce\n // the stake used to join the epoch proportionally\n joiningStake = (totalStake * ownedStakeProportion) / minimumStakeProportion;\n }\n if (joiningStake == 0) {\n revert NoJoiningStakeToJoinEpoch();\n }\n\n if (directories[nextEpochId].stakes[stakee] > 0) {\n revert StakeeAlreadyJoinedEpoch();\n }\n\n uint256 nextBoundary = directories[nextEpochId].totalStake + joiningStake;\n\n directories[nextEpochId].entries.push(DirectoryEntry(stakee, nextBoundary));\n directories[nextEpochId].stakes[stakee] = joiningStake;\n directories[nextEpochId].totalStake = nextBoundary;\n }\n\n /**\n * @notice Call this to perform a stake-weighted scan to find the Node assigned\n * to the given point of the current directory.\n * @param point The point, which will usually be a hash of a public key.\n */\n function scan(uint128 point) external view returns (address stakee) {\n return _scan(point, currentDirectory);\n }\n\n /**\n * @notice Call this to perform a stake-weighted scan to find the Node assigned\n * to the given point of the requested directory.\n * @param point The point, which will usually be a hash of a public key.\n * @param epochId The epoch id associated with the directory to scan.\n */\n function scanWithEpochId(\n uint128 point,\n uint256 epochId\n ) external view returns (address stakee) {\n return _scan(point, epochId);\n }\n\n /**\n * @notice Call this to perform a stake-weighted scan to find the Node assigned\n * to the given point of the requested directory (internal).\n * @dev The current implementation will perform a binary search through\n * the directory. This can allow gas costs to be low if this needs to be\n * used in a transaction.\n * @param point The point, which will usually be a hash of a public key.\n * @param epochId The epoch id associated with the directory to scan.\n */\n function _scan(uint128 point, uint256 epochId) internal view returns (address stakee) {\n uint256 entryLength = directories[epochId].entries.length;\n\n if (entryLength == 0) {\n return address(0);\n }\n\n // Staking all the Sylo would only be 94 bits, so multiplying this with\n // a uint128 cannot overflow a uint256.\n uint256 expectedVal = (directories[epochId].totalStake * uint256(point)) >> 128;\n\n uint256 left;\n uint256 right = entryLength - 1;\n\n // perform a binary search through the directory\n uint256 lower;\n uint256 upper;\n uint256 index;\n\n while (left <= right) {\n index = (left + right) >> 1;\n\n lower = index == 0 ? 0 : directories[epochId].entries[index - 1].boundary;\n upper = directories[epochId].entries[index].boundary;\n\n if (expectedVal >= lower && expectedVal < upper) {\n return directories[epochId].entries[index].stakee;\n } else if (expectedVal < lower) {\n right = index - 1;\n } else {\n // expectedVal >= upper\n left = index + 1;\n }\n }\n }\n\n /**\n * @notice Retrieve the total stake a Node has for the directory in the\n * specified epoch.\n * @param epochId The ID of the epoch.\n * @param stakee The address of the Node.\n * @return The amount of stake the Node has for the given directory in SOLO.\n */\n function getTotalStakeForStakee(\n uint256 epochId,\n address stakee\n ) external view returns (uint256) {\n return directories[epochId].stakes[stakee];\n }\n\n /**\n * @notice Retrieve the total stake for a directory in the specified epoch, which\n * will be the sum of the stakes for all Nodes participating in that epoch.\n * @param epochId The ID of the epoch.\n * @return The total amount of stake in SOLO.\n */\n function getTotalStake(uint256 epochId) external view returns (uint256) {\n return directories[epochId].totalStake;\n }\n\n /**\n * @notice Retrieve all entries for a directory in a specified epoch.\n * @return An array of all the directory entries.\n */\n function getEntries(\n uint256 epochId\n ) external view returns (address[] memory, uint256[] memory) {\n uint256 entryLength = directories[epochId].entries.length;\n\n address[] memory stakees = new address[](entryLength);\n uint256[] memory boundaries = new uint256[](entryLength);\n\n DirectoryEntry memory entry;\n DirectoryEntry[] memory entries = directories[epochId].entries;\n\n for (uint256 i; i < entryLength; ++i) {\n entry = entries[i];\n stakees[i] = entry.stakee;\n boundaries[i] = entry.boundary;\n }\n return (stakees, boundaries);\n }\n}\n" + }, + "contracts/staking/StakingManager.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\n\nimport \"../SyloToken.sol\";\nimport \"../libraries/SyloUtils.sol\";\nimport \"../epochs/EpochsManager.sol\";\nimport \"../payments/ticketing/RewardsManager.sol\";\nimport \"../interfaces/staking/IStakingManager.sol\";\nimport \"../interfaces/ISeekerPowerOracle.sol\";\n\n/**\n * @notice Manages stakes and delegated stakes for Nodes. Holding\n * staked Sylo is necessary for a Node to participate in the\n * Sylo Network. The stake is used in stake-weighted scan function,\n * and delegated stakers are rewarded on a pro-rata basis.\n */\ncontract StakingManager is IStakingManager, Initializable, Ownable2StepUpgradeable, ERC165 {\n // The maximum possible SYLO that exists in the network. Naturally\n // represents the maximum possible SYLO that can be staked.\n uint256 internal constant MAX_SYLO = 10_000_000_000 ether;\n\n /** ERC 20 compatible token we are dealing with */\n IERC20 public _token;\n\n /**\n * @notice Rewards Manager contract. Any changes to stake will automatically\n * trigger a claim to any outstanding rewards.\n */\n RewardsManager public _rewardsManager;\n\n EpochsManager public _epochsManager;\n\n ISeekerPowerOracle public _seekerPowerOracle;\n\n /**\n * @notice Tracks the managed stake for every Node.\n */\n mapping(address => Stake) public stakes;\n\n /** @notice Tracks overall total stake held by this contract */\n uint256 public totalManagedStake;\n\n /**\n * @notice Tracks funds that are in the process of being unlocked. This\n * is indexed by a key that hashes both the address of the staked Node and\n * the address of the staker.\n */\n mapping(bytes32 => Unlock) public unlockings;\n\n /**\n * @notice The number of blocks a user must wait after calling \"unlock\"\n * before they can withdraw their stake\n */\n uint256 public unlockDuration;\n\n /**\n * @notice Minimum amount of stake that a Node needs to stake\n * against itself in order to participate in the network. This is\n * represented as a percentage of the Node's total stake, where\n * the value is a ratio of 10000.\n */\n uint16 public minimumStakeProportion;\n\n /**\n * @notice The multiplier used in determining a Seeker's staking\n * capacity based on its power level.\n */\n uint256 public seekerPowerMultiplier;\n\n event UnlockDurationUpdated(uint256 unlockDuration);\n event MinimumStakeProportionUpdated(uint256 minimumStakeProportion);\n\n error NoStakeToUnlock();\n error StakeNotYetUnlocked();\n error CannotStakeZeroAmount();\n error CannotUnlockZeroAmount();\n error TokenCannotBeZeroAddress();\n error StakeeCannotBeZeroAddress();\n error UnlockDurationCannotBeZero();\n error CannotCancelUnlockZeroAmount();\n error CannotUnlockMoreThanStaked(uint256 stakeAmount, uint256 unlockAmount);\n error StakeCapacityReached(uint256 maxCapacity, uint256 currentCapacity);\n error SeekerPowerNotRegistered(uint256 seekerId);\n\n function initialize(\n IERC20 token,\n RewardsManager rewardsManager,\n EpochsManager epochsManager,\n ISeekerPowerOracle seekerPowerOracle,\n uint256 _unlockDuration,\n uint16 _minimumStakeProportion,\n uint256 _seekerPowerMultiplier\n ) external initializer {\n if (address(token) == address(0)) {\n revert TokenCannotBeZeroAddress();\n }\n\n SyloUtils.validateContractInterface(\n \"RewardsManager\",\n address(rewardsManager),\n type(IRewardsManager).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"EpochsManager\",\n address(epochsManager),\n type(IEpochsManager).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"SeekerPowerOracle\",\n address(seekerPowerOracle),\n type(ISeekerPowerOracle).interfaceId\n );\n\n if (_unlockDuration == 0) {\n revert UnlockDurationCannotBeZero();\n }\n\n Ownable2StepUpgradeable.__Ownable2Step_init();\n\n _token = token;\n _rewardsManager = rewardsManager;\n _epochsManager = epochsManager;\n _seekerPowerOracle = seekerPowerOracle;\n unlockDuration = _unlockDuration;\n minimumStakeProportion = _minimumStakeProportion;\n seekerPowerMultiplier = _seekerPowerMultiplier;\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IStakingManager).interfaceId;\n }\n\n /**\n * @notice Sets the unlock duration for stakes. Only callable by\n * the owner.\n * @param _unlockDuration The unlock duration in number of blocks.\n */\n function setUnlockDuration(uint256 _unlockDuration) external onlyOwner {\n if (_unlockDuration == 0) {\n revert UnlockDurationCannotBeZero();\n }\n\n unlockDuration = _unlockDuration;\n emit UnlockDurationUpdated(_unlockDuration);\n }\n\n /**\n * @notice Sets the minimum stake proportion for Nodes. Only callable by\n * the owner.\n * @param _minimumStakeProportion The minimum stake proportion in SOLO.\n */\n function setMinimumStakeProportion(uint16 _minimumStakeProportion) external onlyOwner {\n minimumStakeProportion = _minimumStakeProportion;\n emit MinimumStakeProportionUpdated(_minimumStakeProportion);\n }\n\n /**\n * @notice Called by Nodes and delegated stakers to add stake.\n * This function will fail under the following conditions:\n * - If the Node address is invalid\n * - If the specified stake value is zero\n * - If the additional stake causes the Node to fail to meet the\n * minimum stake proportion requirement.\n * @param amount The amount of stake to add in SOLO.\n * @param stakee The address of the staked Node.\n */\n function addStake(uint256 amount, address stakee) external {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n if (amount == 0) {\n revert CannotStakeZeroAmount();\n }\n\n _addStake(amount, stakee);\n SafeERC20.safeTransferFrom(_token, msg.sender, address(this), amount);\n }\n\n function _addStake(uint256 amount, address stakee) internal {\n // automatically move any pending rewards generated by their existing stake\n _rewardsManager.updatePendingRewards(stakee, msg.sender);\n\n uint256 currentEpochId = _epochsManager.currentIteration();\n\n Stake storage stake = stakes[stakee];\n\n uint256 currentStake = getCurrentStakerAmount(stakee, msg.sender);\n\n stake.stakeEntries[msg.sender] = StakeEntry(\n currentStake + amount,\n block.number,\n currentEpochId\n );\n\n stake.totalManagedStake = stake.totalManagedStake + amount;\n totalManagedStake = totalManagedStake + amount;\n }\n\n /**\n * @notice Call this function to begin the unlocking process. Calling this\n * will trigger an automatic claim of any outstanding staking rewards. Any\n * stake that was already in the unlocking phase will have the specified\n * amount added to it, and its duration refreshed. This function will fail\n * under the following conditions:\n * - If no stake exists for the caller\n * - If the unlock amount is zero\n * - If the unlock amount is more than what is staked\n * Note: If calling as a Node, this function will *not* revert if it causes\n * the Node to fail to meet the minimum stake proportion. However it will still\n * prevent the Node from participating in the network until the minimum is met\n * again.\n * @param amount The amount of stake to unlock in SOLO.\n * @param stakee The address of the staked Node.\n */\n function unlockStake(uint256 amount, address stakee) external returns (uint256) {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n if (amount == 0) {\n revert CannotUnlockZeroAmount();\n }\n\n uint256 currentStake = getCurrentStakerAmount(stakee, msg.sender);\n\n if (currentStake == 0) {\n revert NoStakeToUnlock();\n }\n if (currentStake < amount) {\n revert CannotUnlockMoreThanStaked(currentStake, amount);\n }\n\n // automatically move any pending rewards generated by their existing stake\n _rewardsManager.updatePendingRewards(stakee, msg.sender);\n\n uint256 currentEpochId = _epochsManager.currentIteration();\n\n Stake storage stake = stakes[stakee];\n\n stake.stakeEntries[msg.sender] = StakeEntry(\n currentStake - amount,\n block.number,\n currentEpochId\n );\n\n stake.totalManagedStake = stake.totalManagedStake - amount;\n totalManagedStake = totalManagedStake - amount;\n\n bytes32 key = getKey(stakee, msg.sender);\n\n // Keep track of when the stake can be withdrawn\n Unlock storage unlock = unlockings[key];\n\n uint256 unlockAt = block.number + unlockDuration;\n if (unlock.unlockAt < unlockAt) {\n unlock.unlockAt = unlockAt;\n }\n\n unlock.amount = unlock.amount + amount;\n\n return unlockAt;\n }\n\n /**\n * @notice Call this function to withdraw stake that has finished unlocking.\n * This will fail if the stake has not yet unlocked.\n * @param stakee The address of the staked Node.\n */\n function withdrawStake(address stakee) external {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n\n bytes32 key = getKey(stakee, msg.sender);\n\n Unlock storage unlock = unlockings[key];\n\n if (unlock.unlockAt >= block.number) {\n revert StakeNotYetUnlocked();\n }\n\n uint256 amount = unlock.amount;\n\n delete unlockings[key];\n\n SafeERC20.safeTransfer(_token, msg.sender, amount);\n }\n\n /**\n * @notice Call this function to cancel any stake that is in the process\n * of unlocking. As this essentially adds back stake to the Node, this\n * will trigger an automatic claim of any outstanding staking rewards.\n * If the specified amount to cancel is greater than the stake that is\n * currently being unlocked, it will cancel the maximum stake possible.\n * @param amount The amount of unlocking stake to cancel in SOLO.\n * @param stakee The address of the staked Node.\n */\n function cancelUnlocking(uint256 amount, address stakee) external {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n if (amount == 0) {\n revert CannotCancelUnlockZeroAmount();\n }\n\n bytes32 key = getKey(stakee, msg.sender);\n\n Unlock storage unlock = unlockings[key];\n\n if (amount >= unlock.amount) {\n amount = unlock.amount;\n delete unlockings[key];\n } else {\n unlock.amount = unlock.amount - amount;\n }\n\n _addStake(amount, stakee);\n }\n\n /**\n * @notice This function determines the staking capacity of\n * a Seeker based on its power level. The method will revert if\n * the Seeker's power level has not been registered with the oracle.\n *\n * Currently the algorithm is as follows:\n * staking_capacity = seeker_power^2\n */\n function calculateCapacityFromSeekerPower(uint256 seekerId) external view returns (uint256) {\n uint256 seekerPower = _seekerPowerOracle.getSeekerPower(seekerId);\n if (seekerPower == 0) {\n revert SeekerPowerNotRegistered(seekerId);\n }\n\n // If the Seeker Power is already\n // at the maximum sylo, then we just return the max sylo value directly.\n if (seekerPower >= MAX_SYLO) {\n return MAX_SYLO;\n }\n\n uint256 capacity = seekerPower * seekerPowerMultiplier;\n\n return capacity > MAX_SYLO ? MAX_SYLO : capacity;\n }\n\n /**\n * @notice This function should be called by clients to determine how much\n * additional delegated stake can be allocated to a Node via an addStake or\n * cancelUnlocking call. This is useful to avoid a revert due to\n * the minimum stake proportion requirement not being met from the additional stake.\n * @param stakee The address of the staked Node.\n */\n function calculateMaxAdditionalDelegatedStake(address stakee) external view returns (uint256) {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n\n Stake storage stake = stakes[stakee];\n\n uint256 currentlyOwnedStake = stake.stakeEntries[stakee].amount;\n uint256 totalMaxStake = (currentlyOwnedStake * SyloUtils.PERCENTAGE_DENOMINATOR) /\n minimumStakeProportion;\n\n if (totalMaxStake < stake.totalManagedStake) {\n revert StakeCapacityReached(totalMaxStake, stake.totalManagedStake);\n }\n\n return totalMaxStake - stake.totalManagedStake;\n }\n\n /**\n * @notice Retrieve the key used to index a stake entry. The key is a hash\n * which takes both address of the Node and the staker as input.\n * @param stakee The address of the staked Node.\n * @param staker The address of the staker.\n * @return A byte-array representing the key.\n */\n function getKey(address stakee, address staker) public pure returns (bytes32) {\n return keccak256(abi.encodePacked(stakee, staker));\n }\n\n /**\n * @notice Retrieve the total stake being managed by this contract.\n * @return The total amount of managed stake in SOLO.\n */\n function getTotalManagedStake() external view returns (uint256) {\n return totalManagedStake;\n }\n\n /**\n * @notice Retrieve a stake entry.\n * @param stakee The address of the staked Node.\n * @param staker The address of the staker.\n * @return The stake entry.\n */\n function getStakeEntry(\n address stakee,\n address staker\n ) external view returns (StakeEntry memory) {\n return stakes[stakee].stakeEntries[staker];\n }\n\n /**\n * @notice Retrieve the total amount of SOLO staked against a Node.\n * @param stakee The address of the staked Node.\n * @return The amount of staked SOLO.\n */\n function getStakeeTotalManagedStake(address stakee) external view returns (uint256) {\n return stakes[stakee].totalManagedStake;\n }\n\n /**\n * @notice Check if a Node is meeting the minimum stake proportion requirement.\n * @param stakee The address of the staked Node.\n * @return True if the Node is meeting minimum stake proportion requirement.\n */\n function checkMinimumStakeProportion(address stakee) public view returns (bool) {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n\n Stake storage stake = stakes[stakee];\n\n uint256 currentlyOwnedStake = stake.stakeEntries[stakee].amount;\n uint16 ownedStakeProportion = SyloUtils.asPerc(\n SafeCast.toUint128(currentlyOwnedStake),\n stake.totalManagedStake\n );\n\n return ownedStakeProportion >= minimumStakeProportion;\n }\n\n /**\n * @notice Retrieve the current amount of SOLO staked against a Node by\n * a specified staker.\n * @param stakee The address of the staked Node.\n * @param staker The address of the staker.\n * @return The amount of staked SOLO.\n */\n function getCurrentStakerAmount(address stakee, address staker) public view returns (uint256) {\n return stakes[stakee].stakeEntries[staker].amount;\n }\n}\n" + }, + "contracts/SyloToken.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract SyloToken is ERC20 {\n constructor() ERC20(\"Sylo\", \"SYLO\") {\n _mint(msg.sender, 10_000_000_000 ether);\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/deployments/porcini-dev/solcInputs/76c1e1f3445d6d518cb33f614f9922c9.json b/deployments/porcini-dev/solcInputs/76c1e1f3445d6d518cb33f614f9922c9.json new file mode 100644 index 00000000..95bbf7ee --- /dev/null +++ b/deployments/porcini-dev/solcInputs/76c1e1f3445d6d518cb33f614f9922c9.json @@ -0,0 +1,161 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./OwnableUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership} and {acceptOwnership}.\n *\n * This module is used through inheritance. It will make available all functions\n * from parent (Ownable).\n */\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\n function __Ownable2Step_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable2Step_init_unchained() internal onlyInitializing {\n }\n address private _pendingOwner;\n\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Returns the address of the pending owner.\n */\n function pendingOwner() public view virtual returns (address) {\n return _pendingOwner;\n }\n\n /**\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual override onlyOwner {\n _pendingOwner = newOwner;\n emit OwnershipTransferStarted(owner(), newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual override {\n delete _pendingOwner;\n super._transferOwnership(newOwner);\n }\n\n /**\n * @dev The new owner accepts the ownership transfer.\n */\n function acceptOwnership() public virtual {\n address sender = _msgSender();\n require(pendingOwner() == sender, \"Ownable2Step: caller is not the new owner\");\n _transferOwnership(sender);\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/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n /**\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/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/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/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/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/extensions/IERC20Permit.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 IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/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/ERC20/utils/SafeERC20.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 \"../IERC20.sol\";\nimport \"../extensions/IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.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(IERC20 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(IERC20 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(IERC20 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(IERC20 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(IERC20 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 IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n 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(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\n }\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/cryptography/ECDSA.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 \"../Strings.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 ECDSA {\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\", Strings.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/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/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/math/Math.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 Math {\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/utils/math/SafeCast.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n *\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\n * all math on `uint256` and `int256` and then downcasting.\n */\nlibrary SafeCast {\n /**\n * @dev Returns the downcasted uint248 from uint256, reverting on\n * overflow (when the input is greater than largest uint248).\n *\n * Counterpart to Solidity's `uint248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n *\n * _Available since v4.7._\n */\n function toUint248(uint256 value) internal pure returns (uint248) {\n require(value <= type(uint248).max, \"SafeCast: value doesn't fit in 248 bits\");\n return uint248(value);\n }\n\n /**\n * @dev Returns the downcasted uint240 from uint256, reverting on\n * overflow (when the input is greater than largest uint240).\n *\n * Counterpart to Solidity's `uint240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n *\n * _Available since v4.7._\n */\n function toUint240(uint256 value) internal pure returns (uint240) {\n require(value <= type(uint240).max, \"SafeCast: value doesn't fit in 240 bits\");\n return uint240(value);\n }\n\n /**\n * @dev Returns the downcasted uint232 from uint256, reverting on\n * overflow (when the input is greater than largest uint232).\n *\n * Counterpart to Solidity's `uint232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n *\n * _Available since v4.7._\n */\n function toUint232(uint256 value) internal pure returns (uint232) {\n require(value <= type(uint232).max, \"SafeCast: value doesn't fit in 232 bits\");\n return uint232(value);\n }\n\n /**\n * @dev Returns the downcasted uint224 from uint256, reverting on\n * overflow (when the input is greater than largest uint224).\n *\n * Counterpart to Solidity's `uint224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n *\n * _Available since v4.2._\n */\n function toUint224(uint256 value) internal pure returns (uint224) {\n require(value <= type(uint224).max, \"SafeCast: value doesn't fit in 224 bits\");\n return uint224(value);\n }\n\n /**\n * @dev Returns the downcasted uint216 from uint256, reverting on\n * overflow (when the input is greater than largest uint216).\n *\n * Counterpart to Solidity's `uint216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n *\n * _Available since v4.7._\n */\n function toUint216(uint256 value) internal pure returns (uint216) {\n require(value <= type(uint216).max, \"SafeCast: value doesn't fit in 216 bits\");\n return uint216(value);\n }\n\n /**\n * @dev Returns the downcasted uint208 from uint256, reverting on\n * overflow (when the input is greater than largest uint208).\n *\n * Counterpart to Solidity's `uint208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n *\n * _Available since v4.7._\n */\n function toUint208(uint256 value) internal pure returns (uint208) {\n require(value <= type(uint208).max, \"SafeCast: value doesn't fit in 208 bits\");\n return uint208(value);\n }\n\n /**\n * @dev Returns the downcasted uint200 from uint256, reverting on\n * overflow (when the input is greater than largest uint200).\n *\n * Counterpart to Solidity's `uint200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n *\n * _Available since v4.7._\n */\n function toUint200(uint256 value) internal pure returns (uint200) {\n require(value <= type(uint200).max, \"SafeCast: value doesn't fit in 200 bits\");\n return uint200(value);\n }\n\n /**\n * @dev Returns the downcasted uint192 from uint256, reverting on\n * overflow (when the input is greater than largest uint192).\n *\n * Counterpart to Solidity's `uint192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n *\n * _Available since v4.7._\n */\n function toUint192(uint256 value) internal pure returns (uint192) {\n require(value <= type(uint192).max, \"SafeCast: value doesn't fit in 192 bits\");\n return uint192(value);\n }\n\n /**\n * @dev Returns the downcasted uint184 from uint256, reverting on\n * overflow (when the input is greater than largest uint184).\n *\n * Counterpart to Solidity's `uint184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n *\n * _Available since v4.7._\n */\n function toUint184(uint256 value) internal pure returns (uint184) {\n require(value <= type(uint184).max, \"SafeCast: value doesn't fit in 184 bits\");\n return uint184(value);\n }\n\n /**\n * @dev Returns the downcasted uint176 from uint256, reverting on\n * overflow (when the input is greater than largest uint176).\n *\n * Counterpart to Solidity's `uint176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n *\n * _Available since v4.7._\n */\n function toUint176(uint256 value) internal pure returns (uint176) {\n require(value <= type(uint176).max, \"SafeCast: value doesn't fit in 176 bits\");\n return uint176(value);\n }\n\n /**\n * @dev Returns the downcasted uint168 from uint256, reverting on\n * overflow (when the input is greater than largest uint168).\n *\n * Counterpart to Solidity's `uint168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n *\n * _Available since v4.7._\n */\n function toUint168(uint256 value) internal pure returns (uint168) {\n require(value <= type(uint168).max, \"SafeCast: value doesn't fit in 168 bits\");\n return uint168(value);\n }\n\n /**\n * @dev Returns the downcasted uint160 from uint256, reverting on\n * overflow (when the input is greater than largest uint160).\n *\n * Counterpart to Solidity's `uint160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n *\n * _Available since v4.7._\n */\n function toUint160(uint256 value) internal pure returns (uint160) {\n require(value <= type(uint160).max, \"SafeCast: value doesn't fit in 160 bits\");\n return uint160(value);\n }\n\n /**\n * @dev Returns the downcasted uint152 from uint256, reverting on\n * overflow (when the input is greater than largest uint152).\n *\n * Counterpart to Solidity's `uint152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n *\n * _Available since v4.7._\n */\n function toUint152(uint256 value) internal pure returns (uint152) {\n require(value <= type(uint152).max, \"SafeCast: value doesn't fit in 152 bits\");\n return uint152(value);\n }\n\n /**\n * @dev Returns the downcasted uint144 from uint256, reverting on\n * overflow (when the input is greater than largest uint144).\n *\n * Counterpart to Solidity's `uint144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n *\n * _Available since v4.7._\n */\n function toUint144(uint256 value) internal pure returns (uint144) {\n require(value <= type(uint144).max, \"SafeCast: value doesn't fit in 144 bits\");\n return uint144(value);\n }\n\n /**\n * @dev Returns the downcasted uint136 from uint256, reverting on\n * overflow (when the input is greater than largest uint136).\n *\n * Counterpart to Solidity's `uint136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n *\n * _Available since v4.7._\n */\n function toUint136(uint256 value) internal pure returns (uint136) {\n require(value <= type(uint136).max, \"SafeCast: value doesn't fit in 136 bits\");\n return uint136(value);\n }\n\n /**\n * @dev Returns the downcasted uint128 from uint256, reverting on\n * overflow (when the input is greater than largest uint128).\n *\n * Counterpart to Solidity's `uint128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v2.5._\n */\n function toUint128(uint256 value) internal pure returns (uint128) {\n require(value <= type(uint128).max, \"SafeCast: value doesn't fit in 128 bits\");\n return uint128(value);\n }\n\n /**\n * @dev Returns the downcasted uint120 from uint256, reverting on\n * overflow (when the input is greater than largest uint120).\n *\n * Counterpart to Solidity's `uint120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n *\n * _Available since v4.7._\n */\n function toUint120(uint256 value) internal pure returns (uint120) {\n require(value <= type(uint120).max, \"SafeCast: value doesn't fit in 120 bits\");\n return uint120(value);\n }\n\n /**\n * @dev Returns the downcasted uint112 from uint256, reverting on\n * overflow (when the input is greater than largest uint112).\n *\n * Counterpart to Solidity's `uint112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n *\n * _Available since v4.7._\n */\n function toUint112(uint256 value) internal pure returns (uint112) {\n require(value <= type(uint112).max, \"SafeCast: value doesn't fit in 112 bits\");\n return uint112(value);\n }\n\n /**\n * @dev Returns the downcasted uint104 from uint256, reverting on\n * overflow (when the input is greater than largest uint104).\n *\n * Counterpart to Solidity's `uint104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n *\n * _Available since v4.7._\n */\n function toUint104(uint256 value) internal pure returns (uint104) {\n require(value <= type(uint104).max, \"SafeCast: value doesn't fit in 104 bits\");\n return uint104(value);\n }\n\n /**\n * @dev Returns the downcasted uint96 from uint256, reverting on\n * overflow (when the input is greater than largest uint96).\n *\n * Counterpart to Solidity's `uint96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n *\n * _Available since v4.2._\n */\n function toUint96(uint256 value) internal pure returns (uint96) {\n require(value <= type(uint96).max, \"SafeCast: value doesn't fit in 96 bits\");\n return uint96(value);\n }\n\n /**\n * @dev Returns the downcasted uint88 from uint256, reverting on\n * overflow (when the input is greater than largest uint88).\n *\n * Counterpart to Solidity's `uint88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n *\n * _Available since v4.7._\n */\n function toUint88(uint256 value) internal pure returns (uint88) {\n require(value <= type(uint88).max, \"SafeCast: value doesn't fit in 88 bits\");\n return uint88(value);\n }\n\n /**\n * @dev Returns the downcasted uint80 from uint256, reverting on\n * overflow (when the input is greater than largest uint80).\n *\n * Counterpart to Solidity's `uint80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n *\n * _Available since v4.7._\n */\n function toUint80(uint256 value) internal pure returns (uint80) {\n require(value <= type(uint80).max, \"SafeCast: value doesn't fit in 80 bits\");\n return uint80(value);\n }\n\n /**\n * @dev Returns the downcasted uint72 from uint256, reverting on\n * overflow (when the input is greater than largest uint72).\n *\n * Counterpart to Solidity's `uint72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n *\n * _Available since v4.7._\n */\n function toUint72(uint256 value) internal pure returns (uint72) {\n require(value <= type(uint72).max, \"SafeCast: value doesn't fit in 72 bits\");\n return uint72(value);\n }\n\n /**\n * @dev Returns the downcasted uint64 from uint256, reverting on\n * overflow (when the input is greater than largest uint64).\n *\n * Counterpart to Solidity's `uint64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v2.5._\n */\n function toUint64(uint256 value) internal pure returns (uint64) {\n require(value <= type(uint64).max, \"SafeCast: value doesn't fit in 64 bits\");\n return uint64(value);\n }\n\n /**\n * @dev Returns the downcasted uint56 from uint256, reverting on\n * overflow (when the input is greater than largest uint56).\n *\n * Counterpart to Solidity's `uint56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n *\n * _Available since v4.7._\n */\n function toUint56(uint256 value) internal pure returns (uint56) {\n require(value <= type(uint56).max, \"SafeCast: value doesn't fit in 56 bits\");\n return uint56(value);\n }\n\n /**\n * @dev Returns the downcasted uint48 from uint256, reverting on\n * overflow (when the input is greater than largest uint48).\n *\n * Counterpart to Solidity's `uint48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n *\n * _Available since v4.7._\n */\n function toUint48(uint256 value) internal pure returns (uint48) {\n require(value <= type(uint48).max, \"SafeCast: value doesn't fit in 48 bits\");\n return uint48(value);\n }\n\n /**\n * @dev Returns the downcasted uint40 from uint256, reverting on\n * overflow (when the input is greater than largest uint40).\n *\n * Counterpart to Solidity's `uint40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n *\n * _Available since v4.7._\n */\n function toUint40(uint256 value) internal pure returns (uint40) {\n require(value <= type(uint40).max, \"SafeCast: value doesn't fit in 40 bits\");\n return uint40(value);\n }\n\n /**\n * @dev Returns the downcasted uint32 from uint256, reverting on\n * overflow (when the input is greater than largest uint32).\n *\n * Counterpart to Solidity's `uint32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v2.5._\n */\n function toUint32(uint256 value) internal pure returns (uint32) {\n require(value <= type(uint32).max, \"SafeCast: value doesn't fit in 32 bits\");\n return uint32(value);\n }\n\n /**\n * @dev Returns the downcasted uint24 from uint256, reverting on\n * overflow (when the input is greater than largest uint24).\n *\n * Counterpart to Solidity's `uint24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n *\n * _Available since v4.7._\n */\n function toUint24(uint256 value) internal pure returns (uint24) {\n require(value <= type(uint24).max, \"SafeCast: value doesn't fit in 24 bits\");\n return uint24(value);\n }\n\n /**\n * @dev Returns the downcasted uint16 from uint256, reverting on\n * overflow (when the input is greater than largest uint16).\n *\n * Counterpart to Solidity's `uint16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v2.5._\n */\n function toUint16(uint256 value) internal pure returns (uint16) {\n require(value <= type(uint16).max, \"SafeCast: value doesn't fit in 16 bits\");\n return uint16(value);\n }\n\n /**\n * @dev Returns the downcasted uint8 from uint256, reverting on\n * overflow (when the input is greater than largest uint8).\n *\n * Counterpart to Solidity's `uint8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n *\n * _Available since v2.5._\n */\n function toUint8(uint256 value) internal pure returns (uint8) {\n require(value <= type(uint8).max, \"SafeCast: value doesn't fit in 8 bits\");\n return uint8(value);\n }\n\n /**\n * @dev Converts a signed int256 into an unsigned uint256.\n *\n * Requirements:\n *\n * - input must be greater than or equal to 0.\n *\n * _Available since v3.0._\n */\n function toUint256(int256 value) internal pure returns (uint256) {\n require(value >= 0, \"SafeCast: value must be positive\");\n return uint256(value);\n }\n\n /**\n * @dev Returns the downcasted int248 from int256, reverting on\n * overflow (when the input is less than smallest int248 or\n * greater than largest int248).\n *\n * Counterpart to Solidity's `int248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n *\n * _Available since v4.7._\n */\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\n downcasted = int248(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 248 bits\");\n }\n\n /**\n * @dev Returns the downcasted int240 from int256, reverting on\n * overflow (when the input is less than smallest int240 or\n * greater than largest int240).\n *\n * Counterpart to Solidity's `int240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n *\n * _Available since v4.7._\n */\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\n downcasted = int240(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 240 bits\");\n }\n\n /**\n * @dev Returns the downcasted int232 from int256, reverting on\n * overflow (when the input is less than smallest int232 or\n * greater than largest int232).\n *\n * Counterpart to Solidity's `int232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n *\n * _Available since v4.7._\n */\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\n downcasted = int232(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 232 bits\");\n }\n\n /**\n * @dev Returns the downcasted int224 from int256, reverting on\n * overflow (when the input is less than smallest int224 or\n * greater than largest int224).\n *\n * Counterpart to Solidity's `int224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n *\n * _Available since v4.7._\n */\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\n downcasted = int224(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 224 bits\");\n }\n\n /**\n * @dev Returns the downcasted int216 from int256, reverting on\n * overflow (when the input is less than smallest int216 or\n * greater than largest int216).\n *\n * Counterpart to Solidity's `int216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n *\n * _Available since v4.7._\n */\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\n downcasted = int216(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 216 bits\");\n }\n\n /**\n * @dev Returns the downcasted int208 from int256, reverting on\n * overflow (when the input is less than smallest int208 or\n * greater than largest int208).\n *\n * Counterpart to Solidity's `int208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n *\n * _Available since v4.7._\n */\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\n downcasted = int208(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 208 bits\");\n }\n\n /**\n * @dev Returns the downcasted int200 from int256, reverting on\n * overflow (when the input is less than smallest int200 or\n * greater than largest int200).\n *\n * Counterpart to Solidity's `int200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n *\n * _Available since v4.7._\n */\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\n downcasted = int200(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 200 bits\");\n }\n\n /**\n * @dev Returns the downcasted int192 from int256, reverting on\n * overflow (when the input is less than smallest int192 or\n * greater than largest int192).\n *\n * Counterpart to Solidity's `int192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n *\n * _Available since v4.7._\n */\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\n downcasted = int192(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 192 bits\");\n }\n\n /**\n * @dev Returns the downcasted int184 from int256, reverting on\n * overflow (when the input is less than smallest int184 or\n * greater than largest int184).\n *\n * Counterpart to Solidity's `int184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n *\n * _Available since v4.7._\n */\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\n downcasted = int184(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 184 bits\");\n }\n\n /**\n * @dev Returns the downcasted int176 from int256, reverting on\n * overflow (when the input is less than smallest int176 or\n * greater than largest int176).\n *\n * Counterpart to Solidity's `int176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n *\n * _Available since v4.7._\n */\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\n downcasted = int176(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 176 bits\");\n }\n\n /**\n * @dev Returns the downcasted int168 from int256, reverting on\n * overflow (when the input is less than smallest int168 or\n * greater than largest int168).\n *\n * Counterpart to Solidity's `int168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n *\n * _Available since v4.7._\n */\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\n downcasted = int168(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 168 bits\");\n }\n\n /**\n * @dev Returns the downcasted int160 from int256, reverting on\n * overflow (when the input is less than smallest int160 or\n * greater than largest int160).\n *\n * Counterpart to Solidity's `int160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n *\n * _Available since v4.7._\n */\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\n downcasted = int160(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 160 bits\");\n }\n\n /**\n * @dev Returns the downcasted int152 from int256, reverting on\n * overflow (when the input is less than smallest int152 or\n * greater than largest int152).\n *\n * Counterpart to Solidity's `int152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n *\n * _Available since v4.7._\n */\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\n downcasted = int152(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 152 bits\");\n }\n\n /**\n * @dev Returns the downcasted int144 from int256, reverting on\n * overflow (when the input is less than smallest int144 or\n * greater than largest int144).\n *\n * Counterpart to Solidity's `int144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n *\n * _Available since v4.7._\n */\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\n downcasted = int144(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 144 bits\");\n }\n\n /**\n * @dev Returns the downcasted int136 from int256, reverting on\n * overflow (when the input is less than smallest int136 or\n * greater than largest int136).\n *\n * Counterpart to Solidity's `int136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n *\n * _Available since v4.7._\n */\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\n downcasted = int136(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 136 bits\");\n }\n\n /**\n * @dev Returns the downcasted int128 from int256, reverting on\n * overflow (when the input is less than smallest int128 or\n * greater than largest int128).\n *\n * Counterpart to Solidity's `int128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v3.1._\n */\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\n downcasted = int128(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 128 bits\");\n }\n\n /**\n * @dev Returns the downcasted int120 from int256, reverting on\n * overflow (when the input is less than smallest int120 or\n * greater than largest int120).\n *\n * Counterpart to Solidity's `int120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n *\n * _Available since v4.7._\n */\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\n downcasted = int120(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 120 bits\");\n }\n\n /**\n * @dev Returns the downcasted int112 from int256, reverting on\n * overflow (when the input is less than smallest int112 or\n * greater than largest int112).\n *\n * Counterpart to Solidity's `int112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n *\n * _Available since v4.7._\n */\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\n downcasted = int112(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 112 bits\");\n }\n\n /**\n * @dev Returns the downcasted int104 from int256, reverting on\n * overflow (when the input is less than smallest int104 or\n * greater than largest int104).\n *\n * Counterpart to Solidity's `int104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n *\n * _Available since v4.7._\n */\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\n downcasted = int104(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 104 bits\");\n }\n\n /**\n * @dev Returns the downcasted int96 from int256, reverting on\n * overflow (when the input is less than smallest int96 or\n * greater than largest int96).\n *\n * Counterpart to Solidity's `int96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n *\n * _Available since v4.7._\n */\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\n downcasted = int96(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 96 bits\");\n }\n\n /**\n * @dev Returns the downcasted int88 from int256, reverting on\n * overflow (when the input is less than smallest int88 or\n * greater than largest int88).\n *\n * Counterpart to Solidity's `int88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n *\n * _Available since v4.7._\n */\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\n downcasted = int88(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 88 bits\");\n }\n\n /**\n * @dev Returns the downcasted int80 from int256, reverting on\n * overflow (when the input is less than smallest int80 or\n * greater than largest int80).\n *\n * Counterpart to Solidity's `int80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n *\n * _Available since v4.7._\n */\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\n downcasted = int80(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 80 bits\");\n }\n\n /**\n * @dev Returns the downcasted int72 from int256, reverting on\n * overflow (when the input is less than smallest int72 or\n * greater than largest int72).\n *\n * Counterpart to Solidity's `int72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n *\n * _Available since v4.7._\n */\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\n downcasted = int72(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 72 bits\");\n }\n\n /**\n * @dev Returns the downcasted int64 from int256, reverting on\n * overflow (when the input is less than smallest int64 or\n * greater than largest int64).\n *\n * Counterpart to Solidity's `int64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v3.1._\n */\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\n downcasted = int64(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 64 bits\");\n }\n\n /**\n * @dev Returns the downcasted int56 from int256, reverting on\n * overflow (when the input is less than smallest int56 or\n * greater than largest int56).\n *\n * Counterpart to Solidity's `int56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n *\n * _Available since v4.7._\n */\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\n downcasted = int56(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 56 bits\");\n }\n\n /**\n * @dev Returns the downcasted int48 from int256, reverting on\n * overflow (when the input is less than smallest int48 or\n * greater than largest int48).\n *\n * Counterpart to Solidity's `int48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n *\n * _Available since v4.7._\n */\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\n downcasted = int48(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 48 bits\");\n }\n\n /**\n * @dev Returns the downcasted int40 from int256, reverting on\n * overflow (when the input is less than smallest int40 or\n * greater than largest int40).\n *\n * Counterpart to Solidity's `int40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n *\n * _Available since v4.7._\n */\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\n downcasted = int40(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 40 bits\");\n }\n\n /**\n * @dev Returns the downcasted int32 from int256, reverting on\n * overflow (when the input is less than smallest int32 or\n * greater than largest int32).\n *\n * Counterpart to Solidity's `int32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v3.1._\n */\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\n downcasted = int32(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 32 bits\");\n }\n\n /**\n * @dev Returns the downcasted int24 from int256, reverting on\n * overflow (when the input is less than smallest int24 or\n * greater than largest int24).\n *\n * Counterpart to Solidity's `int24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n *\n * _Available since v4.7._\n */\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\n downcasted = int24(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 24 bits\");\n }\n\n /**\n * @dev Returns the downcasted int16 from int256, reverting on\n * overflow (when the input is less than smallest int16 or\n * greater than largest int16).\n *\n * Counterpart to Solidity's `int16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v3.1._\n */\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\n downcasted = int16(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 16 bits\");\n }\n\n /**\n * @dev Returns the downcasted int8 from int256, reverting on\n * overflow (when the input is less than smallest int8 or\n * greater than largest int8).\n *\n * Counterpart to Solidity's `int8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n *\n * _Available since v3.1._\n */\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\n downcasted = int8(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 8 bits\");\n }\n\n /**\n * @dev Converts an unsigned uint256 into a signed int256.\n *\n * Requirements:\n *\n * - input must be less than or equal to maxInt256.\n *\n * _Available since v3.0._\n */\n function toInt256(uint256 value) internal pure returns (int256) {\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\n require(value <= uint256(type(int256).max), \"SafeCast: value doesn't fit in an int256\");\n return int256(value);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SignedMath.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 SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.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/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\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 = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _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(SignedMath.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n 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" + }, + "abdk-libraries-solidity/ABDKMath64x64.sol": { + "content": "// SPDX-License-Identifier: BSD-4-Clause\n/*\n * ABDK Math 64.64 Smart Contract Library. Copyright Ā© 2019 by ABDK Consulting.\n * Author: Mikhail Vladimirov \n */\npragma solidity ^0.8.0;\n\n/**\n * Smart contract library of mathematical functions operating with signed\n * 64.64-bit fixed point numbers. Signed 64.64-bit fixed point number is\n * basically a simple fraction whose numerator is signed 128-bit integer and\n * denominator is 2^64. As long as denominator is always the same, there is no\n * need to store it, thus in Solidity signed 64.64-bit fixed point numbers are\n * represented by int128 type holding only the numerator.\n */\nlibrary ABDKMath64x64 {\n /*\n * Minimum value signed 64.64-bit fixed point number may have. \n */\n int128 private constant MIN_64x64 = -0x80000000000000000000000000000000;\n\n /*\n * Maximum value signed 64.64-bit fixed point number may have. \n */\n int128 private constant MAX_64x64 = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;\n\n /**\n * Convert signed 256-bit integer number into signed 64.64-bit fixed point\n * number. Revert on overflow.\n *\n * @param x signed 256-bit integer number\n * @return signed 64.64-bit fixed point number\n */\n function fromInt (int256 x) internal pure returns (int128) {\n unchecked {\n require (x >= -0x8000000000000000 && x <= 0x7FFFFFFFFFFFFFFF);\n return int128 (x << 64);\n }\n }\n\n /**\n * Convert signed 64.64 fixed point number into signed 64-bit integer number\n * rounding down.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64-bit integer number\n */\n function toInt (int128 x) internal pure returns (int64) {\n unchecked {\n return int64 (x >> 64);\n }\n }\n\n /**\n * Convert unsigned 256-bit integer number into signed 64.64-bit fixed point\n * number. Revert on overflow.\n *\n * @param x unsigned 256-bit integer number\n * @return signed 64.64-bit fixed point number\n */\n function fromUInt (uint256 x) internal pure returns (int128) {\n unchecked {\n require (x <= 0x7FFFFFFFFFFFFFFF);\n return int128 (int256 (x << 64));\n }\n }\n\n /**\n * Convert signed 64.64 fixed point number into unsigned 64-bit integer\n * number rounding down. Revert on underflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @return unsigned 64-bit integer number\n */\n function toUInt (int128 x) internal pure returns (uint64) {\n unchecked {\n require (x >= 0);\n return uint64 (uint128 (x >> 64));\n }\n }\n\n /**\n * Convert signed 128.128 fixed point number into signed 64.64-bit fixed point\n * number rounding down. Revert on overflow.\n *\n * @param x signed 128.128-bin fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function from128x128 (int256 x) internal pure returns (int128) {\n unchecked {\n int256 result = x >> 64;\n require (result >= MIN_64x64 && result <= MAX_64x64);\n return int128 (result);\n }\n }\n\n /**\n * Convert signed 64.64 fixed point number into signed 128.128 fixed point\n * number.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 128.128 fixed point number\n */\n function to128x128 (int128 x) internal pure returns (int256) {\n unchecked {\n return int256 (x) << 64;\n }\n }\n\n /**\n * Calculate x + y. Revert on overflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @param y signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function add (int128 x, int128 y) internal pure returns (int128) {\n unchecked {\n int256 result = int256(x) + y;\n require (result >= MIN_64x64 && result <= MAX_64x64);\n return int128 (result);\n }\n }\n\n /**\n * Calculate x - y. Revert on overflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @param y signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function sub (int128 x, int128 y) internal pure returns (int128) {\n unchecked {\n int256 result = int256(x) - y;\n require (result >= MIN_64x64 && result <= MAX_64x64);\n return int128 (result);\n }\n }\n\n /**\n * Calculate x * y rounding down. Revert on overflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @param y signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function mul (int128 x, int128 y) internal pure returns (int128) {\n unchecked {\n int256 result = int256(x) * y >> 64;\n require (result >= MIN_64x64 && result <= MAX_64x64);\n return int128 (result);\n }\n }\n\n /**\n * Calculate x * y rounding towards zero, where x is signed 64.64 fixed point\n * number and y is signed 256-bit integer number. Revert on overflow.\n *\n * @param x signed 64.64 fixed point number\n * @param y signed 256-bit integer number\n * @return signed 256-bit integer number\n */\n function muli (int128 x, int256 y) internal pure returns (int256) {\n unchecked {\n if (x == MIN_64x64) {\n require (y >= -0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF &&\n y <= 0x1000000000000000000000000000000000000000000000000);\n return -y << 63;\n } else {\n bool negativeResult = false;\n if (x < 0) {\n x = -x;\n negativeResult = true;\n }\n if (y < 0) {\n y = -y; // We rely on overflow behavior here\n negativeResult = !negativeResult;\n }\n uint256 absoluteResult = mulu (x, uint256 (y));\n if (negativeResult) {\n require (absoluteResult <=\n 0x8000000000000000000000000000000000000000000000000000000000000000);\n return -int256 (absoluteResult); // We rely on overflow behavior here\n } else {\n require (absoluteResult <=\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\n return int256 (absoluteResult);\n }\n }\n }\n }\n\n /**\n * Calculate x * y rounding down, where x is signed 64.64 fixed point number\n * and y is unsigned 256-bit integer number. Revert on overflow.\n *\n * @param x signed 64.64 fixed point number\n * @param y unsigned 256-bit integer number\n * @return unsigned 256-bit integer number\n */\n function mulu (int128 x, uint256 y) internal pure returns (uint256) {\n unchecked {\n if (y == 0) return 0;\n\n require (x >= 0);\n\n uint256 lo = (uint256 (int256 (x)) * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) >> 64;\n uint256 hi = uint256 (int256 (x)) * (y >> 128);\n\n require (hi <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\n hi <<= 64;\n\n require (hi <=\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - lo);\n return hi + lo;\n }\n }\n\n /**\n * Calculate x / y rounding towards zero. Revert on overflow or when y is\n * zero.\n *\n * @param x signed 64.64-bit fixed point number\n * @param y signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function div (int128 x, int128 y) internal pure returns (int128) {\n unchecked {\n require (y != 0);\n int256 result = (int256 (x) << 64) / y;\n require (result >= MIN_64x64 && result <= MAX_64x64);\n return int128 (result);\n }\n }\n\n /**\n * Calculate x / y rounding towards zero, where x and y are signed 256-bit\n * integer numbers. Revert on overflow or when y is zero.\n *\n * @param x signed 256-bit integer number\n * @param y signed 256-bit integer number\n * @return signed 64.64-bit fixed point number\n */\n function divi (int256 x, int256 y) internal pure returns (int128) {\n unchecked {\n require (y != 0);\n\n bool negativeResult = false;\n if (x < 0) {\n x = -x; // We rely on overflow behavior here\n negativeResult = true;\n }\n if (y < 0) {\n y = -y; // We rely on overflow behavior here\n negativeResult = !negativeResult;\n }\n uint128 absoluteResult = divuu (uint256 (x), uint256 (y));\n if (negativeResult) {\n require (absoluteResult <= 0x80000000000000000000000000000000);\n return -int128 (absoluteResult); // We rely on overflow behavior here\n } else {\n require (absoluteResult <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\n return int128 (absoluteResult); // We rely on overflow behavior here\n }\n }\n }\n\n /**\n * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit\n * integer numbers. Revert on overflow or when y is zero.\n *\n * @param x unsigned 256-bit integer number\n * @param y unsigned 256-bit integer number\n * @return signed 64.64-bit fixed point number\n */\n function divu (uint256 x, uint256 y) internal pure returns (int128) {\n unchecked {\n require (y != 0);\n uint128 result = divuu (x, y);\n require (result <= uint128 (MAX_64x64));\n return int128 (result);\n }\n }\n\n /**\n * Calculate -x. Revert on overflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function neg (int128 x) internal pure returns (int128) {\n unchecked {\n require (x != MIN_64x64);\n return -x;\n }\n }\n\n /**\n * Calculate |x|. Revert on overflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function abs (int128 x) internal pure returns (int128) {\n unchecked {\n require (x != MIN_64x64);\n return x < 0 ? -x : x;\n }\n }\n\n /**\n * Calculate 1 / x rounding towards zero. Revert on overflow or when x is\n * zero.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function inv (int128 x) internal pure returns (int128) {\n unchecked {\n require (x != 0);\n int256 result = int256 (0x100000000000000000000000000000000) / x;\n require (result >= MIN_64x64 && result <= MAX_64x64);\n return int128 (result);\n }\n }\n\n /**\n * Calculate arithmetics average of x and y, i.e. (x + y) / 2 rounding down.\n *\n * @param x signed 64.64-bit fixed point number\n * @param y signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function avg (int128 x, int128 y) internal pure returns (int128) {\n unchecked {\n return int128 ((int256 (x) + int256 (y)) >> 1);\n }\n }\n\n /**\n * Calculate geometric average of x and y, i.e. sqrt (x * y) rounding down.\n * Revert on overflow or in case x * y is negative.\n *\n * @param x signed 64.64-bit fixed point number\n * @param y signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function gavg (int128 x, int128 y) internal pure returns (int128) {\n unchecked {\n int256 m = int256 (x) * int256 (y);\n require (m >= 0);\n require (m <\n 0x4000000000000000000000000000000000000000000000000000000000000000);\n return int128 (sqrtu (uint256 (m)));\n }\n }\n\n /**\n * Calculate x^y assuming 0^0 is 1, where x is signed 64.64 fixed point number\n * and y is unsigned 256-bit integer number. Revert on overflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @param y uint256 value\n * @return signed 64.64-bit fixed point number\n */\n function pow (int128 x, uint256 y) internal pure returns (int128) {\n unchecked {\n bool negative = x < 0 && y & 1 == 1;\n\n uint256 absX = uint128 (x < 0 ? -x : x);\n uint256 absResult;\n absResult = 0x100000000000000000000000000000000;\n\n if (absX <= 0x10000000000000000) {\n absX <<= 63;\n while (y != 0) {\n if (y & 0x1 != 0) {\n absResult = absResult * absX >> 127;\n }\n absX = absX * absX >> 127;\n\n if (y & 0x2 != 0) {\n absResult = absResult * absX >> 127;\n }\n absX = absX * absX >> 127;\n\n if (y & 0x4 != 0) {\n absResult = absResult * absX >> 127;\n }\n absX = absX * absX >> 127;\n\n if (y & 0x8 != 0) {\n absResult = absResult * absX >> 127;\n }\n absX = absX * absX >> 127;\n\n y >>= 4;\n }\n\n absResult >>= 64;\n } else {\n uint256 absXShift = 63;\n if (absX < 0x1000000000000000000000000) { absX <<= 32; absXShift -= 32; }\n if (absX < 0x10000000000000000000000000000) { absX <<= 16; absXShift -= 16; }\n if (absX < 0x1000000000000000000000000000000) { absX <<= 8; absXShift -= 8; }\n if (absX < 0x10000000000000000000000000000000) { absX <<= 4; absXShift -= 4; }\n if (absX < 0x40000000000000000000000000000000) { absX <<= 2; absXShift -= 2; }\n if (absX < 0x80000000000000000000000000000000) { absX <<= 1; absXShift -= 1; }\n\n uint256 resultShift = 0;\n while (y != 0) {\n require (absXShift < 64);\n\n if (y & 0x1 != 0) {\n absResult = absResult * absX >> 127;\n resultShift += absXShift;\n if (absResult > 0x100000000000000000000000000000000) {\n absResult >>= 1;\n resultShift += 1;\n }\n }\n absX = absX * absX >> 127;\n absXShift <<= 1;\n if (absX >= 0x100000000000000000000000000000000) {\n absX >>= 1;\n absXShift += 1;\n }\n\n y >>= 1;\n }\n\n require (resultShift < 64);\n absResult >>= 64 - resultShift;\n }\n int256 result = negative ? -int256 (absResult) : int256 (absResult);\n require (result >= MIN_64x64 && result <= MAX_64x64);\n return int128 (result);\n }\n }\n\n /**\n * Calculate sqrt (x) rounding down. Revert if x < 0.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function sqrt (int128 x) internal pure returns (int128) {\n unchecked {\n require (x >= 0);\n return int128 (sqrtu (uint256 (int256 (x)) << 64));\n }\n }\n\n /**\n * Calculate binary logarithm of x. Revert if x <= 0.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function log_2 (int128 x) internal pure returns (int128) {\n unchecked {\n require (x > 0);\n\n int256 msb = 0;\n int256 xc = x;\n if (xc >= 0x10000000000000000) { xc >>= 64; msb += 64; }\n if (xc >= 0x100000000) { xc >>= 32; msb += 32; }\n if (xc >= 0x10000) { xc >>= 16; msb += 16; }\n if (xc >= 0x100) { xc >>= 8; msb += 8; }\n if (xc >= 0x10) { xc >>= 4; msb += 4; }\n if (xc >= 0x4) { xc >>= 2; msb += 2; }\n if (xc >= 0x2) msb += 1; // No need to shift xc anymore\n\n int256 result = msb - 64 << 64;\n uint256 ux = uint256 (int256 (x)) << uint256 (127 - msb);\n for (int256 bit = 0x8000000000000000; bit > 0; bit >>= 1) {\n ux *= ux;\n uint256 b = ux >> 255;\n ux >>= 127 + b;\n result += bit * int256 (b);\n }\n\n return int128 (result);\n }\n }\n\n /**\n * Calculate natural logarithm of x. Revert if x <= 0.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function ln (int128 x) internal pure returns (int128) {\n unchecked {\n require (x > 0);\n\n return int128 (int256 (\n uint256 (int256 (log_2 (x))) * 0xB17217F7D1CF79ABC9E3B39803F2F6AF >> 128));\n }\n }\n\n /**\n * Calculate binary exponent of x. Revert on overflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function exp_2 (int128 x) internal pure returns (int128) {\n unchecked {\n require (x < 0x400000000000000000); // Overflow\n\n if (x < -0x400000000000000000) return 0; // Underflow\n\n uint256 result = 0x80000000000000000000000000000000;\n\n if (x & 0x8000000000000000 > 0)\n result = result * 0x16A09E667F3BCC908B2FB1366EA957D3E >> 128;\n if (x & 0x4000000000000000 > 0)\n result = result * 0x1306FE0A31B7152DE8D5A46305C85EDEC >> 128;\n if (x & 0x2000000000000000 > 0)\n result = result * 0x1172B83C7D517ADCDF7C8C50EB14A791F >> 128;\n if (x & 0x1000000000000000 > 0)\n result = result * 0x10B5586CF9890F6298B92B71842A98363 >> 128;\n if (x & 0x800000000000000 > 0)\n result = result * 0x1059B0D31585743AE7C548EB68CA417FD >> 128;\n if (x & 0x400000000000000 > 0)\n result = result * 0x102C9A3E778060EE6F7CACA4F7A29BDE8 >> 128;\n if (x & 0x200000000000000 > 0)\n result = result * 0x10163DA9FB33356D84A66AE336DCDFA3F >> 128;\n if (x & 0x100000000000000 > 0)\n result = result * 0x100B1AFA5ABCBED6129AB13EC11DC9543 >> 128;\n if (x & 0x80000000000000 > 0)\n result = result * 0x10058C86DA1C09EA1FF19D294CF2F679B >> 128;\n if (x & 0x40000000000000 > 0)\n result = result * 0x1002C605E2E8CEC506D21BFC89A23A00F >> 128;\n if (x & 0x20000000000000 > 0)\n result = result * 0x100162F3904051FA128BCA9C55C31E5DF >> 128;\n if (x & 0x10000000000000 > 0)\n result = result * 0x1000B175EFFDC76BA38E31671CA939725 >> 128;\n if (x & 0x8000000000000 > 0)\n result = result * 0x100058BA01FB9F96D6CACD4B180917C3D >> 128;\n if (x & 0x4000000000000 > 0)\n result = result * 0x10002C5CC37DA9491D0985C348C68E7B3 >> 128;\n if (x & 0x2000000000000 > 0)\n result = result * 0x1000162E525EE054754457D5995292026 >> 128;\n if (x & 0x1000000000000 > 0)\n result = result * 0x10000B17255775C040618BF4A4ADE83FC >> 128;\n if (x & 0x800000000000 > 0)\n result = result * 0x1000058B91B5BC9AE2EED81E9B7D4CFAB >> 128;\n if (x & 0x400000000000 > 0)\n result = result * 0x100002C5C89D5EC6CA4D7C8ACC017B7C9 >> 128;\n if (x & 0x200000000000 > 0)\n result = result * 0x10000162E43F4F831060E02D839A9D16D >> 128;\n if (x & 0x100000000000 > 0)\n result = result * 0x100000B1721BCFC99D9F890EA06911763 >> 128;\n if (x & 0x80000000000 > 0)\n result = result * 0x10000058B90CF1E6D97F9CA14DBCC1628 >> 128;\n if (x & 0x40000000000 > 0)\n result = result * 0x1000002C5C863B73F016468F6BAC5CA2B >> 128;\n if (x & 0x20000000000 > 0)\n result = result * 0x100000162E430E5A18F6119E3C02282A5 >> 128;\n if (x & 0x10000000000 > 0)\n result = result * 0x1000000B1721835514B86E6D96EFD1BFE >> 128;\n if (x & 0x8000000000 > 0)\n result = result * 0x100000058B90C0B48C6BE5DF846C5B2EF >> 128;\n if (x & 0x4000000000 > 0)\n result = result * 0x10000002C5C8601CC6B9E94213C72737A >> 128;\n if (x & 0x2000000000 > 0)\n result = result * 0x1000000162E42FFF037DF38AA2B219F06 >> 128;\n if (x & 0x1000000000 > 0)\n result = result * 0x10000000B17217FBA9C739AA5819F44F9 >> 128;\n if (x & 0x800000000 > 0)\n result = result * 0x1000000058B90BFCDEE5ACD3C1CEDC823 >> 128;\n if (x & 0x400000000 > 0)\n result = result * 0x100000002C5C85FE31F35A6A30DA1BE50 >> 128;\n if (x & 0x200000000 > 0)\n result = result * 0x10000000162E42FF0999CE3541B9FFFCF >> 128;\n if (x & 0x100000000 > 0)\n result = result * 0x100000000B17217F80F4EF5AADDA45554 >> 128;\n if (x & 0x80000000 > 0)\n result = result * 0x10000000058B90BFBF8479BD5A81B51AD >> 128;\n if (x & 0x40000000 > 0)\n result = result * 0x1000000002C5C85FDF84BD62AE30A74CC >> 128;\n if (x & 0x20000000 > 0)\n result = result * 0x100000000162E42FEFB2FED257559BDAA >> 128;\n if (x & 0x10000000 > 0)\n result = result * 0x1000000000B17217F7D5A7716BBA4A9AE >> 128;\n if (x & 0x8000000 > 0)\n result = result * 0x100000000058B90BFBE9DDBAC5E109CCE >> 128;\n if (x & 0x4000000 > 0)\n result = result * 0x10000000002C5C85FDF4B15DE6F17EB0D >> 128;\n if (x & 0x2000000 > 0)\n result = result * 0x1000000000162E42FEFA494F1478FDE05 >> 128;\n if (x & 0x1000000 > 0)\n result = result * 0x10000000000B17217F7D20CF927C8E94C >> 128;\n if (x & 0x800000 > 0)\n result = result * 0x1000000000058B90BFBE8F71CB4E4B33D >> 128;\n if (x & 0x400000 > 0)\n result = result * 0x100000000002C5C85FDF477B662B26945 >> 128;\n if (x & 0x200000 > 0)\n result = result * 0x10000000000162E42FEFA3AE53369388C >> 128;\n if (x & 0x100000 > 0)\n result = result * 0x100000000000B17217F7D1D351A389D40 >> 128;\n if (x & 0x80000 > 0)\n result = result * 0x10000000000058B90BFBE8E8B2D3D4EDE >> 128;\n if (x & 0x40000 > 0)\n result = result * 0x1000000000002C5C85FDF4741BEA6E77E >> 128;\n if (x & 0x20000 > 0)\n result = result * 0x100000000000162E42FEFA39FE95583C2 >> 128;\n if (x & 0x10000 > 0)\n result = result * 0x1000000000000B17217F7D1CFB72B45E1 >> 128;\n if (x & 0x8000 > 0)\n result = result * 0x100000000000058B90BFBE8E7CC35C3F0 >> 128;\n if (x & 0x4000 > 0)\n result = result * 0x10000000000002C5C85FDF473E242EA38 >> 128;\n if (x & 0x2000 > 0)\n result = result * 0x1000000000000162E42FEFA39F02B772C >> 128;\n if (x & 0x1000 > 0)\n result = result * 0x10000000000000B17217F7D1CF7D83C1A >> 128;\n if (x & 0x800 > 0)\n result = result * 0x1000000000000058B90BFBE8E7BDCBE2E >> 128;\n if (x & 0x400 > 0)\n result = result * 0x100000000000002C5C85FDF473DEA871F >> 128;\n if (x & 0x200 > 0)\n result = result * 0x10000000000000162E42FEFA39EF44D91 >> 128;\n if (x & 0x100 > 0)\n result = result * 0x100000000000000B17217F7D1CF79E949 >> 128;\n if (x & 0x80 > 0)\n result = result * 0x10000000000000058B90BFBE8E7BCE544 >> 128;\n if (x & 0x40 > 0)\n result = result * 0x1000000000000002C5C85FDF473DE6ECA >> 128;\n if (x & 0x20 > 0)\n result = result * 0x100000000000000162E42FEFA39EF366F >> 128;\n if (x & 0x10 > 0)\n result = result * 0x1000000000000000B17217F7D1CF79AFA >> 128;\n if (x & 0x8 > 0)\n result = result * 0x100000000000000058B90BFBE8E7BCD6D >> 128;\n if (x & 0x4 > 0)\n result = result * 0x10000000000000002C5C85FDF473DE6B2 >> 128;\n if (x & 0x2 > 0)\n result = result * 0x1000000000000000162E42FEFA39EF358 >> 128;\n if (x & 0x1 > 0)\n result = result * 0x10000000000000000B17217F7D1CF79AB >> 128;\n\n result >>= uint256 (int256 (63 - (x >> 64)));\n require (result <= uint256 (int256 (MAX_64x64)));\n\n return int128 (int256 (result));\n }\n }\n\n /**\n * Calculate natural exponent of x. Revert on overflow.\n *\n * @param x signed 64.64-bit fixed point number\n * @return signed 64.64-bit fixed point number\n */\n function exp (int128 x) internal pure returns (int128) {\n unchecked {\n require (x < 0x400000000000000000); // Overflow\n\n if (x < -0x400000000000000000) return 0; // Underflow\n\n return exp_2 (\n int128 (int256 (x) * 0x171547652B82FE1777D0FFDA0D23A7D12 >> 128));\n }\n }\n\n /**\n * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit\n * integer numbers. Revert on overflow or when y is zero.\n *\n * @param x unsigned 256-bit integer number\n * @param y unsigned 256-bit integer number\n * @return unsigned 64.64-bit fixed point number\n */\n function divuu (uint256 x, uint256 y) private pure returns (uint128) {\n unchecked {\n require (y != 0);\n\n uint256 result;\n\n if (x <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)\n result = (x << 64) / y;\n else {\n uint256 msb = 192;\n uint256 xc = x >> 192;\n if (xc >= 0x100000000) { xc >>= 32; msb += 32; }\n if (xc >= 0x10000) { xc >>= 16; msb += 16; }\n if (xc >= 0x100) { xc >>= 8; msb += 8; }\n if (xc >= 0x10) { xc >>= 4; msb += 4; }\n if (xc >= 0x4) { xc >>= 2; msb += 2; }\n if (xc >= 0x2) msb += 1; // No need to shift xc anymore\n\n result = (x << 255 - msb) / ((y - 1 >> msb - 191) + 1);\n require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\n\n uint256 hi = result * (y >> 128);\n uint256 lo = result * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\n\n uint256 xh = x >> 192;\n uint256 xl = x << 64;\n\n if (xl < lo) xh -= 1;\n xl -= lo; // We rely on overflow behavior here\n lo = hi << 128;\n if (xl < lo) xh -= 1;\n xl -= lo; // We rely on overflow behavior here\n\n result += xh == hi >> 128 ? xl / y : 1;\n }\n\n require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);\n return uint128 (result);\n }\n }\n\n /**\n * Calculate sqrt (x) rounding down, where x is unsigned 256-bit integer\n * number.\n *\n * @param x unsigned 256-bit integer number\n * @return unsigned 128-bit integer number\n */\n function sqrtu (uint256 x) private pure returns (uint128) {\n unchecked {\n if (x == 0) return 0;\n else {\n uint256 xx = x;\n uint256 r = 1;\n if (xx >= 0x100000000000000000000000000000000) { xx >>= 128; r <<= 64; }\n if (xx >= 0x10000000000000000) { xx >>= 64; r <<= 32; }\n if (xx >= 0x100000000) { xx >>= 32; r <<= 16; }\n if (xx >= 0x10000) { xx >>= 16; r <<= 8; }\n if (xx >= 0x100) { xx >>= 8; r <<= 4; }\n if (xx >= 0x10) { xx >>= 4; r <<= 2; }\n if (xx >= 0x4) { r <<= 1; }\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1;\n r = (r + x / r) >> 1; // Seven iterations should be enough\n uint256 r1 = x / r;\n return uint128 (r < r1 ? r : r1);\n }\n }\n }\n}\n" + }, + "contracts/AuthorizedAccounts.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nimport \"./interfaces/IAuthorizedAccounts.sol\";\n\n/**\n * @notice Manages authorized accounts with limited permissions on behalf of main account\n * these authorized accounts are allowed to perform some certain actions in the Sylo network\n * in order to reduce the works for main account\n */\ncontract AuthorizedAccounts is\n IAuthorizedAccounts,\n Initializable,\n Ownable2StepUpgradeable,\n ERC165\n{\n /**\n * @notice Tracks authorized accounts for every main account\n */\n mapping(address => AuthorizedAccount[]) public authorizedAccounts;\n\n event PermissionsAdded(\n address indexed main,\n address indexed authorized,\n Permission[] permissions\n );\n\n event PermissionsRemoved(\n address indexed main,\n address indexed authorized,\n Permission[] permissions\n );\n\n error AuthorizedAccountCannotBeZeroAddress();\n error MainAccountCannotBeZeroAddress();\n error AtBlockNumberCannotBeZero();\n error AccountAlreadyAuthorized();\n error AccountDoesNotExist();\n\n function initialize() external initializer {\n Ownable2StepUpgradeable.__Ownable2Step_init();\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAuthorizedAccounts).interfaceId;\n }\n\n /**\n * @notice Adds new authorized accounts with certain permissions.\n * This will revert if the account has already existed.\n * @param authorized The address that the main account wants to authorize\n * @param permissions The list of permissions that the authorized account\n * can perform within the Sylo network.\n */\n function authorizeAccount(address authorized, Permission[] calldata permissions) external {\n if (authorized == address(0)) {\n revert AuthorizedAccountCannotBeZeroAddress();\n }\n\n // check if account has already been authorized\n AuthorizedAccount[] storage authAccounts = authorizedAccounts[msg.sender];\n for (uint i; i < authAccounts.length; ++i) {\n if (authAccounts[i].account == authorized) {\n if (authAccounts[i].authorizedAt != 0) {\n revert AccountAlreadyAuthorized();\n }\n\n authAccounts[i].authorizedAt = block.number;\n return _addPermissions(authorized, authAccounts[i], permissions);\n }\n }\n\n // add new authorized account to the list\n authAccounts.push();\n AuthorizedAccount storage newAccount = authAccounts[authAccounts.length - 1];\n newAccount.account = authorized;\n newAccount.authorizedAt = block.number;\n\n _addPermissions(authorized, newAccount, permissions);\n }\n\n /**\n * @notice Removes all permissions of a specific authorized account\n * associated with the msg.sender, and sets the account's authorizedAt to 0.\n * Note: It does not remove the authorized account from the list.\n * This will revert if the account does not exist.\n * @param authorized The address of the authorized account\n */\n function unauthorizeAccount(address authorized) external {\n if (authorized == address(0)) {\n revert AuthorizedAccountCannotBeZeroAddress();\n }\n\n AuthorizedAccount[] storage authAccounts = authorizedAccounts[msg.sender];\n for (uint i; i < authAccounts.length; ++i) {\n if (authAccounts[i].account == authorized) {\n delete authAccounts[i].authorizedAt;\n return _removePermissions(authorized, authAccounts[i], getAllPermissions());\n }\n }\n\n revert AccountDoesNotExist();\n }\n\n /**\n * @notice Adds new permissions to a specific authorized account.\n * - Adding permissions that don't exist in the Permission enum will return\n * with panic code 0x21 (convert a value that is too big or negative into an enum type).\n * - Adding duplicate permissions will update the permissions' authorizedAt value.\n * - Adding permissions that were previously unauthorized will update\n * the authorizedAt and unauthorizedAt values (refer to the comment in\n * IAuthorizedAccount -> AuthorizedPermission struct).\n * This will revert if the account does not exist.\n * @param authorized The authorized account address\n * @param permissions The new permissions will be added to the authorized account\n */\n function addPermissions(address authorized, Permission[] calldata permissions) external {\n if (authorized == address(0)) {\n revert AuthorizedAccountCannotBeZeroAddress();\n }\n\n AuthorizedAccount[] storage authAccounts = authorizedAccounts[msg.sender];\n for (uint i; i < authAccounts.length; ++i) {\n if (authAccounts[i].account == authorized) {\n return _addPermissions(authorized, authAccounts[i], permissions);\n }\n }\n\n revert AccountDoesNotExist();\n }\n\n function _addPermissions(\n address authorized,\n AuthorizedAccount storage authAccount,\n Permission[] memory permissions\n ) private {\n for (uint i; i < permissions.length; ++i) {\n bool exists;\n for (uint j; j < authAccount.permissions.length; ++j) {\n AuthorizedPermission storage authPermission = authAccount.permissions[j];\n if (permissions[i] == authPermission.permission) {\n exists = true;\n authPermission.authorizedAt = block.number;\n\n // make sure unauthorizedAt is not greater than authorizedAt\n // (refer to the comment in IAuthorizedAccount -> AuthorizedPermission struct)\n if (authPermission.unauthorizedAt > authPermission.authorizedAt) {\n authPermission.unauthorizedAt = authPermission.authorizedAt;\n }\n break;\n }\n }\n if (!exists) {\n authAccount.permissions.push(\n AuthorizedPermission({\n permission: permissions[i],\n authorizedAt: block.number,\n unauthorizedAt: 0\n })\n );\n }\n }\n\n emit PermissionsAdded(msg.sender, authorized, permissions);\n }\n\n /**\n * @notice Removes permissions of specific authorized account.\n * - Removing permissions that don't exist in the Permission enum will return\n * with panic code 0x21 (convert a value that is too big or negative into an enum type).\n * - Removing duplicate/authorized permissions will update the permissions'\n * unauthorizedAt value.\n * This will revert if the account does not exist.\n * @param authorized The address of authorized account\n * @param permissions The list of permissions will be removed\n */\n function removePermissions(address authorized, Permission[] calldata permissions) external {\n if (authorized == address(0)) {\n revert AuthorizedAccountCannotBeZeroAddress();\n }\n\n AuthorizedAccount[] storage authAccounts = authorizedAccounts[msg.sender];\n for (uint i; i < authAccounts.length; ++i) {\n if (authAccounts[i].account == authorized) {\n return _removePermissions(authorized, authAccounts[i], permissions);\n }\n }\n\n revert AccountDoesNotExist();\n }\n\n function _removePermissions(\n address authorized,\n AuthorizedAccount storage authAccount,\n Permission[] memory permissions\n ) private {\n for (uint i; i < permissions.length; ++i) {\n for (uint j; j < authAccount.permissions.length; ++j) {\n if (permissions[i] == authAccount.permissions[j].permission) {\n // only update unauthorizedAt if the permission is authorized\n if (\n authAccount.permissions[j].authorizedAt >=\n authAccount.permissions[j].unauthorizedAt\n ) {\n authAccount.permissions[j].unauthorizedAt = block.number + 1;\n }\n break;\n }\n }\n }\n\n emit PermissionsRemoved(msg.sender, authorized, permissions);\n }\n\n /**\n * @notice Validates permission of an authorized account associated with the main account.\n *\n * @param main The address of main account\n * @param authorized The address of authorized account\n * @param permission The permission needs to be verified with the authorized account\n * @param atBlock The block number to check if the permission is valid between\n * the permission's authorizedAt and unauthorizedAt period. It is added later to prevent\n * the timing attack. E.g. If the main account authorizes the PersonalSign permission at\n * block 1, creates a ticket at block 2, then unauthorizes the permission at block 3, the\n * ticket will be invalid and cannot be redeemed. To avoid this, the `atBlock` param is\n * needed to check if the permission is authorized between its authorizedAt and unauthorizedAt\n * duration.\n *\n * @return boolean value\n */\n function validatePermission(\n address main,\n address authorized,\n Permission permission,\n uint256 atBlock\n ) external view returns (bool) {\n if (main == address(0)) {\n revert MainAccountCannotBeZeroAddress();\n }\n\n if (authorized == address(0)) {\n revert AuthorizedAccountCannotBeZeroAddress();\n }\n\n if (atBlock == 0) {\n revert AtBlockNumberCannotBeZero();\n }\n\n AuthorizedAccount[] storage authAccounts = authorizedAccounts[main];\n\n for (uint i = 0; i < authAccounts.length; ++i) {\n if (authAccounts[i].account == authorized) {\n for (uint j = 0; j < authAccounts[i].permissions.length; ++j) {\n if (authAccounts[i].permissions[j].permission == permission) {\n uint256 authorizedAt = authAccounts[i].permissions[j].authorizedAt;\n uint256 unauthorizedAt = authAccounts[i].permissions[j].unauthorizedAt;\n\n bool isPermissionUnauthorized = authorizedAt > 0 &&\n authorizedAt < unauthorizedAt;\n if (isPermissionUnauthorized) {\n // the permission was previously valid, so we check that\n // the `atBlock` is referencing a time when the permission was valid\n return authorizedAt <= atBlock && atBlock < unauthorizedAt;\n }\n\n // otherwise just check if the permission was authorized before the\n // atBlock\n return authorizedAt > 0 && authorizedAt <= atBlock;\n }\n }\n }\n }\n\n return false;\n }\n\n /**\n * @notice Get all authorized accounts associated with a given account\n * @param main The address of main account\n * @return An array of authorized accounts\n */\n function getAuthorizedAccounts(\n address main\n ) external view returns (AuthorizedAccount[] memory) {\n if (main == address(0)) {\n revert MainAccountCannotBeZeroAddress();\n }\n\n return authorizedAccounts[main];\n }\n\n function getAllPermissions() internal pure returns (Permission[] memory) {\n Permission[] memory permissions = new Permission[](1);\n permissions[0] = Permission.PersonalSign;\n return permissions;\n }\n}\n" + }, + "contracts/epochs/EpochsManager.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\n\nimport \"../Registries.sol\";\nimport \"../staking/Directory.sol\";\nimport \"../interfaces/epochs/IEpochsManager.sol\";\nimport \"../payments/ticketing/TicketingParameters.sol\";\n\ncontract EpochsManager is IEpochsManager, Initializable, Ownable2StepUpgradeable, ERC165 {\n Directory public _directory;\n\n Registries public _registries;\n\n IERC721 public _rootSeekers;\n\n TicketingParameters public _ticketingParameters;\n\n /**\n * @notice Track seekers that have joined for a specific epoch.\n */\n mapping(uint256 => mapping(uint256 => address)) public activeSeekers;\n\n // Define all Epoch specific parameters here.\n // When initializing an epoch, these parameters are read,\n // along with parameters from the other contracts to create the\n // new epoch.\n\n /**\n * @notice A mapping of all epochs that have been initialized.\n */\n mapping(uint256 => Epoch) public epochs;\n\n /**\n * @notice The block number since the first epoch can be initialized.\n */\n uint256 public initialEpoch;\n\n /**\n * @notice The duration in blocks an epoch will last for.\n */\n uint256 public epochDuration;\n\n /**\n * @notice The value of the integer used as the current\n * epoch's identifier. This value is incremented as each epoch\n * is initialized.\n */\n uint256 public currentIteration;\n\n event NewEpoch(uint256 indexed epochId);\n event EpochJoined(uint256 indexed epochId, address indexed node, uint256 indexed seekerId);\n event InitialEpochUpdated(uint256 initialEpoch);\n event EpochDurationUpdated(uint256 epochDuration);\n\n error SeekerOwnerMismatch();\n error InitialEpochCannotBeZero();\n error EpochDurationCannotBeZero();\n error DirectoryCannotBeZeroAddress();\n error RegistriesCannotBeZeroAddress();\n error RootSeekerCannotBeZeroAddress();\n error EpochHasNotEnded(uint256 epochId);\n error SeekerAccountCannotBeZeroAddress();\n error TicketingParametersCannotBeZeroAddress();\n error SeekerAlreadyJoinedEpoch(uint256 epochId, uint256 seekerId);\n error InitialEpochNotYetReady(uint256 expectedBlock, uint256 currentBlock);\n\n function initialize(\n IERC721 rootSeekers,\n Directory directory,\n Registries registries,\n TicketingParameters ticketingParameters,\n uint256 _initialEpoch,\n uint256 _epochDuration\n ) external initializer {\n if (address(rootSeekers) == address(0)) {\n revert RootSeekerCannotBeZeroAddress();\n }\n\n SyloUtils.validateContractInterface(\n \"Directory\",\n address(directory),\n type(IDirectory).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"Registries\",\n address(registries),\n type(IRegistries).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"TicketingParameters\",\n address(ticketingParameters),\n type(ITicketingParameters).interfaceId\n );\n\n Ownable2StepUpgradeable.__Ownable2Step_init();\n\n _rootSeekers = rootSeekers;\n _directory = directory;\n _registries = registries;\n _ticketingParameters = ticketingParameters;\n\n initialEpoch = _initialEpoch;\n epochDuration = _epochDuration;\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IEpochsManager).interfaceId;\n }\n\n /**\n * @notice Call this to initialize the next epoch. On success, a `NewEpoch` event\n * will be emitted.\n * @dev The function will read the current set of network parameters, and store\n * the parameters in a new Epoch struct. The end block of the current epoch\n * will also be set to a non-zero value.\n */\n function initializeEpoch() external returns (uint256) {\n if (currentIteration == 0 && initialEpoch > block.number) {\n revert InitialEpochNotYetReady(initialEpoch, block.number);\n }\n\n Epoch storage current = epochs[currentIteration];\n\n uint256 end = current.startBlock + current.duration;\n if (end > block.number) {\n revert EpochHasNotEnded(currentIteration);\n }\n\n (\n uint256 faceValue,\n uint128 baseLiveWinProb,\n uint128 expiredWinProb,\n uint256 ticketDuration,\n uint32 decayRate\n ) = _ticketingParameters.getTicketingParameters();\n\n uint256 nextEpochId = getNextEpochId();\n\n epochs[nextEpochId] = Epoch(\n block.number,\n epochDuration,\n 0,\n _registries.defaultPayoutPercentage(),\n decayRate,\n faceValue,\n baseLiveWinProb,\n expiredWinProb,\n ticketDuration\n );\n\n current.endBlock = block.number;\n\n currentIteration = nextEpochId;\n\n _directory.setCurrentDirectory(nextEpochId);\n\n emit NewEpoch(nextEpochId);\n\n return nextEpochId;\n }\n\n /**\n * @notice Set the first epoch starting block. Only callable by the owner.\n * @param _initialEpoch The block number when the first epoch can be initialized.\n */\n function setInitialEpoch(uint256 _initialEpoch) external onlyOwner {\n if (_initialEpoch == 0) {\n revert InitialEpochCannotBeZero();\n }\n initialEpoch = _initialEpoch;\n emit InitialEpochUpdated(_initialEpoch);\n }\n\n /**\n * @notice Set the epoch duration. Will take effect in the next epoch. Only\n * callable by the owner.\n * @param _epochDuration The epoch duration in number of blocks.\n */\n function setEpochDuration(uint256 _epochDuration) external onlyOwner {\n if (_epochDuration == 0) {\n revert EpochDurationCannotBeZero();\n }\n epochDuration = _epochDuration;\n emit EpochDurationUpdated(epochDuration);\n }\n\n /**\n * @notice Retrieve the parameters for the current epoch.\n * @return The current Epoch parameters.\n */\n function getCurrentActiveEpoch() external view returns (uint256, Epoch memory) {\n return (currentIteration, epochs[currentIteration]);\n }\n\n /**\n * @notice Nodes should call this to join the next epoch. It will\n * initialize the next reward pool and set the stake for the next directory.\n * @dev This is a proxy function for `initalizeNextRewardPool` and\n * `joinNextDirectory`.\n */\n function joinNextEpoch() external {\n Registries.Registry memory registry = _registries.getRegistry(msg.sender);\n\n // validate the node's seeker ownership\n if (registry.seekerAccount == address(0)) {\n revert SeekerAccountCannotBeZeroAddress();\n }\n\n uint256 seekerId = registry.seekerId;\n\n address owner = _rootSeekers.ownerOf(seekerId);\n if (registry.seekerAccount != owner) {\n revert SeekerOwnerMismatch();\n }\n\n uint256 nextEpoch = getNextEpochId();\n if (activeSeekers[nextEpoch][seekerId] != address(0)) {\n revert SeekerAlreadyJoinedEpoch(nextEpoch, seekerId);\n }\n\n activeSeekers[nextEpoch][seekerId] = msg.sender;\n\n _directory._rewardsManager().initializeNextRewardPool(msg.sender);\n _directory.joinNextDirectory(msg.sender, seekerId);\n\n emit EpochJoined(nextEpoch, msg.sender, seekerId);\n }\n\n /**\n * @notice Retrieve the epoch parameter for the given id.\n * @param epochId The id of the epoch to retrieve.\n * @return The epoch parameters associated with the id.\n */\n function getEpoch(uint256 epochId) external view returns (Epoch memory) {\n return epochs[epochId];\n }\n\n /**\n * @notice Retrieve the integer value that will be used for the\n * next epoch id.\n * @return The next epoch id identifier.\n */\n function getNextEpochId() public view returns (uint256) {\n return currentIteration + 1;\n }\n}\n" + }, + "contracts/interfaces/epochs/IEpochsManager.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface IEpochsManager {\n /**\n * @dev This struct will hold all network parameters that will be static\n * for the entire epoch. This value will be stored in a mapping, where the\n * key is the current epoch id.\n */\n struct Epoch {\n // time related variables\n uint256 startBlock; // Block the epoch was initialized\n uint256 duration; // Minimum time epoch will be alive measured in number of blocks\n uint256 endBlock; // Block the epoch ended (and when the next epoch was initialized)\n // Zero here represents the epoch has not yet ended.\n\n // registry variables\n uint32 defaultPayoutPercentage;\n // ticketing variables\n uint32 decayRate;\n uint256 faceValue;\n uint128 baseLiveWinProb;\n uint128 expiredWinProb;\n uint256 ticketDuration;\n }\n\n function initializeEpoch() external returns (uint256);\n\n function setEpochDuration(uint256 _epochDuration) external;\n\n function getCurrentActiveEpoch() external view returns (uint256, Epoch memory);\n\n function joinNextEpoch() external;\n\n function getEpoch(uint256 epochId) external view returns (Epoch memory);\n\n function getNextEpochId() external view returns (uint256);\n}\n" + }, + "contracts/interfaces/IAuthorizedAccounts.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface IAuthorizedAccounts {\n enum Permission {\n // PersonalSign permission allows the authorized account to\n // sign on behalf of the sending account.\n PersonalSign\n }\n\n /**\n * @dev This type will hold the permission type and the block number from\n * which the permission was set to be authorized and unauthorized.\n * The permission is authorized when authorizedAt >= unauthorizedAt.\n *\n * Note: authorizedAt and unauthorizedAt won't be set to 0 when the permission\n * is updated, because they are both needed when validating the permission.\n */\n struct AuthorizedPermission {\n // Permission type\n Permission permission;\n // Block number from which the permission was set to be authorized.\n // If the transaction is called in block 1, the permission is\n // authorized from block 1 (authorizedAt = block.number).\n uint256 authorizedAt;\n // Block number from which the permission was set to be unauthorized.\n // If the transaction is called in block 1, the permission is\n // unauthorized from block 2 (unauthorizedAt = block.number + 1)\n // unauthorizedAt is set that way to avoid the case where the\n // permission is authorized and unauthorized in the same block:\n // E.g. addPermission is called => authorizedAt = 1\n // removePermission is called => unauthorizedAt = 1\n // => We cannot tell if the permission is authorized or not.\n // E.g. addPermission is called => authorizedAt = 1\n // removePermission is called => unauthorizedAt = 2\n // addPermission is called => authorizedAt = 1 AND update unauthorizedAt = authorizedAt = 1\n // => The permission is authorized when authorizedAt >= unauthorizedAt\n uint256 unauthorizedAt;\n }\n\n struct AuthorizedAccount {\n // The authorized account\n address account;\n // Block number at which the account was authorized.\n // If the transaction is called in block 1, the account is\n // authorized at block 1 (authorizedAt = block.number).\n // If the account is unauthorized, authorizedAt will be set to 0.\n uint256 authorizedAt;\n // Permission list\n AuthorizedPermission[] permissions;\n }\n\n function authorizeAccount(address authorized, Permission[] calldata permissions) external;\n\n function unauthorizeAccount(address authorized) external;\n\n function addPermissions(address authorized, Permission[] calldata permissions) external;\n\n function removePermissions(\n address authorized,\n Permission[] calldata permissionsToRemove\n ) external;\n\n function validatePermission(\n address main,\n address authorized,\n Permission permission,\n uint256 atBlock\n ) external returns (bool);\n\n function getAuthorizedAccounts(\n address main\n ) external view returns (AuthorizedAccount[] memory);\n}\n" + }, + "contracts/interfaces/IFuturePassRegistrar.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface IFuturePassRegistrar {\n function futurepassOf(address owner) external view returns (address);\n\n function create(address owner) external returns (address);\n}\n" + }, + "contracts/interfaces/IRegistries.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface IRegistries {\n struct Registry {\n // Percentage of a tickets value that will be rewarded to\n // delegated stakers expressed as a fraction of 100000.\n // This value is currently locked to the default payout percentage\n // until epochs are implemented.\n uint32 payoutPercentage;\n // Public http/s endpoint to retrieve additional metadata\n // about the node.\n // The current metadata schema is as follows:\n // { name: string, multiaddrs: string[] }\n string publicEndpoint;\n // The account which owns a seeker that will be used to\n // operate the Node for this registry.\n address seekerAccount;\n // The id of the seeker used to operate the node. The owner\n // of this id should be the seeker account.\n uint256 seekerId;\n }\n\n function register(string calldata publicEndpoint) external;\n\n function setDefaultPayoutPercentage(uint32 _defaultPayoutPercentage) external;\n\n function setSeekerAccount(\n address seekerAccount,\n uint256 seekerId,\n bytes32 nonce,\n bytes calldata signature\n ) external;\n\n function revokeSeekerAccount(address node) external;\n\n function getRegistry(address account) external view returns (Registry memory);\n\n function getNodes() external view returns (address[] memory);\n\n function getRegistries(\n uint256 start,\n uint256 end\n ) external view returns (address[] memory, Registry[] memory);\n\n function getTotalNodes() external view returns (uint256);\n}\n" + }, + "contracts/interfaces/ISeekerPowerOracle.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface ISeekerPowerOracle {\n function setOracle(address oracle) external;\n\n function registerSeekerPowerRestricted(uint256 seekerId, uint256 power) external;\n\n function registerSeekerPower(\n uint256 seekerId,\n uint256 power,\n bytes32 nonce,\n bytes calldata proof\n ) external;\n\n function getSeekerPower(uint256 seekerId) external view returns (uint256);\n\n function getProofMessage(\n uint256 seekerId,\n uint256 power,\n bytes32 nonce\n ) external pure returns (bytes memory);\n}\n" + }, + "contracts/interfaces/payments/ISyloTicketing.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface ISyloTicketing {\n struct Deposit {\n uint256 escrow; // Balance of users escrow\n uint256 penalty; // Balance of users penalty\n uint256 unlockAt; // Block number a user can withdraw their balances\n }\n\n struct User {\n address main; // Main address of the ticket sender or receiver\n address delegated; // Delegated address used to sign and redeem tickets\n }\n\n struct Ticket {\n uint256 epochId; // The epoch this ticket is associated with\n User sender; // Ticket sender's main and delegated addresses\n User receiver; // Ticket receiver's main and delegated addresses\n address redeemer; // Address of the intended recipient\n uint256 generationBlock; // Block number the ticket was generated\n bytes32 redeemerCommit; // Hash of the secret random number of the redeemer\n }\n\n // A type of ticket that does not explicit state the receiver address.\n struct MultiReceiverTicket {\n uint256 epochId; // The epoch this ticket is associated with\n User sender; // Ticket sender's main and delegated addresses\n address redeemer; // Address of the intended recipient\n uint256 generationBlock; // Block number the ticket was generated\n bytes32 redeemerCommit; // Hash of the secret random number of the redeemer\n }\n\n function setUnlockDuration(uint256 _unlockDuration) external;\n\n function depositEscrow(uint256 amount, address account) external;\n\n function depositPenalty(uint256 amount, address account) external;\n\n function unlockDeposits() external returns (uint256);\n\n function lockDeposits() external;\n\n function withdraw() external;\n\n function redeem(\n Ticket calldata ticket,\n uint256 redeemerRand,\n bytes calldata senderSig,\n bytes calldata receiverSig\n ) external;\n\n function redeemMultiReceiver(\n MultiReceiverTicket calldata ticket,\n uint256 redeemerRand,\n User calldata receiver,\n bytes calldata senderSig,\n bytes calldata receiverSig\n ) external;\n}\n" + }, + "contracts/interfaces/payments/ticketing/IRewardsManager.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface IRewardsManager {\n /**\n * @dev This type will hold the necessary information for delegated stakers\n * to make reward claims against their Node. Every Node will initialize\n * and store a new Reward Pool for each epoch they participate in.\n */\n struct RewardPool {\n // Tracks the balance of the reward pool owed to the stakers\n uint256 stakersRewardTotal;\n // Tracks the block number this reward pool was initialized\n uint256 initializedAt;\n // The total active stake for the node for will be the sum of the\n // stakes owned by its delegators and the node's own stake.\n uint256 totalActiveStake;\n // track the cumulative reward factor as of the time the first ticket\n // for this pool was redeemed\n int128 initialCumulativeRewardFactor;\n }\n\n struct LastClaim {\n // The epoch the claim was made.\n uint256 claimedAt;\n // The stake at the time the claim was made. This is tracked as\n // rewards can only be claimed after an epoch has ended, but the\n // user's stake may have changed by then. This field tracks the\n // staking value before the change so the reward for that epoch\n // can be manually calculated.\n uint256 stake;\n }\n\n function getRewardPool(\n uint256 epochId,\n address stakee\n ) external view returns (RewardPool memory);\n\n function getRewardPoolKey(uint256 epochId, address stakee) external pure returns (bytes32);\n\n function getRewardPoolStakersTotal(\n uint256 epochId,\n address stakee\n ) external view returns (uint256);\n\n function getRewardPoolActiveStake(\n uint256 epochId,\n address stakee\n ) external view returns (uint256);\n\n function getPendingRewards(address stakee) external view returns (uint256);\n\n function getLastClaim(address stakee, address staker) external view returns (LastClaim memory);\n\n function getTotalEpochRewards(uint256 epochId) external view returns (uint256);\n\n function getTotalEpochStakingRewards(uint256 epochId) external view returns (uint256);\n\n function initializeNextRewardPool(address stakee) external;\n\n function incrementRewardPool(address stakee, uint256 amount) external;\n\n function claimStakingRewards(address stakee) external returns (uint256);\n\n function updatePendingRewards(address stakee, address staker) external;\n}\n" + }, + "contracts/interfaces/payments/ticketing/ITicketingParameters.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface ITicketingParameters {\n function setFaceValue(uint256 _faceValue) external;\n\n function setBaseLiveWinProb(uint128 _baseLiveWinProb) external;\n\n function setExpiredWinProb(uint128 _expiredWinProb) external;\n\n function setDecayRate(uint32 _decayRate) external;\n\n function setTicketDuration(uint256 _ticketDuration) external;\n\n function getTicketingParameters()\n external\n view\n returns (uint256, uint128, uint128, uint256, uint32);\n}\n" + }, + "contracts/interfaces/staking/IDirectory.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface IDirectory {\n /**\n * @dev A DirectoryEntry will be stored for every node that joins the\n * network in a specific epoch. The entry will contain the stakee's\n * address, and a boundary value which is a sum of the current directory's\n * total stake, and the current stakee's total stake.\n */\n struct DirectoryEntry {\n address stakee;\n uint256 boundary;\n }\n\n /**\n * @dev An EpochDirectory will be stored for every epoch. The\n * directory will be constructed piece by piece as Nodes join,\n * each adding their own directory entry based on their current\n * stake value.\n */\n struct EpochDirectory {\n DirectoryEntry[] entries;\n mapping(address => uint256) stakes;\n uint256 totalStake;\n }\n\n function setCurrentDirectory(uint256 epochId) external;\n\n function joinNextDirectory(address stakee, uint256 seekerId) external;\n\n function scan(uint128 point) external view returns (address stakee);\n\n function scanWithEpochId(\n uint128 point,\n uint256 epochId\n ) external view returns (address stakee);\n\n function getTotalStakeForStakee(\n uint256 epochId,\n address stakee\n ) external view returns (uint256);\n\n function getTotalStake(uint256 epochId) external view returns (uint256);\n\n function getEntries(\n uint256 epochId\n ) external view returns (address[] memory, uint256[] memory);\n}\n" + }, + "contracts/interfaces/staking/IStakingManager.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\ninterface IStakingManager {\n /**\n * For every Node, there will be a mapping of the staker to a\n * StakeEntry. The stake entry tracks the amount of stake in SOLO,\n * and also when the stake was updated.\n */\n struct StakeEntry {\n uint256 amount;\n // Block number this entry was updated at\n uint256 updatedAt;\n // Epoch this entry was updated. The stake will become active\n // in the following epoch\n uint256 epochId;\n }\n\n /**\n * Every Node must have stake in order to participate in the Epoch.\n * Stake can be provided by the Node itself or by other accounts in\n * the network.\n */\n struct Stake {\n // Track each stake entry associated to a node\n mapping(address => StakeEntry) stakeEntries;\n // The total stake held by this contract for a node,\n // which will be the sum of all addStake and unlockStake calls\n uint256 totalManagedStake;\n }\n\n /**\n * This struct will track stake that is in the process of unlocking.\n */\n struct Unlock {\n uint256 amount; // Amount of stake unlocking\n uint256 unlockAt; // Block number the stake becomes withdrawable\n }\n\n function setUnlockDuration(uint256 _unlockDuration) external;\n\n function setMinimumStakeProportion(uint32 _minimumStakeProportion) external;\n\n function addStake(uint256 amount, address stakee) external;\n\n function unlockStake(uint256 amount, address stakee) external returns (uint256);\n\n function withdrawStake(address stakee) external;\n\n function cancelUnlocking(uint256 amount, address stakee) external;\n\n function calculateCapacityFromSeekerPower(uint256 seekerId) external view returns (uint256);\n\n function calculateMaxAdditionalDelegatedStake(address stakee) external view returns (uint256);\n\n function getTotalManagedStake() external view returns (uint256);\n\n function getStakeEntry(\n address stakee,\n address staker\n ) external view returns (StakeEntry memory);\n\n function getStakeeTotalManagedStake(address stakee) external view returns (uint256);\n}\n" + }, + "contracts/libraries/Manageable.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an list of public managers who may be added or removed.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyManager`, which can be applied to your functions to restrict their use to\n * other contracts which have explicitly been added.\n */\nabstract contract Manageable is Ownable2StepUpgradeable {\n /**\n * @dev Tracks the managers added to this contract, where they key is the\n * address of the managing contract, and the value is the block the manager was added in.\n * We use this mapping to restrict access to those functions in a similar\n * fashion to the onlyOwner construct.\n */\n mapping(address => uint256) public managers;\n\n error OnlyManagers();\n error ManagerCannotBeZeroAddress();\n\n /**\n * @notice Adds a manager to this contract. Only callable by the owner.\n * @param manager The address of the manager contract.\n */\n function addManager(address manager) external onlyOwner {\n if (manager == address(0)) {\n revert ManagerCannotBeZeroAddress();\n }\n managers[manager] = block.number;\n }\n\n /**\n * @notice Removes a manager from this contract. Only callable by the owner.\n * @param manager The address of the manager contract.\n */\n function removeManager(address manager) external onlyOwner {\n delete managers[manager];\n }\n\n /**\n * @dev This modifier allows us to specify that certain contracts have\n * special privileges to call restricted functions.\n */\n modifier onlyManager() {\n if (managers[msg.sender] == 0) {\n revert OnlyManagers();\n }\n _;\n }\n\n // Reserve storage slots for future variables\n uint256[49] private __gap;\n}\n" + }, + "contracts/libraries/SyloUtils.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nerror ContractNameCannotBeEmpty();\nerror InterfaceIdCannotBeZeroBytes();\nerror TargetContractCannotBeZeroAddress(string name);\nerror TargetNotSupportInterface(string name, bytes4 interfaceId);\n\nlibrary SyloUtils {\n /**\n * @dev The maximum possible SYLO that exists in the network.\n */\n uint256 public constant MAX_SYLO = 10_000_000_000 ether;\n\n /**\n * @dev Percentages are expressed as a ratio where 100000 is the denominator.\n * A large denominator allows for more precision, e.g representing 12.5%\n * can be done as 12500 / 100000\n */\n uint32 public constant PERCENTAGE_DENOMINATOR = 100000;\n\n /**\n * @dev Multiply a value by a given percentage. Converts the provided\n * uint128 value to uint256 to avoid any reverts on overflow.\n * @param value The value to multiply.\n * @param percentage The percentage, as a ratio of 10000.\n */\n function percOf(uint128 value, uint32 percentage) internal pure returns (uint256) {\n return (uint256(value) * percentage) / PERCENTAGE_DENOMINATOR;\n }\n\n /**\n * @dev Return a fraction as a percentage.\n * @param numerator The numerator limited to a uint128 value to prevent\n * phantom overflow.\n * @param denominator The denominator.\n * @return The percentage, as a ratio of 10000.\n */\n function asPerc(uint128 numerator, uint256 denominator) internal pure returns (uint32) {\n return SafeCast.toUint32((uint256(numerator) * PERCENTAGE_DENOMINATOR) / denominator);\n }\n\n /**\n * @dev Validate that a contract implements a given interface.\n * @param name The name of the contract, used in error messages.\n * @param target The address of the contract.\n * @param interfaceId The interface ID to check.\n */\n function validateContractInterface(\n string memory name,\n address target,\n bytes4 interfaceId\n ) internal view {\n if (bytes(name).length == 0) {\n revert ContractNameCannotBeEmpty();\n }\n if (target == address(0)) {\n revert TargetContractCannotBeZeroAddress(name);\n }\n if (interfaceId == bytes4(0)) {\n revert InterfaceIdCannotBeZeroBytes();\n }\n if (!ERC165(target).supportsInterface(interfaceId)) {\n revert TargetNotSupportInterface(name, interfaceId);\n }\n }\n}\n" + }, + "contracts/payments/SyloTicketing.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\n\nimport \"../Registries.sol\";\nimport \"../staking/Directory.sol\";\nimport \"../libraries/SyloUtils.sol\";\nimport \"../epochs/EpochsManager.sol\";\nimport \"../staking/StakingManager.sol\";\nimport \"./ticketing/RewardsManager.sol\";\nimport \"../AuthorizedAccounts.sol\";\nimport \"../interfaces/payments/ISyloTicketing.sol\";\nimport \"../interfaces/IFuturePassRegistrar.sol\";\n\n/**\n * @notice The SyloTicketing contract manages the Probabilistic\n * Micro-Payment Ticketing system that pays Nodes for providing the\n * Event Relay service.\n */\ncontract SyloTicketing is ISyloTicketing, Initializable, Ownable2StepUpgradeable, ERC165 {\n /** ERC20 Sylo token contract.*/\n IERC20 public _token;\n\n /** Sylo Registries contract */\n Registries public _registries;\n\n /** Sylo Staking Manager contract */\n StakingManager public _stakingManager;\n\n /** Sylo Directory contract */\n Directory public _directory;\n\n /** Rewards Manager contract */\n RewardsManager public _rewardsManager;\n\n /**\n * @notice Sylo Epochs Manager.\n * @dev The ticketing parameters used when redeeming tickets\n * will be read from this contract.\n */\n EpochsManager public _epochsManager;\n\n /**\n * @notice Sylo Authorized Accounts.\n */\n AuthorizedAccounts public _authorizedAccounts;\n\n /**\n * @notice Futurepass Registrar Pre-compile.\n */\n IFuturePassRegistrar public _futurepassRegistrar;\n\n /**\n * @notice The number of blocks a user must wait after calling \"unlock\"\n * before they can withdraw their funds.\n */\n uint256 public unlockDuration;\n\n /** @notice Mapping of user deposits */\n mapping(address => Deposit) public deposits;\n\n /** @notice Mapping of ticket hashes, used to check if a ticket has been redeemed */\n mapping(bytes32 => bool) public usedTickets;\n\n event UnlockDurationUpdated(uint256 unlockDuration);\n event SenderPenaltyBurnt(address sender);\n event Redemption(\n uint256 indexed epochId,\n address indexed redeemer,\n address indexed sender,\n address receiver,\n uint256 generationBlock,\n uint256 amount\n );\n event MultiReceiverRedemption(\n uint256 indexed epochId,\n address indexed redeemer,\n address indexed sender,\n address receiver,\n uint256 generationBlock,\n uint256 amount\n );\n\n error NoEsrowAndPenalty();\n error UnlockingInProcess();\n error UnlockingNotInProcess();\n error UnlockingNotCompleted();\n error EscrowAmountCannotBeZero();\n error PenaltyAmountCannotBeZero();\n error UnlockDurationCannotBeZero();\n error AccountCannotBeZeroAddress();\n error InvalidSenderSigningPermission();\n error InvalidReceiverSigningPermission();\n\n error TicketNotWinning();\n error MissingFuturepassAccount(address receiver);\n error TicketAlreadyUsed();\n error TicketEpochNotFound();\n error TicketAlreadyRedeemed();\n error RedeemerCommitMismatch();\n error InvalidSenderSignature();\n error InvalidReceiverSignature();\n error TokenCannotBeZeroAddress();\n error TicketNotCreatedInTheEpoch();\n error TicketCannotBeFromFutureBlock();\n error TicketSenderCannotBeZeroAddress();\n error TicketReceiverCannotBeZeroAddress();\n error TicketRedeemerCannotBeZeroAddress();\n error RedeemerMustHaveJoinedEpoch(uint256 epochId);\n\n function initialize(\n IERC20 token,\n Registries registries,\n StakingManager stakingManager,\n Directory directory,\n EpochsManager epochsManager,\n RewardsManager rewardsManager,\n AuthorizedAccounts authorizedAccounts,\n IFuturePassRegistrar futurepassRegistrar,\n uint256 _unlockDuration\n ) external initializer {\n if (address(token) == address(0)) {\n revert TokenCannotBeZeroAddress();\n }\n\n SyloUtils.validateContractInterface(\n \"Registries\",\n address(registries),\n type(IRegistries).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"StakingManager\",\n address(stakingManager),\n type(IStakingManager).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"Directory\",\n address(directory),\n type(IDirectory).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"EpochsManager\",\n address(epochsManager),\n type(IEpochsManager).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"RewardsManager\",\n address(rewardsManager),\n type(IRewardsManager).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"AuthorizedAccounts\",\n address(authorizedAccounts),\n type(IAuthorizedAccounts).interfaceId\n );\n\n if (_unlockDuration == 0) {\n revert UnlockDurationCannotBeZero();\n }\n\n Ownable2StepUpgradeable.__Ownable2Step_init();\n\n _token = token;\n _registries = registries;\n _stakingManager = stakingManager;\n _directory = directory;\n _epochsManager = epochsManager;\n _rewardsManager = rewardsManager;\n _authorizedAccounts = authorizedAccounts;\n _futurepassRegistrar = futurepassRegistrar;\n\n unlockDuration = _unlockDuration;\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(ISyloTicketing).interfaceId;\n }\n\n /**\n * @notice Set the unlock duration for deposits. Only callable\n * by the owner.\n * @param _unlockDuration The unlock duration in blocks.\n */\n function setUnlockDuration(uint256 _unlockDuration) external onlyOwner {\n if (_unlockDuration == 0) {\n revert UnlockDurationCannotBeZero();\n }\n\n unlockDuration = _unlockDuration;\n emit UnlockDurationUpdated(_unlockDuration);\n }\n\n /**\n * @notice Use this function to deposit funds into the\n * escrow. This will fail if the deposit is currently being\n * unlocked.\n * @param amount The amount in SOLO to add to the escrow.\n * @param account The address of the account holding the escrow.\n */\n function depositEscrow(uint256 amount, address account) external {\n if (amount == 0) {\n revert EscrowAmountCannotBeZero();\n }\n if (account == address(0)) {\n revert AccountCannotBeZeroAddress();\n }\n\n Deposit storage deposit = getDeposit(account);\n if (deposit.unlockAt != 0) {\n revert UnlockingInProcess();\n }\n\n deposit.escrow = deposit.escrow + amount;\n\n SafeERC20.safeTransferFrom(_token, msg.sender, address(this), amount);\n }\n\n /**\n * @notice Use this function to deposit funds into the\n * penalty. This will fail if the deposit is currently being\n * unlocked.\n * @param amount The amount in SOLO to add to the escrow.\n * @param account The address of the account holding the penalty.\n */\n function depositPenalty(uint256 amount, address account) external {\n if (amount == 0) {\n revert PenaltyAmountCannotBeZero();\n }\n if (account == address(0)) {\n revert AccountCannotBeZeroAddress();\n }\n\n Deposit storage deposit = getDeposit(account);\n if (deposit.unlockAt != 0) {\n revert UnlockingInProcess();\n }\n\n deposit.penalty = deposit.penalty + amount;\n\n SafeERC20.safeTransferFrom(_token, msg.sender, address(this), amount);\n }\n\n /**\n * @notice Call this function to begin unlocking deposits. This function\n * will fail if no deposit exists, or if the unlock process has\n * already begun.\n */\n function unlockDeposits() external returns (uint256) {\n Deposit storage deposit = getDeposit(msg.sender);\n\n if (deposit.escrow == 0 && deposit.penalty == 0) {\n revert NoEsrowAndPenalty();\n }\n if (deposit.unlockAt != 0) {\n revert UnlockingInProcess();\n }\n\n deposit.unlockAt = block.number + unlockDuration;\n\n return deposit.unlockAt;\n }\n\n /**\n * @notice Call this function to cancel any deposit that is in the\n * unlocking process.\n */\n function lockDeposits() external {\n Deposit storage deposit = getDeposit(msg.sender);\n if (deposit.unlockAt == 0) {\n revert UnlockingNotInProcess();\n }\n\n delete deposit.unlockAt;\n }\n\n /**\n * @notice Call this function once the unlock duration has\n * elapsed in order to transfer the unlocked tokens to the caller's account.\n */\n function withdraw() external {\n return withdrawTo(msg.sender);\n }\n\n /**\n * @notice Call this function once the unlock duration has\n * elapsed in order to transfer the unlocked tokens to the specified\n * account.\n * @param account The address of the account the tokens should be\n * transferred to.\n */\n function withdrawTo(address account) public {\n Deposit memory deposit = getDeposit(msg.sender);\n if (deposit.unlockAt == 0) {\n revert UnlockingNotInProcess();\n }\n if (deposit.unlockAt >= block.number) {\n revert UnlockingNotCompleted();\n }\n\n uint256 amount = deposit.escrow + deposit.penalty;\n\n // Reset deposit values to 0\n delete deposits[msg.sender];\n\n SafeERC20.safeTransfer(_token, account, amount);\n }\n\n /**\n * @notice Nodes should call this function on completing an event\n * delivery. This function will fail if the ticket is invalid or if the\n * ticket is not a winner. Clients should calculate if the ticket is a\n * winner locally, but can also use the public view functions:\n * `requireValidWinningTicket` and `isWinningTicket` to check that a ticket\n * is winning.\n * @param ticket The ticket issued by the sender.\n * @param redeemerRand The redeemer random value, generated by the Node prior\n * to performing the event relay.\n * @param senderSig The signature of the sender of the ticket.\n * @param receiverSig The signature of the redeemer of the ticket.\n */\n function redeem(\n Ticket calldata ticket,\n uint256 redeemerRand,\n bytes calldata senderSig,\n bytes calldata receiverSig\n ) external {\n EpochsManager.Epoch memory epoch = _epochsManager.getEpoch(ticket.epochId);\n if (ticket.generationBlock > block.number) {\n revert TicketCannotBeFromFutureBlock();\n }\n\n bytes32 ticketHash = requireValidWinningTicket(\n ticket,\n redeemerRand,\n senderSig,\n receiverSig\n );\n\n usedTickets[ticketHash] = true;\n\n uint256 directoryStake = _directory.getTotalStakeForStakee(\n ticket.epochId,\n ticket.redeemer\n );\n if (directoryStake == 0) {\n revert RedeemerMustHaveJoinedEpoch(ticket.epochId);\n }\n\n _redeem(epoch, ticket);\n }\n\n /**\n * @notice Nodes should call this function on completing a one-to-many event\n * delivery. This function will fail if the ticket is invalid or if the\n * ticket is not a winner. Additionally, the specified receiver must have\n * a valid futurepass account associated with it. Clients should calculate\n * if the ticket is a winner locally, but can also use the public view\n * functions:\n * `requireValidWinningMultiReceiverTicket` and `isWinningTicket` to check\n * that a ticket is winning.\n * @param ticket The ticket issued by the sender.\n * @param redeemerRand The redeemer random value, generated by the Node prior\n * to performing the event relay.\n * @param receiver A valid receiver of the the relay.\n * @param senderSig The signature of the sender of the ticket.\n * @param receiverSig The signature of the redeemer of the ticket.\n */\n function redeemMultiReceiver(\n MultiReceiverTicket calldata ticket,\n uint256 redeemerRand,\n User calldata receiver,\n bytes calldata senderSig,\n bytes calldata receiverSig\n ) external {\n EpochsManager.Epoch memory epoch = _epochsManager.getEpoch(ticket.epochId);\n if (ticket.generationBlock > block.number) {\n revert TicketCannotBeFromFutureBlock();\n }\n\n (, bytes32 ticketReceiverHash) = requireValidWinningMultiReceiverTicket(\n ticket,\n receiver,\n redeemerRand,\n senderSig,\n receiverSig\n );\n\n usedTickets[ticketReceiverHash] = true;\n\n uint256 directoryStake = _directory.getTotalStakeForStakee(\n ticket.epochId,\n ticket.redeemer\n );\n if (directoryStake == 0) {\n revert RedeemerMustHaveJoinedEpoch(ticket.epochId);\n }\n\n _redeemMultiReceiver(epoch, ticket, receiver.main);\n }\n\n function _redeem(EpochsManager.Epoch memory epoch, Ticket calldata ticket) internal {\n uint256 rewardAmount = rewardRedeemer(epoch, ticket.sender, ticket.redeemer);\n\n emit Redemption(\n ticket.epochId,\n ticket.redeemer,\n ticket.sender.main,\n ticket.receiver.main,\n ticket.generationBlock,\n rewardAmount\n );\n }\n\n function _redeemMultiReceiver(\n EpochsManager.Epoch memory epoch,\n MultiReceiverTicket calldata ticket,\n address receiver\n ) internal {\n uint256 rewardAmount = rewardRedeemer(epoch, ticket.sender, ticket.redeemer);\n\n emit MultiReceiverRedemption(\n ticket.epochId,\n ticket.redeemer,\n ticket.sender.main,\n receiver,\n ticket.generationBlock,\n rewardAmount\n );\n }\n\n function rewardRedeemer(\n EpochsManager.Epoch memory epoch,\n User calldata sender,\n address redeemer\n ) internal returns (uint256) {\n Deposit storage deposit = getDeposit(sender.main);\n\n uint256 amount;\n\n if (epoch.faceValue > deposit.escrow) {\n amount = deposit.escrow;\n incrementRewardPool(redeemer, deposit, amount);\n SafeERC20.safeTransfer(\n _token,\n address(0x000000000000000000000000000000000000dEaD),\n deposit.penalty\n );\n\n delete deposit.penalty;\n emit SenderPenaltyBurnt(sender.main);\n } else {\n amount = epoch.faceValue;\n incrementRewardPool(redeemer, deposit, amount);\n }\n\n return amount;\n }\n\n /**\n * @notice Call this function to check if a ticket is valid and is\n * a winning ticket. It will fail if the ticket is invalid or is not\n * a winner. A ticket is invalid if:\n * - The sender or redeemer addresses are null\n * - The ticket has already been redeemed.\n * - The secret random value of the sender does not match the commit\n * in the ticket.\n * - The signatures are invalid.\n * @param ticket The ticket issued by the sender.\n * @param redeemerRand The redeemer random value, generated by the Node prior\n * to performing the event relay.\n * @param senderSig The signature of the sender of the ticket.\n * @param receiverSig The signature of the redeemer of the ticket.\n * @return ticketHash The hash of the ticket. Should match the hash generated\n * by `getTicketHash`.\n */\n function requireValidWinningTicket(\n Ticket memory ticket,\n uint256 redeemerRand,\n bytes calldata senderSig,\n bytes calldata receiverSig\n ) public view returns (bytes32 ticketHash) {\n if (ticket.sender.main == address(0)) {\n revert TicketSenderCannotBeZeroAddress();\n }\n if (ticket.receiver.main == address(0)) {\n revert TicketReceiverCannotBeZeroAddress();\n }\n if (ticket.redeemer == address(0)) {\n revert TicketRedeemerCannotBeZeroAddress();\n }\n\n ticketHash = getTicketHash(ticket);\n if (usedTickets[ticketHash]) {\n revert TicketAlreadyRedeemed();\n }\n\n // validate the redeemer has knowledge of the redeemer rand\n if (createCommit(ticket.generationBlock, redeemerRand) != ticket.redeemerCommit) {\n revert RedeemerCommitMismatch();\n }\n\n if (!hasSigningPermission(ticket.sender, ticket.generationBlock)) {\n revert InvalidSenderSigningPermission();\n }\n if (!hasSigningPermission(ticket.receiver, ticket.generationBlock)) {\n revert InvalidReceiverSigningPermission();\n }\n\n if (!isValidTicketSig(ticket.sender, senderSig, ticketHash)) {\n revert InvalidSenderSignature();\n }\n if (!isValidTicketSig(ticket.receiver, receiverSig, ticketHash)) {\n revert InvalidReceiverSignature();\n }\n\n if (\n !isWinningTicket(\n senderSig,\n receiverSig,\n ticket.epochId,\n ticket.generationBlock,\n redeemerRand\n )\n ) {\n revert TicketNotWinning();\n }\n }\n\n /**\n * @notice Call this function to check if a multi receiver ticket is valid and is\n * a winning ticket. It will fail if the ticket is invalid or is not\n * a winner. A ticket is invalid if:\n * - The sender, receiver or redeemer addresses are null\n * - The receiver does not have a valid futurepass account\n * - The ticket has already been redeemed.\n * - The secret random value of the redeemer does not match the commit\n * in the ticket.\n * - The signatures are invalid.\n * @param ticket The ticket issued by the sender.\n * @param receiver The receiver associated with the ticket.\n * @param redeemerRand The redeemer random value, generated by the Node prior\n * to performing the event relay.\n * @param senderSig The signature of the sender of the ticket.\n * @param receiverSig The signature of the redeemer of the ticket.\n */\n function requireValidWinningMultiReceiverTicket(\n MultiReceiverTicket memory ticket,\n User calldata receiver,\n uint256 redeemerRand,\n bytes calldata senderSig,\n bytes calldata receiverSig\n ) public view returns (bytes32 ticketHash, bytes32 ticketReceiverHash) {\n if (ticket.sender.main == address(0)) {\n revert TicketSenderCannotBeZeroAddress();\n }\n if (receiver.main == address(0)) {\n revert TicketReceiverCannotBeZeroAddress();\n }\n if (ticket.redeemer == address(0)) {\n revert TicketRedeemerCannotBeZeroAddress();\n }\n\n address futurepassAccount = _futurepassRegistrar.futurepassOf(receiver.main);\n if (futurepassAccount == address(0)) {\n revert MissingFuturepassAccount(receiver.main);\n }\n\n // There are two hashes create. The first hash is signed by the\n // sender and receiver, and is primarily used to validate these actors\n // agreed on the contents of the ticket.\n // The second hash is to prevent re-use. In a multi-receiver context,\n // the same ticket can be re-used amongst many receiver, but should\n // only be used ONCE per futurepass account. Thus the second hash\n // additionally appends the futurepass address as well.\n ticketHash = getMultiReceiverTicketHash(ticket);\n ticketReceiverHash = keccak256(abi.encodePacked(ticketHash, futurepassAccount));\n if (usedTickets[ticketReceiverHash]) {\n revert TicketAlreadyRedeemed();\n }\n\n // validate the redeemer has knowledge of the redeemer rand\n if (createCommit(ticket.generationBlock, redeemerRand) != ticket.redeemerCommit) {\n revert RedeemerCommitMismatch();\n }\n\n if (!hasSigningPermission(ticket.sender, ticket.generationBlock)) {\n revert InvalidSenderSigningPermission();\n }\n if (!hasSigningPermission(receiver, ticket.generationBlock)) {\n revert InvalidReceiverSigningPermission();\n }\n\n if (!isValidTicketSig(ticket.sender, senderSig, ticketHash)) {\n revert InvalidSenderSignature();\n }\n if (!isValidTicketSig(receiver, receiverSig, ticketHash)) {\n revert InvalidReceiverSignature();\n }\n\n if (\n !isWinningTicket(\n senderSig,\n receiverSig,\n ticket.epochId,\n ticket.generationBlock,\n redeemerRand\n )\n ) {\n revert TicketNotWinning();\n }\n\n return (ticketHash, ticketReceiverHash);\n }\n\n function hasSigningPermission(\n User memory user,\n uint256 generationBlock\n ) internal view returns (bool) {\n if (user.delegated == address(0)) {\n return true;\n }\n\n IAuthorizedAccounts.Permission permission = IAuthorizedAccounts.Permission.PersonalSign;\n return\n _authorizedAccounts.validatePermission(\n user.main,\n user.delegated,\n permission,\n generationBlock\n );\n }\n\n function createCommit(uint256 generationBlock, uint256 rand) public pure returns (bytes32) {\n return keccak256(abi.encodePacked(keccak256(abi.encodePacked(generationBlock, rand))));\n }\n\n function getDeposit(address account) private view returns (Deposit storage) {\n return deposits[account];\n }\n\n function isValidTicketSig(\n User memory user,\n bytes memory sig,\n bytes32 ticketHash\n ) internal pure returns (bool) {\n address signer = address(0);\n if (user.delegated != address(0)) {\n signer = user.delegated;\n } else {\n signer = user.main;\n }\n bytes32 ethHash = ECDSA.toEthSignedMessageHash(ticketHash);\n return ECDSA.recover(ethHash, sig) == signer;\n }\n\n /**\n * @notice Use this function to check if a ticket is winning.\n * @param senderSig The signature of the sender of the ticket.\n * @param receiverSig The signature of the receiver of the ticket.\n * @param epochId The epochId of the ticket.\n * @param generationBlock The generationBlock of the ticket.\n * @param redeemerRand The redeemer random value, generated by the Node prior\n * to performing the event relay.\n * @return True if a ticket is a winner.\n */\n function isWinningTicket(\n bytes memory senderSig,\n bytes memory receiverSig,\n uint256 epochId,\n uint256 generationBlock,\n uint256 redeemerRand\n ) public view returns (bool) {\n uint256 winProb = calculateWinningProbability(epochId, generationBlock);\n // bitshift the winProb to a 256 bit value to allow comparison to a 32 byte hash\n uint256 prob = (uint256(winProb) << 128) | uint256(winProb);\n return uint256(keccak256(abi.encodePacked(senderSig, receiverSig, redeemerRand))) < prob;\n }\n\n /**\n * @notice This function calculates the probability of a ticket winning at\n * the block that this function was called. A ticket's winning probability\n * will decay every block since its issuance. The amount of decay will depend\n * on the decay rate parameter of the epoch the ticket was generated in.\n * @param epochId The epochId of the ticket.\n * @param generationBlock The generationBlock of the ticket.\n */\n function calculateWinningProbability(\n uint256 epochId,\n uint256 generationBlock\n ) public view returns (uint128) {\n EpochsManager.Epoch memory epoch = _epochsManager.getEpoch(epochId);\n if (epoch.startBlock == 0) {\n revert TicketEpochNotFound();\n }\n\n if (\n generationBlock < epoch.startBlock ||\n (epoch.endBlock > 0 && generationBlock >= epoch.endBlock)\n ) {\n revert TicketNotCreatedInTheEpoch();\n }\n\n uint256 elapsedDuration = block.number - generationBlock;\n\n // Ticket has completely expired\n if (elapsedDuration >= epoch.ticketDuration) {\n return 0;\n }\n\n uint256 maxDecayValue = SyloUtils.percOf(epoch.baseLiveWinProb, epoch.decayRate);\n\n // determine the amount of probability that has actually decayed\n // by multiplying the maximum decay value against ratio of the tickets elapsed duration\n // vs the actual ticket duration. The max decay value is calculated from a fraction of a\n // uint128 value so we cannot phantom overflow here\n uint256 decayedProbability = (maxDecayValue * elapsedDuration) / epoch.ticketDuration;\n\n // calculate the remaining probability by subtracting the decayed probability\n // from the base\n return epoch.baseLiveWinProb - SafeCast.toUint128(decayedProbability);\n }\n\n /**\n * @notice Returns the hash of the ticket. Takes all fields in a ticket\n * as inputs to the hash.\n * @return A byte-array representing the hash.\n */\n function getTicketHash(Ticket memory ticket) public pure returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(\n ticket.epochId,\n ticket.sender.main,\n ticket.receiver.main,\n ticket.redeemer,\n ticket.generationBlock,\n ticket.redeemerCommit\n )\n );\n }\n\n /**\n * @notice Returns the hash of a multi receiver ticket. Takes all fields in\n * a ticket as inputs to the hash, as well as a specific receiver.\n * @return A byte-array representing the hash.\n */\n function getMultiReceiverTicketHash(\n MultiReceiverTicket memory ticket\n ) public pure returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(\n ticket.epochId,\n ticket.sender.main,\n ticket.redeemer,\n ticket.generationBlock,\n ticket.redeemerCommit\n )\n );\n }\n\n function incrementRewardPool(\n address stakee,\n Deposit storage deposit,\n uint256 amount\n ) internal {\n deposit.escrow = deposit.escrow - amount;\n\n SafeERC20.safeTransfer(_token, address(_rewardsManager), amount);\n _rewardsManager.incrementRewardPool(stakee, amount);\n }\n}\n" + }, + "contracts/payments/ticketing/RewardsManager.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"abdk-libraries-solidity/ABDKMath64x64.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\n\nimport \"../../libraries/SyloUtils.sol\";\nimport \"../../libraries/Manageable.sol\";\nimport \"../../epochs/EpochsManager.sol\";\nimport \"../../staking/StakingManager.sol\";\nimport \"../../interfaces/epochs/IEpochsManager.sol\";\nimport \"../../interfaces/staking/IStakingManager.sol\";\nimport \"../../interfaces/payments/ticketing/IRewardsManager.sol\";\n\n/**\n * @notice Handles epoch based reward pools that are incremented from redeeming tickets.\n * Nodes use this contract to set up their reward pool for the next epoch,\n * and stakers use this contract to track and claim staking rewards.\n * @dev After deployment, the SyloTicketing contract should be\n * set up as a manager to be able to call certain restricted functions.\n */\ncontract RewardsManager is IRewardsManager, Initializable, Manageable, ERC165 {\n uint256 internal constant ONE_SYLO = 1 ether;\n\n // 64x64 Fixed point representation of 1 SYLO (10**18 >> 64)\n int128 internal constant ONE_SYLO_FIXED = 18446744073709551616000000000000000000;\n\n uint256 internal constant MAX_INT64 = 9223372036854775807;\n\n /** ERC20 Sylo token contract. */\n IERC20 public _token;\n\n /** Sylo Staking Manager contract. */\n StakingManager public _stakingManager;\n\n /** Sylo Epochs Manager. */\n EpochsManager public _epochsManager;\n\n /**\n * @dev Each node will manage a cumulative reward factor (CRF) that is incremented\n * whenever a ticket is redeemed. This factor acts as a single value\n * that can be used to calculate any particular staker's reward share. This\n * prevents the need to individually track each staker's proportion, and also allows\n * a claim calculation to be performed without iterating through every epoch.\n *\n * The CRF is calculated as CRF = CRF + Reward / TotalStake.\n */\n mapping(address => int128) private cumulativeRewardFactors;\n\n /**\n * @notice Tracks the last epoch a delegated staker made a reward claim in.\n * The key to this mapping is a hash of the Node's address and the delegated\n * stakers address.\n */\n mapping(bytes32 => LastClaim) public lastClaims;\n\n /**\n * @notice Tracks each Nodes total pending rewards in SOLOs. This\n * value is accumulated as Node's redeem tickets. Rewards are pending if the\n * distribution amongst the stakers has not been accounted for yet. Pending rewards\n * are transferred to unclaimed rewards once the the staker's share has been\n * calculated.\n */\n mapping(address => uint256) public pendingRewards;\n\n /**\n * @notice Tracks rewards for stakers after the stakers share has been calculated,\n * but has not actually been claimed by the staker.\n * The node fee reward is also added to the node's unclaimedStakingRewards.\n */\n mapping(bytes32 => uint256) public unclaimedStakingRewards;\n\n /**\n * @notice Tracks each Node's most recently active reward pool\n */\n mapping(address => uint256) public latestActiveRewardPools;\n\n /**\n * @notice Tracks total accumulated rewards in each epoch\n */\n mapping(uint256 => uint256) public totalEpochRewards;\n\n /**\n * @notice Tracks total accumulated staking rewards in each epoch\n */\n mapping(uint256 => uint256) public totalEpochStakingRewards;\n\n /**\n * @notice Tracks each reward pool initialized by a Node. The key to this map\n * is derived from the epochId and the Node's address.\n */\n mapping(bytes32 => RewardPool) public rewardPools;\n\n error NoRewardToClaim();\n error AmountCannotBeZero();\n error RewardPoolNotExist();\n error RewardPoolAlreadyExist();\n error DoNotAllowZeroAddress();\n error TokenCannotBeZeroAddress();\n error NoStakeToCreateRewardPool();\n error StakeeCannotBeZeroAddress();\n error StakerCannotBeZeroAddress();\n error StakerKeyCannotBeZeroBytes();\n error InvalidFixedPointResult();\n\n function initialize(\n IERC20 token,\n StakingManager stakingManager,\n EpochsManager epochsManager\n ) external initializer {\n if (address(token) == address(0)) {\n revert TokenCannotBeZeroAddress();\n }\n\n SyloUtils.validateContractInterface(\n \"StakingManager\",\n address(stakingManager),\n type(IStakingManager).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"EpochsManager\",\n address(epochsManager),\n type(IEpochsManager).interfaceId\n );\n\n Ownable2StepUpgradeable.__Ownable2Step_init();\n\n _token = token;\n _epochsManager = epochsManager;\n _stakingManager = stakingManager;\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IRewardsManager).interfaceId;\n }\n\n /**\n * @notice Returns the key used to index a reward pool. The key is a hash of\n * the epochId and Node's address.\n * @param epochId The epoch ID the reward pool was created in.\n * @param stakee The address of the Node.\n * @return A byte-array representing the reward pool key.\n */\n function getRewardPoolKey(uint256 epochId, address stakee) public pure returns (bytes32) {\n return keccak256(abi.encodePacked(epochId, stakee));\n }\n\n /**\n * @notice Returns the key used to index staking claims. The key is a hash of\n * the Node's address and the staker's address.\n * @param stakee The address of the Node.\n * @param staker The address of the stake.\n * @return A byte-array representing the key.\n */\n function getStakerKey(address stakee, address staker) public pure returns (bytes32) {\n return keccak256(abi.encodePacked(stakee, staker));\n }\n\n /**\n * @notice Retrieve the reward pool initialized by the given node, at the specified\n * epoch.\n * @param epochId The ID of the epoch the reward pool was initialized in.\n * @param stakee The address of the Node.\n * @return The reward pool.\n */\n function getRewardPool(\n uint256 epochId,\n address stakee\n ) external view returns (RewardPool memory) {\n return rewardPools[getRewardPoolKey(epochId, stakee)];\n }\n\n /**\n * @notice Retrieve the total accumulated reward that will be distributed to a Node's\n * delegated stakers for a given epoch.\n * @param epochId The ID of the epoch the reward pool was initialized in.\n * @param stakee The address of the Node.\n * @return The total accumulated staker reward in SOLO.\n */\n function getRewardPoolStakersTotal(\n uint256 epochId,\n address stakee\n ) external view returns (uint256) {\n return rewardPools[getRewardPoolKey(epochId, stakee)].stakersRewardTotal;\n }\n\n /**\n * @notice Retrieve the total active stake that will be used for a Node's reward\n * pool in a given epoch.\n * @param epochId The ID of the epoch the reward pool was initialized in.\n * @param stakee The address of the Node.\n * @return The total active stake for that reward pool in SOLO.\n */\n function getRewardPoolActiveStake(\n uint256 epochId,\n address stakee\n ) external view returns (uint256) {\n return rewardPools[getRewardPoolKey(epochId, stakee)].totalActiveStake;\n }\n\n /**\n * @notice Retrieve the total pending staking reward allocated to a Node's\n * stakers.\n * @param stakee The address of the Node.\n * @return The total pending staking reward in SOLO.\n */\n function getPendingRewards(address stakee) external view returns (uint256) {\n return pendingRewards[stakee];\n }\n\n /**\n * @notice Retrieves the ID of the epoch in which a staker last made their\n * staking claim.\n * @param stakee The address of the Node.\n * @param staker The address of the staker.\n * @return The ID of the epoch.\n */\n function getLastClaim(\n address stakee,\n address staker\n ) external view returns (LastClaim memory) {\n return lastClaims[getStakerKey(stakee, staker)];\n }\n\n /**\n * @notice Retrieves the total accumulated rewards for a specific epoch.\n * @param epochId The epoch id.\n * @return The total reward in that epoch, including staking rewards and fee\n * reward.\n */\n function getTotalEpochRewards(uint256 epochId) external view returns (uint256) {\n return totalEpochRewards[epochId];\n }\n\n /**\n * @notice Retrieves the total accumulated rewards for stakers in a specific epoch.\n * @param epochId The epoch id.\n * @return The total staking reward in that epoch.\n */\n function getTotalEpochStakingRewards(uint256 epochId) external view returns (uint256) {\n return totalEpochStakingRewards[epochId];\n }\n\n /**\n * @notice This is used by Nodes to initialize their reward pool for\n * the next epoch. This function will revert if the caller has no stake, or\n * if the reward pool has already been initialized. The total active stake\n * for the next reward pool is calculated by summing up the total managed\n * stake held by the RewardsManager contract.\n */\n function initializeNextRewardPool(address stakee) external onlyManager {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n\n uint256 nextEpochId = _epochsManager.getNextEpochId();\n\n RewardPool storage nextRewardPool = rewardPools[getRewardPoolKey(nextEpochId, stakee)];\n if (nextRewardPool.initializedAt != 0) {\n revert RewardPoolAlreadyExist();\n }\n\n uint256 totalStake = _stakingManager.getStakeeTotalManagedStake(stakee);\n if (totalStake == 0) {\n revert NoStakeToCreateRewardPool();\n }\n\n nextRewardPool.totalActiveStake = totalStake;\n\n nextRewardPool.initializedAt = block.number;\n }\n\n /**\n * @dev This function should be called by the Ticketing contract when a\n * ticket is successfully redeemed. The face value of the ticket\n * should be split between incrementing the node's reward balance,\n * and the reward balance for the node's delegated stakers. The face value\n * will be added to the current reward pool's balance. This function will\n * fail if the Ticketing contract has not been set as a manager.\n * @param stakee The address of the Node.\n * @param amount The face value of the ticket in SOLO.\n */\n function incrementRewardPool(address stakee, uint256 amount) external onlyManager {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n if (amount == 0) {\n revert AmountCannotBeZero();\n }\n\n (uint256 epochId, IEpochsManager.Epoch memory currentEpoch) = _epochsManager\n .getCurrentActiveEpoch();\n\n RewardPool storage rewardPool = rewardPools[getRewardPoolKey(epochId, stakee)];\n if (rewardPool.initializedAt == 0) {\n revert RewardPoolNotExist();\n }\n\n // Update the latest active reward pool for the node to be this pool\n if (latestActiveRewardPools[stakee] < epochId) {\n latestActiveRewardPools[stakee] = epochId;\n }\n\n uint256 stakersReward = SyloUtils.percOf(\n SafeCast.toUint128(amount),\n currentEpoch.defaultPayoutPercentage\n );\n\n // transfer the node's fee reward to it's unclaimed reward value\n unclaimedStakingRewards[getStakerKey(stakee, stakee)] =\n unclaimedStakingRewards[getStakerKey(stakee, stakee)] +\n (amount - stakersReward);\n\n // update the value of the reward owed to the stakers\n pendingRewards[stakee] = pendingRewards[stakee] + stakersReward;\n\n // if this is the first ticket redeemed for this reward, set the initial\n // CRF value for this pool\n if (rewardPool.stakersRewardTotal == 0) {\n rewardPool.initialCumulativeRewardFactor = cumulativeRewardFactors[stakee];\n }\n\n rewardPool.stakersRewardTotal = rewardPool.stakersRewardTotal + stakersReward;\n\n // We preemptively prevent an overflow revert with the abdk library.\n // Dividing the stakers reward with the pool's total active\n // stake may produce a value that is greater than the maximum possible\n // 64.64 fixed point value.\n // This error is incredibly niche and unlikely to happen, so we just\n // revert here as well (with a named error) and remediation involves\n // just increasing the amount of stake a node has.\n if (rewardPool.totalActiveStake * MAX_INT64 < stakersReward) {\n revert InvalidFixedPointResult();\n }\n\n cumulativeRewardFactors[stakee] = ABDKMath64x64.add(\n cumulativeRewardFactors[stakee],\n ABDKMath64x64.div(\n toFixedPointSYLO(stakersReward),\n toFixedPointSYLO(rewardPool.totalActiveStake)\n )\n );\n\n totalEpochRewards[epochId] = totalEpochRewards[epochId] + amount;\n totalEpochStakingRewards[epochId] = totalEpochStakingRewards[epochId] + stakersReward;\n }\n\n /**\n * @dev This function utilizes the cumulative reward factors, and the staker's\n * value in stake to calculate the staker's share of the pending reward.\n */\n function calculatePendingClaim(\n bytes32 stakerKey,\n address stakee,\n address staker\n ) internal view returns (uint256) {\n uint256 claim = calculateInitialClaim(stakerKey, stakee);\n\n // find the first reward pool where their stake was active and had\n // generated rewards\n uint256 activeAt;\n RewardPool memory initialActivePool;\n\n uint256 currentEpochId = _epochsManager.currentIteration();\n\n for (uint256 i = lastClaims[stakerKey].claimedAt + 1; i < currentEpochId; ++i) {\n initialActivePool = rewardPools[getRewardPoolKey(i, stakee)];\n // check if node initialized a reward pool for this epoch and\n // gained rewards\n if (initialActivePool.initializedAt > 0 && initialActivePool.stakersRewardTotal > 0) {\n activeAt = i;\n break;\n }\n }\n\n if (activeAt == 0) {\n return claim;\n }\n\n IStakingManager.StakeEntry memory stakeEntry = _stakingManager.getStakeEntry(\n stakee,\n staker\n );\n\n // We convert the staker amount to SYLO as the maximum uint256 value that\n // can be used for the fixed point representation is 2^64-1.\n int128 initialStake = toFixedPointSYLO(stakeEntry.amount);\n\n int128 initialCumulativeRewardFactor = initialActivePool.initialCumulativeRewardFactor;\n\n int128 finalCumulativeRewardFactor = getFinalCumulativeRewardFactor(\n stakee,\n currentEpochId\n );\n\n return\n claim +\n fromFixedPointSYLO(\n ABDKMath64x64.mul(\n initialStake,\n ABDKMath64x64.sub(finalCumulativeRewardFactor, initialCumulativeRewardFactor)\n )\n );\n }\n\n /**\n * Manually calculates the reward claim for the first epoch the claim is being\n * made for. This manual calculation is necessary as claims are only made up\n * to the previous epoch.\n */\n function calculateInitialClaim(\n bytes32 stakerKey,\n address stakee\n ) internal view returns (uint256) {\n LastClaim memory lastClaim = lastClaims[stakerKey];\n\n // if we have already made a claim up to the previous epoch, then\n // there is no need to calculate the initial claim\n if (_epochsManager.currentIteration() == lastClaim.claimedAt) {\n return 0;\n }\n\n RewardPool memory firstRewardPool = rewardPools[\n getRewardPoolKey(lastClaim.claimedAt, stakee)\n ];\n\n // if there was no reward pool initialized for the first epoch,\n // then there is no need to calculate the initial claim\n if (firstRewardPool.totalActiveStake == 0) {\n return 0;\n }\n\n return\n (firstRewardPool.stakersRewardTotal * lastClaim.stake) /\n firstRewardPool.totalActiveStake;\n }\n\n /**\n * Determines the cumulative reward factor to use for claim calculations. The\n * CRF will depend on when the Node last initialized a reward pool, and also when\n * the staker last made their claim.\n */\n function getFinalCumulativeRewardFactor(\n address stakee,\n uint256 currentEpochId\n ) internal view returns (int128) {\n int128 finalCumulativeRewardFactor;\n\n // Get the cumulative reward factor for the Node\n // for the start of this epoch, since we only perform\n // calculations up to the end of the previous epoch.\n if (latestActiveRewardPools[stakee] < currentEpochId) {\n // If the Node has not been active, then the final\n // cumulative reward factor will just be the current one.\n finalCumulativeRewardFactor = cumulativeRewardFactors[stakee];\n } else {\n // We are calculating the claim for an active epoch, the\n // final cumulative reward factor will be taken from the start of this\n // epoch (end of previous epoch).\n RewardPool storage latestRewardPool = rewardPools[\n getRewardPoolKey(latestActiveRewardPools[stakee], stakee)\n ];\n finalCumulativeRewardFactor = latestRewardPool.initialCumulativeRewardFactor;\n }\n\n return finalCumulativeRewardFactor;\n }\n\n /**\n * @notice Call this function to calculate the total reward owed to a staker.\n * This value will include all epochs since the last claim was made up to\n * the previous epoch. This will also add any pending rewards to the\n * final value as well.\n * @dev This function will utilize the cumulative reward factor to perform the\n * calculation, keeping the gas cost scaling of this function to a constant value.\n * @param stakee The address of the Node.\n * @param staker The address of the staker.\n * @return The value of the reward owed to the staker in SOLO.\n */\n function calculateStakerClaim(address stakee, address staker) public view returns (uint256) {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n if (staker == address(0)) {\n revert StakerCannotBeZeroAddress();\n }\n\n bytes32 stakerKey = getStakerKey(stakee, staker);\n uint256 pendingClaim = calculatePendingClaim(stakerKey, stakee, staker);\n\n return pendingClaim + unclaimedStakingRewards[stakerKey];\n }\n\n /**\n * Helper function to convert a uint256 value in SOLOs to a 64.64 fixed point\n * representation in SYLOs while avoiding any possibility of overflow.\n * Any remainders from converting SOLO to SYLO is explicitly handled to mitigate\n * precision loss. The error when using this function is [-1/2^64, 0].\n */\n function toFixedPointSYLO(uint256 amount) internal pure returns (int128) {\n int128 fullSylos = ABDKMath64x64.fromUInt(amount / ONE_SYLO);\n int128 fracSylos = ABDKMath64x64.fromUInt(amount % ONE_SYLO); // remainder\n\n return ABDKMath64x64.add(fullSylos, ABDKMath64x64.div(fracSylos, ONE_SYLO_FIXED));\n }\n\n /**\n * Helper function to convert a 64.64 fixed point value in SYLOs to a uint256\n * representation in SOLOs while avoiding any possibility of overflow.\n */\n function fromFixedPointSYLO(int128 amount) internal pure returns (uint256) {\n uint256 fullSylos = ABDKMath64x64.toUInt(amount);\n uint256 fullSolos = fullSylos * ONE_SYLO;\n\n // calculate the value lost when converting the fixed point amount to a uint\n int128 fracSylos = ABDKMath64x64.sub(amount, ABDKMath64x64.fromUInt(fullSylos));\n uint256 fracSolos = ABDKMath64x64.toUInt(ABDKMath64x64.mul(fracSylos, ONE_SYLO_FIXED));\n\n return fullSolos + fracSolos;\n }\n\n /**\n * @notice Call this function to claim rewards as a staker. The\n * SYLO tokens will be transferred to the caller's account. This function will\n * fail if there exists no reward to claim. Note: Calling this will remove\n * the current unclaimed reward from being used as stake in the next round.\n * @param stakee The address of the Node to claim against.\n */\n function claimStakingRewards(address stakee) external returns (uint256) {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n\n bytes32 stakerKey = getStakerKey(stakee, msg.sender);\n uint256 pendingReward = calculatePendingClaim(stakerKey, stakee, msg.sender);\n\n uint256 totalClaim = pendingReward + unclaimedStakingRewards[stakerKey];\n if (totalClaim == 0) {\n revert NoRewardToClaim();\n }\n\n delete unclaimedStakingRewards[stakerKey];\n pendingRewards[stakee] = pendingRewards[stakee] - pendingReward;\n\n updateLastClaim(stakee, msg.sender);\n\n SafeERC20.safeTransfer(_token, msg.sender, totalClaim);\n\n return totalClaim;\n }\n\n /**\n * @notice This is called by the staking manager to transfer pending rewards\n * to unclaimed rewards for a staker. This is required as the last used CRF\n * needs to be updated whenever stake changes.\n */\n function updatePendingRewards(address stakee, address staker) external onlyManager {\n bytes32 stakerKey = getStakerKey(stakee, staker);\n uint256 pendingReward = calculatePendingClaim(stakerKey, stakee, staker);\n\n pendingRewards[stakee] = pendingRewards[stakee] - pendingReward;\n\n unclaimedStakingRewards[stakerKey] = unclaimedStakingRewards[stakerKey] + pendingReward;\n\n updateLastClaim(stakee, staker);\n }\n\n function updateLastClaim(address stakee, address staker) internal {\n IStakingManager.StakeEntry memory stakeEntry = _stakingManager.getStakeEntry(\n stakee,\n staker\n );\n lastClaims[getStakerKey(stakee, staker)] = LastClaim(\n _epochsManager.currentIteration(),\n stakeEntry.amount\n );\n }\n}\n" + }, + "contracts/payments/ticketing/TicketingParameters.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\n\nimport \"../../libraries/SyloUtils.sol\";\nimport \"../../interfaces/payments/ticketing/ITicketingParameters.sol\";\n\n/**\n * @dev Persists the parameters for the ticketing mechanism. This contract is\n * read by the EpochManager. Extracting the parameters into another\n * contract is necessary to avoid a cyclic dependency between the ticketing\n * and epoch contracts.\n */\ncontract TicketingParameters is\n ITicketingParameters,\n Initializable,\n Ownable2StepUpgradeable,\n ERC165\n{\n /** @notice The value of a winning ticket in SOLO. */\n uint256 public faceValue;\n\n /**\n * @notice The probability of a ticket winning during the start of its lifetime.\n * This is a uint128 value representing the numerator in the probability\n * ratio where 2^128 - 1 is the denominator.\n */\n uint128 public baseLiveWinProb;\n\n /**\n * @notice The probability of a ticket winning after it has expired.\n * This is a uint128 value representing the numerator in the probability\n * ratio where 2^128 - 1 is the denominator. Note: Redeeming expired\n * tickets is currently not supported.\n */\n uint128 public expiredWinProb;\n\n /**\n * @notice The length in blocks before a ticket is considered expired.\n * The default initialization value is 80,000. This equates\n * to roughly two weeks (15s per block).\n */\n uint256 public ticketDuration;\n\n /**\n * @notice A percentage value representing the proportion of the base win\n * probability that will be decayed once a ticket has expired.\n * Example: 80% decayRate indicates that a ticket will decay down to 20% of its\n * base win probability upon reaching the block before its expiry.\n * The value is expressed as a fraction of 100000.\n */\n uint32 public decayRate;\n\n event FaceValueUpdated(uint256 faceValue);\n event BaseLiveWinProbUpdated(uint128 baseLiveWinprob);\n event ExpiredWinProbUpdated(uint128 expiredWinProb);\n event TicketDurationUpdated(uint256 ticketDuration);\n event DecayRateUpdated(uint32 decayRate);\n\n error FaceValueCannotBeZero();\n error TicketDurationCannotBeZero();\n\n function initialize(\n uint256 _faceValue,\n uint128 _baseLiveWinProb,\n uint128 _expiredWinProb,\n uint32 _decayRate,\n uint256 _ticketDuration\n ) external initializer {\n if (_faceValue == 0) {\n revert FaceValueCannotBeZero();\n }\n if (_ticketDuration == 0) {\n revert TicketDurationCannotBeZero();\n }\n\n Ownable2StepUpgradeable.__Ownable2Step_init();\n\n faceValue = _faceValue;\n baseLiveWinProb = _baseLiveWinProb;\n expiredWinProb = _expiredWinProb;\n decayRate = _decayRate;\n ticketDuration = _ticketDuration;\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(ITicketingParameters).interfaceId;\n }\n\n /**\n * @notice Set the face value for tickets in SOLO. Only callable by\n * the contract owner.\n * @param _faceValue The face value to set in SOLO.\n */\n function setFaceValue(uint256 _faceValue) external onlyOwner {\n if (_faceValue == 0) {\n revert FaceValueCannotBeZero();\n }\n\n faceValue = _faceValue;\n emit FaceValueUpdated(_faceValue);\n }\n\n /**\n * @notice Set the base live win probability of a ticket. Only callable by\n * the contract owner.\n * @param _baseLiveWinProb The probability represented as a value\n * between 0 to 2**128 - 1.\n */\n function setBaseLiveWinProb(uint128 _baseLiveWinProb) external onlyOwner {\n baseLiveWinProb = _baseLiveWinProb;\n emit BaseLiveWinProbUpdated(_baseLiveWinProb);\n }\n\n /**\n * @notice Set the expired win probability of a ticket. Only callable by\n * the contract owner.\n * @param _expiredWinProb The probability represented as a value\n * between 0 to 2**128 - 1.\n */\n function setExpiredWinProb(uint128 _expiredWinProb) external onlyOwner {\n expiredWinProb = _expiredWinProb;\n emit ExpiredWinProbUpdated(_expiredWinProb);\n }\n\n /**\n * @notice Set the decay rate of a ticket. Only callable by the\n * the contract owner.\n * @param _decayRate The decay rate as a percentage, where the\n * denominator is 10000.\n */\n function setDecayRate(uint32 _decayRate) external onlyOwner {\n decayRate = _decayRate;\n emit DecayRateUpdated(_decayRate);\n }\n\n /**\n * @notice Set the ticket duration of a ticket. Only callable by the\n * contract owner.\n * @param _ticketDuration The duration of a ticket in number of blocks.\n */\n function setTicketDuration(uint256 _ticketDuration) external onlyOwner {\n if (_ticketDuration == 0) {\n revert TicketDurationCannotBeZero();\n }\n\n ticketDuration = _ticketDuration;\n emit TicketDurationUpdated(_ticketDuration);\n }\n\n /**\n * @notice Retrieve the current ticketing parameters.\n * @return faceValue The face value of a ticket in SOLO.\n * @return baseLiveWinProb The base live win probability of a ticket.\n * @return expiredWinProb The expired win probability of a ticket.\n * @return ticketDuration The duration of a ticket in number of blocks.\n * @return decayRate The decay rate of a ticket.\n */\n function getTicketingParameters()\n external\n view\n returns (uint256, uint128, uint128, uint256, uint32)\n {\n return (faceValue, baseLiveWinProb, expiredWinProb, ticketDuration, decayRate);\n }\n}\n" + }, + "contracts/Registries.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\n\nimport \"./libraries/SyloUtils.sol\";\nimport \"./interfaces/IRegistries.sol\";\n\n/**\n * @notice This contract manages Registries for Nodes. A Registry is a\n * set of parameters configured by the Node itself. A Node is required\n * to have a valid Registry to be able to participate in the network.\n */\ncontract Registries is IRegistries, Initializable, Ownable2StepUpgradeable, IERC165 {\n using ECDSA for bytes32;\n\n /**\n * @notice ERC721 contract for bridged Seekers. Used for verifying ownership\n * of a seeker.\n */\n IERC721 public _rootSeekers;\n\n /**\n * @notice Tracks each Node's registry.\n */\n mapping(address => IRegistries.Registry) public registries;\n\n /**\n * @notice Tracks the node address that each seeker id is registered with\n */\n mapping(uint256 => address) public seekerRegistration;\n\n /**\n * @notice Tracks the address of every registered node.\n */\n address[] public nodes;\n\n /**\n * @notice Tracks nonces used when registering the seeker account\n * to prevent signature re-use.\n */\n mapping(bytes32 => address) private signatureNonces;\n\n /**\n * @notice Payout percentage refers to the portion of a tickets reward\n * that will be allocated to the Node's stakers. This is global, and is\n * currently set for all Nodes.\n */\n uint32 public defaultPayoutPercentage;\n\n event DefaultPayoutPercentageUpdated(uint32 defaultPayoutPercentage);\n\n error NonceCannotBeReused();\n error EndMustBeGreaterThanStart();\n error PercentageCannotExceed100000();\n error PublicEndpointCannotBeEmpty();\n error SeekerAccountMustOwnSeekerId();\n error SeekerAccountMustBeMsgSender();\n error ProofNotSignedBySeekerAccount();\n error RootSeekersCannotBeZeroAddress();\n error SeekerAccountCannotBeZeroAddress();\n error EndCannotExceedNumberOfNodes(uint256 nodeLength);\n\n function initialize(\n IERC721 rootSeekers,\n uint32 _defaultPayoutPercentage\n ) external initializer {\n if (address(rootSeekers) == address(0)) {\n revert RootSeekersCannotBeZeroAddress();\n }\n if (_defaultPayoutPercentage > 100000) {\n revert PercentageCannotExceed100000();\n }\n\n Ownable2StepUpgradeable.__Ownable2Step_init();\n\n _rootSeekers = rootSeekers;\n defaultPayoutPercentage = _defaultPayoutPercentage;\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IRegistries).interfaceId;\n }\n\n /**\n * @notice Set the global default payout percentage value. Only callable\n * by the owner.\n * @param _defaultPayoutPercentage The payout percentage as a value where the\n * denominator is 10000.\n */\n function setDefaultPayoutPercentage(uint32 _defaultPayoutPercentage) external onlyOwner {\n if (_defaultPayoutPercentage > 100000) {\n revert PercentageCannotExceed100000();\n }\n\n defaultPayoutPercentage = _defaultPayoutPercentage;\n emit DefaultPayoutPercentageUpdated(_defaultPayoutPercentage);\n }\n\n /**\n * @notice Call this as a Node to set or update your Registry entry.\n * @param publicEndpoint The public endpoint of your Node. Essential for\n * clients to be able to retrieve additional information, such as\n * an address to establish a p2p connection.\n */\n function register(string calldata publicEndpoint) external {\n if (bytes(publicEndpoint).length == 0) {\n revert PublicEndpointCannotBeEmpty();\n }\n\n // This is the nodes first registration\n if (bytes(registries[msg.sender].publicEndpoint).length == 0) {\n nodes.push(msg.sender);\n }\n\n registries[msg.sender].publicEndpoint = publicEndpoint;\n }\n\n function setSeekerAccount(\n address seekerAccount,\n uint256 seekerId,\n bytes32 nonce,\n bytes calldata signature\n ) external {\n if (seekerAccount == address(0)) {\n revert SeekerAccountCannotBeZeroAddress();\n }\n if (signatureNonces[nonce] != address(0)) {\n revert NonceCannotBeReused();\n }\n\n bytes memory proofMessage = getProofMessage(seekerId, msg.sender, nonce);\n bytes32 ethProof = ECDSA.toEthSignedMessageHash(proofMessage);\n\n if (ECDSA.recover(ethProof, signature) != seekerAccount) {\n revert ProofNotSignedBySeekerAccount();\n }\n\n // Now verify the seeker account actually owns the seeker\n address owner = _rootSeekers.ownerOf(seekerId);\n\n if (seekerAccount != owner) {\n revert SeekerAccountMustOwnSeekerId();\n }\n\n delete registries[seekerRegistration[seekerId]].seekerId;\n delete registries[seekerRegistration[seekerId]].seekerAccount;\n\n registries[msg.sender].seekerAccount = seekerAccount;\n registries[msg.sender].seekerId = seekerId;\n\n seekerRegistration[seekerId] = msg.sender;\n\n signatureNonces[nonce] = seekerAccount;\n }\n\n function revokeSeekerAccount(address node) external {\n Registry storage registry = registries[node];\n\n if (registry.seekerAccount != msg.sender) {\n revert SeekerAccountMustBeMsgSender();\n }\n\n delete registry.seekerAccount;\n delete seekerRegistration[registry.seekerId];\n delete registry.seekerId;\n }\n\n /**\n * @notice Retrieve the registry associated with a Node.\n * @param account The address of the Node.\n * @return The Node's Registry.\n */\n function getRegistry(address account) external view returns (Registry memory) {\n return registries[account];\n }\n\n /**\n * @notice Retrieve all registered nodes.\n * @return An array of node addresses.\n */\n function getNodes() external view returns (address[] memory) {\n return nodes;\n }\n\n /**\n * @notice Retrieves a list of registries. Takes in a\n * a start and end indices to allow pagination.\n * @param start The start index which is inclusive.\n * @param end The end index which is exclusive.\n * @return An array of Registries.\n */\n function getRegistries(\n uint256 start,\n uint256 end\n ) external view returns (address[] memory, Registry[] memory) {\n uint256 nodesLength = nodes.length;\n\n if (end <= start) {\n revert EndMustBeGreaterThanStart();\n }\n if (end > nodesLength) {\n revert EndCannotExceedNumberOfNodes(nodesLength);\n }\n\n address[] memory _nodes = new address[](end - start);\n Registry[] memory _registries = new Registry[](_nodes.length);\n\n for (uint256 i = start; i < end; ++i) {\n _nodes[i - start] = nodes[i];\n _registries[i - start] = registries[nodes[i]];\n }\n\n return (_nodes, _registries);\n }\n\n /**\n * @notice Returns the total number of registered nodes.\n * @return The number of registered nodes.\n */\n function getTotalNodes() external view returns (uint256) {\n return nodes.length;\n }\n\n /**\n * @notice Helper function for deriving the proof message used to\n * validate seeker ownership.\n * @param seekerId The tokenId of the seeker used for operation.\n * @param node The address of the node which that will be operated\n * by the specified seeker.\n * @param nonce The nonce used for this message.\n */\n function getProofMessage(\n uint256 seekerId,\n address node,\n bytes32 nonce\n ) public pure returns (bytes memory) {\n return\n abi.encodePacked(\n unicode\"šŸ¤– Hi frend! šŸ¤–\\n\\nšŸ“œ Signing this message proves that you're the owner of this Seeker NFT and allows your Seeker to be used to operate your Seeker's Node. It's a simple but important step to ensure smooth operation.\\n\\nThis request will not trigger a blockchain transaction or cost any gas fees.\\n\\nšŸ”„ Your node's address: \",\n Strings.toHexString(uint256(uint160(node)), 20),\n unicode\"\\n\\nšŸ†” Your seeker id: \",\n Strings.toString(seekerId),\n unicode\"\\n\\nšŸ“¦ A unique random value which secures this message: \",\n Strings.toHexString(uint256(nonce), 32)\n );\n }\n}\n" + }, + "contracts/SeekerPowerOracle.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nimport \"./interfaces/ISeekerPowerOracle.sol\";\n\n/**\n * @notice Acts as a source of information for Seeker Powers. Allows setting\n * a Seeker's power level via a restricted oracle account call. Seeker Power can also\n * be set by any account if the correct Oracle signature proof is provided.\n */\ncontract SeekerPowerOracle is ISeekerPowerOracle, Initializable, Ownable2StepUpgradeable, ERC165 {\n /**\n * @notice The oracle account. This contract accepts any attestations of\n * Seeker power that have been signed by this account.\n */\n address public oracle;\n\n /**\n * @notice Tracks nonce used when register the Seeker power to\n * prevent signature re-use.\n */\n mapping(bytes32 => address) private proofNonces;\n\n /**\n * @notice Tracks the set of Seeker Power levels.\n */\n mapping(uint256 => uint256) public seekerPowers;\n\n event SeekerPowerUpdated(uint256 indexed seekerId, uint256 indexed power);\n\n error UnauthorizedRegisterSeekerPowerCall();\n error NonceCannotBeReused();\n\n function initialize(address _oracle) external initializer {\n Ownable2StepUpgradeable.__Ownable2Step_init();\n\n oracle = _oracle;\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(ISeekerPowerOracle).interfaceId;\n }\n\n /**\n * @notice Sets the oracle account.\n * @param _oracle The oracle account.\n */\n function setOracle(address _oracle) external onlyOwner {\n oracle = _oracle;\n }\n\n /**\n * @notice Registers a Seeker's power level. Only callable by the\n * owner or the oracle account.\n * @param seekerId The id of the Seeker.\n * @param power The power level of the Seeker.\n */\n function registerSeekerPowerRestricted(uint256 seekerId, uint256 power) external {\n if (msg.sender != oracle) {\n revert UnauthorizedRegisterSeekerPowerCall();\n }\n\n seekerPowers[seekerId] = power;\n emit SeekerPowerUpdated(seekerId, power);\n }\n\n /**\n * @notice Registers a Seeker's power level. Callable by any account\n * but requires a proof signed by the oracle.\n * @param seekerId The id of the Seeker.\n * @param power The power level of the Seeker.\n */\n function registerSeekerPower(\n uint256 seekerId,\n uint256 power,\n bytes32 nonce,\n bytes calldata proof\n ) external {\n if (proofNonces[nonce] != address(0)) {\n revert NonceCannotBeReused();\n }\n\n bytes memory proofMessage = getProofMessage(seekerId, power, nonce);\n bytes32 ecdsaHash = ECDSA.toEthSignedMessageHash(proofMessage);\n\n if (ECDSA.recover(ecdsaHash, proof) != oracle) {\n revert UnauthorizedRegisterSeekerPowerCall();\n }\n\n seekerPowers[seekerId] = power;\n proofNonces[nonce] = oracle;\n\n emit SeekerPowerUpdated(seekerId, power);\n }\n\n /**\n * @notice Retrieves a Seeker's stored power level.\n * @param seekerId The id of the Seeker.\n */\n function getSeekerPower(uint256 seekerId) external view returns (uint256) {\n return seekerPowers[seekerId];\n }\n\n /**\n * @notice Constructs a proof message for the oracle to sign.\n * @param seekerId The id of the Seeker.\n * @param power The power level of the Seeker.\n */\n function getProofMessage(\n uint256 seekerId,\n uint256 power,\n bytes32 nonce\n ) public pure returns (bytes memory) {\n return\n abi.encodePacked(\n Strings.toString(seekerId),\n \":\",\n Strings.toString(power),\n \":\",\n Strings.toHexString(uint256(nonce), 32)\n );\n }\n}\n" + }, + "contracts/staking/Directory.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts/utils/math/Math.sol\";\n\nimport \"./StakingManager.sol\";\nimport \"../libraries/SyloUtils.sol\";\nimport \"../libraries/Manageable.sol\";\nimport \"../interfaces/staking/IDirectory.sol\";\nimport \"../payments/ticketing/RewardsManager.sol\";\n\n/**\n * @notice The Directory contract constructs and manages a structure holding the current stakes,\n * which is queried against using the scan function. The scan function allows submitting\n * random points which will return a staked node's address in proportion to the stake it has.\n */\ncontract Directory is IDirectory, Initializable, Manageable, IERC165 {\n /** Sylo Staking Manager contract */\n StakingManager public _stakingManager;\n\n /** Sylo Rewards Manager contract */\n RewardsManager public _rewardsManager;\n\n /**\n * @notice The epoch ID of the current directory.\n */\n uint256 public currentDirectory;\n\n /**\n * @notice Tracks every directory, which will be indexed by an epoch ID\n */\n mapping(uint256 => EpochDirectory) public directories;\n\n event CurrentDirectoryUpdated(uint256 indexed currentDirectory);\n\n error NoStakeToJoinEpoch();\n error StakeeAlreadyJoinedEpoch();\n error StakeeCannotBeZeroAddress();\n error NoJoiningStakeToJoinEpoch();\n\n function initialize(\n StakingManager stakingManager,\n RewardsManager rewardsManager\n ) external initializer {\n SyloUtils.validateContractInterface(\n \"StakingManager\",\n address(stakingManager),\n type(IStakingManager).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"RewardsManager\",\n address(rewardsManager),\n type(IRewardsManager).interfaceId\n );\n\n Ownable2StepUpgradeable.__Ownable2Step_init();\n\n _stakingManager = stakingManager;\n _rewardsManager = rewardsManager;\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IDirectory).interfaceId;\n }\n\n /**\n * @notice This function should be called when a new epoch is initialized.\n * This will set the current directory to the specified epoch. This is only\n * callable by the owner of this contract, which should be the EpochsManager\n * contract.\n * @dev After deployment, the EpochsManager should immediately be set as\n * the owner.\n * @param epochId The ID of the specified epoch.\n */\n function setCurrentDirectory(uint256 epochId) external onlyManager {\n currentDirectory = epochId;\n emit CurrentDirectoryUpdated(epochId);\n }\n\n /**\n * @notice This function is called by the epochs manager as a prerequisite to when the node joins the next epoch.\n * @param stakee The address of the node.\n * @param seekerId The seekerId of the Seeker that the node is\n * registered with when joining the epoch. It is used to determine the nodes\n * staking capacity based on its seeker power.\n *\n * @dev This will construct the directory as nodes join. The directory is constructed\n * by creating a boundary value which is a sum of the current directory's total stake, and\n * the current stakee's total stake, and pushing the new boundary into the entries array.\n * The previous boundary and the current boundary essentially create a range, where if a\n * random point were to fall within that range, it would belong to the respective stakee.\n * The boundary value grows in size as each stakee joins, thus the directory array\n * always remains sorted. This allows us to perform a binary search on the directory.\n *\n * Example\n *\n * Stakes: [ Alice/20, Bob/10, Carl/40, Dave/25 ]\n * TotalStake: 95\n *\n * EpochDirectory:\n *\n * |-----------|------|----------------|--------|\n * Alice/20 Bob/30 Carl/70 Dave/95\n *\n * The amount of stake that a node will join a directory with is dependent on its\n * different capacity values. There are two distinct capacity values, one\n * calculated from the seeker power, and another from the minimum stake\n * proportion. The final staking amount will not exceed either capacities,\n * and in the case that the current total stake exceeds both, then the final\n * will be the minimum of the two values.\n */\n function joinNextDirectory(address stakee, uint256 seekerId) external onlyManager {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n\n uint256 nextEpochId = currentDirectory + 1;\n\n uint256 totalStake = _stakingManager.getStakeeTotalManagedStake(stakee);\n if (totalStake == 0) {\n revert NoStakeToJoinEpoch();\n }\n\n // staking capacity based on seeker power\n uint256 seekerStakingCapacity = _stakingManager.calculateCapacityFromSeekerPower(seekerId);\n\n // staking capacity based on the min staking proportion constant\n uint256 minProportionStakingCapacity = _stakingManager.calculateCapacityFromMinStakingProportion(stakee);\n\n uint256 joiningStake;\n if (totalStake > seekerStakingCapacity && totalStake > minProportionStakingCapacity) {\n joiningStake = Math.min(seekerStakingCapacity, minProportionStakingCapacity);\n } else if (totalStake > seekerStakingCapacity) {\n joiningStake = seekerStakingCapacity;\n } else if (totalStake > minProportionStakingCapacity) {\n joiningStake = minProportionStakingCapacity;\n } else { // uncapped\n joiningStake = totalStake;\n }\n\n if (joiningStake == 0) {\n revert NoJoiningStakeToJoinEpoch();\n }\n\n if (directories[nextEpochId].stakes[stakee] > 0) {\n revert StakeeAlreadyJoinedEpoch();\n }\n\n uint256 nextBoundary = directories[nextEpochId].totalStake + joiningStake;\n\n directories[nextEpochId].entries.push(DirectoryEntry(stakee, nextBoundary));\n directories[nextEpochId].stakes[stakee] = joiningStake;\n directories[nextEpochId].totalStake = nextBoundary;\n }\n\n /**\n * @notice Call this to perform a stake-weighted scan to find the Node assigned\n * to the given point of the current directory.\n * @param point The point, which will usually be a hash of a public key.\n */\n function scan(uint128 point) external view returns (address stakee) {\n return _scan(point, currentDirectory);\n }\n\n /**\n * @notice Call this to perform a stake-weighted scan to find the Node assigned\n * to the given point of the requested directory.\n * @param point The point, which will usually be a hash of a public key.\n * @param epochId The epoch id associated with the directory to scan.\n */\n function scanWithEpochId(\n uint128 point,\n uint256 epochId\n ) external view returns (address stakee) {\n return _scan(point, epochId);\n }\n\n /**\n * @notice Call this to perform a stake-weighted scan to find the Node assigned\n * to the given point of the requested directory (internal).\n * @dev The current implementation will perform a binary search through\n * the directory. This can allow gas costs to be low if this needs to be\n * used in a transaction.\n * @param point The point, which will usually be a hash of a public key.\n * @param epochId The epoch id associated with the directory to scan.\n */\n function _scan(uint128 point, uint256 epochId) internal view returns (address stakee) {\n uint256 entryLength = directories[epochId].entries.length;\n\n if (entryLength == 0) {\n return address(0);\n }\n\n // Staking all the Sylo would only be 94 bits, so multiplying this with\n // a uint128 cannot overflow a uint256.\n uint256 expectedVal = (directories[epochId].totalStake * uint256(point)) >> 128;\n\n uint256 left;\n uint256 right = entryLength - 1;\n\n // perform a binary search through the directory\n uint256 lower;\n uint256 upper;\n uint256 index;\n\n while (left <= right) {\n index = (left + right) >> 1;\n\n lower = index == 0 ? 0 : directories[epochId].entries[index - 1].boundary;\n upper = directories[epochId].entries[index].boundary;\n\n if (expectedVal >= lower && expectedVal < upper) {\n return directories[epochId].entries[index].stakee;\n } else if (expectedVal < lower) {\n right = index - 1;\n } else {\n // expectedVal >= upper\n left = index + 1;\n }\n }\n }\n\n /**\n * @notice Retrieve the total stake a Node has for the directory in the\n * specified epoch.\n * @param epochId The ID of the epoch.\n * @param stakee The address of the Node.\n * @return The amount of stake the Node has for the given directory in SOLO.\n */\n function getTotalStakeForStakee(\n uint256 epochId,\n address stakee\n ) external view returns (uint256) {\n return directories[epochId].stakes[stakee];\n }\n\n /**\n * @notice Retrieve the total stake for a directory in the specified epoch, which\n * will be the sum of the stakes for all Nodes participating in that epoch.\n * @param epochId The ID of the epoch.\n * @return The total amount of stake in SOLO.\n */\n function getTotalStake(uint256 epochId) external view returns (uint256) {\n return directories[epochId].totalStake;\n }\n\n /**\n * @notice Retrieve all entries for a directory in a specified epoch.\n * @return An array of all the directory entries.\n */\n function getEntries(\n uint256 epochId\n ) external view returns (address[] memory, uint256[] memory) {\n uint256 entryLength = directories[epochId].entries.length;\n\n address[] memory stakees = new address[](entryLength);\n uint256[] memory boundaries = new uint256[](entryLength);\n\n DirectoryEntry memory entry;\n DirectoryEntry[] memory entries = directories[epochId].entries;\n\n for (uint256 i; i < entryLength; ++i) {\n entry = entries[i];\n stakees[i] = entry.stakee;\n boundaries[i] = entry.boundary;\n }\n return (stakees, boundaries);\n }\n}\n" + }, + "contracts/staking/StakingManager.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\n\nimport \"../SyloToken.sol\";\nimport \"../libraries/SyloUtils.sol\";\nimport \"../SeekerPowerOracle.sol\";\nimport \"../epochs/EpochsManager.sol\";\nimport \"../payments/ticketing/RewardsManager.sol\";\nimport \"../interfaces/staking/IStakingManager.sol\";\n\n/**\n * @notice Manages stakes and delegated stakes for Nodes. Holding\n * staked Sylo is necessary for a Node to participate in the\n * Sylo Network. The stake is used in stake-weighted scan function,\n * and delegated stakers are rewarded on a pro-rata basis.\n */\ncontract StakingManager is IStakingManager, Initializable, Ownable2StepUpgradeable, ERC165 {\n /** ERC 20 compatible token we are dealing with */\n IERC20 public _token;\n\n /**\n * @notice Rewards Manager contract. Any changes to stake will automatically\n * trigger a claim to any outstanding rewards.\n */\n RewardsManager public _rewardsManager;\n\n EpochsManager public _epochsManager;\n\n SeekerPowerOracle public _seekerPowerOracle;\n\n /**\n * @notice Tracks the managed stake for every Node.\n */\n mapping(address => Stake) public stakes;\n\n /** @notice Tracks overall total stake held by this contract */\n uint256 public totalManagedStake;\n\n /**\n * @notice Tracks funds that are in the process of being unlocked. This\n * is indexed by a key that hashes both the address of the staked Node and\n * the address of the staker.\n */\n mapping(bytes32 => Unlock) public unlockings;\n\n /**\n * @notice The number of blocks a user must wait after calling \"unlock\"\n * before they can withdraw their stake\n */\n uint256 public unlockDuration;\n\n /**\n * @notice Minimum amount of stake that a Node needs to stake\n * against itself in order to participate in the network. This is\n * represented as a percentage of the Node's total stake, where\n * the value is a ratio of 10000.\n */\n uint32 public minimumStakeProportion;\n\n /**\n * @notice The multiplier used in determining a Seeker's staking\n * capacity based on its power level.\n */\n uint256 public seekerPowerMultiplier;\n\n event UnlockDurationUpdated(uint256 unlockDuration);\n event MinimumStakeProportionUpdated(uint256 minimumStakeProportion);\n\n error NoStakeToUnlock();\n error StakeNotYetUnlocked();\n error CannotStakeZeroAmount();\n error CannotUnlockZeroAmount();\n error TokenCannotBeZeroAddress();\n error StakeeCannotBeZeroAddress();\n error UnlockDurationCannotBeZero();\n error CannotCancelUnlockZeroAmount();\n error CannotUnlockMoreThanStaked(uint256 stakeAmount, uint256 unlockAmount);\n error StakeCapacityReached(uint256 maxCapacity, uint256 currentCapacity);\n error SeekerPowerNotRegistered(uint256 seekerId);\n\n function initialize(\n IERC20 token,\n RewardsManager rewardsManager,\n EpochsManager epochsManager,\n SeekerPowerOracle seekerPowerOracle,\n uint256 _unlockDuration,\n uint32 _minimumStakeProportion,\n uint256 _seekerPowerMultiplier\n ) external initializer {\n if (address(token) == address(0)) {\n revert TokenCannotBeZeroAddress();\n }\n\n SyloUtils.validateContractInterface(\n \"RewardsManager\",\n address(rewardsManager),\n type(IRewardsManager).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"EpochsManager\",\n address(epochsManager),\n type(IEpochsManager).interfaceId\n );\n\n SyloUtils.validateContractInterface(\n \"SeekerPowerOracle\",\n address(seekerPowerOracle),\n type(ISeekerPowerOracle).interfaceId\n );\n\n if (_unlockDuration == 0) {\n revert UnlockDurationCannotBeZero();\n }\n\n Ownable2StepUpgradeable.__Ownable2Step_init();\n\n _token = token;\n _rewardsManager = rewardsManager;\n _epochsManager = epochsManager;\n _seekerPowerOracle = seekerPowerOracle;\n unlockDuration = _unlockDuration;\n minimumStakeProportion = _minimumStakeProportion;\n seekerPowerMultiplier = _seekerPowerMultiplier;\n }\n\n /**\n * @notice Returns true if the contract implements the interface defined by\n * `interfaceId` from ERC165.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IStakingManager).interfaceId;\n }\n\n /**\n * @notice Sets the unlock duration for stakes. Only callable by\n * the owner.\n * @param _unlockDuration The unlock duration in number of blocks.\n */\n function setUnlockDuration(uint256 _unlockDuration) external onlyOwner {\n if (_unlockDuration == 0) {\n revert UnlockDurationCannotBeZero();\n }\n\n unlockDuration = _unlockDuration;\n emit UnlockDurationUpdated(_unlockDuration);\n }\n\n /**\n * @notice Sets the minimum stake proportion for Nodes. Only callable by\n * the owner.\n * @param _minimumStakeProportion The minimum stake proportion in SOLO.\n */\n function setMinimumStakeProportion(uint32 _minimumStakeProportion) external onlyOwner {\n minimumStakeProportion = _minimumStakeProportion;\n emit MinimumStakeProportionUpdated(_minimumStakeProportion);\n }\n\n /**\n * @notice Called by Nodes and delegated stakers to add stake.\n * This function will fail under the following conditions:\n * - If the Node address is invalid\n * - If the specified stake value is zero\n * - If the additional stake causes the Node to fail to meet the\n * minimum stake proportion requirement.\n * @param amount The amount of stake to add in SOLO.\n * @param stakee The address of the staked Node.\n */\n function addStake(uint256 amount, address stakee) external {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n if (amount == 0) {\n revert CannotStakeZeroAmount();\n }\n\n _addStake(amount, stakee);\n SafeERC20.safeTransferFrom(_token, msg.sender, address(this), amount);\n }\n\n function _addStake(uint256 amount, address stakee) internal {\n // automatically move any pending rewards generated by their existing stake\n _rewardsManager.updatePendingRewards(stakee, msg.sender);\n\n uint256 currentEpochId = _epochsManager.currentIteration();\n\n Stake storage stake = stakes[stakee];\n\n uint256 currentStake = getCurrentStakerAmount(stakee, msg.sender);\n\n stake.stakeEntries[msg.sender] = StakeEntry(\n currentStake + amount,\n block.number,\n currentEpochId\n );\n\n stake.totalManagedStake = stake.totalManagedStake + amount;\n totalManagedStake = totalManagedStake + amount;\n }\n\n /**\n * @notice Call this function to begin the unlocking process. Calling this\n * will trigger an automatic claim of any outstanding staking rewards. Any\n * stake that was already in the unlocking phase will have the specified\n * amount added to it, and its duration refreshed. This function will fail\n * under the following conditions:\n * - If no stake exists for the caller\n * - If the unlock amount is zero\n * - If the unlock amount is more than what is staked\n * Note: If calling as a Node, this function will *not* revert if it causes\n * the Node to fail to meet the minimum stake proportion. However it will still\n * prevent the Node from participating in the network until the minimum is met\n * again.\n * @param amount The amount of stake to unlock in SOLO.\n * @param stakee The address of the staked Node.\n */\n function unlockStake(uint256 amount, address stakee) external returns (uint256) {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n if (amount == 0) {\n revert CannotUnlockZeroAmount();\n }\n\n uint256 currentStake = getCurrentStakerAmount(stakee, msg.sender);\n\n if (currentStake == 0) {\n revert NoStakeToUnlock();\n }\n if (currentStake < amount) {\n revert CannotUnlockMoreThanStaked(currentStake, amount);\n }\n\n // automatically move any pending rewards generated by their existing stake\n _rewardsManager.updatePendingRewards(stakee, msg.sender);\n\n uint256 currentEpochId = _epochsManager.currentIteration();\n\n Stake storage stake = stakes[stakee];\n\n stake.stakeEntries[msg.sender] = StakeEntry(\n currentStake - amount,\n block.number,\n currentEpochId\n );\n\n stake.totalManagedStake = stake.totalManagedStake - amount;\n totalManagedStake = totalManagedStake - amount;\n\n bytes32 key = getKey(stakee, msg.sender);\n\n // Keep track of when the stake can be withdrawn\n Unlock storage unlock = unlockings[key];\n\n uint256 unlockAt = block.number + unlockDuration;\n if (unlock.unlockAt < unlockAt) {\n unlock.unlockAt = unlockAt;\n }\n\n unlock.amount = unlock.amount + amount;\n\n return unlockAt;\n }\n\n /**\n * @notice Call this function to withdraw stake that has finished unlocking.\n * This will fail if the stake has not yet unlocked.\n * @param stakee The address of the staked Node.\n */\n function withdrawStake(address stakee) external {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n\n bytes32 key = getKey(stakee, msg.sender);\n\n Unlock storage unlock = unlockings[key];\n\n if (unlock.unlockAt >= block.number) {\n revert StakeNotYetUnlocked();\n }\n\n uint256 amount = unlock.amount;\n\n delete unlockings[key];\n\n SafeERC20.safeTransfer(_token, msg.sender, amount);\n }\n\n /**\n * @notice Call this function to cancel any stake that is in the process\n * of unlocking. As this essentially adds back stake to the Node, this\n * will trigger an automatic claim of any outstanding staking rewards.\n * If the specified amount to cancel is greater than the stake that is\n * currently being unlocked, it will cancel the maximum stake possible.\n * @param amount The amount of unlocking stake to cancel in SOLO.\n * @param stakee The address of the staked Node.\n */\n function cancelUnlocking(uint256 amount, address stakee) external {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n if (amount == 0) {\n revert CannotCancelUnlockZeroAmount();\n }\n\n bytes32 key = getKey(stakee, msg.sender);\n\n Unlock storage unlock = unlockings[key];\n\n if (amount >= unlock.amount) {\n amount = unlock.amount;\n delete unlockings[key];\n } else {\n unlock.amount = unlock.amount - amount;\n }\n\n _addStake(amount, stakee);\n }\n\n /**\n * @notice This function determines the staking capacity of\n * a Seeker based on its power level. The method will revert if\n * the Seeker's power level has not been registered with the oracle.\n *\n * Currently the algorithm is as follows:\n * staking_capacity = seeker_power * seeker_power_multiplier;\n */\n function calculateCapacityFromSeekerPower(uint256 seekerId) external view returns (uint256) {\n uint256 seekerPower = _seekerPowerOracle.getSeekerPower(seekerId);\n if (seekerPower == 0) {\n revert SeekerPowerNotRegistered(seekerId);\n }\n\n // If the Seeker Power is already\n // at the maximum sylo, then we just return the max sylo value directly.\n if (seekerPower >= SyloUtils.MAX_SYLO) {\n return SyloUtils.MAX_SYLO;\n }\n\n uint256 capacity = seekerPower * seekerPowerMultiplier;\n\n return capacity > SyloUtils.MAX_SYLO ? SyloUtils.MAX_SYLO : capacity;\n }\n\n /**\n * @notice This function can be used to a determine a Node's staking capacity,\n * based on the minimum stake proportion constant.\n * @param stakee The address of the staked Node.\n */\n function calculateCapacityFromMinStakingProportion(address stakee) public view returns (uint256) {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n\n Stake storage stake = stakes[stakee];\n\n uint256 currentlyOwnedStake = stake.stakeEntries[stakee].amount;\n return (currentlyOwnedStake * SyloUtils.PERCENTAGE_DENOMINATOR) /\n minimumStakeProportion;\n }\n\n /**\n * @notice This function should be called by clients to determine how much\n * additional delegated stake can be allocated to a Node via an addStake or\n * cancelUnlocking call. This is useful to avoid a revert due to\n * the minimum stake proportion requirement not being met from the additional stake.\n * @param stakee The address of the staked Node.\n */\n function calculateMaxAdditionalDelegatedStake(address stakee) external view returns (uint256) {\n uint256 totalMaxStake = calculateCapacityFromMinStakingProportion(stakee);\n\n Stake storage stake = stakes[stakee];\n\n if (totalMaxStake < stake.totalManagedStake) {\n revert StakeCapacityReached(totalMaxStake, stake.totalManagedStake);\n }\n\n return totalMaxStake - stake.totalManagedStake;\n }\n\n /**\n * @notice Retrieve the key used to index a stake entry. The key is a hash\n * which takes both address of the Node and the staker as input.\n * @param stakee The address of the staked Node.\n * @param staker The address of the staker.\n * @return A byte-array representing the key.\n */\n function getKey(address stakee, address staker) public pure returns (bytes32) {\n return keccak256(abi.encodePacked(stakee, staker));\n }\n\n /**\n * @notice Retrieve the total stake being managed by this contract.\n * @return The total amount of managed stake in SOLO.\n */\n function getTotalManagedStake() external view returns (uint256) {\n return totalManagedStake;\n }\n\n /**\n * @notice Retrieve a stake entry.\n * @param stakee The address of the staked Node.\n * @param staker The address of the staker.\n * @return The stake entry.\n */\n function getStakeEntry(\n address stakee,\n address staker\n ) external view returns (StakeEntry memory) {\n return stakes[stakee].stakeEntries[staker];\n }\n\n /**\n * @notice Retrieve the total amount of SOLO staked against a Node.\n * @param stakee The address of the staked Node.\n * @return The amount of staked SOLO.\n */\n function getStakeeTotalManagedStake(address stakee) external view returns (uint256) {\n return stakes[stakee].totalManagedStake;\n }\n\n /**\n * @notice Check if a Node is meeting the minimum stake proportion requirement.\n * @param stakee The address of the staked Node.\n * @return True if the Node is meeting minimum stake proportion requirement.\n */\n function checkMinimumStakeProportion(address stakee) public view returns (bool) {\n if (stakee == address(0)) {\n revert StakeeCannotBeZeroAddress();\n }\n\n Stake storage stake = stakes[stakee];\n\n uint256 currentlyOwnedStake = stake.stakeEntries[stakee].amount;\n uint32 ownedStakeProportion = SyloUtils.asPerc(\n SafeCast.toUint128(currentlyOwnedStake),\n stake.totalManagedStake\n );\n\n return ownedStakeProportion >= minimumStakeProportion;\n }\n\n /**\n * @notice Retrieve the current amount of SOLO staked against a Node by\n * a specified staker.\n * @param stakee The address of the staked Node.\n * @param staker The address of the staker.\n * @return The amount of staked SOLO.\n */\n function getCurrentStakerAmount(address stakee, address staker) public view returns (uint256) {\n return stakes[stakee].stakeEntries[staker].amount;\n }\n}\n" + }, + "contracts/SyloToken.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract SyloToken is ERC20 {\n constructor() ERC20(\"Sylo\", \"SYLO\") {\n _mint(msg.sender, 10_000_000_000 ether);\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/deployments/porcini-dev_deployment_phase_two.json b/deployments/porcini-dev_deployment_phase_two.json new file mode 100644 index 00000000..e17f9652 --- /dev/null +++ b/deployments/porcini-dev_deployment_phase_two.json @@ -0,0 +1,15 @@ +{ + "deployer": "0x448c8e9e1816300Dd052e77D2A44c990A2807D15", + "syloToken": "0xCCcCCcCC00000C64000000000000000000000000", + "authorizedAccounts": "0x68eCb081F49690b3453F9a4fFa65c054d74DCFE0", + "registries": "0x76c226017D7B0CEcC467dC0f353268d537252607", + "ticketingParameters": "0xCE1BAd6FaC2eDab78C607bfA50a9BfC29A172214", + "epochsManager": "0x9591e2f0a64E39675c9C3C28D055974fa1b93774", + "stakingManager": "0x9DBdad1AF4c0ab8065A2AD0e55172590d6655cFf", + "rewardsManager": "0x6802094eC43b1D769AA41A6925244AedB0D294a0", + "directory": "0x75aBF214870415A94B0d38840Cd541E9a0f196FA", + "syloTicketing": "0x62D39eB18f77143aA3B847FDB54F95db896fC28f", + "seekers": "0xAAAAAAAA00001864000000000000000000000000", + "seekerPowerOracle": "0xdB51e2219Fc69627ae29D177E4a1c9D9129E8230", + "futurepassRegistrar": "0x000000000000000000000000000000000000FFFF" +} \ No newline at end of file diff --git a/hardhat.config.ts b/hardhat.config.ts index cf40e1d1..ee735923 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -36,36 +36,12 @@ const config: HardhatUserConfig = { url: 'http://0.0.0.0:8545', accounts: 'remote', }, - ropsten: { - url: process.env.ROPSTEN_INFURA_ENDPOINT ?? '', - accounts: { - mnemonic: process.env.ROPSTEN_MNEMONIC ?? '', - }, - }, - rata: { - url: process.env.RATA_ENDPOINT ?? '', - accounts: { - mnemonic: process.env.ROPSTEN_MNEMONIC ?? '', - }, - }, - nikau: { - url: process.env.NIKAU_ENDPOINT ?? '', - accounts: { - mnemonic: process.env.ROPSTEN_MNEMONIC ?? '', - }, - }, 'porcini-dev': { url: 'https://porcini.rootnet.app', accounts: { mnemonic: process.env.ROPSTEN_MNEMONIC ?? '', }, }, - 'porcini-testing': { - url: 'https://porcini.rootnet.app', - accounts: { - mnemonic: process.env.ROPSTEN_MNEMONIC ?? '', - }, - }, rootlocal: { url: 'http://0.0.0.0:9933', accounts: [