@keep-network/tbtc-v2 1.6.0-dev.6 → 1.6.0-dev.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/artifacts/BLS.json +6 -6
  2. package/artifacts/Bank.json +17 -17
  3. package/artifacts/BeaconAuthorization.json +6 -6
  4. package/artifacts/BeaconDkg.json +6 -6
  5. package/artifacts/BeaconDkgValidator.json +9 -9
  6. package/artifacts/BeaconInactivity.json +6 -6
  7. package/artifacts/BeaconSortitionPool.json +16 -16
  8. package/artifacts/Bridge.json +32 -32
  9. package/artifacts/BridgeGovernance.json +14 -14
  10. package/artifacts/BridgeGovernanceParameters.json +7 -7
  11. package/artifacts/Deposit.json +7 -7
  12. package/artifacts/DepositSweep.json +7 -7
  13. package/artifacts/DonationVault.json +11 -11
  14. package/artifacts/EcdsaDkgValidator.json +7 -7
  15. package/artifacts/EcdsaInactivity.json +6 -6
  16. package/artifacts/EcdsaSortitionPool.json +16 -16
  17. package/artifacts/Fraud.json +7 -7
  18. package/artifacts/LightRelay.json +28 -28
  19. package/artifacts/LightRelayMaintainerProxy.json +24 -24
  20. package/artifacts/MaintainerProxy.json +37 -37
  21. package/artifacts/MovingFunds.json +7 -7
  22. package/artifacts/NuCypherToken.json +11 -11
  23. package/artifacts/RandomBeacon.json +23 -23
  24. package/artifacts/RandomBeaconChaosnet.json +11 -11
  25. package/artifacts/RandomBeaconGovernance.json +12 -12
  26. package/artifacts/Redemption.json +7 -7
  27. package/artifacts/ReimbursementPool.json +11 -11
  28. package/artifacts/T.json +11 -11
  29. package/artifacts/TBTC.json +19 -19
  30. package/artifacts/TBTCToken.json +19 -19
  31. package/artifacts/TBTCVault.json +36 -36
  32. package/artifacts/TokenStaking.json +156 -308
  33. package/artifacts/TokenholderGovernor.json +47 -47
  34. package/artifacts/TokenholderTimelock.json +36 -36
  35. package/artifacts/VendingMachine.json +22 -22
  36. package/artifacts/VendingMachineNuCypher.json +9 -9
  37. package/artifacts/VendingMachineV2.json +15 -15
  38. package/artifacts/VendingMachineV3.json +15 -15
  39. package/artifacts/WalletProposalValidator.json +61 -13
  40. package/artifacts/WalletRegistry.json +31 -31
  41. package/artifacts/WalletRegistryGovernance.json +56 -56
  42. package/artifacts/Wallets.json +7 -7
  43. package/artifacts/solcInputs/{d46fa1d8846c35adf326ab51a3910266.json → b4e1c442421284b256fcad9f86102ecc.json} +3 -3
  44. package/build/contracts/GovernanceUtils.sol/GovernanceUtils.dbg.json +1 -1
  45. package/build/contracts/bank/Bank.sol/Bank.dbg.json +1 -1
  46. package/build/contracts/bank/IReceiveBalanceApproval.sol/IReceiveBalanceApproval.dbg.json +1 -1
  47. package/build/contracts/bridge/BitcoinTx.sol/BitcoinTx.dbg.json +1 -1
  48. package/build/contracts/bridge/Bridge.sol/Bridge.dbg.json +1 -1
  49. package/build/contracts/bridge/BridgeGovernanceParameters.sol/BridgeGovernanceParameters.dbg.json +1 -1
  50. package/build/contracts/bridge/BridgeState.sol/BridgeState.dbg.json +1 -1
  51. package/build/contracts/bridge/Deposit.sol/Deposit.dbg.json +1 -1
  52. package/build/contracts/bridge/DepositSweep.sol/DepositSweep.dbg.json +1 -1
  53. package/build/contracts/bridge/EcdsaLib.sol/EcdsaLib.dbg.json +1 -1
  54. package/build/contracts/bridge/Fraud.sol/Fraud.dbg.json +1 -1
  55. package/build/contracts/bridge/Heartbeat.sol/Heartbeat.dbg.json +1 -1
  56. package/build/contracts/bridge/IRelay.sol/IRelay.dbg.json +1 -1
  57. package/build/contracts/bridge/MovingFunds.sol/MovingFunds.dbg.json +1 -1
  58. package/build/contracts/bridge/Redemption.sol/OutboundTx.dbg.json +1 -1
  59. package/build/contracts/bridge/Redemption.sol/Redemption.dbg.json +1 -1
  60. package/build/contracts/bridge/VendingMachine.sol/VendingMachine.dbg.json +1 -1
  61. package/build/contracts/bridge/VendingMachineV2.sol/VendingMachineV2.dbg.json +1 -1
  62. package/build/contracts/bridge/VendingMachineV3.sol/VendingMachineV3.dbg.json +1 -1
  63. package/build/contracts/bridge/WalletProposalValidator.sol/WalletProposalValidator.dbg.json +1 -1
  64. package/build/contracts/bridge/WalletProposalValidator.sol/WalletProposalValidator.json +38 -2
  65. package/build/contracts/bridge/Wallets.sol/Wallets.dbg.json +1 -1
  66. package/build/contracts/l2/L2TBTC.sol/L2TBTC.dbg.json +1 -1
  67. package/build/contracts/l2/L2WormholeGateway.sol/IWormholeTokenBridge.dbg.json +1 -1
  68. package/build/contracts/l2/L2WormholeGateway.sol/L2WormholeGateway.dbg.json +1 -1
  69. package/build/contracts/maintainer/MaintainerProxy.sol/MaintainerProxy.dbg.json +1 -1
  70. package/build/contracts/relay/LightRelay.sol/ILightRelay.dbg.json +1 -1
  71. package/build/contracts/relay/LightRelay.sol/LightRelay.dbg.json +1 -1
  72. package/build/contracts/relay/LightRelay.sol/RelayUtils.dbg.json +1 -1
  73. package/build/contracts/relay/LightRelayMaintainerProxy.sol/LightRelayMaintainerProxy.dbg.json +1 -1
  74. package/build/contracts/token/TBTC.sol/TBTC.dbg.json +1 -1
  75. package/build/contracts/vault/DonationVault.sol/DonationVault.dbg.json +1 -1
  76. package/build/contracts/vault/IVault.sol/IVault.dbg.json +1 -1
  77. package/build/contracts/vault/TBTCOptimisticMinting.sol/TBTCOptimisticMinting.dbg.json +1 -1
  78. package/build/contracts/vault/TBTCVault.sol/TBTCVault.dbg.json +1 -1
  79. package/contracts/bridge/WalletProposalValidator.sol +75 -0
  80. package/export/artifacts/@keep-network/ecdsa/contracts/EcdsaDkgValidator.sol/EcdsaDkgValidator.json +24 -24
  81. package/export/artifacts/@keep-network/ecdsa/contracts/WalletRegistry.sol/WalletRegistry.json +4999 -4814
  82. package/export/artifacts/@keep-network/ecdsa/contracts/libraries/EcdsaDkg.sol/EcdsaDkg.json +2 -2
  83. package/export/artifacts/@keep-network/ecdsa/contracts/libraries/EcdsaInactivity.sol/EcdsaInactivity.json +23 -23
  84. package/export/artifacts/@keep-network/random-beacon/contracts/ReimbursementPool.sol/ReimbursementPool.json +53 -53
  85. package/export/artifacts/@keep-network/sortition-pools/contracts/Chaosnet.sol/Chaosnet.json +21 -21
  86. package/export/artifacts/@keep-network/sortition-pools/contracts/Rewards.sol/Rewards.json +16 -16
  87. package/export/artifacts/@keep-network/sortition-pools/contracts/SortitionPool.sol/SortitionPool.json +206 -206
  88. package/export/artifacts/@keep-network/sortition-pools/contracts/SortitionTree.sol/SortitionTree.json +26 -26
  89. package/export/artifacts/@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol/ERC1967Proxy.json +46 -46
  90. package/export/artifacts/@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol/ProxyAdmin.json +36 -36
  91. package/export/artifacts/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy.json +78 -78
  92. package/export/artifacts/@openzeppelin/contracts/token/ERC721/ERC721.sol/ERC721.json +68 -68
  93. package/export/artifacts/@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol/ERC20Upgradeable.json +43 -43
  94. package/export/artifacts/@thesis/solidity-contracts/contracts/token/ERC20WithPermit.sol/ERC20WithPermit.json +79 -79
  95. package/export/artifacts/@thesis/solidity-contracts/contracts/token/MisfundRecovery.sol/MisfundRecovery.json +42 -42
  96. package/export/artifacts/contracts/bank/Bank.sol/Bank.json +77 -77
  97. package/export/artifacts/contracts/bridge/Bridge.sol/Bridge.json +320 -320
  98. package/export/artifacts/contracts/bridge/VendingMachine.sol/VendingMachine.json +108 -108
  99. package/export/artifacts/contracts/bridge/VendingMachineV2.sol/VendingMachineV2.json +63 -63
  100. package/export/artifacts/contracts/bridge/VendingMachineV3.sol/VendingMachineV3.json +65 -65
  101. package/export/artifacts/contracts/bridge/WalletProposalValidator.sol/WalletProposalValidator.json +6918 -4135
  102. package/export/artifacts/contracts/l2/L2TBTC.sol/L2TBTC.json +194 -194
  103. package/export/artifacts/contracts/l2/L2WormholeGateway.sol/L2WormholeGateway.json +98 -98
  104. package/export/artifacts/contracts/maintainer/MaintainerProxy.sol/MaintainerProxy.json +149 -149
  105. package/export/artifacts/contracts/relay/LightRelay.sol/LightRelay.json +76 -76
  106. package/export/artifacts/contracts/relay/LightRelayMaintainerProxy.sol/LightRelayMaintainerProxy.json +62 -62
  107. package/export/artifacts/contracts/test/BankStub.sol/BankStub.json +79 -79
  108. package/export/artifacts/contracts/test/BridgeStub.sol/BridgeStub.json +358 -358
  109. package/export/artifacts/contracts/test/GoerliLightRelay.sol/GoerliLightRelay.json +78 -78
  110. package/export/artifacts/contracts/test/HeartbeatStub.sol/HeartbeatStub.json +4 -4
  111. package/export/artifacts/contracts/test/LightRelayStub.sol/LightRelayStub.json +78 -78
  112. package/export/artifacts/contracts/test/ReceiveApprovalStub.sol/ReceiveApprovalStub.json +7 -7
  113. package/export/artifacts/contracts/test/SepoliaLightRelay.sol/SepoliaLightRelay.json +78 -78
  114. package/export/artifacts/contracts/test/SystemTestRelay.sol/SystemTestRelay.json +14 -14
  115. package/export/artifacts/contracts/test/TestERC20.sol/TestERC20.json +85 -85
  116. package/export/artifacts/contracts/test/TestERC721.sol/TestERC721.json +78 -78
  117. package/export/artifacts/contracts/test/TestEcdsaLib.sol/TestEcdsaLib.json +4 -4
  118. package/export/artifacts/contracts/test/WormholeBridgeStub.sol/WormholeBridgeStub.json +37 -37
  119. package/export/artifacts/contracts/token/TBTC.sol/TBTC.json +104 -104
  120. package/export/artifacts/contracts/vault/DonationVault.sol/DonationVault.json +19 -19
  121. package/export/artifacts/contracts/vault/TBTCVault.sol/TBTCVault.json +184 -184
  122. package/export/typechain/factories/EcdsaAuthorization__factory.js +1 -1
  123. package/export/typechain/factories/IStaking__factory.js +24 -103
  124. package/export/typechain/factories/WalletProposalValidator__factory.js +37 -1
  125. package/export/typechain/factories/WalletRegistry__factory.js +1 -1
  126. package/package.json +2 -2
  127. package/artifacts/KeepRegistry.json +0 -99
  128. package/artifacts/KeepStake.json +0 -286
  129. package/artifacts/KeepToken.json +0 -711
  130. package/artifacts/KeepTokenStaking.json +0 -483
  131. package/artifacts/NuCypherStakingEscrow.json +0 -287
  132. package/artifacts/VendingMachineKeep.json +0 -400
@@ -1,287 +0,0 @@
1
- {
2
- "address": "0xbCF26943C0197d2eE0E5D05c716Be60cc2761508",
3
- "abi": [
4
- {
5
- "inputs": [
6
- {
7
- "internalType": "address",
8
- "name": "staker",
9
- "type": "address"
10
- }
11
- ],
12
- "name": "getAllTokens",
13
- "outputs": [
14
- {
15
- "internalType": "uint256",
16
- "name": "",
17
- "type": "uint256"
18
- }
19
- ],
20
- "stateMutability": "view",
21
- "type": "function"
22
- },
23
- {
24
- "inputs": [
25
- {
26
- "internalType": "address",
27
- "name": "",
28
- "type": "address"
29
- }
30
- ],
31
- "name": "investigators",
32
- "outputs": [
33
- {
34
- "internalType": "uint256",
35
- "name": "",
36
- "type": "uint256"
37
- }
38
- ],
39
- "stateMutability": "view",
40
- "type": "function"
41
- },
42
- {
43
- "inputs": [
44
- {
45
- "internalType": "address",
46
- "name": "staker",
47
- "type": "address"
48
- },
49
- {
50
- "internalType": "address",
51
- "name": "stakingProvider",
52
- "type": "address"
53
- }
54
- ],
55
- "name": "requestMerge",
56
- "outputs": [
57
- {
58
- "internalType": "uint256",
59
- "name": "",
60
- "type": "uint256"
61
- }
62
- ],
63
- "stateMutability": "nonpayable",
64
- "type": "function"
65
- },
66
- {
67
- "inputs": [
68
- {
69
- "internalType": "address",
70
- "name": "staker",
71
- "type": "address"
72
- },
73
- {
74
- "internalType": "uint256",
75
- "name": "value",
76
- "type": "uint256"
77
- }
78
- ],
79
- "name": "setStaker",
80
- "outputs": [],
81
- "stateMutability": "nonpayable",
82
- "type": "function"
83
- },
84
- {
85
- "inputs": [
86
- {
87
- "internalType": "address",
88
- "name": "staker",
89
- "type": "address"
90
- },
91
- {
92
- "internalType": "uint256",
93
- "name": "penalty",
94
- "type": "uint256"
95
- },
96
- {
97
- "internalType": "address",
98
- "name": "investigator",
99
- "type": "address"
100
- },
101
- {
102
- "internalType": "uint256",
103
- "name": "reward",
104
- "type": "uint256"
105
- }
106
- ],
107
- "name": "slashStaker",
108
- "outputs": [],
109
- "stateMutability": "nonpayable",
110
- "type": "function"
111
- },
112
- {
113
- "inputs": [
114
- {
115
- "internalType": "address",
116
- "name": "staker",
117
- "type": "address"
118
- }
119
- ],
120
- "name": "stakerInfo",
121
- "outputs": [
122
- {
123
- "components": [
124
- {
125
- "internalType": "uint256",
126
- "name": "value",
127
- "type": "uint256"
128
- },
129
- {
130
- "internalType": "address",
131
- "name": "stakingProvider",
132
- "type": "address"
133
- }
134
- ],
135
- "internalType": "struct NuCypherTokenStakingMock.StakerStruct",
136
- "name": "",
137
- "type": "tuple"
138
- }
139
- ],
140
- "stateMutability": "view",
141
- "type": "function"
142
- },
143
- {
144
- "inputs": [
145
- {
146
- "internalType": "address",
147
- "name": "",
148
- "type": "address"
149
- }
150
- ],
151
- "name": "stakers",
152
- "outputs": [
153
- {
154
- "internalType": "uint256",
155
- "name": "value",
156
- "type": "uint256"
157
- },
158
- {
159
- "internalType": "address",
160
- "name": "stakingProvider",
161
- "type": "address"
162
- }
163
- ],
164
- "stateMutability": "view",
165
- "type": "function"
166
- }
167
- ],
168
- "transactionHash": "0xe747d2ccb719893ec434f74f0192d0a809a382f527f3996f087bd82089f2b3cd",
169
- "receipt": {
170
- "to": null,
171
- "from": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8",
172
- "contractAddress": "0xbCF26943C0197d2eE0E5D05c716Be60cc2761508",
173
- "transactionIndex": 0,
174
- "gasUsed": "327706",
175
- "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
176
- "blockHash": "0xfddf5f71ed57f368d70d7f68c5ef83f2bd1e4ce893c8efff6944f62d6d2866c8",
177
- "transactionHash": "0xe747d2ccb719893ec434f74f0192d0a809a382f527f3996f087bd82089f2b3cd",
178
- "logs": [],
179
- "blockNumber": 5,
180
- "cumulativeGasUsed": "327706",
181
- "status": 1,
182
- "byzantium": true
183
- },
184
- "args": [],
185
- "numDeployments": 1,
186
- "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"staker\",\"type\":\"address\"}],\"name\":\"getAllTokens\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"investigators\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"staker\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"stakingProvider\",\"type\":\"address\"}],\"name\":\"requestMerge\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"staker\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"setStaker\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"staker\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"penalty\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"investigator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"reward\",\"type\":\"uint256\"}],\"name\":\"slashStaker\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"staker\",\"type\":\"address\"}],\"name\":\"stakerInfo\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"stakingProvider\",\"type\":\"address\"}],\"internalType\":\"struct NuCypherTokenStakingMock.StakerStruct\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"stakers\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"stakingProvider\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"slashStaker(address,uint256,address,uint256)\":{\"params\":{\"investigator\":\"Investigator\",\"penalty\":\"Penalty\",\"reward\":\"Reward for the investigator\",\"staker\":\"Staker's address\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getAllTokens(address)\":{\"notice\":\"Get all tokens belonging to the staker\"},\"requestMerge(address,address)\":{\"notice\":\"Request merge between NuCypher staking contract and T staking contract. Returns amount of staked tokens\"},\"slashStaker(address,uint256,address,uint256)\":{\"notice\":\"Slash the staker's stake and reward the investigator\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/test/TokenStakingTestSet.sol\":\"NuCypherTokenStakingMock\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.0;\\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 * 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 !AddressUpgradeable.isContract(address(this));\\n }\\n}\\n\",\"keccak256\":\"0x372b0bc04e3b4c074559bbbfb1317afddb56de5504158ca25a7f9cd403980445\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20Upgradeable {\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n\\n /**\\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\",\"keccak256\":\"0x6777f3fccb5dab95a9088ef62c41bee0198fd92e50d7c94f0e3733788af4079e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20Upgradeable.sol\\\";\\nimport \\\"../../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20Upgradeable {\\n using AddressUpgradeable for address;\\n\\n function safeTransfer(\\n IERC20Upgradeable token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20Upgradeable token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20Upgradeable token,\\n address spender,\\n uint256 value\\n ) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20Upgradeable token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20Upgradeable token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3e26a49d2fa5ef8338b8a9467c91e54f417cb07e849b1cc0f4ebc4d2a147938e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\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\":\"0x55cf2bd9fc76704ddcdc19834cd288b7de00fc0f298a40ea16a954ae8991db2d\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary MathUpgradeable {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a / b + (a % b == 0 ? 0 : 1);\\n }\\n}\\n\",\"keccak256\":\"0xd0a917e32d1251a9b2f1dea15e932815d5382e64e6b0a18104664a6cc774cd70\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/math/SafeCast.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\\n * checks.\\n *\\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\\n * easily result in undesired exploitation or bugs, since developers usually\\n * assume that overflows raise errors. `SafeCast` restores this intuition by\\n * reverting the transaction when such an operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n *\\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\\n * all math on `uint256` and `int256` and then downcasting.\\n */\\nlibrary SafeCastUpgradeable {\\n /**\\n * @dev Returns the downcasted 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 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 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 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 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 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 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 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 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 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 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 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 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 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 int128 from int256, reverting on\\n * overflow (when the input is less than smallest int128 or\\n * greater than largest int128).\\n *\\n * Counterpart to Solidity's `int128` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 128 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt128(int256 value) internal pure returns (int128) {\\n require(value >= type(int128).min && value <= type(int128).max, \\\"SafeCast: value doesn't fit in 128 bits\\\");\\n return int128(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int64 from int256, reverting on\\n * overflow (when the input is less than smallest int64 or\\n * greater than largest int64).\\n *\\n * Counterpart to Solidity's `int64` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 64 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt64(int256 value) internal pure returns (int64) {\\n require(value >= type(int64).min && value <= type(int64).max, \\\"SafeCast: value doesn't fit in 64 bits\\\");\\n return int64(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int32 from int256, reverting on\\n * overflow (when the input is less than smallest int32 or\\n * greater than largest int32).\\n *\\n * Counterpart to Solidity's `int32` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 32 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt32(int256 value) internal pure returns (int32) {\\n require(value >= type(int32).min && value <= type(int32).max, \\\"SafeCast: value doesn't fit in 32 bits\\\");\\n return int32(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int16 from int256, reverting on\\n * overflow (when the input is less than smallest int16 or\\n * greater than largest int16).\\n *\\n * Counterpart to Solidity's `int16` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 16 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt16(int256 value) internal pure returns (int16) {\\n require(value >= type(int16).min && value <= type(int16).max, \\\"SafeCast: value doesn't fit in 16 bits\\\");\\n return int16(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int8 from int256, reverting on\\n * overflow (when the input is less than smallest int8 or\\n * greater than largest int8).\\n *\\n * Counterpart to Solidity's `int8` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 8 bits.\\n *\\n * _Available since v3.1._\\n */\\n function toInt8(int256 value) internal pure returns (int8) {\\n require(value >= type(int8).min && value <= type(int8).max, \\\"SafeCast: value doesn't fit in 8 bits\\\");\\n return int8(value);\\n }\\n\\n /**\\n * @dev Converts an unsigned uint256 into a signed int256.\\n *\\n * Requirements:\\n *\\n * - input must be less than or equal to maxInt256.\\n */\\n 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\":\"0xcec885ecdf113b4265ed0856972d7ff167bfeb3802604b18cbb782bf47ecc4ae\",\"license\":\"MIT\"},\"@openzeppelin/contracts/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() {\\n _transferOwnership(_msgSender());\\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\":\"0x24e0364e503a9bbde94c715d26573a76f14cd2a202d45f96f52134ab806b67b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n\\n /**\\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\",\"keccak256\":\"0xbbc8ac883ac3c0078ce5ad3e288fbb3ffcc8a30c3a98c0fda0114d64fc44fca2\",\"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/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc3d946432c0ddbb1f846a0d3985be71299df331b91d06732152117f62f0be2b5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x516a22876c1fab47f49b1bc22b4614491cd05338af8bd2e7b382da090a079990\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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\":\"0x2ccf9d2313a313d41a791505f2b5abfdc62191b5d4334f7f7a82691c088a1c87\",\"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/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 v4.4.1 (utils/math/SafeCast.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\\n * checks.\\n *\\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\\n * easily result in undesired exploitation or bugs, since developers usually\\n * assume that overflows raise errors. `SafeCast` restores this intuition by\\n * reverting the transaction when such an operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n *\\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\\n * all math on `uint256` and `int256` and then downcasting.\\n */\\nlibrary SafeCast {\\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 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 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 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 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 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 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 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 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 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 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 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 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 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 int128 from int256, reverting on\\n * overflow (when the input is less than smallest int128 or\\n * greater than largest int128).\\n *\\n * Counterpart to Solidity's `int128` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 128 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt128(int256 value) internal pure returns (int128) {\\n require(value >= type(int128).min && value <= type(int128).max, \\\"SafeCast: value doesn't fit in 128 bits\\\");\\n return int128(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int64 from int256, reverting on\\n * overflow (when the input is less than smallest int64 or\\n * greater than largest int64).\\n *\\n * Counterpart to Solidity's `int64` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 64 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt64(int256 value) internal pure returns (int64) {\\n require(value >= type(int64).min && value <= type(int64).max, \\\"SafeCast: value doesn't fit in 64 bits\\\");\\n return int64(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int32 from int256, reverting on\\n * overflow (when the input is less than smallest int32 or\\n * greater than largest int32).\\n *\\n * Counterpart to Solidity's `int32` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 32 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt32(int256 value) internal pure returns (int32) {\\n require(value >= type(int32).min && value <= type(int32).max, \\\"SafeCast: value doesn't fit in 32 bits\\\");\\n return int32(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int16 from int256, reverting on\\n * overflow (when the input is less than smallest int16 or\\n * greater than largest int16).\\n *\\n * Counterpart to Solidity's `int16` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 16 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt16(int256 value) internal pure returns (int16) {\\n require(value >= type(int16).min && value <= type(int16).max, \\\"SafeCast: value doesn't fit in 16 bits\\\");\\n return int16(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int8 from int256, reverting on\\n * overflow (when the input is less than smallest int8 or\\n * greater than largest int8).\\n *\\n * Counterpart to Solidity's `int8` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 8 bits.\\n *\\n * _Available since v3.1._\\n */\\n function toInt8(int256 value) internal pure returns (int8) {\\n require(value >= type(int8).min && value <= type(int8).max, \\\"SafeCast: value doesn't fit in 8 bits\\\");\\n return int8(value);\\n }\\n\\n /**\\n * @dev Converts an unsigned uint256 into a signed int256.\\n *\\n * Requirements:\\n *\\n * - input must be less than or equal to maxInt256.\\n */\\n 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\":\"0x5c6caab697d302ad7eb59c234a4d2dbc965c1bae87709bd2850060b7695b28c7\",\"license\":\"MIT\"},\"@thesis/solidity-contracts/contracts/token/ERC20WithPermit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\nimport \\\"./IERC20WithPermit.sol\\\";\\nimport \\\"./IReceiveApproval.sol\\\";\\n\\n/// @title ERC20WithPermit\\n/// @notice Burnable ERC20 token with EIP2612 permit functionality. User can\\n/// authorize a transfer of their token with a signature conforming\\n/// EIP712 standard instead of an on-chain transaction from their\\n/// address. Anyone can submit this signature on the user's behalf by\\n/// calling the permit function, as specified in EIP2612 standard,\\n/// paying gas fees, and possibly performing other actions in the same\\n/// transaction.\\ncontract ERC20WithPermit is IERC20WithPermit, Ownable {\\n /// @notice The amount of tokens owned by the given account.\\n mapping(address => uint256) public override balanceOf;\\n\\n /// @notice The remaining number of tokens that spender will be\\n /// allowed to spend on behalf of owner through `transferFrom` and\\n /// `burnFrom`. This is zero by default.\\n mapping(address => mapping(address => uint256)) public override allowance;\\n\\n /// @notice Returns the current nonce for EIP2612 permission for the\\n /// provided token owner for a replay protection. Used to construct\\n /// EIP2612 signature provided to `permit` function.\\n mapping(address => uint256) public override nonce;\\n\\n uint256 public immutable cachedChainId;\\n bytes32 public immutable cachedDomainSeparator;\\n\\n /// @notice Returns EIP2612 Permit message hash. Used to construct EIP2612\\n /// signature provided to `permit` function.\\n bytes32 public constant override PERMIT_TYPEHASH =\\n keccak256(\\n \\\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\\\"\\n );\\n\\n /// @notice The amount of tokens in existence.\\n uint256 public override totalSupply;\\n\\n /// @notice The name of the token.\\n string public override name;\\n\\n /// @notice The symbol of the token.\\n string public override symbol;\\n\\n /// @notice The decimals places of the token.\\n uint8 public constant override decimals = 18;\\n\\n constructor(string memory _name, string memory _symbol) {\\n name = _name;\\n symbol = _symbol;\\n\\n cachedChainId = block.chainid;\\n cachedDomainSeparator = buildDomainSeparator();\\n }\\n\\n /// @notice Moves `amount` tokens from the caller's account to `recipient`.\\n /// @return True if the operation succeeded, reverts otherwise.\\n /// @dev Requirements:\\n /// - `recipient` cannot be the zero address,\\n /// - the caller must have a balance of at least `amount`.\\n function transfer(address recipient, uint256 amount)\\n external\\n override\\n returns (bool)\\n {\\n _transfer(msg.sender, recipient, amount);\\n return true;\\n }\\n\\n /// @notice Moves `amount` tokens from `spender` to `recipient` using the\\n /// allowance mechanism. `amount` is then deducted from the caller's\\n /// allowance unless the allowance was made for `type(uint256).max`.\\n /// @return True if the operation succeeded, reverts otherwise.\\n /// @dev Requirements:\\n /// - `spender` and `recipient` cannot be the zero address,\\n /// - `spender` must have a balance of at least `amount`,\\n /// - the caller must have allowance for `spender`'s tokens of at least\\n /// `amount`.\\n function transferFrom(\\n address spender,\\n address recipient,\\n uint256 amount\\n ) external override returns (bool) {\\n uint256 currentAllowance = allowance[spender][msg.sender];\\n if (currentAllowance != type(uint256).max) {\\n require(\\n currentAllowance >= amount,\\n \\\"Transfer amount exceeds allowance\\\"\\n );\\n _approve(spender, msg.sender, currentAllowance - amount);\\n }\\n _transfer(spender, recipient, amount);\\n return true;\\n }\\n\\n /// @notice EIP2612 approval made with secp256k1 signature.\\n /// Users can authorize a transfer of their tokens with a signature\\n /// conforming EIP712 standard, rather than an on-chain transaction\\n /// from their address. Anyone can submit this signature on the\\n /// user's behalf by calling the permit function, paying gas fees,\\n /// and possibly performing other actions in the same transaction.\\n /// @dev The deadline argument can be set to `type(uint256).max to create\\n /// permits that effectively never expire. If the `amount` is set\\n /// to `type(uint256).max` then `transferFrom` and `burnFrom` will\\n /// not reduce an allowance.\\n function permit(\\n address owner,\\n address spender,\\n uint256 amount,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external override {\\n /* solhint-disable-next-line not-rely-on-time */\\n require(deadline >= block.timestamp, \\\"Permission expired\\\");\\n\\n // Validate `s` and `v` values for a malleability concern described in EIP2.\\n // Only signatures with `s` value in the lower half of the secp256k1\\n // curve's order and `v` value of 27 or 28 are considered valid.\\n require(\\n uint256(s) <=\\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0,\\n \\\"Invalid signature 's' value\\\"\\n );\\n require(v == 27 || v == 28, \\\"Invalid signature 'v' value\\\");\\n\\n bytes32 digest = keccak256(\\n abi.encodePacked(\\n \\\"\\\\x19\\\\x01\\\",\\n DOMAIN_SEPARATOR(),\\n keccak256(\\n abi.encode(\\n PERMIT_TYPEHASH,\\n owner,\\n spender,\\n amount,\\n nonce[owner]++,\\n deadline\\n )\\n )\\n )\\n );\\n address recoveredAddress = ecrecover(digest, v, r, s);\\n require(\\n recoveredAddress != address(0) && recoveredAddress == owner,\\n \\\"Invalid signature\\\"\\n );\\n _approve(owner, spender, amount);\\n }\\n\\n /// @notice Creates `amount` tokens and assigns them to `account`,\\n /// increasing the total supply.\\n /// @dev Requirements:\\n /// - `recipient` cannot be the zero address.\\n function mint(address recipient, uint256 amount) external onlyOwner {\\n require(recipient != address(0), \\\"Mint to the zero address\\\");\\n\\n beforeTokenTransfer(address(0), recipient, amount);\\n\\n totalSupply += amount;\\n balanceOf[recipient] += amount;\\n emit Transfer(address(0), recipient, amount);\\n }\\n\\n /// @notice Destroys `amount` tokens from the caller.\\n /// @dev Requirements:\\n /// - the caller must have a balance of at least `amount`.\\n function burn(uint256 amount) external override {\\n _burn(msg.sender, amount);\\n }\\n\\n /// @notice Destroys `amount` of tokens from `account` using the allowance\\n /// mechanism. `amount` is then deducted from the caller's allowance\\n /// unless the allowance was made for `type(uint256).max`.\\n /// @dev Requirements:\\n /// - `account` must have a balance of at least `amount`,\\n /// - the caller must have allowance for `account`'s tokens of at least\\n /// `amount`.\\n function burnFrom(address account, uint256 amount) external override {\\n uint256 currentAllowance = allowance[account][msg.sender];\\n if (currentAllowance != type(uint256).max) {\\n require(\\n currentAllowance >= amount,\\n \\\"Burn amount exceeds allowance\\\"\\n );\\n _approve(account, msg.sender, currentAllowance - amount);\\n }\\n _burn(account, amount);\\n }\\n\\n /// @notice Calls `receiveApproval` function on spender previously approving\\n /// the spender to withdraw from the caller multiple times, up to\\n /// the `amount` amount. If this function is called again, it\\n /// overwrites the current allowance with `amount`. Reverts if the\\n /// approval reverted or if `receiveApproval` call on the spender\\n /// reverted.\\n /// @return True if both approval and `receiveApproval` calls succeeded.\\n /// @dev If the `amount` is set to `type(uint256).max` then\\n /// `transferFrom` and `burnFrom` will not reduce an allowance.\\n function approveAndCall(\\n address spender,\\n uint256 amount,\\n bytes memory extraData\\n ) external override returns (bool) {\\n if (approve(spender, amount)) {\\n IReceiveApproval(spender).receiveApproval(\\n msg.sender,\\n amount,\\n address(this),\\n extraData\\n );\\n return true;\\n }\\n return false;\\n }\\n\\n /// @notice Sets `amount` as the allowance of `spender` over the caller's\\n /// tokens.\\n /// @return True if the operation succeeded.\\n /// @dev If the `amount` is set to `type(uint256).max` then\\n /// `transferFrom` and `burnFrom` will not reduce an allowance.\\n /// Beware that changing an allowance with this method brings the risk\\n /// that someone may use both the old and the new allowance by\\n /// unfortunate transaction ordering. One possible solution to mitigate\\n /// this race condition is to first reduce the spender's allowance to 0\\n /// and set the desired value afterwards:\\n /// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n function approve(address spender, uint256 amount)\\n public\\n override\\n returns (bool)\\n {\\n _approve(msg.sender, spender, amount);\\n return true;\\n }\\n\\n /// @notice Returns hash of EIP712 Domain struct with the token name as\\n /// a signing domain and token contract as a verifying contract.\\n /// Used to construct EIP2612 signature provided to `permit`\\n /// function.\\n /* solhint-disable-next-line func-name-mixedcase */\\n function DOMAIN_SEPARATOR() public view override returns (bytes32) {\\n // As explained in EIP-2612, if the DOMAIN_SEPARATOR contains the\\n // chainId and is defined at contract deployment instead of\\n // reconstructed for every signature, there is a risk of possible replay\\n // attacks between chains in the event of a future chain split.\\n // To address this issue, we check the cached chain ID against the\\n // current one and in case they are different, we build domain separator\\n // from scratch.\\n if (block.chainid == cachedChainId) {\\n return cachedDomainSeparator;\\n } else {\\n return buildDomainSeparator();\\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 /// - when `from` and `to` are both non-zero, `amount` of `from`'s tokens\\n /// will be to 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 // slither-disable-next-line dead-code\\n function beforeTokenTransfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {}\\n\\n function _burn(address account, uint256 amount) internal {\\n uint256 currentBalance = balanceOf[account];\\n require(currentBalance >= amount, \\\"Burn amount exceeds balance\\\");\\n\\n beforeTokenTransfer(account, address(0), amount);\\n\\n balanceOf[account] = currentBalance - amount;\\n totalSupply -= amount;\\n emit Transfer(account, address(0), amount);\\n }\\n\\n function _transfer(\\n address spender,\\n address recipient,\\n uint256 amount\\n ) private {\\n require(spender != address(0), \\\"Transfer from the zero address\\\");\\n require(recipient != address(0), \\\"Transfer to the zero address\\\");\\n require(recipient != address(this), \\\"Transfer to the token address\\\");\\n\\n beforeTokenTransfer(spender, recipient, amount);\\n\\n uint256 spenderBalance = balanceOf[spender];\\n require(spenderBalance >= amount, \\\"Transfer amount exceeds balance\\\");\\n balanceOf[spender] = spenderBalance - amount;\\n balanceOf[recipient] += amount;\\n emit Transfer(spender, recipient, amount);\\n }\\n\\n function _approve(\\n address owner,\\n address spender,\\n uint256 amount\\n ) private {\\n require(owner != address(0), \\\"Approve from the zero address\\\");\\n require(spender != address(0), \\\"Approve to the zero address\\\");\\n allowance[owner][spender] = amount;\\n emit Approval(owner, spender, amount);\\n }\\n\\n function buildDomainSeparator() private view returns (bytes32) {\\n return\\n keccak256(\\n abi.encode(\\n keccak256(\\n \\\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\\\"\\n ),\\n keccak256(bytes(name)),\\n keccak256(bytes(\\\"1\\\")),\\n block.chainid,\\n address(this)\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x1e1bf4ec5c9d6fe70f6f834316482aeff3f122ff4ffaa7178099e7ae71a0b16d\",\"license\":\"MIT\"},\"@thesis/solidity-contracts/contracts/token/IApproveAndCall.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.4;\\n\\n/// @notice An interface that should be implemented by tokens supporting\\n/// `approveAndCall`/`receiveApproval` pattern.\\ninterface IApproveAndCall {\\n /// @notice Executes `receiveApproval` function on spender as specified in\\n /// `IReceiveApproval` interface. Approves spender to withdraw from\\n /// the caller multiple times, up to the `amount`. If this\\n /// function is called again, it overwrites the current allowance\\n /// with `amount`. Reverts if the approval reverted or if\\n /// `receiveApproval` call on the spender reverted.\\n function approveAndCall(\\n address spender,\\n uint256 amount,\\n bytes memory extraData\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x393d18ef81a57dcc96fff4c340cc2945deaebb37b9796c322cf2bc96872c3df8\",\"license\":\"MIT\"},\"@thesis/solidity-contracts/contracts/token/IERC20WithPermit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\\\";\\n\\nimport \\\"./IApproveAndCall.sol\\\";\\n\\n/// @title IERC20WithPermit\\n/// @notice Burnable ERC20 token with EIP2612 permit functionality. User can\\n/// authorize a transfer of their token with a signature conforming\\n/// EIP712 standard instead of an on-chain transaction from their\\n/// address. Anyone can submit this signature on the user's behalf by\\n/// calling the permit function, as specified in EIP2612 standard,\\n/// paying gas fees, and possibly performing other actions in the same\\n/// transaction.\\ninterface IERC20WithPermit is IERC20, IERC20Metadata, IApproveAndCall {\\n /// @notice EIP2612 approval made with secp256k1 signature.\\n /// Users can authorize a transfer of their tokens with a signature\\n /// conforming EIP712 standard, rather than an on-chain transaction\\n /// from their address. Anyone can submit this signature on the\\n /// user's behalf by calling the permit function, paying gas fees,\\n /// and possibly performing other actions in the same transaction.\\n /// @dev The deadline argument can be set to `type(uint256).max to create\\n /// permits that effectively never expire.\\n function permit(\\n address owner,\\n address spender,\\n uint256 amount,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /// @notice Destroys `amount` tokens from the caller.\\n function burn(uint256 amount) external;\\n\\n /// @notice Destroys `amount` of tokens from `account`, deducting the amount\\n /// from caller's allowance.\\n function burnFrom(address account, uint256 amount) external;\\n\\n /// @notice Returns hash of EIP712 Domain struct with the token name as\\n /// a signing domain and token contract as a verifying contract.\\n /// Used to construct EIP2612 signature provided to `permit`\\n /// function.\\n /* solhint-disable-next-line func-name-mixedcase */\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n\\n /// @notice Returns the current nonce for EIP2612 permission for the\\n /// provided token owner for a replay protection. Used to construct\\n /// EIP2612 signature provided to `permit` function.\\n function nonce(address owner) external view returns (uint256);\\n\\n /// @notice Returns EIP2612 Permit message hash. Used to construct EIP2612\\n /// signature provided to `permit` function.\\n /* solhint-disable-next-line func-name-mixedcase */\\n function PERMIT_TYPEHASH() external pure returns (bytes32);\\n}\\n\",\"keccak256\":\"0xdac9a5086c19a7128b505a7be1ab0ac1aa314f6989cb88d2417e9d7383f89fa9\",\"license\":\"MIT\"},\"@thesis/solidity-contracts/contracts/token/IReceiveApproval.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.4;\\n\\n/// @notice An interface that should be implemented by contracts supporting\\n/// `approveAndCall`/`receiveApproval` pattern.\\ninterface IReceiveApproval {\\n /// @notice Receives approval to spend tokens. Called as a result of\\n /// `approveAndCall` call on the token.\\n function receiveApproval(\\n address from,\\n uint256 amount,\\n address token,\\n bytes calldata extraData\\n ) external;\\n}\\n\",\"keccak256\":\"0x6a30d83ad230548b1e7839737affc8489a035314209de14b89dbef7fb0f66395\",\"license\":\"MIT\"},\"@thesis/solidity-contracts/contracts/token/MisfundRecovery.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\n/// @title MisfundRecovery\\n/// @notice Allows the owner of the token contract extending MisfundRecovery\\n/// to recover any ERC20 and ERC721 sent mistakenly to the token\\n/// contract address.\\ncontract MisfundRecovery is Ownable {\\n using SafeERC20 for IERC20;\\n\\n function recoverERC20(\\n IERC20 token,\\n address recipient,\\n uint256 amount\\n ) external onlyOwner {\\n token.safeTransfer(recipient, amount);\\n }\\n\\n function recoverERC721(\\n IERC721 token,\\n address recipient,\\n uint256 tokenId,\\n bytes calldata data\\n ) external onlyOwner {\\n token.safeTransferFrom(address(this), recipient, tokenId, data);\\n }\\n}\\n\",\"keccak256\":\"0xbbfea02bf20e2a6df5a497bbc05c7540a3b7c7dfb8b1feeaffef7f6b8ba65d65\",\"license\":\"MIT\"},\"contracts/governance/Checkpoints.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\n\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n\\npragma solidity 0.8.9;\\n\\nimport \\\"./IVotesHistory.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol\\\";\\n\\n/// @title Checkpoints\\n/// @dev Abstract contract to support checkpoints for Compound-like voting and\\n/// delegation. This implementation supports token supply up to 2^96 - 1.\\n/// This contract keeps a history (checkpoints) of each account's vote\\n/// power. Vote power can be delegated either by calling the {delegate}\\n/// function directly, or by providing a signature to be used with\\n/// {delegateBySig}. Voting power can be publicly queried through\\n/// {getVotes} and {getPastVotes}.\\n/// NOTE: Extracted from OpenZeppelin ERCVotes.sol.\\n/// @dev This contract is upgrade-safe.\\nabstract contract Checkpoints is IVotesHistory {\\n struct Checkpoint {\\n uint32 fromBlock;\\n uint96 votes;\\n }\\n\\n // slither-disable-next-line uninitialized-state\\n mapping(address => address) internal _delegates;\\n mapping(address => uint128[]) internal _checkpoints;\\n uint128[] internal _totalSupplyCheckpoints;\\n\\n // Reserved storage space in case we need to add more variables,\\n // since there are upgradeable contracts that inherit from this one.\\n // See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n // slither-disable-next-line unused-state\\n uint256[47] private __gap;\\n\\n /// @notice Emitted when an account changes their delegate.\\n event DelegateChanged(\\n address indexed delegator,\\n address indexed fromDelegate,\\n address indexed toDelegate\\n );\\n\\n /// @notice Emitted when a balance or delegate change results in changes\\n /// to an account's voting power.\\n event DelegateVotesChanged(\\n address indexed delegate,\\n uint256 previousBalance,\\n uint256 newBalance\\n );\\n\\n function checkpoints(address account, uint32 pos)\\n public\\n view\\n virtual\\n returns (Checkpoint memory checkpoint)\\n {\\n (uint32 fromBlock, uint96 votes) = decodeCheckpoint(\\n _checkpoints[account][pos]\\n );\\n checkpoint = Checkpoint(fromBlock, votes);\\n }\\n\\n /// @notice Get number of checkpoints for `account`.\\n function numCheckpoints(address account)\\n public\\n view\\n virtual\\n returns (uint32)\\n {\\n return SafeCastUpgradeable.toUint32(_checkpoints[account].length);\\n }\\n\\n /// @notice Get the address `account` is currently delegating to.\\n function delegates(address account) public view virtual returns (address) {\\n return _delegates[account];\\n }\\n\\n /// @notice Gets the current votes balance for `account`.\\n /// @param account The address to get votes balance\\n /// @return The number of current votes for `account`\\n function getVotes(address account) public view returns (uint96) {\\n uint256 pos = _checkpoints[account].length;\\n return pos == 0 ? 0 : decodeValue(_checkpoints[account][pos - 1]);\\n }\\n\\n /// @notice Determine the prior number of votes for an account as of\\n /// a block number.\\n /// @dev Block number must be a finalized block or else this function will\\n /// revert to prevent misinformation.\\n /// @param account The address of the account to check\\n /// @param blockNumber The block number to get the vote balance at\\n /// @return The number of votes the account had as of the given block\\n function getPastVotes(address account, uint256 blockNumber)\\n public\\n view\\n returns (uint96)\\n {\\n return lookupCheckpoint(_checkpoints[account], blockNumber);\\n }\\n\\n /// @notice Retrieve the `totalSupply` at the end of `blockNumber`.\\n /// Note, this value is the sum of all balances, but it is NOT the\\n /// sum of all the delegated votes!\\n /// @param blockNumber The block number to get the total supply at\\n /// @dev `blockNumber` must have been already mined\\n function getPastTotalSupply(uint256 blockNumber)\\n public\\n view\\n returns (uint96)\\n {\\n return lookupCheckpoint(_totalSupplyCheckpoints, blockNumber);\\n }\\n\\n /// @notice Change delegation for `delegator` to `delegatee`.\\n // slither-disable-next-line dead-code\\n function delegate(address delegator, address delegatee) internal virtual;\\n\\n /// @notice Moves voting power from one delegate to another\\n /// @param src Address of old delegate\\n /// @param dst Address of new delegate\\n /// @param amount Voting power amount to transfer between delegates\\n function moveVotingPower(\\n address src,\\n address dst,\\n uint256 amount\\n ) internal {\\n if (src != dst && amount > 0) {\\n if (src != address(0)) {\\n // https://github.com/crytic/slither/issues/960\\n // slither-disable-next-line variable-scope\\n (uint256 oldWeight, uint256 newWeight) = writeCheckpoint(\\n _checkpoints[src],\\n subtract,\\n amount\\n );\\n emit DelegateVotesChanged(src, oldWeight, newWeight);\\n }\\n\\n if (dst != address(0)) {\\n // https://github.com/crytic/slither/issues/959\\n // slither-disable-next-line uninitialized-local\\n (uint256 oldWeight, uint256 newWeight) = writeCheckpoint(\\n _checkpoints[dst],\\n add,\\n amount\\n );\\n emit DelegateVotesChanged(dst, oldWeight, newWeight);\\n }\\n }\\n }\\n\\n /// @notice Writes a new checkpoint based on operating last stored value\\n /// with a `delta`. Usually, said operation is the `add` or\\n /// `subtract` functions from this contract, but more complex\\n /// functions can be passed as parameters.\\n /// @param ckpts The checkpoints array to use\\n /// @param op The function to apply over the last value and the `delta`\\n /// @param delta Variation with respect to last stored value to be used\\n /// for new checkpoint\\n function writeCheckpoint(\\n uint128[] storage ckpts,\\n function(uint256, uint256) view returns (uint256) op,\\n uint256 delta\\n ) internal returns (uint256 oldWeight, uint256 newWeight) {\\n uint256 pos = ckpts.length;\\n oldWeight = pos == 0 ? 0 : decodeValue(ckpts[pos - 1]);\\n newWeight = op(oldWeight, delta);\\n\\n if (pos > 0) {\\n uint32 fromBlock = decodeBlockNumber(ckpts[pos - 1]);\\n // slither-disable-next-line incorrect-equality\\n if (fromBlock == block.number) {\\n ckpts[pos - 1] = encodeCheckpoint(\\n fromBlock,\\n SafeCastUpgradeable.toUint96(newWeight)\\n );\\n return (oldWeight, newWeight);\\n }\\n }\\n\\n ckpts.push(\\n encodeCheckpoint(\\n SafeCastUpgradeable.toUint32(block.number),\\n SafeCastUpgradeable.toUint96(newWeight)\\n )\\n );\\n }\\n\\n /// @notice Lookup a value in a list of (sorted) checkpoints.\\n /// @param ckpts The checkpoints array to use\\n /// @param blockNumber Block number when we want to get the checkpoint at\\n function lookupCheckpoint(uint128[] storage ckpts, uint256 blockNumber)\\n internal\\n view\\n returns (uint96)\\n {\\n // We run a binary search to look for the earliest checkpoint taken\\n // after `blockNumber`. During the loop, the index of the wanted\\n // checkpoint remains in the range [low-1, high). With each iteration,\\n // either `low` or `high` is moved towards the middle of the range to\\n // maintain the invariant.\\n // - If the middle checkpoint is after `blockNumber`,\\n // we look in [low, mid)\\n // - If the middle checkpoint is before or equal to `blockNumber`,\\n // we look in [mid+1, high)\\n // Once we reach a single value (when low == high), we've found the\\n // right checkpoint at the index high-1, if not out of bounds (in that\\n // case we're looking too far in the past and the result is 0).\\n // Note that if the latest checkpoint available is exactly for\\n // `blockNumber`, we end up with an index that is past the end of the\\n // array, so we technically don't find a checkpoint after\\n // `blockNumber`, but it works out the same.\\n require(blockNumber < block.number, \\\"Block not yet determined\\\");\\n\\n uint256 high = ckpts.length;\\n uint256 low = 0;\\n while (low < high) {\\n uint256 mid = MathUpgradeable.average(low, high);\\n uint32 midBlock = decodeBlockNumber(ckpts[mid]);\\n if (midBlock > blockNumber) {\\n high = mid;\\n } else {\\n low = mid + 1;\\n }\\n }\\n\\n return high == 0 ? 0 : decodeValue(ckpts[high - 1]);\\n }\\n\\n /// @notice Maximum token supply. Defaults to `type(uint96).max` (2^96 - 1)\\n // slither-disable-next-line dead-code\\n function maxSupply() internal view virtual returns (uint96) {\\n return type(uint96).max;\\n }\\n\\n /// @notice Encodes a `blockNumber` and `value` into a single `uint128`\\n /// checkpoint.\\n /// @dev `blockNumber` is stored in the first 32 bits, while `value` in the\\n /// remaining 96 bits.\\n function encodeCheckpoint(uint32 blockNumber, uint96 value)\\n internal\\n pure\\n returns (uint128)\\n {\\n return (uint128(blockNumber) << 96) | uint128(value);\\n }\\n\\n /// @notice Decodes a block number from a `uint128` `checkpoint`.\\n function decodeBlockNumber(uint128 checkpoint)\\n internal\\n pure\\n returns (uint32)\\n {\\n return uint32(bytes4(bytes16(checkpoint)));\\n }\\n\\n /// @notice Decodes a voting value from a `uint128` `checkpoint`.\\n function decodeValue(uint128 checkpoint) internal pure returns (uint96) {\\n return uint96(checkpoint);\\n }\\n\\n /// @notice Decodes a block number and voting value from a `uint128`\\n /// `checkpoint`.\\n function decodeCheckpoint(uint128 checkpoint)\\n internal\\n pure\\n returns (uint32 blockNumber, uint96 value)\\n {\\n blockNumber = decodeBlockNumber(checkpoint);\\n value = decodeValue(checkpoint);\\n }\\n\\n // slither-disable-next-line dead-code\\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a + b;\\n }\\n\\n // slither-disable-next-line dead-code\\n function subtract(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a - b;\\n }\\n}\\n\",\"keccak256\":\"0x67b28349e88afe7440c43df93ba5de56873d850a25147161e4469731750efb16\",\"license\":\"GPL-3.0-or-later\"},\"contracts/governance/IVotesHistory.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\n\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n\\npragma solidity 0.8.9;\\n\\ninterface IVotesHistory {\\n function getPastVotes(address account, uint256 blockNumber)\\n external\\n view\\n returns (uint96);\\n\\n function getPastTotalSupply(uint256 blockNumber)\\n external\\n view\\n returns (uint96);\\n}\\n\",\"keccak256\":\"0x535e87cf4c2e9a9439d99cf0918f013965fa6c4ddfbab07ff6ca4b195c8edc9f\",\"license\":\"GPL-3.0-or-later\"},\"contracts/staking/IApplication.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\n\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n\\npragma solidity ^0.8.9;\\n\\n/// @title Application interface for Threshold Network applications\\n/// @notice Generic interface for an application. Application is an external\\n/// smart contract or a set of smart contracts utilizing functionalities\\n/// offered by Threshold Network. Applications authorized for the given\\n/// staking provider are eligible to slash the stake delegated to that\\n/// staking provider.\\ninterface IApplication {\\n /// @dev Event emitted by `withdrawRewards` function.\\n event RewardsWithdrawn(address indexed stakingProvider, uint96 amount);\\n\\n /// @notice Withdraws application rewards for the given staking provider.\\n /// Rewards are withdrawn to the staking provider's beneficiary\\n /// address set in the staking contract.\\n /// @dev Emits `RewardsWithdrawn` event.\\n function withdrawRewards(address stakingProvider) external;\\n\\n /// @notice Used by T staking contract to inform the application that the\\n /// authorized amount for the given staking provider increased.\\n /// The application may do any necessary housekeeping. The\\n /// application must revert the transaction in case the\\n /// authorization is below the minimum required.\\n function authorizationIncreased(\\n address stakingProvider,\\n uint96 fromAmount,\\n uint96 toAmount\\n ) external;\\n\\n /// @notice Used by T staking contract to inform the application that the\\n /// authorization decrease for the given staking provider has been\\n /// requested. The application should mark the authorization as\\n /// pending decrease and respond to the staking contract with\\n /// `approveAuthorizationDecrease` at its discretion. It may\\n /// happen right away but it also may happen several months later.\\n /// If there is already a pending authorization decrease request\\n /// for the application, and the application does not agree for\\n /// overwriting it, the function should revert.\\n function authorizationDecreaseRequested(\\n address stakingProvider,\\n uint96 fromAmount,\\n uint96 toAmount\\n ) external;\\n\\n /// @notice Used by T staking contract to inform the application the\\n /// authorization has been decreased for the given staking provider\\n /// involuntarily, as a result of slashing. Lets the application to\\n /// do any housekeeping neccessary. Called with 250k gas limit and\\n /// does not revert the transaction if\\n /// `involuntaryAuthorizationDecrease` call failed.\\n function involuntaryAuthorizationDecrease(\\n address stakingProvider,\\n uint96 fromAmount,\\n uint96 toAmount\\n ) external;\\n\\n /// @notice Returns the amount of application rewards available for\\n /// withdrawal for the given staking provider.\\n function availableRewards(address stakingProvider)\\n external\\n view\\n returns (uint96);\\n\\n /// @notice The minimum authorization amount required for the staking\\n /// provider so that they can participate in the application.\\n function minimumAuthorization() external view returns (uint96);\\n}\\n\",\"keccak256\":\"0x43d707dccc548bf48ad316d9652450cb297203234d251132cdc6b97508eb44c5\",\"license\":\"GPL-3.0-or-later\"},\"contracts/staking/ILegacyTokenStaking.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\n\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n\\npragma solidity 0.8.9;\\n\\n/// @title IKeepTokenStaking\\n/// @notice Interface for Keep TokenStaking contract\\ninterface IKeepTokenStaking {\\n /// @notice Seize provided token amount from every member in the misbehaved\\n /// operators array. The tattletale is rewarded with 5% of the total seized\\n /// amount scaled by the reward adjustment parameter and the rest 95% is burned.\\n /// @param amountToSeize Token amount to seize from every misbehaved operator.\\n /// @param rewardMultiplier Reward adjustment in percentage. Min 1% and 100% max.\\n /// @param tattletale Address to receive the 5% reward.\\n /// @param misbehavedOperators Array of addresses to seize the tokens from.\\n function seize(\\n uint256 amountToSeize,\\n uint256 rewardMultiplier,\\n address tattletale,\\n address[] memory misbehavedOperators\\n ) external;\\n\\n /// @notice Gets stake delegation info for the given operator.\\n /// @param operator Operator address.\\n /// @return amount The amount of tokens the given operator delegated.\\n /// @return createdAt The time when the stake has been delegated.\\n /// @return undelegatedAt The time when undelegation has been requested.\\n /// If undelegation has not been requested, 0 is returned.\\n function getDelegationInfo(address operator)\\n external\\n view\\n returns (\\n uint256 amount,\\n uint256 createdAt,\\n uint256 undelegatedAt\\n );\\n\\n /// @notice Gets the stake owner for the specified operator address.\\n /// @return Stake owner address.\\n function ownerOf(address operator) external view returns (address);\\n\\n /// @notice Gets the beneficiary for the specified operator address.\\n /// @return Beneficiary address.\\n function beneficiaryOf(address operator)\\n external\\n view\\n returns (address payable);\\n\\n /// @notice Gets the authorizer for the specified operator address.\\n /// @return Authorizer address.\\n function authorizerOf(address operator) external view returns (address);\\n\\n /// @notice Gets the eligible stake balance of the specified address.\\n /// An eligible stake is a stake that passed the initialization period\\n /// and is not currently undelegating. Also, the operator had to approve\\n /// the specified operator contract.\\n ///\\n /// Operator with a minimum required amount of eligible stake can join the\\n /// network and participate in new work selection.\\n ///\\n /// @param operator address of stake operator.\\n /// @param operatorContract address of operator contract.\\n /// @return balance an uint256 representing the eligible stake balance.\\n function eligibleStake(address operator, address operatorContract)\\n external\\n view\\n returns (uint256 balance);\\n}\\n\\n/// @title INuCypherStakingEscrow\\n/// @notice Interface for NuCypher StakingEscrow contract\\ninterface INuCypherStakingEscrow {\\n /// @notice Slash the staker's stake and reward the investigator\\n /// @param staker Staker's address\\n /// @param penalty Penalty\\n /// @param investigator Investigator\\n /// @param reward Reward for the investigator\\n function slashStaker(\\n address staker,\\n uint256 penalty,\\n address investigator,\\n uint256 reward\\n ) external;\\n\\n /// @notice Request merge between NuCypher staking contract and T staking contract.\\n /// Returns amount of staked tokens\\n function requestMerge(address staker, address stakingProvider)\\n external\\n returns (uint256);\\n\\n /// @notice Get all tokens belonging to the staker\\n function getAllTokens(address staker) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x807d42d248e94c1f2269c7aa27031302a1225525e1405010424dd91adcc092ab\",\"license\":\"GPL-3.0-or-later\"},\"contracts/staking/IStaking.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\n\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n\\npragma solidity ^0.8.9;\\n\\n/// @title Interface of Threshold Network staking contract\\n/// @notice The staking contract enables T owners to have their wallets offline\\n/// and their stake managed by staking providers on their behalf.\\n/// The staking contract does not define operator role. The operator\\n/// responsible for running off-chain client software is appointed by\\n/// the staking provider in the particular application utilizing the\\n/// staking contract. All off-chain client software should be able\\n/// to run without exposing operator's or staking provider\\u2019s private\\n/// key and should not require any owner\\u2019s keys at all. The stake\\n/// delegation optimizes the network throughput without compromising the\\n/// security of the owners\\u2019 stake.\\ninterface IStaking {\\n enum StakeType {\\n NU,\\n KEEP,\\n T\\n }\\n\\n //\\n //\\n // Delegating a stake\\n //\\n //\\n\\n /// @notice Creates a delegation with `msg.sender` owner with the given\\n /// staking provider, beneficiary, and authorizer. Transfers the\\n /// given amount of T to the staking contract.\\n /// @dev The owner of the delegation needs to have the amount approved to\\n /// transfer to the staking contract.\\n function stake(\\n address stakingProvider,\\n address payable beneficiary,\\n address authorizer,\\n uint96 amount\\n ) external;\\n\\n /// @notice Copies delegation from the legacy KEEP staking contract to T\\n /// staking contract. No tokens are transferred. Caches the active\\n /// stake amount from KEEP staking contract. Can be called by\\n /// anyone.\\n /// @dev The staking provider in T staking contract is the legacy KEEP\\n /// staking contract operator.\\n function stakeKeep(address stakingProvider) external;\\n\\n /// @notice Copies delegation from the legacy NU staking contract to T\\n /// staking contract, additionally appointing staking provider,\\n /// beneficiary and authorizer roles. Caches the amount staked in NU\\n /// staking contract. Can be called only by the original delegation\\n /// owner.\\n function stakeNu(\\n address stakingProvider,\\n address payable beneficiary,\\n address authorizer\\n ) external;\\n\\n /// @notice Allows the Governance to set the minimum required stake amount.\\n /// This amount is required to protect against griefing the staking\\n /// contract and individual applications are allowed to require\\n /// higher minimum stakes if necessary.\\n function setMinimumStakeAmount(uint96 amount) external;\\n\\n //\\n //\\n // Authorizing an application\\n //\\n //\\n\\n /// @notice Allows the Governance to approve the particular application\\n /// before individual stake authorizers are able to authorize it.\\n function approveApplication(address application) external;\\n\\n /// @notice Increases the authorization of the given staking provider for\\n /// the given application by the given amount. Can only be called by\\n /// the authorizer for that staking provider.\\n /// @dev Calls `authorizationIncreased(address stakingProvider, uint256 amount)`\\n /// on the given application to notify the application about\\n /// authorization change. See `IApplication`.\\n function increaseAuthorization(\\n address stakingProvider,\\n address application,\\n uint96 amount\\n ) external;\\n\\n /// @notice Requests decrease of the authorization for the given staking\\n /// provider on the given application by the provided amount.\\n /// It may not change the authorized amount immediatelly. When\\n /// it happens depends on the application. Can only be called by the\\n /// given staking provider\\u2019s authorizer. Overwrites pending\\n /// authorization decrease for the given staking provider and\\n /// application if the application agrees for that. If the\\n /// application does not agree for overwriting, the function\\n /// reverts.\\n /// @dev Calls `authorizationDecreaseRequested(address stakingProvider, uint256 amount)`\\n /// on the given application. See `IApplication`.\\n function requestAuthorizationDecrease(\\n address stakingProvider,\\n address application,\\n uint96 amount\\n ) external;\\n\\n /// @notice Requests decrease of all authorizations for the given staking\\n /// provider on all applications by all authorized amount.\\n /// It may not change the authorized amount immediatelly. When\\n /// it happens depends on the application. Can only be called by the\\n /// given staking provider\\u2019s authorizer. Overwrites pending\\n /// authorization decrease for the given staking provider and\\n /// application.\\n /// @dev Calls `authorizationDecreaseRequested(address stakingProvider, uint256 amount)`\\n /// for each authorized application. See `IApplication`.\\n function requestAuthorizationDecrease(address stakingProvider) external;\\n\\n /// @notice Called by the application at its discretion to approve the\\n /// previously requested authorization decrease request. Can only be\\n /// called by the application that was previously requested to\\n /// decrease the authorization for that staking provider.\\n /// Returns resulting authorized amount for the application.\\n function approveAuthorizationDecrease(address stakingProvider)\\n external\\n returns (uint96);\\n\\n /// @notice Decreases the authorization for the given `stakingProvider` on\\n /// the given disabled `application`, for all authorized amount.\\n /// Can be called by anyone.\\n function forceDecreaseAuthorization(\\n address stakingProvider,\\n address application\\n ) external;\\n\\n /// @notice Pauses the given application\\u2019s eligibility to slash stakes.\\n /// Besides that stakers can't change authorization to the application.\\n /// Can be called only by the Panic Button of the particular\\n /// application. The paused application can not slash stakes until\\n /// it is approved again by the Governance using `approveApplication`\\n /// function. Should be used only in case of an emergency.\\n function pauseApplication(address application) external;\\n\\n /// @notice Disables the given application. The disabled application can't\\n /// slash stakers. Also stakers can't increase authorization to that\\n /// application but can decrease without waiting by calling\\n /// `requestAuthorizationDecrease` at any moment. Can be called only\\n /// by the governance. The disabled application can't be approved\\n /// again. Should be used only in case of an emergency.\\n function disableApplication(address application) external;\\n\\n /// @notice Sets the Panic Button role for the given application to the\\n /// provided address. Can only be called by the Governance. If the\\n /// Panic Button for the given application should be disabled, the\\n /// role address should be set to 0x0 address.\\n function setPanicButton(address application, address panicButton) external;\\n\\n /// @notice Sets the maximum number of applications one staking provider can\\n /// have authorized. Used to protect against DoSing slashing queue.\\n /// Can only be called by the Governance.\\n function setAuthorizationCeiling(uint256 ceiling) external;\\n\\n //\\n //\\n // Stake top-up\\n //\\n //\\n\\n /// @notice Increases the amount of the stake for the given staking provider.\\n /// @dev The sender of this transaction needs to have the amount approved to\\n /// transfer to the staking contract.\\n function topUp(address stakingProvider, uint96 amount) external;\\n\\n /// @notice Propagates information about stake top-up from the legacy KEEP\\n /// staking contract to T staking contract. Can be called only by\\n /// the owner or the staking provider.\\n function topUpKeep(address stakingProvider) external;\\n\\n /// @notice Propagates information about stake top-up from the legacy NU\\n /// staking contract to T staking contract. Can be called only by\\n /// the owner or the staking provider.\\n function topUpNu(address stakingProvider) external;\\n\\n //\\n //\\n // Undelegating a stake (unstaking)\\n //\\n //\\n\\n /// @notice Reduces the liquid T stake amount by the provided amount and\\n /// withdraws T to the owner. Reverts if there is at least one\\n /// authorization higher than the sum of the legacy stake and\\n /// remaining liquid T stake or if the unstake amount is higher than\\n /// the liquid T stake amount. Can be called only by the delegation\\n /// owner or the staking provider.\\n function unstakeT(address stakingProvider, uint96 amount) external;\\n\\n /// @notice Sets the legacy KEEP staking contract active stake amount cached\\n /// in T staking contract to 0. Reverts if the amount of liquid T\\n /// staked in T staking contract is lower than the highest\\n /// application authorization. This function allows to unstake from\\n /// KEEP staking contract and still being able to operate in T\\n /// network and earning rewards based on the liquid T staked. Can be\\n /// called only by the delegation owner or the staking provider.\\n function unstakeKeep(address stakingProvider) external;\\n\\n /// @notice Reduces cached legacy NU stake amount by the provided amount.\\n /// Reverts if there is at least one authorization higher than the\\n /// sum of remaining legacy NU stake and liquid T stake for that\\n /// staking provider or if the untaked amount is higher than the\\n /// cached legacy stake amount. If succeeded, the legacy NU stake\\n /// can be partially or fully undelegated on the legacy staking\\n /// contract. This function allows to unstake from NU staking\\n /// contract and still being able to operate in T network and\\n /// earning rewards based on the liquid T staked. Can be called only\\n /// by the delegation owner or the staking provider.\\n function unstakeNu(address stakingProvider, uint96 amount) external;\\n\\n /// @notice Sets cached legacy stake amount to 0, sets the liquid T stake\\n /// amount to 0 and withdraws all liquid T from the stake to the\\n /// owner. Reverts if there is at least one non-zero authorization.\\n /// Can be called only by the delegation owner or the staking\\n /// provider.\\n function unstakeAll(address stakingProvider) external;\\n\\n //\\n //\\n // Keeping information in sync\\n //\\n //\\n\\n /// @notice Notifies about the discrepancy between legacy KEEP active stake\\n /// and the amount cached in T staking contract. Slashes the staking\\n /// provider in case the amount cached is higher than the actual\\n /// active stake amount in KEEP staking contract. Needs to update\\n /// authorizations of all affected applications and execute an\\n /// involuntary allocation decrease on all affected applications.\\n /// Can be called by anyone, notifier receives a reward.\\n function notifyKeepStakeDiscrepancy(address stakingProvider) external;\\n\\n /// @notice Notifies about the discrepancy between legacy NU active stake\\n /// and the amount cached in T staking contract. Slashes the\\n /// staking provider in case the amount cached is higher than the\\n /// actual active stake amount in NU staking contract. Needs to\\n /// update authorizations of all affected applications and execute\\n /// an involuntary allocation decrease on all affected applications.\\n /// Can be called by anyone, notifier receives a reward.\\n function notifyNuStakeDiscrepancy(address stakingProvider) external;\\n\\n /// @notice Sets the penalty amount for stake discrepancy and reward\\n /// multiplier for reporting it. The penalty is seized from the\\n /// delegated stake, and 5% of the penalty, scaled by the\\n /// multiplier, is given to the notifier. The rest of the tokens are\\n /// burned. Can only be called by the Governance. See `seize` function.\\n function setStakeDiscrepancyPenalty(\\n uint96 penalty,\\n uint256 rewardMultiplier\\n ) external;\\n\\n /// @notice Sets reward in T tokens for notification of misbehaviour\\n /// of one staking provider. Can only be called by the governance.\\n function setNotificationReward(uint96 reward) external;\\n\\n /// @notice Transfer some amount of T tokens as reward for notifications\\n /// of misbehaviour\\n function pushNotificationReward(uint96 reward) external;\\n\\n /// @notice Withdraw some amount of T tokens from notifiers treasury.\\n /// Can only be called by the governance.\\n function withdrawNotificationReward(address recipient, uint96 amount)\\n external;\\n\\n /// @notice Adds staking providers to the slashing queue along with the\\n /// amount that should be slashed from each one of them. Can only be\\n /// called by application authorized for all staking providers in\\n /// the array.\\n function slash(uint96 amount, address[] memory stakingProviders) external;\\n\\n /// @notice Adds staking providers to the slashing queue along with the\\n /// amount. The notifier will receive reward per each staking\\n /// provider from notifiers treasury. Can only be called by\\n /// application authorized for all staking providers in the array.\\n function seize(\\n uint96 amount,\\n uint256 rewardMultipier,\\n address notifier,\\n address[] memory stakingProviders\\n ) external;\\n\\n /// @notice Takes the given number of queued slashing operations and\\n /// processes them. Receives 5% of the slashed amount.\\n /// Executes `involuntaryAllocationDecrease` function on each\\n /// affected application.\\n function processSlashing(uint256 count) external;\\n\\n //\\n //\\n // Auxiliary functions\\n //\\n //\\n\\n /// @notice Returns the authorized stake amount of the staking provider for\\n /// the application.\\n function authorizedStake(address stakingProvider, address application)\\n external\\n view\\n returns (uint96);\\n\\n /// @notice Returns staked amount of T, Keep and Nu for the specified\\n /// staking provider.\\n /// @dev All values are in T denomination\\n function stakes(address stakingProvider)\\n external\\n view\\n returns (\\n uint96 tStake,\\n uint96 keepInTStake,\\n uint96 nuInTStake\\n );\\n\\n /// @notice Returns start staking timestamp.\\n /// @dev This value is set at most once.\\n function getStartStakingTimestamp(address stakingProvider)\\n external\\n view\\n returns (uint256);\\n\\n /// @notice Returns staked amount of NU for the specified staking provider.\\n function stakedNu(address stakingProvider) external view returns (uint256);\\n\\n /// @notice Gets the stake owner, the beneficiary and the authorizer\\n /// for the specified staking provider address.\\n /// @return owner Stake owner address.\\n /// @return beneficiary Beneficiary address.\\n /// @return authorizer Authorizer address.\\n function rolesOf(address stakingProvider)\\n external\\n view\\n returns (\\n address owner,\\n address payable beneficiary,\\n address authorizer\\n );\\n\\n /// @notice Returns length of application array\\n function getApplicationsLength() external view returns (uint256);\\n\\n /// @notice Returns length of slashing queue\\n function getSlashingQueueLength() external view returns (uint256);\\n\\n /// @notice Returns minimum possible stake for T, KEEP or NU in T\\n /// denomination.\\n /// @dev For example, suppose the given staking provider has 10 T, 20 T\\n /// worth of KEEP, and 30 T worth of NU all staked, and the maximum\\n /// application authorization is 40 T, then `getMinStaked` for\\n /// that staking provider returns:\\n /// * 0 T if KEEP stake type specified i.e.\\n /// min = 40 T max - (10 T + 30 T worth of NU) = 0 T\\n /// * 10 T if NU stake type specified i.e.\\n /// min = 40 T max - (10 T + 20 T worth of KEEP) = 10 T\\n /// * 0 T if T stake type specified i.e.\\n /// min = 40 T max - (20 T worth of KEEP + 30 T worth of NU) < 0 T\\n /// In other words, the minimum stake amount for the specified\\n /// stake type is the minimum amount of stake of the given type\\n /// needed to satisfy the maximum application authorization given the\\n /// staked amounts of the other stake types for that staking provider.\\n function getMinStaked(address stakingProvider, StakeType stakeTypes)\\n external\\n view\\n returns (uint96);\\n\\n /// @notice Returns available amount to authorize for the specified application\\n function getAvailableToAuthorize(\\n address stakingProvider,\\n address application\\n ) external view returns (uint96);\\n}\\n\",\"keccak256\":\"0x45c15ff4a9a47024ce413da249a6a77cc2f20a81909e7536d4c5198c92f3f148\",\"license\":\"GPL-3.0-or-later\"},\"contracts/staking/KeepStake.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\n\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n\\npragma solidity 0.8.9;\\n\\nimport \\\"./ILegacyTokenStaking.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\n/// @title KEEP ManagedGrant contract interface\\ninterface IManagedGrant {\\n function grantee() external view returns (address);\\n}\\n\\n/// @title KEEP stake owner resolver\\n/// @notice T network staking contract supports existing KEEP stakes by allowing\\n/// KEEP stakers to use their stakes in T network and weights them based\\n/// on KEEP<>T token ratio. KEEP stake owner is cached in T staking\\n/// contract and used to restrict access to all functions only owner or\\n/// operator should call. To cache KEEP stake owner in T staking\\n/// contract, T staking contract first needs to resolve the owner.\\n///\\n/// Resolving liquid KEEP stake owner is easy. Resolving token grant\\n/// stake owner is complicated and not possible to do on-chain from\\n/// a contract external to KEEP TokenStaking contract. Keep TokenStaking\\n/// knows the grant ID but does not expose it externally.\\n///\\n/// KeepStake contract addresses this problem by exposing\\n/// operator-owner mappings snapshotted off-chain based on events and\\n/// information publicly available from KEEP TokenStaking contract and\\n/// KEEP TokenGrant contract. Additionally, it gives the Governance\\n/// ability to add new mappings in case they are ever needed; in\\n/// practice, this will be needed only if someone decides to stake their\\n/// KEEP token grant in KEEP network after 2021-11-11 when the snapshot\\n/// was taken.\\n///\\n/// Operator-owner pairs were snapshotted 2021-11-11 in the following\\n/// way:\\n/// 1. Fetch all TokenStaking events from KEEP staking contract.\\n/// 2. Filter out undelegated operators.\\n/// 3. Filter out canceled delegations.\\n/// 4. Fetch grant stake information from KEEP TokenGrant for that\\n/// operator to determine if we are dealing with grant delegation.\\n/// 5. Fetch grantee address from KEEP TokenGrant contract.\\n/// 6. Check if we are dealing with ManagedGrant by looking for all\\n/// created ManagedGrants and comparing their address against grantee\\n/// address fetched from TokenGrant contract.\\ncontract KeepStake is Ownable {\\n IKeepTokenStaking public immutable keepTokenStaking;\\n\\n mapping(address => address) public operatorToManagedGrant;\\n mapping(address => address) public operatorToGrantee;\\n\\n constructor(IKeepTokenStaking _keepTokenStaking) {\\n keepTokenStaking = _keepTokenStaking;\\n }\\n\\n /// @notice Allows the Governance to set new operator-managed grant pair.\\n /// This function should only be called for managed grants if\\n /// the snapshot does include this pair.\\n function setManagedGrant(address operator, address managedGrant)\\n external\\n onlyOwner\\n {\\n operatorToManagedGrant[operator] = managedGrant;\\n }\\n\\n /// @notice Allows the Governance to set new operator-grantee pair.\\n /// This function should only be called for non-managed grants if\\n /// the snapshot does include this pair.\\n function setGrantee(address operator, address grantee) external onlyOwner {\\n operatorToGrantee[operator] = grantee;\\n }\\n\\n /// @notice Resolves KEEP stake owner for the provided operator address.\\n /// Reverts if could not resolve the owner.\\n function resolveOwner(address operator) external view returns (address) {\\n address owner = operatorToManagedGrant[operator];\\n if (owner != address(0)) {\\n return IManagedGrant(owner).grantee();\\n }\\n\\n owner = operatorToGrantee[operator];\\n if (owner != address(0)) {\\n return owner;\\n }\\n\\n owner = resolveSnapshottedManagedGrantees(operator);\\n if (owner != address(0)) {\\n return owner;\\n }\\n\\n owner = resolveSnapshottedGrantees(operator);\\n if (owner != address(0)) {\\n return owner;\\n }\\n\\n owner = keepTokenStaking.ownerOf(operator);\\n require(owner != address(0), \\\"Could not resolve the owner\\\");\\n\\n return owner;\\n }\\n\\n function resolveSnapshottedManagedGrantees(address operator)\\n internal\\n view\\n returns (address)\\n {\\n if (operator == 0x855A951162B1B93D70724484d5bdc9D00B56236B) {\\n return\\n IManagedGrant(0xFADbF758307A054C57B365Db1De90acA71feaFE5)\\n .grantee();\\n }\\n if (operator == 0xF1De9490Bf7298b5F350cE74332Ad7cf8d5cB181) {\\n return\\n IManagedGrant(0xAEd493Aaf3E76E83b29E151848b71eF4544f92f1)\\n .grantee();\\n }\\n if (operator == 0x39d2aCBCD80d80080541C6eed7e9feBb8127B2Ab) {\\n return\\n IManagedGrant(0xA2fa09D6f8C251422F5fde29a0BAd1C53dEfAe66)\\n .grantee();\\n }\\n if (operator == 0xd66cAE89FfBc6E50e6b019e45c1aEc93Dec54781) {\\n return\\n IManagedGrant(0x306309f9d105F34132db0bFB3Ce3f5B0245Cd386)\\n .grantee();\\n }\\n if (operator == 0x2eBE08379f4fD866E871A9b9E1d5C695154C6A9F) {\\n return\\n IManagedGrant(0xd00c0d43b747C33726B3f0ff4BDA4b72dc53c6E9)\\n .grantee();\\n }\\n if (operator == 0xA97c34278162b556A527CFc01B53eb4DDeDFD223) {\\n return\\n IManagedGrant(0xB3E967355c456B1Bd43cB0188A321592D410D096)\\n .grantee();\\n }\\n if (operator == 0x6C76d49322C9f8761A1623CEd89A31490cdB649d) {\\n return\\n IManagedGrant(0xB3E967355c456B1Bd43cB0188A321592D410D096)\\n .grantee();\\n }\\n if (operator == 0x4a41c7a884d119eaaefE471D0B3a638226408382) {\\n return\\n IManagedGrant(0xcdf3d216d82a463Ce82971F2F5DA3d8f9C5f093A)\\n .grantee();\\n }\\n if (operator == 0x9c06Feb7Ebc8065ee11Cd5E8EEdaAFb2909A7087) {\\n return\\n IManagedGrant(0x45119cd98d145283762BA9eBCAea75F72D188733)\\n .grantee();\\n }\\n if (operator == 0x9bD818Ab6ACC974f2Cf2BD2EBA7a250126Accb9F) {\\n return\\n IManagedGrant(0x6E535043377067621954ee84065b0bd7357e7aBa)\\n .grantee();\\n }\\n if (operator == 0x1d803c89760F8B4057DB15BCb3B8929E0498D310) {\\n return\\n IManagedGrant(0xB3E967355c456B1Bd43cB0188A321592D410D096)\\n .grantee();\\n }\\n if (operator == 0x3101927DEeC27A2bfA6c4a6316e3A221f631dB91) {\\n return\\n IManagedGrant(0x178Bf1946feD0e2362fdF8bcD3f91F0701a012C6)\\n .grantee();\\n }\\n if (operator == 0x9d9b187E478bC62694A7bED216Fc365de87F280C) {\\n return\\n IManagedGrant(0xFBad17CFad6cb00D726c65501D69FdC13Ca5477c)\\n .grantee();\\n }\\n if (operator == 0xd977144724Bc77FaeFAe219F958AE3947205d0b5) {\\n return\\n IManagedGrant(0x087B442BFd4E42675cf2df5fa566F87d7A96Fb12)\\n .grantee();\\n }\\n if (operator == 0x045E511f53DeBF55c9C0B4522f14F602f7C7cA81) {\\n return\\n IManagedGrant(0xFcfe8C036C414a15cF871071c483687095caF7D6)\\n .grantee();\\n }\\n if (operator == 0x3Dd301b3c96A282d8092E1e6f6846f24172D45C1) {\\n return\\n IManagedGrant(0xb5Bdd2D9B3541fc8f581Af37430D26527e59aeF8)\\n .grantee();\\n }\\n if (operator == 0x5d84DEB482E770479154028788Df79aA7C563aA4) {\\n return\\n IManagedGrant(0x9D1a179c469a8BdD0b683A9f9250246cc47e8fBE)\\n .grantee();\\n }\\n if (operator == 0x1dF927B69A97E8140315536163C029d188e8573b) {\\n return\\n IManagedGrant(0xb5Bdd2D9B3541fc8f581Af37430D26527e59aeF8)\\n .grantee();\\n }\\n if (operator == 0x617daCE069Fbd41993491de211b4DfccdAcbd348) {\\n return\\n IManagedGrant(0xb5Bdd2D9B3541fc8f581Af37430D26527e59aeF8)\\n .grantee();\\n }\\n if (operator == 0x650A9eD18Df873cad98C88dcaC8170531cAD2399) {\\n return\\n IManagedGrant(0x1Df7324A3aD20526DFa02Cc803eD2D97Cac81F3b)\\n .grantee();\\n }\\n if (operator == 0x07C9a8f8264221906b7b8958951Ce4753D39628B) {\\n return\\n IManagedGrant(0x305D12b4d70529Cd618dA7399F5520701E510041)\\n .grantee();\\n }\\n if (operator == 0x63eB4c3DD0751F9BE7070A01156513C227fa1eF6) {\\n return\\n IManagedGrant(0x306309f9d105F34132db0bFB3Ce3f5B0245Cd386)\\n .grantee();\\n }\\n if (operator == 0xc6349eEC31048787676b6297ba71721376A8DdcF) {\\n return\\n IManagedGrant(0xac1a985E75C6a0b475b9c807Ad0705a988Be2D99)\\n .grantee();\\n }\\n if (operator == 0x3B945f9C0C8737e44f8e887d4F04B5B3A491Ac4d) {\\n return\\n IManagedGrant(0x82e17477726E8D9D2C237745cA9989631582eE98)\\n .grantee();\\n }\\n if (operator == 0xF35343299a4f80Dd5D917bbe5ddd54eBB820eBd4) {\\n return\\n IManagedGrant(0xCC88c15506251B62ccCeebA193e100d6bBC9a30D)\\n .grantee();\\n }\\n if (operator == 0x3B9e5ae72d068448bB96786989c0d86FBC0551D1) {\\n return\\n IManagedGrant(0x306309f9d105F34132db0bFB3Ce3f5B0245Cd386)\\n .grantee();\\n }\\n if (operator == 0xB2D53Be158Cb8451dFc818bD969877038c1BdeA1) {\\n return\\n IManagedGrant(0xaE55e3800f0A3feaFdcE535A8C0fab0fFdB90DEe)\\n .grantee();\\n }\\n if (operator == 0xF6dbF7AFe05b8Bb6f198eC7e69333c98D3C4608C) {\\n return\\n IManagedGrant(0xbb8D24a20c20625f86739824014C3cBAAAb26700)\\n .grantee();\\n }\\n if (operator == 0xB62Fc1ADfFb2ab832041528C8178358338d85f76) {\\n return\\n IManagedGrant(0x9ED98fD1C29018B9342CB8F57A3073B9695f0c02)\\n .grantee();\\n }\\n if (operator == 0x9bC8d30d971C9e74298112803036C05db07D73e3) {\\n return\\n IManagedGrant(0x66beda757939f8e505b5Eb883cd02C8d4a11Bca2)\\n .grantee();\\n }\\n\\n return address(0);\\n }\\n\\n function resolveSnapshottedGrantees(address operator)\\n internal\\n pure\\n returns (address)\\n {\\n if (operator == 0x1147ccFB4AEFc6e587a23b78724Ef20Ec6e474D4) {\\n return 0x3FB49dA4375Ef9019f17990D04c6d5daD482D80a;\\n }\\n if (operator == 0x4c21541f95a00C03C75F38C71DC220bd27cbbEd9) {\\n return 0xC897cfeE43a8d827F76D4226994D5CE5EBBe2571;\\n }\\n if (operator == 0x7E6332d18719a5463d3867a1a892359509589a3d) {\\n return 0x1578eD833D986c1188D1a998aA5FEcD418beF5da;\\n }\\n if (operator == 0x8Bd660A764Ca14155F3411a4526a028b6316CB3E) {\\n return 0xf6f372DfAeCC1431186598c304e91B79Ce115766;\\n }\\n if (operator == 0x4F4f0D0dfd93513B3f4Cb116Fe9d0A005466F725) {\\n return 0x8b055ac1c4dd287E2a46D4a52d61FE76FB551bD0;\\n }\\n if (operator == 0x1DF0250027fEC876d8876d1ac7A392c9098F1a1e) {\\n return 0xE408fFa969707Ce5d7aA3e5F8d44674Fa4b26219;\\n }\\n if (operator == 0x860EF3f83B6adFEF757F98345c3B8DdcFCA9d152) {\\n return 0x08a3633AAb8f3E436DEA204288Ee26Fe094406b0;\\n }\\n if (operator == 0xe3a2d16dA142E6B190A5d9F7e0C07cc460B58A5F) {\\n return 0x875f8fFCDDeD63B5d8Cf54be4E4b82FE6c6E249C;\\n }\\n if (operator == 0xBDE07f1cA107Ef319b0Bb26eBF1d0a5b4c97ffc1) {\\n return 0x1578eD833D986c1188D1a998aA5FEcD418beF5da;\\n }\\n if (operator == 0xE86181D6b672d78D33e83029fF3D0ef4A601B4C4) {\\n return 0x1578eD833D986c1188D1a998aA5FEcD418beF5da;\\n }\\n if (operator == 0xb7c561e2069aCaE2c4480111B1606790BB4E13fE) {\\n return 0x1578eD833D986c1188D1a998aA5FEcD418beF5da;\\n }\\n if (operator == 0x526c013f8382B050d32d86e7090Ac84De22EdA4D) {\\n return 0x61C6E5DDacded540CD08066C08cbc096d22D91f4;\\n }\\n\\n return address(0);\\n }\\n}\\n\",\"keccak256\":\"0xc75f6be595ec0e0c885d689786808a53b70c0a170a53dd344228359dc6aaf178\",\"license\":\"GPL-3.0-or-later\"},\"contracts/staking/TokenStaking.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\n\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n\\npragma solidity 0.8.9;\\n\\nimport \\\"./IApplication.sol\\\";\\nimport \\\"./ILegacyTokenStaking.sol\\\";\\nimport \\\"./IStaking.sol\\\";\\nimport \\\"./KeepStake.sol\\\";\\nimport \\\"../governance/Checkpoints.sol\\\";\\nimport \\\"../token/T.sol\\\";\\nimport \\\"../utils/PercentUtils.sol\\\";\\nimport \\\"../utils/SafeTUpgradeable.sol\\\";\\nimport \\\"../vending/VendingMachine.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\\\";\\n\\n/// @notice TokenStaking is the main staking contract of the Threshold Network.\\n/// Apart from the basic usage of enabling T stakes, it also acts as a\\n/// sort of \\\"meta-staking\\\" contract, accepting existing legacy NU/KEEP\\n/// stakes. Additionally, it serves as application manager for the apps\\n/// that run on the Threshold Network. Note that legacy NU/KEEP staking\\n/// contracts see TokenStaking as an application (e.g., slashing is\\n/// requested by TokenStaking and performed by the legacy contracts).\\n/// @dev TokenStaking is upgradeable, using OpenZeppelin's Upgradeability\\n/// framework. As such, it is required to satisfy OZ's guidelines, like\\n/// restrictions on constructors, immutable variables, base contracts and\\n/// libraries. See https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable\\ncontract TokenStaking is Initializable, IStaking, Checkpoints {\\n using SafeTUpgradeable for T;\\n using PercentUtils for uint256;\\n using SafeCastUpgradeable for uint256;\\n\\n enum ApplicationStatus {\\n NOT_APPROVED,\\n APPROVED,\\n PAUSED,\\n DISABLED\\n }\\n\\n struct StakingProviderInfo {\\n uint96 nuInTStake;\\n address owner;\\n uint96 keepInTStake;\\n address payable beneficiary;\\n uint96 tStake;\\n address authorizer;\\n mapping(address => AppAuthorization) authorizations;\\n address[] authorizedApplications;\\n uint256 startStakingTimestamp;\\n }\\n\\n struct AppAuthorization {\\n uint96 authorized;\\n uint96 deauthorizing;\\n }\\n\\n struct ApplicationInfo {\\n ApplicationStatus status;\\n address panicButton;\\n }\\n\\n struct SlashingEvent {\\n address stakingProvider;\\n uint96 amount;\\n }\\n\\n uint256 internal constant SLASHING_REWARD_PERCENT = 5;\\n uint256 internal constant MIN_STAKE_TIME = 24 hours;\\n uint256 internal constant GAS_LIMIT_AUTHORIZATION_DECREASE = 250000;\\n uint256 internal constant CONVERSION_DIVISOR = 10**(18 - 3);\\n\\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable\\n T internal immutable token;\\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable\\n IKeepTokenStaking internal immutable keepStakingContract;\\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable\\n KeepStake internal immutable keepStake;\\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable\\n INuCypherStakingEscrow internal immutable nucypherStakingContract;\\n\\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable\\n uint256 internal immutable keepRatio;\\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable\\n uint256 internal immutable nucypherRatio;\\n\\n address public governance;\\n uint96 public minTStakeAmount;\\n uint256 public authorizationCeiling;\\n uint96 public stakeDiscrepancyPenalty;\\n uint256 public stakeDiscrepancyRewardMultiplier;\\n\\n uint256 public notifiersTreasury;\\n uint256 public notificationReward;\\n\\n mapping(address => StakingProviderInfo) internal stakingProviders;\\n mapping(address => ApplicationInfo) public applicationInfo;\\n address[] public applications;\\n\\n SlashingEvent[] public slashingQueue;\\n uint256 public slashingQueueIndex;\\n\\n event Staked(\\n StakeType indexed stakeType,\\n address indexed owner,\\n address indexed stakingProvider,\\n address beneficiary,\\n address authorizer,\\n uint96 amount\\n );\\n event MinimumStakeAmountSet(uint96 amount);\\n event ApplicationStatusChanged(\\n address indexed application,\\n ApplicationStatus indexed newStatus\\n );\\n event AuthorizationIncreased(\\n address indexed stakingProvider,\\n address indexed application,\\n uint96 fromAmount,\\n uint96 toAmount\\n );\\n event AuthorizationDecreaseRequested(\\n address indexed stakingProvider,\\n address indexed application,\\n uint96 fromAmount,\\n uint96 toAmount\\n );\\n event AuthorizationDecreaseApproved(\\n address indexed stakingProvider,\\n address indexed application,\\n uint96 fromAmount,\\n uint96 toAmount\\n );\\n event AuthorizationInvoluntaryDecreased(\\n address indexed stakingProvider,\\n address indexed application,\\n uint96 fromAmount,\\n uint96 toAmount,\\n bool indexed successfulCall\\n );\\n event PanicButtonSet(\\n address indexed application,\\n address indexed panicButton\\n );\\n event AuthorizationCeilingSet(uint256 ceiling);\\n event ToppedUp(address indexed stakingProvider, uint96 amount);\\n event Unstaked(address indexed stakingProvider, uint96 amount);\\n event TokensSeized(\\n address indexed stakingProvider,\\n uint96 amount,\\n bool indexed discrepancy\\n );\\n event StakeDiscrepancyPenaltySet(uint96 penalty, uint256 rewardMultiplier);\\n event NotificationRewardSet(uint96 reward);\\n event NotificationRewardPushed(uint96 reward);\\n event NotificationRewardWithdrawn(address recipient, uint96 amount);\\n event NotifierRewarded(address indexed notifier, uint256 amount);\\n event SlashingProcessed(\\n address indexed caller,\\n uint256 count,\\n uint256 tAmount\\n );\\n event OwnerRefreshed(\\n address indexed stakingProvider,\\n address indexed oldOwner,\\n address indexed newOwner\\n );\\n event GovernanceTransferred(address oldGovernance, address newGovernance);\\n\\n modifier onlyGovernance() {\\n require(governance == msg.sender, \\\"Caller is not the governance\\\");\\n _;\\n }\\n\\n modifier onlyPanicButtonOf(address application) {\\n require(\\n applicationInfo[application].panicButton == msg.sender,\\n \\\"Caller is not the panic button\\\"\\n );\\n _;\\n }\\n\\n modifier onlyAuthorizerOf(address stakingProvider) {\\n //slither-disable-next-line incorrect-equality\\n require(\\n stakingProviders[stakingProvider].authorizer == msg.sender,\\n \\\"Not authorizer\\\"\\n );\\n _;\\n }\\n\\n modifier onlyOwnerOrStakingProvider(address stakingProvider) {\\n //slither-disable-next-line incorrect-equality\\n require(\\n stakingProviders[stakingProvider].owner != address(0) &&\\n (stakingProvider == msg.sender ||\\n stakingProviders[stakingProvider].owner == msg.sender),\\n \\\"Not owner or provider\\\"\\n );\\n _;\\n }\\n\\n modifier onlyOwnerOf(address stakingProvider) {\\n // slither-disable-next-line incorrect-equality\\n require(\\n stakingProviders[stakingProvider].owner == msg.sender,\\n \\\"Caller is not owner\\\"\\n );\\n _;\\n }\\n\\n /// @param _token Address of T token contract\\n /// @param _keepStakingContract Address of Keep staking contract\\n /// @param _nucypherStakingContract Address of NuCypher staking contract\\n /// @param _keepVendingMachine Address of Keep vending machine\\n /// @param _nucypherVendingMachine Address of NuCypher vending machine\\n /// @param _keepStake Address of Keep contract with grant owners\\n /// @custom:oz-upgrades-unsafe-allow constructor\\n constructor(\\n T _token,\\n IKeepTokenStaking _keepStakingContract,\\n INuCypherStakingEscrow _nucypherStakingContract,\\n VendingMachine _keepVendingMachine,\\n VendingMachine _nucypherVendingMachine,\\n KeepStake _keepStake\\n ) {\\n // calls to check contracts are working\\n require(\\n _token.totalSupply() > 0 &&\\n _keepStakingContract.ownerOf(address(0)) == address(0) &&\\n _nucypherStakingContract.getAllTokens(address(0)) == 0 &&\\n AddressUpgradeable.isContract(address(_keepStake)),\\n \\\"Wrong input parameters\\\"\\n );\\n token = _token;\\n keepStakingContract = _keepStakingContract;\\n keepStake = _keepStake;\\n nucypherStakingContract = _nucypherStakingContract;\\n\\n keepRatio = _keepVendingMachine.ratio();\\n nucypherRatio = _nucypherVendingMachine.ratio();\\n }\\n\\n function initialize() external initializer {\\n _transferGovernance(msg.sender);\\n }\\n\\n //\\n //\\n // Delegating a stake\\n //\\n //\\n\\n /// @notice Creates a delegation with `msg.sender` owner with the given\\n /// staking provider, beneficiary, and authorizer. Transfers the\\n /// given amount of T to the staking contract.\\n /// @dev The owner of the delegation needs to have the amount approved to\\n /// transfer to the staking contract.\\n function stake(\\n address stakingProvider,\\n address payable beneficiary,\\n address authorizer,\\n uint96 amount\\n ) external override {\\n require(\\n stakingProvider != address(0) &&\\n beneficiary != address(0) &&\\n authorizer != address(0),\\n \\\"Parameters must be specified\\\"\\n );\\n StakingProviderInfo storage stakingProviderStruct = stakingProviders[\\n stakingProvider\\n ];\\n (, uint256 createdAt, ) = keepStakingContract.getDelegationInfo(\\n stakingProvider\\n );\\n require(\\n createdAt == 0 && stakingProviderStruct.owner == address(0),\\n \\\"Provider is already in use\\\"\\n );\\n require(\\n amount > 0 && amount >= minTStakeAmount,\\n \\\"Amount is less than minimum\\\"\\n );\\n stakingProviderStruct.owner = msg.sender;\\n stakingProviderStruct.authorizer = authorizer;\\n stakingProviderStruct.beneficiary = beneficiary;\\n\\n stakingProviderStruct.tStake = amount;\\n /* solhint-disable-next-line not-rely-on-time */\\n stakingProviderStruct.startStakingTimestamp = block.timestamp;\\n\\n increaseStakeCheckpoint(stakingProvider, amount);\\n\\n emit Staked(\\n StakeType.T,\\n msg.sender,\\n stakingProvider,\\n beneficiary,\\n authorizer,\\n amount\\n );\\n token.safeTransferFrom(msg.sender, address(this), amount);\\n }\\n\\n /// @notice Copies delegation from the legacy KEEP staking contract to T\\n /// staking contract. No tokens are transferred. Caches the active\\n /// stake amount from KEEP staking contract. Can be called by\\n /// anyone.\\n /// @dev The staking provider in T staking contract is the legacy KEEP\\n /// staking contract operator.\\n function stakeKeep(address stakingProvider) external override {\\n require(stakingProvider != address(0), \\\"Parameters must be specified\\\");\\n StakingProviderInfo storage stakingProviderStruct = stakingProviders[\\n stakingProvider\\n ];\\n\\n require(\\n stakingProviderStruct.owner == address(0),\\n \\\"Provider is already in use\\\"\\n );\\n\\n uint96 tAmount = getKeepAmountInT(stakingProvider);\\n require(tAmount != 0, \\\"Nothing to sync\\\");\\n\\n stakingProviderStruct.keepInTStake = tAmount;\\n stakingProviderStruct.owner = keepStake.resolveOwner(stakingProvider);\\n stakingProviderStruct.authorizer = keepStakingContract.authorizerOf(\\n stakingProvider\\n );\\n stakingProviderStruct.beneficiary = keepStakingContract.beneficiaryOf(\\n stakingProvider\\n );\\n\\n /* solhint-disable-next-line not-rely-on-time */\\n stakingProviderStruct.startStakingTimestamp = block.timestamp;\\n\\n increaseStakeCheckpoint(stakingProvider, tAmount);\\n\\n emit Staked(\\n StakeType.KEEP,\\n stakingProviderStruct.owner,\\n stakingProvider,\\n stakingProviderStruct.beneficiary,\\n stakingProviderStruct.authorizer,\\n tAmount\\n );\\n }\\n\\n /// @notice Copies delegation from the legacy NU staking contract to T\\n /// staking contract, additionally appointing beneficiary and\\n /// authorizer roles. Caches the amount staked in NU staking\\n /// contract. Can be called only by the original delegation owner.\\n function stakeNu(\\n address stakingProvider,\\n address payable beneficiary,\\n address authorizer\\n ) external override {\\n require(\\n stakingProvider != address(0) &&\\n beneficiary != address(0) &&\\n authorizer != address(0),\\n \\\"Parameters must be specified\\\"\\n );\\n StakingProviderInfo storage stakingProviderStruct = stakingProviders[\\n stakingProvider\\n ];\\n (, uint256 createdAt, ) = keepStakingContract.getDelegationInfo(\\n stakingProvider\\n );\\n require(\\n createdAt == 0 && stakingProviderStruct.owner == address(0),\\n \\\"Provider is already in use\\\"\\n );\\n\\n uint96 tAmount = getNuAmountInT(msg.sender, stakingProvider);\\n require(tAmount > 0, \\\"Nothing to sync\\\");\\n\\n stakingProviderStruct.nuInTStake = tAmount;\\n stakingProviderStruct.owner = msg.sender;\\n stakingProviderStruct.authorizer = authorizer;\\n stakingProviderStruct.beneficiary = beneficiary;\\n /* solhint-disable-next-line not-rely-on-time */\\n stakingProviderStruct.startStakingTimestamp = block.timestamp;\\n\\n increaseStakeCheckpoint(stakingProvider, tAmount);\\n\\n emit Staked(\\n StakeType.NU,\\n msg.sender,\\n stakingProvider,\\n beneficiary,\\n authorizer,\\n tAmount\\n );\\n }\\n\\n /// @notice Allows the Governance to set the minimum required stake amount.\\n /// This amount is required to protect against griefing the staking\\n /// contract and individual applications are allowed to require\\n /// higher minimum stakes if necessary.\\n /// @dev Staking providers are not required to maintain a minimum T stake\\n /// all the time. 24 hours after the delegation, T stake can be reduced\\n /// below the minimum stake. The minimum stake in the staking contract\\n /// is just to protect against griefing stake operation. Please note\\n /// that each application may have its own minimum authorization though\\n /// and the authorization can not be higher than the stake.\\n function setMinimumStakeAmount(uint96 amount)\\n external\\n override\\n onlyGovernance\\n {\\n minTStakeAmount = amount;\\n emit MinimumStakeAmountSet(amount);\\n }\\n\\n //\\n //\\n // Authorizing an application\\n //\\n //\\n\\n /// @notice Allows the Governance to approve the particular application\\n /// before individual stake authorizers are able to authorize it.\\n function approveApplication(address application)\\n external\\n override\\n onlyGovernance\\n {\\n require(application != address(0), \\\"Parameters must be specified\\\");\\n ApplicationInfo storage info = applicationInfo[application];\\n require(\\n info.status == ApplicationStatus.NOT_APPROVED ||\\n info.status == ApplicationStatus.PAUSED,\\n \\\"Can't approve application\\\"\\n );\\n\\n if (info.status == ApplicationStatus.NOT_APPROVED) {\\n applications.push(application);\\n }\\n info.status = ApplicationStatus.APPROVED;\\n emit ApplicationStatusChanged(application, ApplicationStatus.APPROVED);\\n }\\n\\n /// @notice Increases the authorization of the given staking provider for\\n /// the given application by the given amount. Can only be called by\\n /// the given staking provider\\u2019s authorizer.\\n /// @dev Calls `authorizationIncreased` callback on the given application to\\n /// notify the application about authorization change.\\n /// See `IApplication`.\\n function increaseAuthorization(\\n address stakingProvider,\\n address application,\\n uint96 amount\\n ) external override onlyAuthorizerOf(stakingProvider) {\\n require(amount > 0, \\\"Parameters must be specified\\\");\\n ApplicationInfo storage applicationStruct = applicationInfo[\\n application\\n ];\\n require(\\n applicationStruct.status == ApplicationStatus.APPROVED,\\n \\\"Application is not approved\\\"\\n );\\n\\n StakingProviderInfo storage stakingProviderStruct = stakingProviders[\\n stakingProvider\\n ];\\n AppAuthorization storage authorization = stakingProviderStruct\\n .authorizations[application];\\n uint96 fromAmount = authorization.authorized;\\n if (fromAmount == 0) {\\n require(\\n authorizationCeiling == 0 ||\\n stakingProviderStruct.authorizedApplications.length <\\n authorizationCeiling,\\n \\\"Too many applications\\\"\\n );\\n stakingProviderStruct.authorizedApplications.push(application);\\n }\\n\\n uint96 availableTValue = getAvailableToAuthorize(\\n stakingProvider,\\n application\\n );\\n require(availableTValue >= amount, \\\"Not enough stake to authorize\\\");\\n authorization.authorized += amount;\\n emit AuthorizationIncreased(\\n stakingProvider,\\n application,\\n fromAmount,\\n authorization.authorized\\n );\\n IApplication(application).authorizationIncreased(\\n stakingProvider,\\n fromAmount,\\n authorization.authorized\\n );\\n }\\n\\n /// @notice Requests decrease of all authorizations for the given staking\\n /// provider on all applications by all authorized amount.\\n /// It may not change the authorized amount immediatelly. When\\n /// it happens depends on the application. Can only be called by the\\n /// given staking provider\\u2019s authorizer. Overwrites pending\\n /// authorization decrease for the given staking provider and\\n /// application.\\n /// @dev Calls `authorizationDecreaseRequested` callback\\n /// for each authorized application. See `IApplication`.\\n function requestAuthorizationDecrease(address stakingProvider) external {\\n StakingProviderInfo storage stakingProviderStruct = stakingProviders[\\n stakingProvider\\n ];\\n uint96 deauthorizing = 0;\\n for (\\n uint256 i = 0;\\n i < stakingProviderStruct.authorizedApplications.length;\\n i++\\n ) {\\n address application = stakingProviderStruct.authorizedApplications[\\n i\\n ];\\n uint96 authorized = stakingProviderStruct\\n .authorizations[application]\\n .authorized;\\n if (authorized > 0) {\\n requestAuthorizationDecrease(\\n stakingProvider,\\n application,\\n authorized\\n );\\n deauthorizing += authorized;\\n }\\n }\\n\\n require(deauthorizing > 0, \\\"Nothing was authorized\\\");\\n }\\n\\n /// @notice Called by the application at its discretion to approve the\\n /// previously requested authorization decrease request. Can only be\\n /// called by the application that was previously requested to\\n /// decrease the authorization for that staking provider.\\n /// Returns resulting authorized amount for the application.\\n function approveAuthorizationDecrease(address stakingProvider)\\n external\\n override\\n returns (uint96)\\n {\\n ApplicationInfo storage applicationStruct = applicationInfo[msg.sender];\\n require(\\n applicationStruct.status == ApplicationStatus.APPROVED,\\n \\\"Application is not approved\\\"\\n );\\n\\n StakingProviderInfo storage stakingProviderStruct = stakingProviders[\\n stakingProvider\\n ];\\n AppAuthorization storage authorization = stakingProviderStruct\\n .authorizations[msg.sender];\\n require(authorization.deauthorizing > 0, \\\"No deauthorizing in process\\\");\\n\\n uint96 fromAmount = authorization.authorized;\\n authorization.authorized -= authorization.deauthorizing;\\n authorization.deauthorizing = 0;\\n emit AuthorizationDecreaseApproved(\\n stakingProvider,\\n msg.sender,\\n fromAmount,\\n authorization.authorized\\n );\\n\\n // remove application from an array\\n if (authorization.authorized == 0) {\\n cleanAuthorizedApplications(stakingProviderStruct, 1);\\n }\\n\\n return authorization.authorized;\\n }\\n\\n /// @notice Decreases the authorization for the given `stakingProvider` on\\n /// the given disabled `application`, for all authorized amount.\\n /// Can be called by anyone.\\n function forceDecreaseAuthorization(\\n address stakingProvider,\\n address application\\n ) external override {\\n require(\\n applicationInfo[application].status == ApplicationStatus.DISABLED,\\n \\\"Application is not disabled\\\"\\n );\\n\\n StakingProviderInfo storage stakingProviderStruct = stakingProviders[\\n stakingProvider\\n ];\\n AppAuthorization storage authorization = stakingProviderStruct\\n .authorizations[application];\\n uint96 fromAmount = authorization.authorized;\\n require(fromAmount > 0, \\\"Application is not authorized\\\");\\n authorization.authorized = 0;\\n authorization.deauthorizing = 0;\\n\\n emit AuthorizationDecreaseApproved(\\n stakingProvider,\\n application,\\n fromAmount,\\n 0\\n );\\n cleanAuthorizedApplications(stakingProviderStruct, 1);\\n }\\n\\n /// @notice Pauses the given application\\u2019s eligibility to slash stakes.\\n /// Besides that stakers can't change authorization to the application.\\n /// Can be called only by the Panic Button of the particular\\n /// application. The paused application can not slash stakes until\\n /// it is approved again by the Governance using `approveApplication`\\n /// function. Should be used only in case of an emergency.\\n function pauseApplication(address application)\\n external\\n override\\n onlyPanicButtonOf(application)\\n {\\n ApplicationInfo storage applicationStruct = applicationInfo[\\n application\\n ];\\n require(\\n applicationStruct.status == ApplicationStatus.APPROVED,\\n \\\"Can't pause application\\\"\\n );\\n applicationStruct.status = ApplicationStatus.PAUSED;\\n emit ApplicationStatusChanged(application, ApplicationStatus.PAUSED);\\n }\\n\\n /// @notice Disables the given application. The disabled application can't\\n /// slash stakers. Also stakers can't increase authorization to that\\n /// application but can decrease without waiting by calling\\n /// `forceDecreaseAuthorization` at any moment. Can be called only\\n /// by the governance. The disabled application can't be approved\\n /// again. Should be used only in case of an emergency.\\n function disableApplication(address application)\\n external\\n override\\n onlyGovernance\\n {\\n ApplicationInfo storage applicationStruct = applicationInfo[\\n application\\n ];\\n require(\\n applicationStruct.status == ApplicationStatus.APPROVED ||\\n applicationStruct.status == ApplicationStatus.PAUSED,\\n \\\"Can't disable application\\\"\\n );\\n applicationStruct.status = ApplicationStatus.DISABLED;\\n emit ApplicationStatusChanged(application, ApplicationStatus.DISABLED);\\n }\\n\\n /// @notice Sets the Panic Button role for the given application to the\\n /// provided address. Can only be called by the Governance. If the\\n /// Panic Button for the given application should be disabled, the\\n /// role address should be set to 0x0 address.\\n function setPanicButton(address application, address panicButton)\\n external\\n override\\n onlyGovernance\\n {\\n ApplicationInfo storage applicationStruct = applicationInfo[\\n application\\n ];\\n require(\\n applicationStruct.status == ApplicationStatus.APPROVED,\\n \\\"Application is not approved\\\"\\n );\\n applicationStruct.panicButton = panicButton;\\n emit PanicButtonSet(application, panicButton);\\n }\\n\\n /// @notice Sets the maximum number of applications one staking provider can\\n /// have authorized. Used to protect against DoSing slashing queue.\\n /// Can only be called by the Governance.\\n function setAuthorizationCeiling(uint256 ceiling)\\n external\\n override\\n onlyGovernance\\n {\\n authorizationCeiling = ceiling;\\n emit AuthorizationCeilingSet(ceiling);\\n }\\n\\n //\\n //\\n // Stake top-up\\n //\\n //\\n\\n /// @notice Increases the amount of the stake for the given staking provider.\\n /// @dev The sender of this transaction needs to have the amount approved to\\n /// transfer to the staking contract.\\n function topUp(address stakingProvider, uint96 amount) external override {\\n require(\\n stakingProviders[stakingProvider].owner != address(0),\\n \\\"Nothing to top-up\\\"\\n );\\n require(amount > 0, \\\"Parameters must be specified\\\");\\n StakingProviderInfo storage stakingProviderStruct = stakingProviders[\\n stakingProvider\\n ];\\n stakingProviderStruct.tStake += amount;\\n emit ToppedUp(stakingProvider, amount);\\n increaseStakeCheckpoint(stakingProvider, amount);\\n token.safeTransferFrom(msg.sender, address(this), amount);\\n }\\n\\n /// @notice Propagates information about stake top-up from the legacy KEEP\\n /// staking contract to T staking contract. Can be called only by\\n /// the owner or the staking provider.\\n function topUpKeep(address stakingProvider)\\n external\\n override\\n onlyOwnerOrStakingProvider(stakingProvider)\\n {\\n StakingProviderInfo storage stakingProviderStruct = stakingProviders[\\n stakingProvider\\n ];\\n uint96 tAmount = getKeepAmountInT(stakingProvider);\\n require(\\n tAmount > stakingProviderStruct.keepInTStake,\\n \\\"Nothing to top-up\\\"\\n );\\n\\n uint96 toppedUp = tAmount - stakingProviderStruct.keepInTStake;\\n emit ToppedUp(stakingProvider, toppedUp);\\n stakingProviderStruct.keepInTStake = tAmount;\\n increaseStakeCheckpoint(stakingProvider, toppedUp);\\n }\\n\\n /// @notice Propagates information about stake top-up from the legacy NU\\n /// staking contract to T staking contract. Can be called only by\\n /// the owner or the staking provider.\\n function topUpNu(address stakingProvider)\\n external\\n override\\n onlyOwnerOf(stakingProvider)\\n {\\n StakingProviderInfo storage stakingProviderStruct = stakingProviders[\\n stakingProvider\\n ];\\n uint96 tAmount = getNuAmountInT(\\n stakingProviderStruct.owner,\\n stakingProvider\\n );\\n require(\\n tAmount > stakingProviderStruct.nuInTStake,\\n \\\"Nothing to top-up\\\"\\n );\\n\\n uint96 toppedUp = tAmount - stakingProviderStruct.nuInTStake;\\n emit ToppedUp(stakingProvider, toppedUp);\\n stakingProviderStruct.nuInTStake = tAmount;\\n increaseStakeCheckpoint(stakingProvider, toppedUp);\\n }\\n\\n //\\n //\\n // Undelegating a stake (unstaking)\\n //\\n //\\n\\n /// @notice Reduces the liquid T stake amount by the provided amount and\\n /// withdraws T to the owner. Reverts if there is at least one\\n /// authorization higher than the sum of the legacy stake and\\n /// remaining liquid T stake or if the unstake amount is higher than\\n /// the liquid T stake amount. Can be called only by the owner or\\n /// the staking provider. Can only be called when 24h passed since\\n /// the stake has been delegated.\\n function unstakeT(address stakingProvider, uint96 amount)\\n external\\n override\\n onlyOwnerOrStakingProvider(stakingProvider)\\n {\\n StakingProviderInfo storage stakingProviderStruct = stakingProviders[\\n stakingProvider\\n ];\\n require(\\n amount > 0 &&\\n amount + getMinStaked(stakingProvider, StakeType.T) <=\\n stakingProviderStruct.tStake,\\n \\\"Too much to unstake\\\"\\n );\\n require(\\n stakingProviderStruct.startStakingTimestamp + MIN_STAKE_TIME <=\\n /* solhint-disable-next-line not-rely-on-time */\\n block.timestamp,\\n \\\"Can't unstake earlier than 24h\\\"\\n );\\n\\n stakingProviderStruct.tStake -= amount;\\n decreaseStakeCheckpoint(stakingProvider, amount);\\n emit Unstaked(stakingProvider, amount);\\n token.safeTransfer(stakingProviderStruct.owner, amount);\\n }\\n\\n /// @notice Sets the legacy KEEP staking contract active stake amount cached\\n /// in T staking contract to 0. Reverts if the amount of liquid T\\n /// staked in T staking contract is lower than the highest\\n /// application authorization. This function allows to unstake from\\n /// KEEP staking contract and still being able to operate in T\\n /// network and earning rewards based on the liquid T staked. Can be\\n /// called only by the delegation owner or the staking provider.\\n /// Can only be called when 24h passed since the stake has been\\n /// delegated.\\n /// @dev This function (or `unstakeAll`) must be called before\\n /// `undelegate`/`undelegateAt` in Keep staking contract. Otherwise\\n /// provider can be slashed by `notifyKeepStakeDiscrepancy` method.\\n function unstakeKeep(address stakingProvider)\\n external\\n override\\n onlyOwnerOrStakingProvider(stakingProvider)\\n {\\n StakingProviderInfo storage stakingProviderStruct = stakingProviders[\\n stakingProvider\\n ];\\n uint96 keepInTStake = stakingProviderStruct.keepInTStake;\\n require(keepInTStake != 0, \\\"Nothing to unstake\\\");\\n require(\\n getMinStaked(stakingProvider, StakeType.KEEP) == 0,\\n \\\"Keep stake still authorized\\\"\\n );\\n require(\\n stakingProviderStruct.startStakingTimestamp + MIN_STAKE_TIME <=\\n /* solhint-disable-next-line not-rely-on-time */\\n block.timestamp,\\n \\\"Can't unstake earlier than 24h\\\"\\n );\\n\\n emit Unstaked(stakingProvider, keepInTStake);\\n stakingProviderStruct.keepInTStake = 0;\\n decreaseStakeCheckpoint(stakingProvider, keepInTStake);\\n }\\n\\n /// @notice Reduces cached legacy NU stake amount by the provided amount.\\n /// Reverts if there is at least one authorization higher than the\\n /// sum of remaining legacy NU stake and liquid T stake for that\\n /// staking provider or if the untaked amount is higher than the\\n /// cached legacy stake amount. If succeeded, the legacy NU stake\\n /// can be partially or fully undelegated on the legacy staking\\n /// contract. This function allows to unstake from NU staking\\n /// contract and still being able to operate in T network and\\n /// earning rewards based on the liquid T staked. Can be called only\\n /// by the delegation owner or the staking provider. Can only be\\n /// called when 24h passed since the stake has been delegated.\\n /// @dev This function (or `unstakeAll`) must be called before `withdraw`\\n /// in NuCypher staking contract. Otherwise NU tokens can't be\\n /// unlocked.\\n /// @param stakingProvider Staking provider address\\n /// @param amount Amount of NU to unstake in T denomination\\n function unstakeNu(address stakingProvider, uint96 amount)\\n external\\n override\\n onlyOwnerOrStakingProvider(stakingProvider)\\n {\\n StakingProviderInfo storage stakingProviderStruct = stakingProviders[\\n stakingProvider\\n ];\\n // rounding amount to guarantee exact T<>NU conversion in both ways,\\n // so there's no remainder after unstaking\\n (, uint96 tRemainder) = convertFromT(amount, nucypherRatio);\\n amount -= tRemainder;\\n require(\\n amount > 0 &&\\n amount + getMinStaked(stakingProvider, StakeType.NU) <=\\n stakingProviderStruct.nuInTStake,\\n \\\"Too much to unstake\\\"\\n );\\n require(\\n stakingProviderStruct.startStakingTimestamp + MIN_STAKE_TIME <=\\n /* solhint-disable-next-line not-rely-on-time */\\n block.timestamp,\\n \\\"Can't unstake earlier than 24h\\\"\\n );\\n\\n stakingProviderStruct.nuInTStake -= amount;\\n decreaseStakeCheckpoint(stakingProvider, amount);\\n emit Unstaked(stakingProvider, amount);\\n }\\n\\n /// @notice Sets cached legacy stake amount to 0, sets the liquid T stake\\n /// amount to 0 and withdraws all liquid T from the stake to the\\n /// owner. Reverts if there is at least one non-zero authorization.\\n /// Can be called only by the delegation owner or the staking\\n /// provider. Can only be called when 24h passed since the stake\\n /// has been delegated.\\n function unstakeAll(address stakingProvider)\\n external\\n override\\n onlyOwnerOrStakingProvider(stakingProvider)\\n {\\n StakingProviderInfo storage stakingProviderStruct = stakingProviders[\\n stakingProvider\\n ];\\n require(\\n stakingProviderStruct.authorizedApplications.length == 0,\\n \\\"Stake still authorized\\\"\\n );\\n require(\\n stakingProviderStruct.startStakingTimestamp + MIN_STAKE_TIME <=\\n /* solhint-disable-next-line not-rely-on-time */\\n block.timestamp,\\n \\\"Can't unstake earlier than 24h\\\"\\n );\\n\\n uint96 unstaked = stakingProviderStruct.tStake +\\n stakingProviderStruct.keepInTStake +\\n stakingProviderStruct.nuInTStake;\\n emit Unstaked(stakingProvider, unstaked);\\n uint96 amount = stakingProviderStruct.tStake;\\n stakingProviderStruct.tStake = 0;\\n stakingProviderStruct.keepInTStake = 0;\\n stakingProviderStruct.nuInTStake = 0;\\n decreaseStakeCheckpoint(stakingProvider, unstaked);\\n\\n if (amount > 0) {\\n token.safeTransfer(stakingProviderStruct.owner, amount);\\n }\\n }\\n\\n //\\n //\\n // Keeping information in sync\\n //\\n //\\n\\n /// @notice Notifies about the discrepancy between legacy KEEP active stake\\n /// and the amount cached in T staking contract. Slashes the staking\\n /// provider in case the amount cached is higher than the actual\\n /// active stake amount in KEEP staking contract. Needs to update\\n /// authorizations of all affected applications and execute an\\n /// involuntary authorization decrease on all affected applications.\\n /// Can be called by anyone, notifier receives a reward.\\n function notifyKeepStakeDiscrepancy(address stakingProvider)\\n external\\n override\\n {\\n StakingProviderInfo storage stakingProviderStruct = stakingProviders[\\n stakingProvider\\n ];\\n require(stakingProviderStruct.keepInTStake > 0, \\\"Nothing to slash\\\");\\n\\n (uint256 keepStakeAmount, , uint256 undelegatedAt) = keepStakingContract\\n .getDelegationInfo(stakingProvider);\\n\\n (uint96 realKeepInTStake, ) = convertToT(keepStakeAmount, keepRatio);\\n uint96 oldKeepInTStake = stakingProviderStruct.keepInTStake;\\n\\n require(\\n oldKeepInTStake > realKeepInTStake || undelegatedAt != 0,\\n \\\"There is no discrepancy\\\"\\n );\\n stakingProviderStruct.keepInTStake = realKeepInTStake;\\n seizeKeep(\\n stakingProviderStruct,\\n stakingProvider,\\n stakeDiscrepancyPenalty,\\n stakeDiscrepancyRewardMultiplier\\n );\\n\\n uint96 slashedAmount = realKeepInTStake -\\n stakingProviderStruct.keepInTStake;\\n emit TokensSeized(stakingProvider, slashedAmount, true);\\n if (undelegatedAt != 0) {\\n stakingProviderStruct.keepInTStake = 0;\\n }\\n\\n decreaseStakeCheckpoint(\\n stakingProvider,\\n oldKeepInTStake - stakingProviderStruct.keepInTStake\\n );\\n\\n authorizationDecrease(\\n stakingProvider,\\n stakingProviderStruct,\\n slashedAmount\\n );\\n }\\n\\n /// @notice Notifies about the discrepancy between legacy NU active stake\\n /// and the amount cached in T staking contract. Slashes the\\n /// staking provider in case the amount cached is higher than the\\n /// actual active stake amount in NU staking contract. Needs to\\n /// update authorizations of all affected applications and execute an\\n /// involuntary authorization decrease on all affected applications.\\n /// Can be called by anyone, notifier receives a reward.\\n /// @dev Real discrepancy between T and Nu is impossible.\\n /// This method is a safeguard in case of bugs in NuCypher staking\\n /// contract\\n function notifyNuStakeDiscrepancy(address stakingProvider)\\n external\\n override\\n {\\n StakingProviderInfo storage stakingProviderStruct = stakingProviders[\\n stakingProvider\\n ];\\n require(stakingProviderStruct.nuInTStake > 0, \\\"Nothing to slash\\\");\\n\\n uint256 nuStakeAmount = nucypherStakingContract.getAllTokens(\\n stakingProviderStruct.owner\\n );\\n (uint96 realNuInTStake, ) = convertToT(nuStakeAmount, nucypherRatio);\\n uint96 oldNuInTStake = stakingProviderStruct.nuInTStake;\\n require(oldNuInTStake > realNuInTStake, \\\"There is no discrepancy\\\");\\n\\n stakingProviderStruct.nuInTStake = realNuInTStake;\\n seizeNu(\\n stakingProviderStruct,\\n stakeDiscrepancyPenalty,\\n stakeDiscrepancyRewardMultiplier\\n );\\n\\n uint96 slashedAmount = realNuInTStake -\\n stakingProviderStruct.nuInTStake;\\n emit TokensSeized(stakingProvider, slashedAmount, true);\\n authorizationDecrease(\\n stakingProvider,\\n stakingProviderStruct,\\n slashedAmount\\n );\\n decreaseStakeCheckpoint(\\n stakingProvider,\\n oldNuInTStake - stakingProviderStruct.nuInTStake\\n );\\n }\\n\\n /// @notice Sets the penalty amount for stake discrepancy and reward\\n /// multiplier for reporting it. The penalty is seized from the\\n /// delegated stake, and 5% of the penalty, scaled by the\\n /// multiplier, is given to the notifier. The rest of the tokens are\\n /// burned. Can only be called by the Governance. See `seize` function.\\n function setStakeDiscrepancyPenalty(\\n uint96 penalty,\\n uint256 rewardMultiplier\\n ) external override onlyGovernance {\\n stakeDiscrepancyPenalty = penalty;\\n stakeDiscrepancyRewardMultiplier = rewardMultiplier;\\n emit StakeDiscrepancyPenaltySet(penalty, rewardMultiplier);\\n }\\n\\n /// @notice Sets reward in T tokens for notification of misbehaviour\\n /// of one staking provider. Can only be called by the governance.\\n function setNotificationReward(uint96 reward)\\n external\\n override\\n onlyGovernance\\n {\\n notificationReward = reward;\\n emit NotificationRewardSet(reward);\\n }\\n\\n /// @notice Transfer some amount of T tokens as reward for notifications\\n /// of misbehaviour\\n function pushNotificationReward(uint96 reward) external override {\\n require(reward > 0, \\\"Parameters must be specified\\\");\\n notifiersTreasury += reward;\\n emit NotificationRewardPushed(reward);\\n token.safeTransferFrom(msg.sender, address(this), reward);\\n }\\n\\n /// @notice Withdraw some amount of T tokens from notifiers treasury.\\n /// Can only be called by the governance.\\n function withdrawNotificationReward(address recipient, uint96 amount)\\n external\\n override\\n onlyGovernance\\n {\\n require(amount <= notifiersTreasury, \\\"Not enough tokens\\\");\\n notifiersTreasury -= amount;\\n emit NotificationRewardWithdrawn(recipient, amount);\\n token.safeTransfer(recipient, amount);\\n }\\n\\n /// @notice Adds staking providers to the slashing queue along with the\\n /// amount that should be slashed from each one of them. Can only be\\n /// called by application authorized for all staking providers in\\n /// the array.\\n /// @dev This method doesn't emit events for providers that are added to\\n /// the queue. If necessary events can be added to the application\\n /// level.\\n function slash(uint96 amount, address[] memory _stakingProviders)\\n external\\n override\\n {\\n notify(amount, 0, address(0), _stakingProviders);\\n }\\n\\n /// @notice Adds staking providers to the slashing queue along with the\\n /// amount. The notifier will receive reward per each provider from\\n /// notifiers treasury. Can only be called by application\\n /// authorized for all staking providers in the array.\\n /// @dev This method doesn't emit events for staking providers that are\\n /// added to the queue. If necessary events can be added to the\\n /// application level.\\n function seize(\\n uint96 amount,\\n uint256 rewardMultiplier,\\n address notifier,\\n address[] memory _stakingProviders\\n ) external override {\\n notify(amount, rewardMultiplier, notifier, _stakingProviders);\\n }\\n\\n /// @notice Takes the given number of queued slashing operations and\\n /// processes them. Receives 5% of the slashed amount.\\n /// Executes `involuntaryAuthorizationDecrease` function on each\\n /// affected application.\\n function processSlashing(uint256 count) external virtual override {\\n require(\\n slashingQueueIndex < slashingQueue.length && count > 0,\\n \\\"Nothing to process\\\"\\n );\\n\\n uint256 maxIndex = slashingQueueIndex + count;\\n maxIndex = MathUpgradeable.min(maxIndex, slashingQueue.length);\\n count = maxIndex - slashingQueueIndex;\\n uint96 tAmountToBurn = 0;\\n\\n uint256 index = slashingQueueIndex;\\n for (; index < maxIndex; index++) {\\n SlashingEvent storage slashing = slashingQueue[index];\\n tAmountToBurn += processSlashing(slashing);\\n }\\n slashingQueueIndex = index;\\n\\n uint256 tProcessorReward = uint256(tAmountToBurn).percent(\\n SLASHING_REWARD_PERCENT\\n );\\n notifiersTreasury += tAmountToBurn - tProcessorReward.toUint96();\\n emit SlashingProcessed(msg.sender, count, tProcessorReward);\\n if (tProcessorReward > 0) {\\n token.safeTransfer(msg.sender, tProcessorReward);\\n }\\n }\\n\\n /// @notice Delegate voting power from the stake associated to the\\n /// `stakingProvider` to a `delegatee` address. Caller must be the\\n /// owner of this stake.\\n function delegateVoting(address stakingProvider, address delegatee)\\n external\\n {\\n delegate(stakingProvider, delegatee);\\n }\\n\\n /// @notice Transfers ownership of the contract to `newGuvnor`.\\n function transferGovernance(address newGuvnor)\\n external\\n virtual\\n onlyGovernance\\n {\\n _transferGovernance(newGuvnor);\\n }\\n\\n //\\n //\\n // Auxiliary functions\\n //\\n //\\n\\n /// @notice Returns the authorized stake amount of the staking provider for\\n /// the application.\\n function authorizedStake(address stakingProvider, address application)\\n external\\n view\\n override\\n returns (uint96)\\n {\\n return\\n stakingProviders[stakingProvider]\\n .authorizations[application]\\n .authorized;\\n }\\n\\n /// @notice Returns staked amount of T, Keep and Nu for the specified\\n /// staking provider.\\n /// @dev All values are in T denomination\\n function stakes(address stakingProvider)\\n external\\n view\\n override\\n returns (\\n uint96 tStake,\\n uint96 keepInTStake,\\n uint96 nuInTStake\\n )\\n {\\n StakingProviderInfo storage stakingProviderStruct = stakingProviders[\\n stakingProvider\\n ];\\n tStake = stakingProviderStruct.tStake;\\n keepInTStake = stakingProviderStruct.keepInTStake;\\n nuInTStake = stakingProviderStruct.nuInTStake;\\n }\\n\\n /// @notice Returns start staking timestamp.\\n /// @dev This value is set at most once.\\n function getStartStakingTimestamp(address stakingProvider)\\n external\\n view\\n override\\n returns (uint256)\\n {\\n return stakingProviders[stakingProvider].startStakingTimestamp;\\n }\\n\\n /// @notice Returns staked amount of NU for the specified staking provider.\\n function stakedNu(address stakingProvider)\\n external\\n view\\n override\\n returns (uint256 nuAmount)\\n {\\n (nuAmount, ) = convertFromT(\\n stakingProviders[stakingProvider].nuInTStake,\\n nucypherRatio\\n );\\n }\\n\\n /// @notice Gets the stake owner, the beneficiary and the authorizer\\n /// for the specified staking provider address.\\n /// @return owner Stake owner address.\\n /// @return beneficiary Beneficiary address.\\n /// @return authorizer Authorizer address.\\n function rolesOf(address stakingProvider)\\n external\\n view\\n override\\n returns (\\n address owner,\\n address payable beneficiary,\\n address authorizer\\n )\\n {\\n StakingProviderInfo storage stakingProviderStruct = stakingProviders[\\n stakingProvider\\n ];\\n owner = stakingProviderStruct.owner;\\n beneficiary = stakingProviderStruct.beneficiary;\\n authorizer = stakingProviderStruct.authorizer;\\n }\\n\\n /// @notice Returns length of application array\\n function getApplicationsLength() external view override returns (uint256) {\\n return applications.length;\\n }\\n\\n /// @notice Returns length of slashing queue\\n function getSlashingQueueLength() external view override returns (uint256) {\\n return slashingQueue.length;\\n }\\n\\n /// @notice Requests decrease of the authorization for the given staking\\n /// provider on the given application by the provided amount.\\n /// It may not change the authorized amount immediatelly. When\\n /// it happens depends on the application. Can only be called by the\\n /// given staking provider\\u2019s authorizer. Overwrites pending\\n /// authorization decrease for the given staking provider and\\n /// application if the application agrees for that. If the\\n /// application does not agree for overwriting, the function\\n /// reverts.\\n /// @dev Calls `authorizationDecreaseRequested` callback on the given\\n /// application. See `IApplication`.\\n function requestAuthorizationDecrease(\\n address stakingProvider,\\n address application,\\n uint96 amount\\n ) public override onlyAuthorizerOf(stakingProvider) {\\n ApplicationInfo storage applicationStruct = applicationInfo[\\n application\\n ];\\n require(\\n applicationStruct.status == ApplicationStatus.APPROVED,\\n \\\"Application is not approved\\\"\\n );\\n\\n require(amount > 0, \\\"Parameters must be specified\\\");\\n\\n AppAuthorization storage authorization = stakingProviders[\\n stakingProvider\\n ].authorizations[application];\\n require(\\n authorization.authorized >= amount,\\n \\\"Amount exceeds authorized\\\"\\n );\\n\\n authorization.deauthorizing = amount;\\n uint96 deauthorizingTo = authorization.authorized - amount;\\n emit AuthorizationDecreaseRequested(\\n stakingProvider,\\n application,\\n authorization.authorized,\\n deauthorizingTo\\n );\\n IApplication(application).authorizationDecreaseRequested(\\n stakingProvider,\\n authorization.authorized,\\n deauthorizingTo\\n );\\n }\\n\\n /// @notice Returns minimum possible stake for T, KEEP or NU in T denomination\\n /// @dev For example, suppose the given staking provider has 10 T, 20 T worth\\n /// of KEEP, and 30 T worth of NU all staked, and the maximum\\n /// application authorization is 40 T, then `getMinStaked` for\\n /// that staking provider returns:\\n /// * 0 T if KEEP stake type specified i.e.\\n /// min = 40 T max - (10 T + 30 T worth of NU) = 0 T\\n /// * 10 T if NU stake type specified i.e.\\n /// min = 40 T max - (10 T + 20 T worth of KEEP) = 10 T\\n /// * 0 T if T stake type specified i.e.\\n /// min = 40 T max - (20 T worth of KEEP + 30 T worth of NU) < 0 T\\n /// In other words, the minimum stake amount for the specified\\n /// stake type is the minimum amount of stake of the given type\\n /// needed to satisfy the maximum application authorization given\\n /// the staked amounts of the other stake types for that staking\\n /// provider.\\n function getMinStaked(address stakingProvider, StakeType stakeTypes)\\n public\\n view\\n override\\n returns (uint96)\\n {\\n StakingProviderInfo storage stakingProviderStruct = stakingProviders[\\n stakingProvider\\n ];\\n uint256 maxAuthorization = 0;\\n for (\\n uint256 i = 0;\\n i < stakingProviderStruct.authorizedApplications.length;\\n i++\\n ) {\\n address application = stakingProviderStruct.authorizedApplications[\\n i\\n ];\\n maxAuthorization = MathUpgradeable.max(\\n maxAuthorization,\\n stakingProviderStruct.authorizations[application].authorized\\n );\\n }\\n\\n if (maxAuthorization == 0) {\\n return 0;\\n }\\n if (stakeTypes != StakeType.T) {\\n maxAuthorization -= MathUpgradeable.min(\\n maxAuthorization,\\n stakingProviderStruct.tStake\\n );\\n }\\n if (stakeTypes != StakeType.NU) {\\n maxAuthorization -= MathUpgradeable.min(\\n maxAuthorization,\\n stakingProviderStruct.nuInTStake\\n );\\n }\\n if (stakeTypes != StakeType.KEEP) {\\n maxAuthorization -= MathUpgradeable.min(\\n maxAuthorization,\\n stakingProviderStruct.keepInTStake\\n );\\n }\\n return maxAuthorization.toUint96();\\n }\\n\\n /// @notice Returns available amount to authorize for the specified\\n /// application.\\n function getAvailableToAuthorize(\\n address stakingProvider,\\n address application\\n ) public view override returns (uint96 availableTValue) {\\n StakingProviderInfo storage stakingProviderStruct = stakingProviders[\\n stakingProvider\\n ];\\n availableTValue =\\n stakingProviderStruct.tStake +\\n stakingProviderStruct.keepInTStake +\\n stakingProviderStruct.nuInTStake;\\n availableTValue -= stakingProviderStruct\\n .authorizations[application]\\n .authorized;\\n }\\n\\n /// @notice Delegate voting power from the stake associated to the\\n /// `stakingProvider` to a `delegatee` address. Caller must be the owner\\n /// of this stake.\\n /// @dev Original abstract function defined in Checkpoints contract had two\\n /// parameters, `delegator` and `delegatee`. Here we override it and\\n /// comply with the same signature but the semantics of the first\\n /// parameter changes to the `stakingProvider` address.\\n function delegate(address stakingProvider, address delegatee)\\n internal\\n virtual\\n override\\n onlyOwnerOf(stakingProvider)\\n {\\n StakingProviderInfo storage stakingProviderStruct = stakingProviders[\\n stakingProvider\\n ];\\n uint96 stakingProviderBalance = stakingProviderStruct.tStake +\\n stakingProviderStruct.keepInTStake +\\n stakingProviderStruct.nuInTStake;\\n address oldDelegatee = delegates(stakingProvider);\\n _delegates[stakingProvider] = delegatee;\\n emit DelegateChanged(stakingProvider, oldDelegatee, delegatee);\\n moveVotingPower(oldDelegatee, delegatee, stakingProviderBalance);\\n }\\n\\n /// @notice Adds staking providers to the slashing queue along with the\\n /// amount. The notifier will receive reward per each staking\\n /// provider from notifiers treasury. Can only be called by\\n /// application authorized for all staking providers in the array.\\n function notify(\\n uint96 amount,\\n uint256 rewardMultiplier,\\n address notifier,\\n address[] memory _stakingProviders\\n ) internal {\\n require(\\n amount > 0 && _stakingProviders.length > 0,\\n \\\"Parameters must be specified\\\"\\n );\\n\\n ApplicationInfo storage applicationStruct = applicationInfo[msg.sender];\\n require(\\n applicationStruct.status == ApplicationStatus.APPROVED,\\n \\\"Application is not approved\\\"\\n );\\n\\n uint256 queueLength = slashingQueue.length;\\n for (uint256 i = 0; i < _stakingProviders.length; i++) {\\n address stakingProvider = _stakingProviders[i];\\n uint256 amountToSlash = MathUpgradeable.min(\\n stakingProviders[stakingProvider]\\n .authorizations[msg.sender]\\n .authorized,\\n amount\\n );\\n if (\\n //slither-disable-next-line incorrect-equality\\n amountToSlash == 0\\n ) {\\n continue;\\n }\\n slashingQueue.push(\\n SlashingEvent(stakingProvider, amountToSlash.toUint96())\\n );\\n }\\n\\n if (notifier != address(0)) {\\n uint256 reward = ((slashingQueue.length - queueLength) *\\n notificationReward).percent(rewardMultiplier);\\n reward = MathUpgradeable.min(reward, notifiersTreasury);\\n emit NotifierRewarded(notifier, reward);\\n if (reward != 0) {\\n notifiersTreasury -= reward;\\n token.safeTransfer(notifier, reward);\\n }\\n }\\n }\\n\\n /// @notice Processes one specified slashing event.\\n /// Executes `involuntaryAuthorizationDecrease` function on each\\n /// affected application.\\n //slither-disable-next-line dead-code\\n function processSlashing(SlashingEvent storage slashing)\\n internal\\n returns (uint96 tAmountToBurn)\\n {\\n StakingProviderInfo storage stakingProviderStruct = stakingProviders[\\n slashing.stakingProvider\\n ];\\n uint96 tAmountToSlash = slashing.amount;\\n uint96 oldStake = stakingProviderStruct.tStake +\\n stakingProviderStruct.keepInTStake +\\n stakingProviderStruct.nuInTStake;\\n // slash T\\n if (stakingProviderStruct.tStake > 0) {\\n if (tAmountToSlash <= stakingProviderStruct.tStake) {\\n tAmountToBurn = tAmountToSlash;\\n } else {\\n tAmountToBurn = stakingProviderStruct.tStake;\\n }\\n stakingProviderStruct.tStake -= tAmountToBurn;\\n tAmountToSlash -= tAmountToBurn;\\n }\\n\\n // slash KEEP\\n if (tAmountToSlash > 0 && stakingProviderStruct.keepInTStake > 0) {\\n (uint256 keepStakeAmount, , ) = keepStakingContract\\n .getDelegationInfo(slashing.stakingProvider);\\n (uint96 tAmount, ) = convertToT(keepStakeAmount, keepRatio);\\n stakingProviderStruct.keepInTStake = tAmount;\\n\\n tAmountToSlash = seizeKeep(\\n stakingProviderStruct,\\n slashing.stakingProvider,\\n tAmountToSlash,\\n 100\\n );\\n }\\n\\n // slash NU\\n if (tAmountToSlash > 0 && stakingProviderStruct.nuInTStake > 0) {\\n // synchronization skipped due to impossibility of real discrepancy\\n tAmountToSlash = seizeNu(\\n stakingProviderStruct,\\n tAmountToSlash,\\n 100\\n );\\n }\\n\\n uint96 slashedAmount = slashing.amount - tAmountToSlash;\\n emit TokensSeized(slashing.stakingProvider, slashedAmount, false);\\n authorizationDecrease(\\n slashing.stakingProvider,\\n stakingProviderStruct,\\n slashedAmount\\n );\\n uint96 newStake = stakingProviderStruct.tStake +\\n stakingProviderStruct.keepInTStake +\\n stakingProviderStruct.nuInTStake;\\n decreaseStakeCheckpoint(slashing.stakingProvider, oldStake - newStake);\\n }\\n\\n /// @notice Synchronize authorizations (if needed) after slashing stake\\n function authorizationDecrease(\\n address stakingProvider,\\n StakingProviderInfo storage stakingProviderStruct,\\n uint96 slashedAmount\\n ) internal {\\n uint96 totalStake = stakingProviderStruct.tStake +\\n stakingProviderStruct.nuInTStake +\\n stakingProviderStruct.keepInTStake;\\n uint256 applicationsToDelete = 0;\\n for (\\n uint256 i = 0;\\n i < stakingProviderStruct.authorizedApplications.length;\\n i++\\n ) {\\n address authorizedApplication = stakingProviderStruct\\n .authorizedApplications[i];\\n AppAuthorization storage authorization = stakingProviderStruct\\n .authorizations[authorizedApplication];\\n uint96 fromAmount = authorization.authorized;\\n\\n authorization.authorized -= MathUpgradeable\\n .min(fromAmount, slashedAmount)\\n .toUint96();\\n\\n if (authorization.authorized > totalStake) {\\n authorization.authorized = totalStake;\\n }\\n\\n bool successful = true;\\n //slither-disable-next-line calls-loop\\n try\\n IApplication(authorizedApplication)\\n .involuntaryAuthorizationDecrease{\\n gas: GAS_LIMIT_AUTHORIZATION_DECREASE\\n }(stakingProvider, fromAmount, authorization.authorized)\\n {} catch {\\n successful = false;\\n }\\n if (authorization.deauthorizing > authorization.authorized) {\\n authorization.deauthorizing = authorization.authorized;\\n }\\n emit AuthorizationInvoluntaryDecreased(\\n stakingProvider,\\n authorizedApplication,\\n fromAmount,\\n authorization.authorized,\\n successful\\n );\\n if (authorization.authorized == 0) {\\n applicationsToDelete++;\\n }\\n }\\n if (applicationsToDelete > 0) {\\n cleanAuthorizedApplications(\\n stakingProviderStruct,\\n applicationsToDelete\\n );\\n }\\n }\\n\\n /// @notice Convert amount from T to Keep and call `seize` in Keep staking contract.\\n /// Returns remainder of slashing amount in T\\n /// @dev Note this internal function doesn't update stake checkpoints\\n function seizeKeep(\\n StakingProviderInfo storage stakingProviderStruct,\\n address stakingProvider,\\n uint96 tAmountToSlash,\\n uint256 rewardMultiplier\\n ) internal returns (uint96) {\\n if (stakingProviderStruct.keepInTStake == 0) {\\n return tAmountToSlash;\\n }\\n\\n uint96 tPenalty;\\n if (tAmountToSlash <= stakingProviderStruct.keepInTStake) {\\n tPenalty = tAmountToSlash;\\n } else {\\n tPenalty = stakingProviderStruct.keepInTStake;\\n }\\n\\n (uint256 keepPenalty, uint96 tRemainder) = convertFromT(\\n tPenalty,\\n keepRatio\\n );\\n if (keepPenalty == 0) {\\n return tAmountToSlash;\\n }\\n tPenalty -= tRemainder;\\n stakingProviderStruct.keepInTStake -= tPenalty;\\n tAmountToSlash -= tPenalty;\\n\\n address[] memory stakingProviderWrapper = new address[](1);\\n stakingProviderWrapper[0] = stakingProvider;\\n keepStakingContract.seize(\\n keepPenalty,\\n rewardMultiplier,\\n msg.sender,\\n stakingProviderWrapper\\n );\\n return tAmountToSlash;\\n }\\n\\n /// @notice Convert amount from T to NU and call `slashStaker` in NuCypher staking contract.\\n /// Returns remainder of slashing amount in T\\n /// @dev Note this internal function doesn't update the stake checkpoints\\n function seizeNu(\\n StakingProviderInfo storage stakingProviderStruct,\\n uint96 tAmountToSlash,\\n uint256 rewardMultiplier\\n ) internal returns (uint96) {\\n if (stakingProviderStruct.nuInTStake == 0) {\\n return tAmountToSlash;\\n }\\n\\n uint96 tPenalty;\\n if (tAmountToSlash <= stakingProviderStruct.nuInTStake) {\\n tPenalty = tAmountToSlash;\\n } else {\\n tPenalty = stakingProviderStruct.nuInTStake;\\n }\\n\\n (uint256 nuPenalty, uint96 tRemainder) = convertFromT(\\n tPenalty,\\n nucypherRatio\\n );\\n if (nuPenalty == 0) {\\n return tAmountToSlash;\\n }\\n tPenalty -= tRemainder;\\n stakingProviderStruct.nuInTStake -= tPenalty;\\n tAmountToSlash -= tPenalty;\\n\\n uint256 nuReward = nuPenalty.percent(SLASHING_REWARD_PERCENT).percent(\\n rewardMultiplier\\n );\\n nucypherStakingContract.slashStaker(\\n stakingProviderStruct.owner,\\n nuPenalty,\\n msg.sender,\\n nuReward\\n );\\n return tAmountToSlash;\\n }\\n\\n /// @notice Removes application with zero authorization from authorized\\n /// applications array\\n function cleanAuthorizedApplications(\\n StakingProviderInfo storage stakingProviderStruct,\\n uint256 numberToDelete\\n ) internal {\\n uint256 length = stakingProviderStruct.authorizedApplications.length;\\n if (numberToDelete == length) {\\n delete stakingProviderStruct.authorizedApplications;\\n return;\\n }\\n\\n uint256 deleted = 0;\\n uint256 index = 0;\\n uint256 newLength = length - numberToDelete;\\n while (index < newLength && deleted < numberToDelete) {\\n address application = stakingProviderStruct.authorizedApplications[\\n index\\n ];\\n if (\\n stakingProviderStruct.authorizations[application].authorized ==\\n 0\\n ) {\\n stakingProviderStruct.authorizedApplications[\\n index\\n ] = stakingProviderStruct.authorizedApplications[\\n length - deleted - 1\\n ];\\n deleted++;\\n } else {\\n index++;\\n }\\n }\\n\\n for (index = newLength; index < length; index++) {\\n stakingProviderStruct.authorizedApplications.pop();\\n }\\n }\\n\\n /// @notice Creates new checkpoints due to a change of stake amount\\n /// @param _delegator Address of the staking provider acting as delegator\\n /// @param _amount Amount of T to increment\\n /// @param increase True if the change is an increase, false if a decrease\\n function newStakeCheckpoint(\\n address _delegator,\\n uint96 _amount,\\n bool increase\\n ) internal {\\n if (_amount == 0) {\\n return;\\n }\\n writeCheckpoint(\\n _totalSupplyCheckpoints,\\n increase ? add : subtract,\\n _amount\\n );\\n address delegatee = delegates(_delegator);\\n if (delegatee != address(0)) {\\n (uint256 oldWeight, uint256 newWeight) = writeCheckpoint(\\n _checkpoints[delegatee],\\n increase ? add : subtract,\\n _amount\\n );\\n emit DelegateVotesChanged(delegatee, oldWeight, newWeight);\\n }\\n }\\n\\n /// @notice Creates new checkpoints due to an increment of a stakers' stake\\n /// @param _delegator Address of the staking provider acting as delegator\\n /// @param _amount Amount of T to increment\\n function increaseStakeCheckpoint(address _delegator, uint96 _amount)\\n internal\\n {\\n newStakeCheckpoint(_delegator, _amount, true);\\n }\\n\\n /// @notice Creates new checkpoints due to a decrease of a stakers' stake\\n /// @param _delegator Address of the stake owner acting as delegator\\n /// @param _amount Amount of T to decrease\\n function decreaseStakeCheckpoint(address _delegator, uint96 _amount)\\n internal\\n {\\n newStakeCheckpoint(_delegator, _amount, false);\\n }\\n\\n /// @notice Returns amount of Nu stake in the NuCypher staking contract for\\n /// the specified staking provider.\\n /// Resulting value in T denomination\\n function getNuAmountInT(address owner, address stakingProvider)\\n internal\\n returns (uint96)\\n {\\n uint256 nuStakeAmount = nucypherStakingContract.requestMerge(\\n owner,\\n stakingProvider\\n );\\n (uint96 tAmount, ) = convertToT(nuStakeAmount, nucypherRatio);\\n return tAmount;\\n }\\n\\n function _transferGovernance(address newGuvnor) internal virtual {\\n address oldGuvnor = governance;\\n governance = newGuvnor;\\n emit GovernanceTransferred(oldGuvnor, newGuvnor);\\n }\\n\\n /// @notice Returns amount of Keep stake in the Keep staking contract for\\n /// the specified staking provider.\\n /// Resulting value in T denomination\\n function getKeepAmountInT(address stakingProvider)\\n internal\\n view\\n returns (uint96)\\n {\\n uint256 keepStakeAmount = keepStakingContract.eligibleStake(\\n stakingProvider,\\n address(this)\\n );\\n (uint96 tAmount, ) = convertToT(keepStakeAmount, keepRatio);\\n return tAmount;\\n }\\n\\n /// @notice Returns the T token amount that's obtained from `amount` legacy\\n /// tokens for the given `ratio`, and the remainder that can't be\\n /// converted.\\n function convertToT(uint256 amount, uint256 ratio)\\n internal\\n pure\\n returns (uint96 tAmount, uint256 remainder)\\n {\\n remainder = amount % CONVERSION_DIVISOR;\\n uint256 convertibleAmount = amount - remainder;\\n tAmount = ((convertibleAmount * ratio) / CONVERSION_DIVISOR).toUint96();\\n }\\n\\n /// @notice Returns the amount of legacy tokens that's obtained from\\n /// `tAmount` T tokens for the given `ratio`, and the T remainder\\n /// that can't be converted.\\n function convertFromT(uint96 tAmount, uint256 ratio)\\n internal\\n pure\\n returns (uint256 amount, uint96 tRemainder)\\n {\\n //slither-disable-next-line weak-prng\\n tRemainder = (tAmount % ratio).toUint96();\\n uint256 convertibleAmount = tAmount - tRemainder;\\n amount = (convertibleAmount * CONVERSION_DIVISOR) / ratio;\\n }\\n}\\n\",\"keccak256\":\"0xa27013f0a67e85cdaffe06db9e9be9f44a4e71db682a6e85835b6242827bc6d2\",\"license\":\"GPL-3.0-or-later\"},\"contracts/test/TokenStakingTestSet.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\n\\npragma solidity 0.8.9;\\n\\nimport \\\"../staking/ILegacyTokenStaking.sol\\\";\\nimport \\\"../staking/IApplication.sol\\\";\\nimport \\\"../staking/TokenStaking.sol\\\";\\n\\ncontract KeepTokenStakingMock is IKeepTokenStaking {\\n using PercentUtils for uint256;\\n\\n struct OperatorStruct {\\n address owner;\\n address payable beneficiary;\\n address authorizer;\\n uint256 createdAt;\\n uint256 undelegatedAt;\\n uint256 amount;\\n mapping(address => bool) eligibility;\\n }\\n\\n mapping(address => OperatorStruct) internal operators;\\n mapping(address => uint256) public tattletales;\\n\\n function setOperator(\\n address operator,\\n address owner,\\n address payable beneficiary,\\n address authorizer,\\n uint256 createdAt,\\n uint256 undelegatedAt,\\n uint256 amount\\n ) external {\\n OperatorStruct storage operatorStrut = operators[operator];\\n operatorStrut.owner = owner;\\n operatorStrut.beneficiary = beneficiary;\\n operatorStrut.authorizer = authorizer;\\n operatorStrut.createdAt = createdAt;\\n operatorStrut.undelegatedAt = undelegatedAt;\\n operatorStrut.amount = amount;\\n }\\n\\n function setEligibility(\\n address operator,\\n address application,\\n bool isEligible\\n ) external {\\n operators[operator].eligibility[application] = isEligible;\\n }\\n\\n function setAmount(address operator, uint256 amount) external {\\n operators[operator].amount = amount;\\n }\\n\\n function setUndelegatedAt(address operator, uint256 undelegatedAt)\\n external\\n {\\n operators[operator].undelegatedAt = undelegatedAt;\\n }\\n\\n function seize(\\n uint256 amountToSeize,\\n uint256 rewardMultiplier,\\n address tattletale,\\n address[] memory misbehavedOperators\\n ) external override {\\n require(amountToSeize > 0, \\\"Amount to slash must be greater than zero\\\");\\n // assumed only one will be slashed (per call)\\n require(\\n misbehavedOperators.length == 1,\\n \\\"Only one operator per call in tests\\\"\\n );\\n address operator = misbehavedOperators[0];\\n operators[operator].amount -= amountToSeize;\\n tattletales[tattletale] += amountToSeize.percent(5).percent(\\n rewardMultiplier\\n );\\n }\\n\\n function getDelegationInfo(address operator)\\n external\\n view\\n override\\n returns (\\n uint256 amount,\\n uint256 createdAt,\\n uint256 undelegatedAt\\n )\\n {\\n amount = operators[operator].amount;\\n createdAt = operators[operator].createdAt;\\n undelegatedAt = operators[operator].undelegatedAt;\\n }\\n\\n function ownerOf(address operator)\\n external\\n view\\n override\\n returns (address)\\n {\\n return operators[operator].owner;\\n }\\n\\n function beneficiaryOf(address operator)\\n external\\n view\\n override\\n returns (address payable)\\n {\\n return operators[operator].beneficiary;\\n }\\n\\n function authorizerOf(address operator)\\n external\\n view\\n override\\n returns (address)\\n {\\n return operators[operator].authorizer;\\n }\\n\\n function eligibleStake(address operator, address operatorContract)\\n external\\n view\\n override\\n returns (uint256 balance)\\n {\\n OperatorStruct storage operatorStrut = operators[operator];\\n if (operatorStrut.eligibility[operatorContract]) {\\n return operatorStrut.amount;\\n }\\n return 0;\\n }\\n}\\n\\ncontract NuCypherTokenStakingMock is INuCypherStakingEscrow {\\n struct StakerStruct {\\n uint256 value;\\n address stakingProvider;\\n }\\n\\n mapping(address => StakerStruct) public stakers;\\n mapping(address => uint256) public investigators;\\n\\n function setStaker(address staker, uint256 value) external {\\n stakers[staker].value = value;\\n }\\n\\n function slashStaker(\\n address staker,\\n uint256 penalty,\\n address investigator,\\n uint256 reward\\n ) external override {\\n require(penalty > 0, \\\"Amount to slash must be greater than zero\\\");\\n stakers[staker].value -= penalty;\\n investigators[investigator] += reward;\\n }\\n\\n function requestMerge(address staker, address stakingProvider)\\n external\\n override\\n returns (uint256)\\n {\\n StakerStruct storage stakerStruct = stakers[staker];\\n require(\\n stakerStruct.stakingProvider == address(0) ||\\n stakerStruct.stakingProvider == stakingProvider,\\n \\\"Another provider was already set for this staker\\\"\\n );\\n if (stakerStruct.stakingProvider == address(0)) {\\n stakerStruct.stakingProvider = stakingProvider;\\n }\\n return stakers[staker].value;\\n }\\n\\n function getAllTokens(address staker)\\n external\\n view\\n override\\n returns (uint256)\\n {\\n return stakers[staker].value;\\n }\\n\\n function stakerInfo(address staker)\\n public\\n view\\n returns (StakerStruct memory)\\n {\\n return stakers[staker];\\n }\\n}\\n\\ncontract VendingMachineMock {\\n uint256 public constant FLOATING_POINT_DIVISOR = 10**15;\\n\\n uint256 public immutable ratio;\\n\\n constructor(uint96 _wrappedTokenAllocation, uint96 _tTokenAllocation) {\\n ratio =\\n (FLOATING_POINT_DIVISOR * _tTokenAllocation) /\\n _wrappedTokenAllocation;\\n }\\n}\\n\\ncontract ApplicationMock is IApplication {\\n struct StakingProviderStruct {\\n uint96 authorized;\\n uint96 deauthorizingTo;\\n }\\n\\n TokenStaking internal immutable tokenStaking;\\n mapping(address => StakingProviderStruct) public stakingProviders;\\n\\n constructor(TokenStaking _tokenStaking) {\\n tokenStaking = _tokenStaking;\\n }\\n\\n function withdrawRewards(address) external {\\n // does nothing\\n }\\n\\n function authorizationIncreased(\\n address stakingProvider,\\n uint96,\\n uint96 toAmount\\n ) external override {\\n stakingProviders[stakingProvider].authorized = toAmount;\\n }\\n\\n function authorizationDecreaseRequested(\\n address stakingProvider,\\n uint96,\\n uint96 toAmount\\n ) external override {\\n stakingProviders[stakingProvider].deauthorizingTo = toAmount;\\n }\\n\\n function approveAuthorizationDecrease(address stakingProvider) external {\\n StakingProviderStruct storage stakingProviderStruct = stakingProviders[\\n stakingProvider\\n ];\\n stakingProviderStruct.authorized = tokenStaking\\n .approveAuthorizationDecrease(stakingProvider);\\n }\\n\\n function slash(uint96 amount, address[] memory _stakingProviders) external {\\n tokenStaking.slash(amount, _stakingProviders);\\n }\\n\\n function seize(\\n uint96 amount,\\n uint256 rewardMultiplier,\\n address notifier,\\n address[] memory _stakingProviders\\n ) external {\\n tokenStaking.seize(\\n amount,\\n rewardMultiplier,\\n notifier,\\n _stakingProviders\\n );\\n }\\n\\n function involuntaryAuthorizationDecrease(\\n address stakingProvider,\\n uint96,\\n uint96 toAmount\\n ) public virtual override {\\n StakingProviderStruct storage stakingProviderStruct = stakingProviders[\\n stakingProvider\\n ];\\n require(\\n toAmount != stakingProviderStruct.authorized,\\n \\\"Nothing to decrease\\\"\\n );\\n uint96 decrease = stakingProviderStruct.authorized - toAmount;\\n if (stakingProviderStruct.deauthorizingTo > decrease) {\\n stakingProviderStruct.deauthorizingTo -= decrease;\\n } else {\\n stakingProviderStruct.deauthorizingTo = 0;\\n }\\n stakingProviderStruct.authorized = toAmount;\\n }\\n\\n function availableRewards(address) external pure returns (uint96) {\\n return 0;\\n }\\n\\n function minimumAuthorization() external pure returns (uint96) {\\n return 0;\\n }\\n}\\n\\ncontract BrokenApplicationMock is ApplicationMock {\\n constructor(TokenStaking _tokenStaking) ApplicationMock(_tokenStaking) {}\\n\\n function involuntaryAuthorizationDecrease(\\n address,\\n uint96,\\n uint96\\n ) public pure override {\\n revert(\\\"Broken application\\\");\\n }\\n}\\n\\ncontract ExpensiveApplicationMock is ApplicationMock {\\n uint256[] private dummy;\\n\\n constructor(TokenStaking _tokenStaking) ApplicationMock(_tokenStaking) {}\\n\\n function involuntaryAuthorizationDecrease(\\n address stakingProvider,\\n uint96 fromAmount,\\n uint96 toAmount\\n ) public override {\\n super.involuntaryAuthorizationDecrease(\\n stakingProvider,\\n fromAmount,\\n toAmount\\n );\\n for (uint256 i = 0; i < 12; i++) {\\n dummy.push(i);\\n }\\n }\\n}\\n\\ncontract ManagedGrantMock {\\n address public grantee;\\n\\n //slither-disable-next-line missing-zero-check\\n function setGrantee(address _grantee) external {\\n grantee = _grantee;\\n }\\n}\\n\\ncontract ExtendedTokenStaking is TokenStaking {\\n constructor(\\n T _token,\\n IKeepTokenStaking _keepStakingContract,\\n INuCypherStakingEscrow _nucypherStakingContract,\\n VendingMachine _keepVendingMachine,\\n VendingMachine _nucypherVendingMachine,\\n KeepStake _keepStake\\n )\\n TokenStaking(\\n _token,\\n _keepStakingContract,\\n _nucypherStakingContract,\\n _keepVendingMachine,\\n _nucypherVendingMachine,\\n _keepStake\\n )\\n {}\\n\\n function cleanAuthorizedApplications(\\n address stakingProvider,\\n uint256 numberToDelete\\n ) external {\\n StakingProviderInfo storage stakingProviderStruct = stakingProviders[\\n stakingProvider\\n ];\\n cleanAuthorizedApplications(stakingProviderStruct, numberToDelete);\\n }\\n\\n function setAuthorization(\\n address stakingProvider,\\n address application,\\n uint96 amount\\n ) external {\\n stakingProviders[stakingProvider]\\n .authorizations[application]\\n .authorized = amount;\\n }\\n\\n function setAuthorizedApplications(\\n address stakingProvider,\\n address[] memory _applications\\n ) external {\\n stakingProviders[stakingProvider]\\n .authorizedApplications = _applications;\\n }\\n\\n // to decrease size of test contract\\n function processSlashing(uint256 count) external override {}\\n\\n function getAuthorizedApplications(address stakingProvider)\\n external\\n view\\n returns (address[] memory)\\n {\\n return stakingProviders[stakingProvider].authorizedApplications;\\n }\\n}\\n\",\"keccak256\":\"0x55bd1a8dc0c354ff3be00489028bd31f95fbf8c75a2c28a41f1b2466a7f955be\",\"license\":\"GPL-3.0-or-later\"},\"contracts/token/T.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\n\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n\\npragma solidity 0.8.9;\\n\\nimport \\\"../governance/Checkpoints.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/math/SafeCast.sol\\\";\\nimport \\\"@thesis/solidity-contracts/contracts/token/ERC20WithPermit.sol\\\";\\nimport \\\"@thesis/solidity-contracts/contracts/token/MisfundRecovery.sol\\\";\\n\\n/// @title T token\\n/// @notice Threshold Network T token\\n/// @dev By default, token balance does not account for voting power.\\n/// This makes transfers cheaper. The downside is that it requires users\\n/// to delegate to themselves to activate checkpoints and have their\\n/// voting power tracked.\\ncontract T is ERC20WithPermit, MisfundRecovery, Checkpoints {\\n /// @notice The EIP-712 typehash for the delegation struct used by\\n /// `delegateBySig`.\\n bytes32 public constant DELEGATION_TYPEHASH =\\n keccak256(\\n \\\"Delegation(address delegatee,uint256 nonce,uint256 deadline)\\\"\\n );\\n\\n constructor() ERC20WithPermit(\\\"Threshold Network Token\\\", \\\"T\\\") {}\\n\\n /// @notice Delegates votes from signatory to `delegatee`\\n /// @param delegatee The address to delegate votes to\\n /// @param deadline The time at which to expire the signature\\n /// @param v The recovery byte of the signature\\n /// @param r Half of the ECDSA signature pair\\n /// @param s Half of the ECDSA signature pair\\n function delegateBySig(\\n address signatory,\\n address delegatee,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external {\\n /* solhint-disable-next-line not-rely-on-time */\\n require(deadline >= block.timestamp, \\\"Delegation expired\\\");\\n\\n // Validate `s` and `v` values for a malleability concern described in EIP2.\\n // Only signatures with `s` value in the lower half of the secp256k1\\n // curve's order and `v` value of 27 or 28 are considered valid.\\n require(\\n uint256(s) <=\\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0,\\n \\\"Invalid signature 's' value\\\"\\n );\\n require(v == 27 || v == 28, \\\"Invalid signature 'v' value\\\");\\n\\n bytes32 digest = keccak256(\\n abi.encodePacked(\\n \\\"\\\\x19\\\\x01\\\",\\n DOMAIN_SEPARATOR(),\\n keccak256(\\n abi.encode(\\n DELEGATION_TYPEHASH,\\n delegatee,\\n nonce[signatory]++,\\n deadline\\n )\\n )\\n )\\n );\\n\\n address recoveredAddress = ecrecover(digest, v, r, s);\\n require(\\n recoveredAddress != address(0) && recoveredAddress == signatory,\\n \\\"Invalid signature\\\"\\n );\\n\\n return delegate(signatory, delegatee);\\n }\\n\\n /// @notice Delegate votes from `msg.sender` to `delegatee`.\\n /// @param delegatee The address to delegate votes to\\n function delegate(address delegatee) public virtual {\\n return delegate(msg.sender, delegatee);\\n }\\n\\n // slither-disable-next-line dead-code\\n function beforeTokenTransfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal override {\\n uint96 safeAmount = SafeCast.toUint96(amount);\\n\\n // When minting:\\n if (from == address(0)) {\\n // Does not allow to mint more than uint96 can fit. Otherwise, the\\n // Checkpoint might not fit the balance.\\n require(\\n totalSupply + amount <= maxSupply(),\\n \\\"Maximum total supply exceeded\\\"\\n );\\n writeCheckpoint(_totalSupplyCheckpoints, add, safeAmount);\\n }\\n\\n // When burning:\\n if (to == address(0)) {\\n writeCheckpoint(_totalSupplyCheckpoints, subtract, safeAmount);\\n }\\n\\n moveVotingPower(delegates(from), delegates(to), safeAmount);\\n }\\n\\n function delegate(address delegator, address delegatee)\\n internal\\n virtual\\n override\\n {\\n address currentDelegate = delegates(delegator);\\n uint96 delegatorBalance = SafeCast.toUint96(balanceOf[delegator]);\\n _delegates[delegator] = delegatee;\\n\\n emit DelegateChanged(delegator, currentDelegate, delegatee);\\n\\n moveVotingPower(currentDelegate, delegatee, delegatorBalance);\\n }\\n}\\n\",\"keccak256\":\"0x6265416225fd15b1108fce13d570b53a862a5d256ba2e6329bccf658eccac430\",\"license\":\"GPL-3.0-or-later\"},\"contracts/utils/PercentUtils.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\n\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n\\npragma solidity 0.8.9;\\n\\nlibrary PercentUtils {\\n // Return `b`% of `a`\\n // 200.percent(40) == 80\\n // Commutative, works both ways\\n function percent(uint256 a, uint256 b) internal pure returns (uint256) {\\n return (a * b) / 100;\\n }\\n\\n // Return `a` as percentage of `b`:\\n // 80.asPercentOf(200) == 40\\n //slither-disable-next-line dead-code\\n function asPercentOf(uint256 a, uint256 b) internal pure returns (uint256) {\\n return (a * 100) / b;\\n }\\n}\\n\",\"keccak256\":\"0xf5feadeff9d504b33058dfd6c2b99d31ecebc152b356272646a7afe6ed638d40\",\"license\":\"GPL-3.0-or-later\"},\"contracts/utils/SafeTUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\n\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n\\npragma solidity 0.8.9;\\n\\nimport \\\"../token/T.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\\\";\\n\\n/// @notice A wrapper around OpenZeppelin's `SafeERC20Upgradeable` but specific\\n/// to the T token. Use this library in upgradeable contracts. If your\\n/// contract is non-upgradeable, then the traditional `SafeERC20` works.\\n/// The motivation is to prevent upgradeable contracts that use T from\\n/// depending on the `Address` library, which can be problematic since\\n/// it uses `delegatecall`, which is discouraged by OpenZeppelin for use\\n/// in upgradeable contracts.\\n/// @dev This implementation force-casts T to `IERC20Upgradeable` to make it\\n/// work with `SafeERC20Upgradeable`.\\nlibrary SafeTUpgradeable {\\n function safeTransfer(\\n T token,\\n address to,\\n uint256 value\\n ) internal {\\n SafeERC20Upgradeable.safeTransfer(\\n IERC20Upgradeable(address(token)),\\n to,\\n value\\n );\\n }\\n\\n function safeTransferFrom(\\n T token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n SafeERC20Upgradeable.safeTransferFrom(\\n IERC20Upgradeable(address(token)),\\n from,\\n to,\\n value\\n );\\n }\\n}\\n\",\"keccak256\":\"0xf53907099650f9f973ff51c403730e7ae7170a5728fbde49f0f00b0a17775ce7\",\"license\":\"GPL-3.0-or-later\"},\"contracts/vending/VendingMachine.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\n\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n// \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c \\u2590\\u2588\\u2588\\u2588\\u2588\\u258c\\n\\npragma solidity 0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\n\\nimport \\\"@thesis/solidity-contracts/contracts/token/IReceiveApproval.sol\\\";\\nimport \\\"../token/T.sol\\\";\\n\\n/// @title T token vending machine\\n/// @notice Contract implements a special update protocol to enable KEEP/NU\\n/// token holders to wrap their tokens and obtain T tokens according\\n/// to a fixed ratio. This will go on indefinitely and enable NU and\\n/// KEEP token holders to join T network without needing to buy or\\n/// sell any assets. Logistically, anyone holding NU or KEEP can wrap\\n/// those assets in order to upgrade to T. They can also unwrap T in\\n/// order to downgrade back to the underlying asset. There is a separate\\n/// instance of this contract deployed for KEEP holders and a separate\\n/// instance of this contract deployed for NU holders.\\ncontract VendingMachine is IReceiveApproval {\\n using SafeERC20 for IERC20;\\n using SafeERC20 for T;\\n\\n /// @notice Number of decimal places of precision in conversion to/from\\n /// wrapped tokens (assuming typical ERC20 token with 18 decimals).\\n /// This implies that amounts of wrapped tokens below this precision\\n /// won't take part in the conversion. E.g., for a value of 3, then\\n /// for a conversion of 1.123456789 wrapped tokens, only 1.123 is\\n /// convertible (i.e., 3 decimal places), and 0.000456789 is left.\\n uint256 public constant WRAPPED_TOKEN_CONVERSION_PRECISION = 3;\\n\\n /// @notice Divisor for precision purposes, used to represent fractions.\\n uint256 public constant FLOATING_POINT_DIVISOR =\\n 10**(18 - WRAPPED_TOKEN_CONVERSION_PRECISION);\\n\\n /// @notice The token being wrapped to T (KEEP/NU).\\n IERC20 public immutable wrappedToken;\\n\\n /// @notice T token contract.\\n T public immutable tToken;\\n\\n /// @notice The ratio with which T token is converted based on the provided\\n /// token being wrapped (KEEP/NU), expressed in 1e18 precision.\\n ///\\n /// When wrapping:\\n /// x [T] = amount [KEEP/NU] * ratio / FLOATING_POINT_DIVISOR\\n ///\\n /// When unwrapping:\\n /// x [KEEP/NU] = amount [T] * FLOATING_POINT_DIVISOR / ratio\\n uint256 public immutable ratio;\\n\\n /// @notice The total balance of wrapped tokens for the given holder\\n /// account. Only holders that have previously wrapped KEEP/NU to T\\n /// can unwrap, up to the amount previously wrapped.\\n mapping(address => uint256) public wrappedBalance;\\n\\n event Wrapped(\\n address indexed recipient,\\n uint256 wrappedTokenAmount,\\n uint256 tTokenAmount\\n );\\n event Unwrapped(\\n address indexed recipient,\\n uint256 tTokenAmount,\\n uint256 wrappedTokenAmount\\n );\\n\\n /// @notice Sets the reference to `wrappedToken` and `tToken`. Initializes\\n /// conversion `ratio` between wrapped token and T based on the\\n /// provided `_tTokenAllocation` and `_wrappedTokenAllocation`.\\n /// @param _wrappedToken Address to ERC20 token that will be wrapped to T\\n /// @param _tToken Address of T token\\n /// @param _wrappedTokenAllocation The total supply of the token that will be\\n /// wrapped to T\\n /// @param _tTokenAllocation The allocation of T this instance of Vending\\n /// Machine will receive\\n /// @dev Multiplications in this contract can't overflow uint256 as we\\n /// restrict `_wrappedTokenAllocation` and `_tTokenAllocation` to\\n /// 96 bits and FLOATING_POINT_DIVISOR fits in less than 60 bits.\\n constructor(\\n IERC20 _wrappedToken,\\n T _tToken,\\n uint96 _wrappedTokenAllocation,\\n uint96 _tTokenAllocation\\n ) {\\n wrappedToken = _wrappedToken;\\n tToken = _tToken;\\n ratio =\\n (FLOATING_POINT_DIVISOR * _tTokenAllocation) /\\n _wrappedTokenAllocation;\\n }\\n\\n /// @notice Wraps up to the the given `amount` of the token (KEEP/NU) and\\n /// releases T token proportionally to the amount being wrapped with\\n /// respect to the wrap ratio. The token holder needs to have at\\n /// least the given amount of the wrapped token (KEEP/NU) approved\\n /// to transfer to the Vending Machine before calling this function.\\n /// @param amount The amount of KEEP/NU to be wrapped\\n function wrap(uint256 amount) external {\\n _wrap(msg.sender, amount);\\n }\\n\\n /// @notice Wraps up to the given amount of the token (KEEP/NU) and releases\\n /// T token proportionally to the amount being wrapped with respect\\n /// to the wrap ratio. This is a shortcut to `wrap` function that\\n /// avoids a separate approval transaction. Only KEEP/NU token\\n /// is allowed as a caller, so please call this function via\\n /// token's `approveAndCall`.\\n /// @param from Caller's address, must be the same as `wrappedToken` field\\n /// @param amount The amount of KEEP/NU to be wrapped\\n /// @param token Token's address, must be the same as `wrappedToken` field\\n function receiveApproval(\\n address from,\\n uint256 amount,\\n address token,\\n bytes calldata\\n ) external override {\\n require(\\n token == address(wrappedToken),\\n \\\"Token is not the wrapped token\\\"\\n );\\n require(\\n msg.sender == address(wrappedToken),\\n \\\"Only wrapped token caller allowed\\\"\\n );\\n _wrap(from, amount);\\n }\\n\\n /// @notice Unwraps up to the given `amount` of T back to the legacy token\\n /// (KEEP/NU) according to the wrap ratio. It can only be called by\\n /// a token holder who previously wrapped their tokens in this\\n /// vending machine contract. The token holder can't unwrap more\\n /// tokens than they originally wrapped. The token holder needs to\\n /// have at least the given amount of T tokens approved to transfer\\n /// to the Vending Machine before calling this function.\\n /// @param amount The amount of T to unwrap back to the collateral (KEEP/NU)\\n function unwrap(uint256 amount) external {\\n _unwrap(msg.sender, amount);\\n }\\n\\n /// @notice Returns the T token amount that's obtained from `amount` wrapped\\n /// tokens (KEEP/NU), and the remainder that can't be upgraded.\\n function conversionToT(uint256 amount)\\n public\\n view\\n returns (uint256 tAmount, uint256 wrappedRemainder)\\n {\\n wrappedRemainder = amount % FLOATING_POINT_DIVISOR;\\n uint256 convertibleAmount = amount - wrappedRemainder;\\n tAmount = (convertibleAmount * ratio) / FLOATING_POINT_DIVISOR;\\n }\\n\\n /// @notice The amount of wrapped tokens (KEEP/NU) that's obtained from\\n /// `amount` T tokens, and the remainder that can't be downgraded.\\n function conversionFromT(uint256 amount)\\n public\\n view\\n returns (uint256 wrappedAmount, uint256 tRemainder)\\n {\\n tRemainder = amount % ratio;\\n uint256 convertibleAmount = amount - tRemainder;\\n wrappedAmount = (convertibleAmount * FLOATING_POINT_DIVISOR) / ratio;\\n }\\n\\n function _wrap(address tokenHolder, uint256 wrappedTokenAmount) internal {\\n (uint256 tTokenAmount, uint256 remainder) = conversionToT(\\n wrappedTokenAmount\\n );\\n wrappedTokenAmount -= remainder;\\n require(wrappedTokenAmount > 0, \\\"Disallow conversions of zero value\\\");\\n emit Wrapped(tokenHolder, wrappedTokenAmount, tTokenAmount);\\n\\n wrappedBalance[tokenHolder] += wrappedTokenAmount;\\n wrappedToken.safeTransferFrom(\\n tokenHolder,\\n address(this),\\n wrappedTokenAmount\\n );\\n tToken.safeTransfer(tokenHolder, tTokenAmount);\\n }\\n\\n function _unwrap(address tokenHolder, uint256 tTokenAmount) internal {\\n (uint256 wrappedTokenAmount, uint256 remainder) = conversionFromT(\\n tTokenAmount\\n );\\n tTokenAmount -= remainder;\\n require(tTokenAmount > 0, \\\"Disallow conversions of zero value\\\");\\n require(\\n wrappedBalance[tokenHolder] >= wrappedTokenAmount,\\n \\\"Can not unwrap more than previously wrapped\\\"\\n );\\n\\n emit Unwrapped(tokenHolder, tTokenAmount, wrappedTokenAmount);\\n wrappedBalance[tokenHolder] -= wrappedTokenAmount;\\n tToken.safeTransferFrom(tokenHolder, address(this), tTokenAmount);\\n wrappedToken.safeTransfer(tokenHolder, wrappedTokenAmount);\\n }\\n}\\n\",\"keccak256\":\"0xa4e7de5a9063db09b32ca97fa0fb5d8d1cc7b539387d1b44d74d15d3c2ed4134\",\"license\":\"GPL-3.0-or-later\"}},\"version\":1}",
187
- "bytecode": "0x608060405234801561001057600080fd5b506104f7806100206000396000f3fe608060405234801561001057600080fd5b506004361061006d5760003560e01c8063178b6de6146100725780633223ff4b146100ae5780633d4fa8e5146100c15780634e745f1f146100ed5780637da5f6a6146101655780639168ae721461018557806399cc218c146101d2575b600080fd5b61009b6100803660046103b9565b6001600160a01b031660009081526020819052604090205490565b6040519081526020015b60405180910390f35b61009b6100bc3660046103db565b6101e5565b6100eb6100cf36600461040e565b6001600160a01b03909116600090815260208190526040902055565b005b6101416100fb3660046103b9565b604080518082018252600080825260209182018190526001600160a01b039384168152808252829020825180840190935280548352600101549092169181019190915290565b60408051825181526020928301516001600160a01b031692810192909252016100a5565b61009b6101733660046103b9565b60016020526000908152604090205481565b6101b56101933660046103b9565b600060208190529081526040902080546001909101546001600160a01b031682565b604080519283526001600160a01b039091166020830152016100a5565b6100eb6101e0366004610438565b6102db565b6001600160a01b038083166000908152602081905260408120600181015491929091161580610223575060018101546001600160a01b038481169116145b61028d5760405162461bcd60e51b815260206004820152603060248201527f416e6f746865722070726f76696465722077617320616c72656164792073657460448201526f103337b9103a3434b99039ba30b5b2b960811b60648201526084015b60405180910390fd5b60018101546001600160a01b03166102bd576001810180546001600160a01b0319166001600160a01b0385161790555b5050506001600160a01b031660009081526020819052604090205490565b6000831161033d5760405162461bcd60e51b815260206004820152602960248201527f416d6f756e7420746f20736c617368206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610284565b6001600160a01b03841660009081526020819052604081208054859290610365908490610492565b90915550506001600160a01b038216600090815260016020526040812080548392906103929084906104a9565b909155505050505050565b80356001600160a01b03811681146103b457600080fd5b919050565b6000602082840312156103cb57600080fd5b6103d48261039d565b9392505050565b600080604083850312156103ee57600080fd5b6103f78361039d565b91506104056020840161039d565b90509250929050565b6000806040838503121561042157600080fd5b61042a8361039d565b946020939093013593505050565b6000806000806080858703121561044e57600080fd5b6104578561039d565b93506020850135925061046c6040860161039d565b9396929550929360600135925050565b634e487b7160e01b600052601160045260246000fd5b6000828210156104a4576104a461047c565b500390565b600082198211156104bc576104bc61047c565b50019056fea264697066735822122032cfbd37cdeb97fb894be38888d2bf07db9313b28b5c73385e9b2800a1d487ca64736f6c63430008090033",
188
- "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061006d5760003560e01c8063178b6de6146100725780633223ff4b146100ae5780633d4fa8e5146100c15780634e745f1f146100ed5780637da5f6a6146101655780639168ae721461018557806399cc218c146101d2575b600080fd5b61009b6100803660046103b9565b6001600160a01b031660009081526020819052604090205490565b6040519081526020015b60405180910390f35b61009b6100bc3660046103db565b6101e5565b6100eb6100cf36600461040e565b6001600160a01b03909116600090815260208190526040902055565b005b6101416100fb3660046103b9565b604080518082018252600080825260209182018190526001600160a01b039384168152808252829020825180840190935280548352600101549092169181019190915290565b60408051825181526020928301516001600160a01b031692810192909252016100a5565b61009b6101733660046103b9565b60016020526000908152604090205481565b6101b56101933660046103b9565b600060208190529081526040902080546001909101546001600160a01b031682565b604080519283526001600160a01b039091166020830152016100a5565b6100eb6101e0366004610438565b6102db565b6001600160a01b038083166000908152602081905260408120600181015491929091161580610223575060018101546001600160a01b038481169116145b61028d5760405162461bcd60e51b815260206004820152603060248201527f416e6f746865722070726f76696465722077617320616c72656164792073657460448201526f103337b9103a3434b99039ba30b5b2b960811b60648201526084015b60405180910390fd5b60018101546001600160a01b03166102bd576001810180546001600160a01b0319166001600160a01b0385161790555b5050506001600160a01b031660009081526020819052604090205490565b6000831161033d5760405162461bcd60e51b815260206004820152602960248201527f416d6f756e7420746f20736c617368206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610284565b6001600160a01b03841660009081526020819052604081208054859290610365908490610492565b90915550506001600160a01b038216600090815260016020526040812080548392906103929084906104a9565b909155505050505050565b80356001600160a01b03811681146103b457600080fd5b919050565b6000602082840312156103cb57600080fd5b6103d48261039d565b9392505050565b600080604083850312156103ee57600080fd5b6103f78361039d565b91506104056020840161039d565b90509250929050565b6000806040838503121561042157600080fd5b61042a8361039d565b946020939093013593505050565b6000806000806080858703121561044e57600080fd5b6104578561039d565b93506020850135925061046c6040860161039d565b9396929550929360600135925050565b634e487b7160e01b600052601160045260246000fd5b6000828210156104a4576104a461047c565b500390565b600082198211156104bc576104bc61047c565b50019056fea264697066735822122032cfbd37cdeb97fb894be38888d2bf07db9313b28b5c73385e9b2800a1d487ca64736f6c63430008090033",
189
- "devdoc": {
190
- "kind": "dev",
191
- "methods": {
192
- "slashStaker(address,uint256,address,uint256)": {
193
- "params": {
194
- "investigator": "Investigator",
195
- "penalty": "Penalty",
196
- "reward": "Reward for the investigator",
197
- "staker": "Staker's address"
198
- }
199
- }
200
- },
201
- "version": 1
202
- },
203
- "userdoc": {
204
- "kind": "user",
205
- "methods": {
206
- "getAllTokens(address)": {
207
- "notice": "Get all tokens belonging to the staker"
208
- },
209
- "requestMerge(address,address)": {
210
- "notice": "Request merge between NuCypher staking contract and T staking contract. Returns amount of staked tokens"
211
- },
212
- "slashStaker(address,uint256,address,uint256)": {
213
- "notice": "Slash the staker's stake and reward the investigator"
214
- }
215
- },
216
- "version": 1
217
- },
218
- "storageLayout": {
219
- "storage": [
220
- {
221
- "astId": 17613,
222
- "contract": "contracts/test/TokenStakingTestSet.sol:NuCypherTokenStakingMock",
223
- "label": "stakers",
224
- "offset": 0,
225
- "slot": "0",
226
- "type": "t_mapping(t_address,t_struct(StakerStruct)17608_storage)"
227
- },
228
- {
229
- "astId": 17617,
230
- "contract": "contracts/test/TokenStakingTestSet.sol:NuCypherTokenStakingMock",
231
- "label": "investigators",
232
- "offset": 0,
233
- "slot": "1",
234
- "type": "t_mapping(t_address,t_uint256)"
235
- }
236
- ],
237
- "types": {
238
- "t_address": {
239
- "encoding": "inplace",
240
- "label": "address",
241
- "numberOfBytes": "20"
242
- },
243
- "t_mapping(t_address,t_struct(StakerStruct)17608_storage)": {
244
- "encoding": "mapping",
245
- "key": "t_address",
246
- "label": "mapping(address => struct NuCypherTokenStakingMock.StakerStruct)",
247
- "numberOfBytes": "32",
248
- "value": "t_struct(StakerStruct)17608_storage"
249
- },
250
- "t_mapping(t_address,t_uint256)": {
251
- "encoding": "mapping",
252
- "key": "t_address",
253
- "label": "mapping(address => uint256)",
254
- "numberOfBytes": "32",
255
- "value": "t_uint256"
256
- },
257
- "t_struct(StakerStruct)17608_storage": {
258
- "encoding": "inplace",
259
- "label": "struct NuCypherTokenStakingMock.StakerStruct",
260
- "members": [
261
- {
262
- "astId": 17605,
263
- "contract": "contracts/test/TokenStakingTestSet.sol:NuCypherTokenStakingMock",
264
- "label": "value",
265
- "offset": 0,
266
- "slot": "0",
267
- "type": "t_uint256"
268
- },
269
- {
270
- "astId": 17607,
271
- "contract": "contracts/test/TokenStakingTestSet.sol:NuCypherTokenStakingMock",
272
- "label": "stakingProvider",
273
- "offset": 0,
274
- "slot": "1",
275
- "type": "t_address"
276
- }
277
- ],
278
- "numberOfBytes": "64"
279
- },
280
- "t_uint256": {
281
- "encoding": "inplace",
282
- "label": "uint256",
283
- "numberOfBytes": "32"
284
- }
285
- }
286
- }
287
- }