diff --git a/.gitignore b/.gitignore index aee36f40..4b14798a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,8 @@ node_modules/ artifacts/ build/ cache/ -deployments/ +deployments/* +!deployments/mainnet/ export/ export.json diff --git a/.openzeppelin/mainnet.json b/.openzeppelin/mainnet.json index 02040035..394fd655 100644 --- a/.openzeppelin/mainnet.json +++ b/.openzeppelin/mainnet.json @@ -2,45 +2,7 @@ "manifestVersion": "3.2", "admin": { "address": "0x758279CE7f54568A149bcdFcc7699e20b1dE43E5", - "txHash": "0xed01f878c6c5a160dd137fe0dce837e2c745415784125380919232b715db665a", - "deployTransaction": { - "hash": "0xed01f878c6c5a160dd137fe0dce837e2c745415784125380919232b715db665a", - "type": 2, - "accessList": [], - "blockHash": null, - "blockNumber": null, - "transactionIndex": null, - "confirmations": 0, - "from": "0xFfFd7092685bDeeBD121D1A0FEA3c349114Cce50", - "gasPrice": { - "type": "BigNumber", - "hex": "0x134549158c" - }, - "maxPriorityFeePerGas": { - "type": "BigNumber", - "hex": "0x77359400" - }, - "maxFeePerGas": { - "type": "BigNumber", - "hex": "0x134549158c" - }, - "gasLimit": { - "type": "BigNumber", - "hex": "0x0762b4" - }, - "to": null, - "value": { - "type": "BigNumber", - "hex": "0x00" - }, - "nonce": 2, - "data": "0x608060405234801561001057600080fd5b50600080546001600160a01b031916339081178255604051909182917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350610759806100616000396000f3fe60806040526004361061007b5760003560e01c80639623609d1161004e5780639623609d1461011157806399a88ec414610124578063f2fde38b14610144578063f3b7dead146101645761007b565b8063204e1c7a14610080578063715018a6146100bc5780637eff275e146100d35780638da5cb5b146100f3575b600080fd5b34801561008c57600080fd5b506100a061009b366004610515565b610184565b6040516001600160a01b03909116815260200160405180910390f35b3480156100c857600080fd5b506100d1610215565b005b3480156100df57600080fd5b506100d16100ee366004610554565b610292565b3480156100ff57600080fd5b506000546001600160a01b03166100a0565b6100d161011f36600461058c565b61031c565b34801561013057600080fd5b506100d161013f366004610554565b6103ad565b34801561015057600080fd5b506100d161015f366004610515565b610405565b34801561017057600080fd5b506100a061017f366004610515565b6104ef565b6000806000836001600160a01b03166040516101aa90635c60da1b60e01b815260040190565b600060405180830381855afa9150503d80600081146101e5576040519150601f19603f3d011682016040523d82523d6000602084013e6101ea565b606091505b5091509150816101f957600080fd5b8080602001905181019061020d9190610538565b949350505050565b6000546001600160a01b031633146102485760405162461bcd60e51b815260040161023f906106c0565b60405180910390fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146102bc5760405162461bcd60e51b815260040161023f906106c0565b6040516308f2839760e41b81526001600160a01b038281166004830152831690638f283970906024015b600060405180830381600087803b15801561030057600080fd5b505af1158015610314573d6000803e3d6000fd5b505050505050565b6000546001600160a01b031633146103465760405162461bcd60e51b815260040161023f906106c0565b60405163278f794360e11b81526001600160a01b03841690634f1ef286903490610376908690869060040161065d565b6000604051808303818588803b15801561038f57600080fd5b505af11580156103a3573d6000803e3d6000fd5b5050505050505050565b6000546001600160a01b031633146103d75760405162461bcd60e51b815260040161023f906106c0565b604051631b2ce7f360e11b81526001600160a01b038281166004830152831690633659cfe6906024016102e6565b6000546001600160a01b0316331461042f5760405162461bcd60e51b815260040161023f906106c0565b6001600160a01b0381166104945760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161023f565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000806000836001600160a01b03166040516101aa906303e1469160e61b815260040190565b600060208284031215610526578081fd5b81356105318161070b565b9392505050565b600060208284031215610549578081fd5b81516105318161070b565b60008060408385031215610566578081fd5b82356105718161070b565b915060208301356105818161070b565b809150509250929050565b6000806000606084860312156105a0578081fd5b83356105ab8161070b565b925060208401356105bb8161070b565b9150604084013567ffffffffffffffff808211156105d7578283fd5b818601915086601f8301126105ea578283fd5b8135818111156105fc576105fc6106f5565b604051601f8201601f19908116603f01168101908382118183101715610624576106246106f5565b8160405282815289602084870101111561063c578586fd5b82602086016020830137856020848301015280955050505050509250925092565b600060018060a01b038416825260206040818401528351806040850152825b818110156106985785810183015185820160600152820161067c565b818111156106a95783606083870101525b50601f01601f191692909201606001949350505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461072057600080fd5b5056fea2646970667358221220d849f96f3086b9f82cdcf665adb8c697ace05638da1c7c16ab2d26293717af6764736f6c63430008020033", - "r": "0x6885b321b1e7c4aa593439aa23463195169cce9b91cd86ec64effcd72bc3e49a", - "s": "0x093ef2962156e17cf290ab77a5ae1cd524741b3cb96e56696984b5a4dc7e6ae4", - "v": 0, - "creates": "0x758279CE7f54568A149bcdFcc7699e20b1dE43E5", - "chainId": 1 - } + "txHash": "0xed01f878c6c5a160dd137fe0dce837e2c745415784125380919232b715db665a" }, "proxies": [ { @@ -258,7 +220,12 @@ }, "t_enum(ApplicationStatus)12373": { "label": "enum TokenStaking.ApplicationStatus", - "members": ["NOT_APPROVED", "APPROVED", "PAUSED", "DISABLED"] + "members": [ + "NOT_APPROVED", + "APPROVED", + "PAUSED", + "DISABLED" + ] }, "t_array(t_struct(SlashingEvent)12414_storage)dyn_storage": { "label": "struct TokenStaking.SlashingEvent[]" @@ -273,10 +240,6 @@ { "label": "amount", "type": "t_uint96" - }, - { - "label": "application", - "type": "t_address" } ] }, @@ -300,6 +263,344 @@ } } } + }, + "b4cf5ea03c87e86ce2bab71fd4e7ac91df0ecd81e50b7f7dd4f6f6f07eba0bd7": { + "address": "0x57E1a87603bD1960D734243f8b2f5133911E009D", + "txHash": "0xb2ad86231bc567dfe611aae60cef7f5298301334a63acaae1fcaf3c1fade6d3f", + "layout": { + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:39" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:44" + }, + { + "label": "_delegates", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_address)", + "contract": "Checkpoints", + "src": "contracts/governance/Checkpoints.sol:49" + }, + { + "label": "_checkpoints", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_address,t_array(t_uint128)dyn_storage)", + "contract": "Checkpoints", + "src": "contracts/governance/Checkpoints.sol:49" + }, + { + "label": "_totalSupplyCheckpoints", + "offset": 0, + "slot": "3", + "type": "t_array(t_uint128)dyn_storage", + "contract": "Checkpoints", + "src": "contracts/governance/Checkpoints.sol:51" + }, + { + "label": "__gap", + "offset": 0, + "slot": "4", + "type": "t_array(t_uint256)47_storage", + "contract": "Checkpoints", + "src": "contracts/governance/Checkpoints.sol:61" + }, + { + "label": "governance", + "offset": 0, + "slot": "51", + "type": "t_address", + "contract": "TokenStaking", + "src": "contracts/staking/TokenStaking.sol:114" + }, + { + "label": "minTStakeAmount", + "offset": 20, + "slot": "51", + "type": "t_uint96", + "contract": "TokenStaking", + "src": "contracts/staking/TokenStaking.sol:115" + }, + { + "label": "authorizationCeiling", + "offset": 0, + "slot": "52", + "type": "t_uint256", + "contract": "TokenStaking", + "src": "contracts/staking/TokenStaking.sol:116" + }, + { + "label": "stakeDiscrepancyPenalty", + "offset": 0, + "slot": "53", + "type": "t_uint96", + "contract": "TokenStaking", + "src": "contracts/staking/TokenStaking.sol:118" + }, + { + "label": "stakeDiscrepancyRewardMultiplier", + "offset": 0, + "slot": "54", + "type": "t_uint256", + "contract": "TokenStaking", + "src": "contracts/staking/TokenStaking.sol:119" + }, + { + "label": "notifiersTreasury", + "offset": 0, + "slot": "55", + "type": "t_uint256", + "contract": "TokenStaking", + "src": "contracts/staking/TokenStaking.sol:121" + }, + { + "label": "notificationReward", + "offset": 0, + "slot": "56", + "type": "t_uint256", + "contract": "TokenStaking", + "src": "contracts/staking/TokenStaking.sol:122" + }, + { + "label": "stakingProviders", + "offset": 0, + "slot": "57", + "type": "t_mapping(t_address,t_struct(StakingProviderInfo)12821_storage)", + "contract": "TokenStaking", + "src": "contracts/staking/TokenStaking.sol:125" + }, + { + "label": "applicationInfo", + "offset": 0, + "slot": "58", + "type": "t_mapping(t_address,t_struct(ApplicationInfo)12832_storage)", + "contract": "TokenStaking", + "src": "contracts/staking/TokenStaking.sol:126" + }, + { + "label": "applications", + "offset": 0, + "slot": "59", + "type": "t_array(t_address)dyn_storage", + "contract": "TokenStaking", + "src": "contracts/staking/TokenStaking.sol:128" + }, + { + "label": "slashingQueue", + "offset": 0, + "slot": "60", + "type": "t_array(t_struct(SlashingEvent)12837_storage)dyn_storage", + "contract": "TokenStaking", + "src": "contracts/staking/TokenStaking.sol:130" + }, + { + "label": "slashingQueueIndex", + "offset": 0, + "slot": "61", + "type": "t_uint256", + "contract": "TokenStaking", + "src": "contracts/staking/TokenStaking.sol:131" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_address_payable": { + "label": "address payable", + "numberOfBytes": "20" + }, + "t_array(t_address)dyn_storage": { + "label": "address[]", + "numberOfBytes": "32" + }, + "t_array(t_struct(SlashingEvent)12837_storage)dyn_storage": { + "label": "struct TokenStaking.SlashingEvent[]", + "numberOfBytes": "32" + }, + "t_array(t_uint128)dyn_storage": { + "label": "uint128[]", + "numberOfBytes": "32" + }, + "t_array(t_uint256)47_storage": { + "label": "uint256[47]", + "numberOfBytes": "1504" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_enum(ApplicationStatus)12798": { + "label": "enum TokenStaking.ApplicationStatus", + "members": [ + "NOT_APPROVED", + "APPROVED", + "PAUSED", + "DISABLED" + ], + "numberOfBytes": "1" + }, + "t_mapping(t_address,t_address)": { + "label": "mapping(address => address)", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_array(t_uint128)dyn_storage)": { + "label": "mapping(address => uint128[])", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_struct(AppAuthorization)12826_storage)": { + "label": "mapping(address => struct TokenStaking.AppAuthorization)", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_struct(ApplicationInfo)12832_storage)": { + "label": "mapping(address => struct TokenStaking.ApplicationInfo)", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_struct(StakingProviderInfo)12821_storage)": { + "label": "mapping(address => struct TokenStaking.StakingProviderInfo)", + "numberOfBytes": "32" + }, + "t_struct(AppAuthorization)12826_storage": { + "label": "struct TokenStaking.AppAuthorization", + "members": [ + { + "label": "authorized", + "type": "t_uint96", + "offset": 0, + "slot": "0" + }, + { + "label": "deauthorizing", + "type": "t_uint96", + "offset": 12, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(ApplicationInfo)12832_storage": { + "label": "struct TokenStaking.ApplicationInfo", + "members": [ + { + "label": "status", + "type": "t_enum(ApplicationStatus)12798", + "offset": 0, + "slot": "0" + }, + { + "label": "panicButton", + "type": "t_address", + "offset": 1, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(SlashingEvent)12837_storage": { + "label": "struct TokenStaking.SlashingEvent", + "members": [ + { + "label": "stakingProvider", + "type": "t_address", + "offset": 0, + "slot": "0" + }, + { + "label": "amount", + "type": "t_uint96", + "offset": 20, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(StakingProviderInfo)12821_storage": { + "label": "struct TokenStaking.StakingProviderInfo", + "members": [ + { + "label": "nuInTStake", + "type": "t_uint96", + "offset": 0, + "slot": "0" + }, + { + "label": "owner", + "type": "t_address", + "offset": 12, + "slot": "0" + }, + { + "label": "keepInTStake", + "type": "t_uint96", + "offset": 0, + "slot": "1" + }, + { + "label": "beneficiary", + "type": "t_address_payable", + "offset": 12, + "slot": "1" + }, + { + "label": "tStake", + "type": "t_uint96", + "offset": 0, + "slot": "2" + }, + { + "label": "authorizer", + "type": "t_address", + "offset": 12, + "slot": "2" + }, + { + "label": "authorizations", + "type": "t_mapping(t_address,t_struct(AppAuthorization)12826_storage)", + "offset": 0, + "slot": "3" + }, + { + "label": "authorizedApplications", + "type": "t_array(t_address)dyn_storage", + "offset": 0, + "slot": "4" + }, + { + "label": "startStakingTimestamp", + "type": "t_uint256", + "offset": 0, + "slot": "5" + } + ], + "numberOfBytes": "192" + }, + "t_uint128": { + "label": "uint128", + "numberOfBytes": "16" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint96": { + "label": "uint96", + "numberOfBytes": "12" + } + } + } } } } diff --git a/.prettierignore b/.prettierignore index 6318f21a..b7675a74 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,3 +1,4 @@ +.openzeppelin/ artifacts/ build/ cache/ diff --git a/deployments/mainnet/.chainId b/deployments/mainnet/.chainId new file mode 100644 index 00000000..56a6051c --- /dev/null +++ b/deployments/mainnet/.chainId @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/deployments/mainnet/KeepStake.json b/deployments/mainnet/KeepStake.json new file mode 100644 index 00000000..5f505920 --- /dev/null +++ b/deployments/mainnet/KeepStake.json @@ -0,0 +1,287 @@ +{ + "address": "0x10DE37cF84202A20cae61069C617B3Aa874aF8b4", + "abi": [ + { + "inputs": [ + { + "internalType": "contract IKeepTokenStaking", + "name": "_keepTokenStaking", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "keepTokenStaking", + "outputs": [ + { + "internalType": "contract IKeepTokenStaking", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "operatorToGrantee", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "operatorToManagedGrant", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "resolveOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "address", + "name": "grantee", + "type": "address" + } + ], + "name": "setGrantee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "address", + "name": "managedGrant", + "type": "address" + } + ], + "name": "setManagedGrant", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xab80a05ee089aa5df29de6c6a5ec00e66c00f7d242623b0650c9ad2619cf6336", + "receipt": { + "to": null, + "from": "0xFfFd7092685bDeeBD121D1A0FEA3c349114Cce50", + "contractAddress": "0x10DE37cF84202A20cae61069C617B3Aa874aF8b4", + "transactionIndex": 164, + "gasUsed": "1355541", + "logsBloom": "0x00000000000000000000000000004000000000000000000000801000000000000000000000000000000000000000000000000000000000000000000000100000000000002000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000020000000000000000000000000800000000000000000000000000000000000000000", + "blockHash": "0xea85285f049f20d12c2ffe1ab62046c1e1eb11110562e040c5d6d8855219016d", + "transactionHash": "0xab80a05ee089aa5df29de6c6a5ec00e66c00f7d242623b0650c9ad2619cf6336", + "logs": [ + { + "transactionIndex": 164, + "blockNumber": 14113763, + "transactionHash": "0xab80a05ee089aa5df29de6c6a5ec00e66c00f7d242623b0650c9ad2619cf6336", + "address": "0x10DE37cF84202A20cae61069C617B3Aa874aF8b4", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000fffd7092685bdeebd121d1a0fea3c349114cce50" + ], + "data": "0x", + "logIndex": 179, + "blockHash": "0xea85285f049f20d12c2ffe1ab62046c1e1eb11110562e040c5d6d8855219016d" + } + ], + "blockNumber": 14113763, + "cumulativeGasUsed": "11865435", + "status": 1, + "byzantium": true + }, + "args": [ + "0x1293a54e160D1cd7075487898d65266081A15458" + ], + "numDeployments": 1, + "solcInputHash": "ecfd0a8dc1d11e9f659c5fce34a455a2", + "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IKeepTokenStaking\",\"name\":\"_keepTokenStaking\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"keepTokenStaking\",\"outputs\":[{\"internalType\":\"contract IKeepTokenStaking\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"operatorToGrantee\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"operatorToManagedGrant\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"resolveOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"grantee\",\"type\":\"address\"}],\"name\":\"setGrantee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"managedGrant\",\"type\":\"address\"}],\"name\":\"setManagedGrant\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"title\":\"KEEP stake owner resolver\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"resolveOwner(address)\":{\"notice\":\"Resolves KEEP stake owner for the provided operator address. Reverts if could not resolve the owner.\"},\"setGrantee(address,address)\":{\"notice\":\"Allows the Governance to set new operator-grantee pair. This function should only be called for non-managed grants if the snapshot does include this pair.\"},\"setManagedGrant(address,address)\":{\"notice\":\"Allows the Governance to set new operator-managed grant pair. This function should only be called for managed grants if the snapshot does include this pair.\"}},\"notice\":\"T network staking contract supports existing KEEP stakes by allowing KEEP stakers to use their stakes in T network and weights them based on KEEP<>T token ratio. KEEP stake owner is cached in T staking contract and used to restrict access to all functions only owner or operator should call. To cache KEEP staking contract in T staking contract, it fitst needs to resolve the owner. Resolving liquid KEEP stake owner is easy. Resolving token grant stake owner is complicated and not possible to do on-chain from a contract external to KEEP TokenStaking contract. Keep TokenStaking knows the grant ID but does not expose it externally. KeepStake contract addresses this problem by exposing operator-owner mappings snapshotted off-chain based on events and information publicly available from KEEP TokenStaking contract and KEEP TokenGrant contract. Additionally, it gives the Governance ability to add new mappings in case they are ever needed; in practice, this will be needed only if someone decides to stake their KEEP token grant in KEEP network after 2021-11-11 when the snapshot was taken. Operator-owner pairs were snapshotted 2021-11-11 in the following way: 1. Fetch all TokenStaking events from KEEP staking contract. 2. Filter out undelegated operators. 3. Filter out canceled delegations. 4. Fetch grant stake information from KEEP TokenGrant for that operator to determine if we are dealing with grant delegation. 5. Fetch grantee address from KEEP TokenGrant contract. 6. Check if we are dealing with ManagedGrant by looking for all created ManagedGrants and comparing their address against grantee address fetched from TokenGrant contract.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/staking/KeepStake.sol\":\"KeepStake\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10},\"remappings\":[]},\"sources\":{\"@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/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\"},\"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/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 staking contract in T staking\\n/// contract, it fitst needs to resolve the owner. Resolving liquid\\n/// KEEP stake owner is easy. Resolving token grant stake owner is\\n/// complicated and not possible to do on-chain from a contract external\\n/// to KEEP TokenStaking contract. Keep TokenStaking knows the grant ID\\n/// 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\":\"0x4ad3a18ebfb9d1b5e189ed4a827e7af96cf14f2b4386c96ca08e940418391a0b\",\"license\":\"GPL-3.0-or-later\"}},\"version\":1}", + "bytecode": "0x60a060405234801561001057600080fd5b506040516117fa3803806117fa83398101604081905261002f91610099565b61003833610049565b6001600160a01b03166080526100c9565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156100ab57600080fd5b81516001600160a01b03811681146100c257600080fd5b9392505050565b6080516117106100ea6000396000818160b6015261028f01526117106000f3fe608060405234801561001057600080fd5b50600436106100835760003560e01c806301f326961461008857806303055815146100b157806310b648cb146100d8578063715018a6146100ed57806384f82c53146100f55780638da5cb5b14610108578063edc6640014610110578063f2fde38b14610139578063f371b2161461014c575b600080fd5b61009b61009636600461161e565b610175565b6040516100a8919061163b565b60405180910390f35b61009b7f000000000000000000000000000000000000000000000000000000000000000081565b6100eb6100e636600461164f565b610375565b005b6100eb6103d2565b6100eb61010336600461164f565b61040d565b61009b61046a565b61009b61011e36600461161e565b6002602052600090815260409020546001600160a01b031681565b6100eb61014736600461161e565b610479565b61009b61015a36600461161e565b6001602052600090815260409020546001600160a01b031681565b6001600160a01b03808216600090815260016020526040812054909116801561021057806001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b1580156101d157600080fd5b505afa1580156101e5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102099190611688565b9392505050565b506001600160a01b038083166000908152600260205260409020541680156102385792915050565b61024183610519565b90506001600160a01b038116156102585792915050565b610261836112b7565b90506001600160a01b038116156102785792915050565b604051630a57ebcf60e11b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906314afd79e906102c490869060040161163b565b60206040518083038186803b1580156102dc57600080fd5b505afa1580156102f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103149190611688565b90506001600160a01b03811661036f5760405162461bcd60e51b815260206004820152601b60248201527a21b7bab632103737ba103932b9b7b63b32903a34329037bbb732b960291b60448201526064015b60405180910390fd5b92915050565b3361037e61046a565b6001600160a01b0316146103a45760405162461bcd60e51b8152600401610366906116a5565b6001600160a01b03918216600090815260016020526040902080546001600160a01b03191691909216179055565b336103db61046a565b6001600160a01b0316146104015760405162461bcd60e51b8152600401610366906116a5565b61040b60006115b9565b565b3361041661046a565b6001600160a01b03161461043c5760405162461bcd60e51b8152600401610366906116a5565b6001600160a01b03918216600090815260026020526040902080546001600160a01b03191691909216179055565b6000546001600160a01b031690565b3361048261046a565b6001600160a01b0316146104a85760405162461bcd60e51b8152600401610366906116a5565b6001600160a01b03811661050d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610366565b610516816115b9565b50565b600073855a951162b1b93d70724484d5bdc9d00b56236b6001600160a01b03831614156105c55773fadbf758307a054c57b365db1de90aca71feafe56001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b505afa1580156105a1573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061036f9190611688565b73f1de9490bf7298b5f350ce74332ad7cf8d5cb1816001600160a01b03831614156106375773aed493aaf3e76e83b29e151848b71ef4544f92f16001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b7339d2acbcd80d80080541c6eed7e9febb8127b2ab6001600160a01b03831614156106a95773a2fa09d6f8c251422f5fde29a0bad1c53defae666001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b73d66cae89ffbc6e50e6b019e45c1aec93dec547816001600160a01b038316141561071b5773306309f9d105f34132db0bfb3ce3f5b0245cd3866001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b732ebe08379f4fd866e871a9b9e1d5c695154c6a9f6001600160a01b038316141561078d5773d00c0d43b747c33726b3f0ff4bda4b72dc53c6e96001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b73a97c34278162b556a527cfc01b53eb4ddedfd2236001600160a01b03831614156107ff5773b3e967355c456b1bd43cb0188a321592d410d0966001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b736c76d49322c9f8761a1623ced89a31490cdb649d6001600160a01b03831614156108715773b3e967355c456b1bd43cb0188a321592d410d0966001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b734a41c7a884d119eaaefe471d0b3a6382264083826001600160a01b03831614156108e35773cdf3d216d82a463ce82971f2f5da3d8f9c5f093a6001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b739c06feb7ebc8065ee11cd5e8eedaafb2909a70876001600160a01b0383161415610955577345119cd98d145283762ba9ebcaea75f72d1887336001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b739bd818ab6acc974f2cf2bd2eba7a250126accb9f6001600160a01b03831614156109c757736e535043377067621954ee84065b0bd7357e7aba6001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b731d803c89760f8b4057db15bcb3b8929e0498d3106001600160a01b0383161415610a395773b3e967355c456b1bd43cb0188a321592d410d0966001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b733101927deec27a2bfa6c4a6316e3a221f631db916001600160a01b0383161415610aab5773178bf1946fed0e2362fdf8bcd3f91f0701a012c66001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b739d9b187e478bc62694a7bed216fc365de87f280c6001600160a01b0383161415610b1d5773fbad17cfad6cb00d726c65501d69fdc13ca5477c6001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b73d977144724bc77faefae219f958ae3947205d0b56001600160a01b0383161415610b8f5773087b442bfd4e42675cf2df5fa566f87d7a96fb126001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b73045e511f53debf55c9c0b4522f14f602f7c7ca816001600160a01b0383161415610c015773fcfe8c036c414a15cf871071c483687095caf7d66001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b733dd301b3c96a282d8092e1e6f6846f24172d45c16001600160a01b0383161415610c735773b5bdd2d9b3541fc8f581af37430d26527e59aef86001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b735d84deb482e770479154028788df79aa7c563aa46001600160a01b0383161415610ce557739d1a179c469a8bdd0b683a9f9250246cc47e8fbe6001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b731df927b69a97e8140315536163c029d188e8573b6001600160a01b0383161415610d575773b5bdd2d9b3541fc8f581af37430d26527e59aef86001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b73617dace069fbd41993491de211b4dfccdacbd3486001600160a01b0383161415610dc95773b5bdd2d9b3541fc8f581af37430d26527e59aef86001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b73650a9ed18df873cad98c88dcac8170531cad23996001600160a01b0383161415610e3b57731df7324a3ad20526dfa02cc803ed2d97cac81f3b6001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b7307c9a8f8264221906b7b8958951ce4753d39628b6001600160a01b0383161415610ead5773305d12b4d70529cd618da7399f5520701e5100416001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b7363eb4c3dd0751f9be7070a01156513c227fa1ef66001600160a01b0383161415610f1f5773306309f9d105f34132db0bfb3ce3f5b0245cd3866001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b73c6349eec31048787676b6297ba71721376a8ddcf6001600160a01b0383161415610f915773ac1a985e75c6a0b475b9c807ad0705a988be2d996001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b733b945f9c0c8737e44f8e887d4f04b5b3a491ac4d6001600160a01b0383161415611003577382e17477726e8d9d2c237745ca9989631582ee986001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b73f35343299a4f80dd5d917bbe5ddd54ebb820ebd46001600160a01b03831614156110755773cc88c15506251b62ccceeba193e100d6bbc9a30d6001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b733b9e5ae72d068448bb96786989c0d86fbc0551d16001600160a01b03831614156110e75773306309f9d105f34132db0bfb3ce3f5b0245cd3866001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b73b2d53be158cb8451dfc818bd969877038c1bdea16001600160a01b03831614156111595773ae55e3800f0a3feafdce535a8c0fab0ffdb90dee6001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b73f6dbf7afe05b8bb6f198ec7e69333c98d3c4608c6001600160a01b03831614156111cb5773bb8d24a20c20625f86739824014c3cbaaab267006001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b73b62fc1adffb2ab832041528c8178358338d85f766001600160a01b038316141561123d57739ed98fd1c29018b9342cb8f57a3073b9695f0c026001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b739bc8d30d971c9e74298112803036c05db07d73e36001600160a01b03831614156112af577366beda757939f8e505b5eb883cd02c8d4a11bca26001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b506000919050565b6000731147ccfb4aefc6e587a23b78724ef20ec6e474d46001600160a01b03831614156112f95750733fb49da4375ef9019f17990d04c6d5dad482d80a919050565b734c21541f95a00c03c75f38c71dc220bd27cbbed96001600160a01b0383161415611339575073c897cfee43a8d827f76d4226994d5ce5ebbe2571919050565b737e6332d18719a5463d3867a1a892359509589a3d6001600160a01b03831614156113795750731578ed833d986c1188d1a998aa5fecd418bef5da919050565b738bd660a764ca14155f3411a4526a028b6316cb3e6001600160a01b03831614156113b9575073f6f372dfaecc1431186598c304e91b79ce115766919050565b734f4f0d0dfd93513b3f4cb116fe9d0a005466f7256001600160a01b03831614156113f95750738b055ac1c4dd287e2a46d4a52d61fe76fb551bd0919050565b731df0250027fec876d8876d1ac7a392c9098f1a1e6001600160a01b0383161415611439575073e408ffa969707ce5d7aa3e5f8d44674fa4b26219919050565b73860ef3f83b6adfef757f98345c3b8ddcfca9d1526001600160a01b038316141561147957507308a3633aab8f3e436dea204288ee26fe094406b0919050565b73e3a2d16da142e6b190a5d9f7e0c07cc460b58a5f6001600160a01b03831614156114b9575073875f8ffcdded63b5d8cf54be4e4b82fe6c6e249c919050565b73bde07f1ca107ef319b0bb26ebf1d0a5b4c97ffc16001600160a01b03831614156114f95750731578ed833d986c1188d1a998aa5fecd418bef5da919050565b73e86181d6b672d78d33e83029ff3d0ef4a601b4c46001600160a01b03831614156115395750731578ed833d986c1188d1a998aa5fecd418bef5da919050565b73b7c561e2069acae2c4480111b1606790bb4e13fe6001600160a01b03831614156115795750731578ed833d986c1188d1a998aa5fecd418bef5da919050565b73526c013f8382b050d32d86e7090ac84de22eda4d6001600160a01b03831614156112af57507361c6e5ddacded540cd08066c08cbc096d22d91f4919050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116811461051657600080fd5b60006020828403121561163057600080fd5b813561020981611609565b6001600160a01b0391909116815260200190565b6000806040838503121561166257600080fd5b823561166d81611609565b9150602083013561167d81611609565b809150509250929050565b60006020828403121561169a57600080fd5b815161020981611609565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260408201526060019056fea2646970667358221220c0ac96c7f48a68918e7d689e73ff0792db6f94354c2b8641f039b4f5ed22036c64736f6c63430008090033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100835760003560e01c806301f326961461008857806303055815146100b157806310b648cb146100d8578063715018a6146100ed57806384f82c53146100f55780638da5cb5b14610108578063edc6640014610110578063f2fde38b14610139578063f371b2161461014c575b600080fd5b61009b61009636600461161e565b610175565b6040516100a8919061163b565b60405180910390f35b61009b7f000000000000000000000000000000000000000000000000000000000000000081565b6100eb6100e636600461164f565b610375565b005b6100eb6103d2565b6100eb61010336600461164f565b61040d565b61009b61046a565b61009b61011e36600461161e565b6002602052600090815260409020546001600160a01b031681565b6100eb61014736600461161e565b610479565b61009b61015a36600461161e565b6001602052600090815260409020546001600160a01b031681565b6001600160a01b03808216600090815260016020526040812054909116801561021057806001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b1580156101d157600080fd5b505afa1580156101e5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102099190611688565b9392505050565b506001600160a01b038083166000908152600260205260409020541680156102385792915050565b61024183610519565b90506001600160a01b038116156102585792915050565b610261836112b7565b90506001600160a01b038116156102785792915050565b604051630a57ebcf60e11b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906314afd79e906102c490869060040161163b565b60206040518083038186803b1580156102dc57600080fd5b505afa1580156102f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103149190611688565b90506001600160a01b03811661036f5760405162461bcd60e51b815260206004820152601b60248201527a21b7bab632103737ba103932b9b7b63b32903a34329037bbb732b960291b60448201526064015b60405180910390fd5b92915050565b3361037e61046a565b6001600160a01b0316146103a45760405162461bcd60e51b8152600401610366906116a5565b6001600160a01b03918216600090815260016020526040902080546001600160a01b03191691909216179055565b336103db61046a565b6001600160a01b0316146104015760405162461bcd60e51b8152600401610366906116a5565b61040b60006115b9565b565b3361041661046a565b6001600160a01b03161461043c5760405162461bcd60e51b8152600401610366906116a5565b6001600160a01b03918216600090815260026020526040902080546001600160a01b03191691909216179055565b6000546001600160a01b031690565b3361048261046a565b6001600160a01b0316146104a85760405162461bcd60e51b8152600401610366906116a5565b6001600160a01b03811661050d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610366565b610516816115b9565b50565b600073855a951162b1b93d70724484d5bdc9d00b56236b6001600160a01b03831614156105c55773fadbf758307a054c57b365db1de90aca71feafe56001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b505afa1580156105a1573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061036f9190611688565b73f1de9490bf7298b5f350ce74332ad7cf8d5cb1816001600160a01b03831614156106375773aed493aaf3e76e83b29e151848b71ef4544f92f16001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b7339d2acbcd80d80080541c6eed7e9febb8127b2ab6001600160a01b03831614156106a95773a2fa09d6f8c251422f5fde29a0bad1c53defae666001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b73d66cae89ffbc6e50e6b019e45c1aec93dec547816001600160a01b038316141561071b5773306309f9d105f34132db0bfb3ce3f5b0245cd3866001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b732ebe08379f4fd866e871a9b9e1d5c695154c6a9f6001600160a01b038316141561078d5773d00c0d43b747c33726b3f0ff4bda4b72dc53c6e96001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b73a97c34278162b556a527cfc01b53eb4ddedfd2236001600160a01b03831614156107ff5773b3e967355c456b1bd43cb0188a321592d410d0966001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b736c76d49322c9f8761a1623ced89a31490cdb649d6001600160a01b03831614156108715773b3e967355c456b1bd43cb0188a321592d410d0966001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b734a41c7a884d119eaaefe471d0b3a6382264083826001600160a01b03831614156108e35773cdf3d216d82a463ce82971f2f5da3d8f9c5f093a6001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b739c06feb7ebc8065ee11cd5e8eedaafb2909a70876001600160a01b0383161415610955577345119cd98d145283762ba9ebcaea75f72d1887336001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b739bd818ab6acc974f2cf2bd2eba7a250126accb9f6001600160a01b03831614156109c757736e535043377067621954ee84065b0bd7357e7aba6001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b731d803c89760f8b4057db15bcb3b8929e0498d3106001600160a01b0383161415610a395773b3e967355c456b1bd43cb0188a321592d410d0966001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b733101927deec27a2bfa6c4a6316e3a221f631db916001600160a01b0383161415610aab5773178bf1946fed0e2362fdf8bcd3f91f0701a012c66001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b739d9b187e478bc62694a7bed216fc365de87f280c6001600160a01b0383161415610b1d5773fbad17cfad6cb00d726c65501d69fdc13ca5477c6001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b73d977144724bc77faefae219f958ae3947205d0b56001600160a01b0383161415610b8f5773087b442bfd4e42675cf2df5fa566f87d7a96fb126001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b73045e511f53debf55c9c0b4522f14f602f7c7ca816001600160a01b0383161415610c015773fcfe8c036c414a15cf871071c483687095caf7d66001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b733dd301b3c96a282d8092e1e6f6846f24172d45c16001600160a01b0383161415610c735773b5bdd2d9b3541fc8f581af37430d26527e59aef86001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b735d84deb482e770479154028788df79aa7c563aa46001600160a01b0383161415610ce557739d1a179c469a8bdd0b683a9f9250246cc47e8fbe6001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b731df927b69a97e8140315536163c029d188e8573b6001600160a01b0383161415610d575773b5bdd2d9b3541fc8f581af37430d26527e59aef86001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b73617dace069fbd41993491de211b4dfccdacbd3486001600160a01b0383161415610dc95773b5bdd2d9b3541fc8f581af37430d26527e59aef86001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b73650a9ed18df873cad98c88dcac8170531cad23996001600160a01b0383161415610e3b57731df7324a3ad20526dfa02cc803ed2d97cac81f3b6001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b7307c9a8f8264221906b7b8958951ce4753d39628b6001600160a01b0383161415610ead5773305d12b4d70529cd618da7399f5520701e5100416001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b7363eb4c3dd0751f9be7070a01156513c227fa1ef66001600160a01b0383161415610f1f5773306309f9d105f34132db0bfb3ce3f5b0245cd3866001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b73c6349eec31048787676b6297ba71721376a8ddcf6001600160a01b0383161415610f915773ac1a985e75c6a0b475b9c807ad0705a988be2d996001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b733b945f9c0c8737e44f8e887d4f04b5b3a491ac4d6001600160a01b0383161415611003577382e17477726e8d9d2c237745ca9989631582ee986001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b73f35343299a4f80dd5d917bbe5ddd54ebb820ebd46001600160a01b03831614156110755773cc88c15506251b62ccceeba193e100d6bbc9a30d6001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b733b9e5ae72d068448bb96786989c0d86fbc0551d16001600160a01b03831614156110e75773306309f9d105f34132db0bfb3ce3f5b0245cd3866001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b73b2d53be158cb8451dfc818bd969877038c1bdea16001600160a01b03831614156111595773ae55e3800f0a3feafdce535a8c0fab0ffdb90dee6001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b73f6dbf7afe05b8bb6f198ec7e69333c98d3c4608c6001600160a01b03831614156111cb5773bb8d24a20c20625f86739824014c3cbaaab267006001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b73b62fc1adffb2ab832041528c8178358338d85f766001600160a01b038316141561123d57739ed98fd1c29018b9342cb8f57a3073b9695f0c026001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b739bc8d30d971c9e74298112803036c05db07d73e36001600160a01b03831614156112af577366beda757939f8e505b5eb883cd02c8d4a11bca26001600160a01b031663d5f520766040518163ffffffff1660e01b815260040160206040518083038186803b15801561058d57600080fd5b506000919050565b6000731147ccfb4aefc6e587a23b78724ef20ec6e474d46001600160a01b03831614156112f95750733fb49da4375ef9019f17990d04c6d5dad482d80a919050565b734c21541f95a00c03c75f38c71dc220bd27cbbed96001600160a01b0383161415611339575073c897cfee43a8d827f76d4226994d5ce5ebbe2571919050565b737e6332d18719a5463d3867a1a892359509589a3d6001600160a01b03831614156113795750731578ed833d986c1188d1a998aa5fecd418bef5da919050565b738bd660a764ca14155f3411a4526a028b6316cb3e6001600160a01b03831614156113b9575073f6f372dfaecc1431186598c304e91b79ce115766919050565b734f4f0d0dfd93513b3f4cb116fe9d0a005466f7256001600160a01b03831614156113f95750738b055ac1c4dd287e2a46d4a52d61fe76fb551bd0919050565b731df0250027fec876d8876d1ac7a392c9098f1a1e6001600160a01b0383161415611439575073e408ffa969707ce5d7aa3e5f8d44674fa4b26219919050565b73860ef3f83b6adfef757f98345c3b8ddcfca9d1526001600160a01b038316141561147957507308a3633aab8f3e436dea204288ee26fe094406b0919050565b73e3a2d16da142e6b190a5d9f7e0c07cc460b58a5f6001600160a01b03831614156114b9575073875f8ffcdded63b5d8cf54be4e4b82fe6c6e249c919050565b73bde07f1ca107ef319b0bb26ebf1d0a5b4c97ffc16001600160a01b03831614156114f95750731578ed833d986c1188d1a998aa5fecd418bef5da919050565b73e86181d6b672d78d33e83029ff3d0ef4a601b4c46001600160a01b03831614156115395750731578ed833d986c1188d1a998aa5fecd418bef5da919050565b73b7c561e2069acae2c4480111b1606790bb4e13fe6001600160a01b03831614156115795750731578ed833d986c1188d1a998aa5fecd418bef5da919050565b73526c013f8382b050d32d86e7090ac84de22eda4d6001600160a01b03831614156112af57507361c6e5ddacded540cd08066c08cbc096d22d91f4919050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116811461051657600080fd5b60006020828403121561163057600080fd5b813561020981611609565b6001600160a01b0391909116815260200190565b6000806040838503121561166257600080fd5b823561166d81611609565b9150602083013561167d81611609565b809150509250929050565b60006020828403121561169a57600080fd5b815161020981611609565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260408201526060019056fea2646970667358221220c0ac96c7f48a68918e7d689e73ff0792db6f94354c2b8641f039b4f5ed22036c64736f6c63430008090033", + "devdoc": { + "kind": "dev", + "methods": { + "owner()": { + "details": "Returns the address of the current owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "title": "KEEP stake owner resolver", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "resolveOwner(address)": { + "notice": "Resolves KEEP stake owner for the provided operator address. Reverts if could not resolve the owner." + }, + "setGrantee(address,address)": { + "notice": "Allows the Governance to set new operator-grantee pair. This function should only be called for non-managed grants if the snapshot does include this pair." + }, + "setManagedGrant(address,address)": { + "notice": "Allows the Governance to set new operator-managed grant pair. This function should only be called for managed grants if the snapshot does include this pair." + } + }, + "notice": "T network staking contract supports existing KEEP stakes by allowing KEEP stakers to use their stakes in T network and weights them based on KEEP<>T token ratio. KEEP stake owner is cached in T staking contract and used to restrict access to all functions only owner or operator should call. To cache KEEP staking contract in T staking contract, it fitst needs to resolve the owner. Resolving liquid KEEP stake owner is easy. Resolving token grant stake owner is complicated and not possible to do on-chain from a contract external to KEEP TokenStaking contract. Keep TokenStaking knows the grant ID but does not expose it externally. KeepStake contract addresses this problem by exposing operator-owner mappings snapshotted off-chain based on events and information publicly available from KEEP TokenStaking contract and KEEP TokenGrant contract. Additionally, it gives the Governance ability to add new mappings in case they are ever needed; in practice, this will be needed only if someone decides to stake their KEEP token grant in KEEP network after 2021-11-11 when the snapshot was taken. Operator-owner pairs were snapshotted 2021-11-11 in the following way: 1. Fetch all TokenStaking events from KEEP staking contract. 2. Filter out undelegated operators. 3. Filter out canceled delegations. 4. Fetch grant stake information from KEEP TokenGrant for that operator to determine if we are dealing with grant delegation. 5. Fetch grantee address from KEEP TokenGrant contract. 6. Check if we are dealing with ManagedGrant by looking for all created ManagedGrants and comparing their address against grantee address fetched from TokenGrant contract.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 1491, + "contract": "contracts/staking/KeepStake.sol:KeepStake", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 11750, + "contract": "contracts/staking/KeepStake.sol:KeepStake", + "label": "operatorToManagedGrant", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_address)" + }, + { + "astId": 11754, + "contract": "contracts/staking/KeepStake.sol:KeepStake", + "label": "operatorToGrantee", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_address,t_address)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_address)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => address)", + "numberOfBytes": "32", + "value": "t_address" + } + } + } +} \ No newline at end of file diff --git a/deployments/mainnet/KeepToken.json b/deployments/mainnet/KeepToken.json new file mode 100644 index 00000000..506d8200 --- /dev/null +++ b/deployments/mainnet/KeepToken.json @@ -0,0 +1,430 @@ +{ + "address": "0x85Eee30c52B0b379b046Fb0F85F4f3Dc3009aFEC", + "abi": [ + { + "inputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "constant": true, + "inputs": [], + "name": "DECIMALS", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "INITIAL_SUPPLY", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "NAME", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "SYMBOL", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_extraData", + "type": "bytes" + } + ], + "name": "approveAndCall", + "outputs": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burnFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } + ], + "numDeployments": 2 +} \ No newline at end of file diff --git a/deployments/mainnet/KeepTokenStaking.json b/deployments/mainnet/KeepTokenStaking.json new file mode 100644 index 00000000..82ffbbe2 --- /dev/null +++ b/deployments/mainnet/KeepTokenStaking.json @@ -0,0 +1,915 @@ +{ + "address": "0x1293a54e160D1cd7075487898d65266081A15458", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ERC20Burnable", + "name": "_token", + "type": "address" + }, + { + "internalType": "contract TokenGrant", + "name": "_tokenGrant", + "type": "address" + }, + { + "internalType": "contract TokenStakingEscrow", + "name": "_escrow", + "type": "address" + }, + { + "internalType": "contract KeepRegistry", + "name": "_registry", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_initializationPeriod", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "lockCreator", + "type": "address" + } + ], + "name": "ExpiredLockReleased", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "lockCreator", + "type": "address" + } + ], + "name": "LockReleased", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "beneficiary", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "authorizer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "OperatorStaked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "RecoveredStake", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "StakeDelegated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "lockCreator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "until", + "type": "uint256" + } + ], + "name": "StakeLocked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "StakeOwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "TokensSeized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "TokensSlashed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newAmount", + "type": "uint256" + } + ], + "name": "TopUpCompleted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "topUp", + "type": "uint256" + } + ], + "name": "TopUpInitiated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "undelegatedAt", + "type": "uint256" + } + ], + "name": "Undelegated", + "type": "event" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + }, + { + "internalType": "address", + "name": "_operatorContract", + "type": "address" + } + ], + "name": "activeStake", + "outputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + }, + { + "internalType": "address", + "name": "_operatorContract", + "type": "address" + } + ], + "name": "authorizeOperatorContract", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + } + ], + "name": "authorizerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "_address", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + } + ], + "name": "beneficiaryOf", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + } + ], + "name": "cancelStake", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "delegatedAuthoritySource", + "type": "address" + } + ], + "name": "claimDelegatedAuthority", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + } + ], + "name": "commitTopUp", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "deployedAt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + }, + { + "internalType": "address", + "name": "_operatorContract", + "type": "address" + } + ], + "name": "eligibleStake", + "outputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "operatorContract", + "type": "address" + } + ], + "name": "getAuthoritySource", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + } + ], + "name": "getDelegationInfo", + "outputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "createdAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "undelegatedAt", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "getLocks", + "outputs": [ + { + "internalType": "address[]", + "name": "creators", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "expirations", + "type": "uint256[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "internalType": "address", + "name": "operatorContract", + "type": "address" + } + ], + "name": "hasMinimumStake", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "initializationPeriod", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "_operatorContract", + "type": "address" + } + ], + "name": "isApprovedOperatorContract", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + }, + { + "internalType": "address", + "name": "_operatorContract", + "type": "address" + } + ], + "name": "isAuthorizedForOperator", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isStakeLocked", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "lockStake", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "minimumStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_extraData", + "type": "bytes" + } + ], + "name": "receiveApproval", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + } + ], + "name": "recoverStake", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "address", + "name": "operatorContract", + "type": "address" + } + ], + "name": "releaseExpiredLock", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "amountToSeize", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardMultiplier", + "type": "uint256" + }, + { + "internalType": "address", + "name": "tattletale", + "type": "address" + }, + { + "internalType": "address[]", + "name": "misbehavedOperators", + "type": "address[]" + } + ], + "name": "seize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "amountToSlash", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "misbehavedOperators", + "type": "address[]" + } + ], + "name": "slash", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferStakeOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + } + ], + "name": "undelegate", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_undelegationTimestamp", + "type": "uint256" + } + ], + "name": "undelegateAt", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "undelegationPeriod", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "unlockStake", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } + ] +} diff --git a/deployments/mainnet/NuCypherStakingEscrow.json b/deployments/mainnet/NuCypherStakingEscrow.json new file mode 100644 index 00000000..eeb4298a --- /dev/null +++ b/deployments/mainnet/NuCypherStakingEscrow.json @@ -0,0 +1,1897 @@ +{ + "address": "0xbbD3C0C794F40c4f993B03F65343aCC6fcfCb2e2", + "abi": [ + { + "inputs": [ + { + "internalType": "contract NuCypherToken", + "name": "_token", + "type": "address" + }, + { + "internalType": "contract PolicyManagerInterface", + "name": "_policyManager", + "type": "address" + }, + { + "internalType": "contract AdjudicatorInterface", + "name": "_adjudicator", + "type": "address" + }, + { + "internalType": "contract WorkLockInterface", + "name": "_workLock", + "type": "address" + }, + { + "internalType": "uint32", + "name": "_genesisHoursPerPeriod", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "_hoursPerPeriod", + "type": "uint32" + }, + { + "internalType": "uint256", + "name": "_issuanceDecayCoefficient", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_lockDurationCoefficient1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_lockDurationCoefficient2", + "type": "uint256" + }, + { + "internalType": "uint16", + "name": "_maximumRewardedPeriods", + "type": "uint16" + }, + { + "internalType": "uint256", + "name": "_firstPhaseTotalSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_firstPhaseMaxIssuance", + "type": "uint256" + }, + { + "internalType": "uint16", + "name": "_minLockedPeriods", + "type": "uint16" + }, + { + "internalType": "uint256", + "name": "_minAllowableLockedTokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_maxAllowableLockedTokens", + "type": "uint256" + }, + { + "internalType": "uint16", + "name": "_minWorkerPeriods", + "type": "uint16" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint16", + "name": "period", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "CommitmentMade", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "periods", + "type": "uint16" + } + ], + "name": "Deposited", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "oldValue", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "lastPeriod", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newValue", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "periods", + "type": "uint16" + } + ], + "name": "Divided", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Donated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "reservedReward", + "type": "uint256" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "firstPeriod", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "periods", + "type": "uint16" + } + ], + "name": "Locked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value1", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value2", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "lastPeriod", + "type": "uint16" + } + ], + "name": "Merged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint16", + "name": "period", + "type": "uint16" + } + ], + "name": "Migrated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint16", + "name": "period", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Minted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "lastPeriod", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "periods", + "type": "uint16" + } + ], + "name": "Prolonged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "reStake", + "type": "bool" + } + ], + "name": "ReStakeSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "penalty", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "investigator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "reward", + "type": "uint256" + } + ], + "name": "Slashed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "snapshotsEnabled", + "type": "bool" + } + ], + "name": "SnapshotSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "testTarget", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "StateVerified", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "UpgradeFinished", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "windDown", + "type": "bool" + } + ], + "name": "WindDownSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Withdrawn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "measureWork", + "type": "bool" + } + ], + "name": "WorkMeasurementSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "worker", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint16", + "name": "startPeriod", + "type": "uint16" + } + ], + "name": "WorkerBonded", + "type": "event" + }, + { + "inputs": [], + "name": "MAX_SUB_STAKES", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "adjudicator", + "outputs": [ + { + "internalType": "contract AdjudicatorInterface", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "balanceHistory", + "outputs": [ + { + "internalType": "uint128", + "name": "", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_worker", + "type": "address" + } + ], + "name": "bondWorker", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "commitToNextPeriod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "currentMintingPeriod", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "currentPeriodSupply", + "outputs": [ + { + "internalType": "uint128", + "name": "", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_staker", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + }, + { + "internalType": "uint16", + "name": "_unlockingDuration", + "type": "uint16" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + } + ], + "name": "depositAndIncrease", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_staker", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + }, + { + "internalType": "uint16", + "name": "_unlockingDuration", + "type": "uint16" + } + ], + "name": "depositFromWorkLock", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_newValue", + "type": "uint256" + }, + { + "internalType": "uint16", + "name": "_additionalDuration", + "type": "uint16" + } + ], + "name": "divideStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + } + ], + "name": "donate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_staker", + "type": "address" + }, + { + "internalType": "uint16", + "name": "_period", + "type": "uint16" + } + ], + "name": "findIndexOfPastDowntime", + "outputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_target", + "type": "address" + } + ], + "name": "finishUpgrade", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "firstPhaseMaxIssuance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "firstPhaseTotalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "genesisSecondsPerPeriod", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_offsetPeriods", + "type": "uint16" + }, + { + "internalType": "uint256", + "name": "_startIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_maxStakers", + "type": "uint256" + } + ], + "name": "getActiveStakers", + "outputs": [ + { + "internalType": "uint256", + "name": "allLockedTokens", + "type": "uint256" + }, + { + "internalType": "uint256[2][]", + "name": "activeStakers", + "type": "uint256[2][]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_staker", + "type": "address" + } + ], + "name": "getAllTokens", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_staker", + "type": "address" + } + ], + "name": "getCompletedWork", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getCurrentPeriod", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_staker", + "type": "address" + } + ], + "name": "getFlags", + "outputs": [ + { + "internalType": "bool", + "name": "windDown", + "type": "bool" + }, + { + "internalType": "bool", + "name": "reStake", + "type": "bool" + }, + { + "internalType": "bool", + "name": "measureWork", + "type": "bool" + }, + { + "internalType": "bool", + "name": "snapshots", + "type": "bool" + }, + { + "internalType": "bool", + "name": "migrated", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_staker", + "type": "address" + } + ], + "name": "getLastCommittedPeriod", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_staker", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + } + ], + "name": "getLastPeriodOfSubStake", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_staker", + "type": "address" + }, + { + "internalType": "uint16", + "name": "_offsetPeriods", + "type": "uint16" + } + ], + "name": "getLockedTokens", + "outputs": [ + { + "internalType": "uint256", + "name": "lockedValue", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_staker", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + } + ], + "name": "getPastDowntime", + "outputs": [ + { + "internalType": "uint16", + "name": "startPeriod", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "endPeriod", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_staker", + "type": "address" + } + ], + "name": "getPastDowntimeLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getReservedReward", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getStakersLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_staker", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + } + ], + "name": "getSubStakeInfo", + "outputs": [ + { + "internalType": "uint16", + "name": "firstPeriod", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "lastPeriod", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "unlockingDuration", + "type": "uint16" + }, + { + "internalType": "uint128", + "name": "lockedValue", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_staker", + "type": "address" + } + ], + "name": "getSubStakesLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_staker", + "type": "address" + } + ], + "name": "getWorkerFromStaker", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_reservedReward", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_sourceOfFunds", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "isOwner", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "isUpgrade", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + }, + { + "internalType": "uint16", + "name": "_unlockingDuration", + "type": "uint16" + } + ], + "name": "lockAndCreate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + } + ], + "name": "lockAndIncrease", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "lockDurationCoefficient1", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lockDurationCoefficient2", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_period", + "type": "uint16" + } + ], + "name": "lockedPerPeriod", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxAllowableLockedTokens", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maximumRewardedPeriods", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_index1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_index2", + "type": "uint256" + } + ], + "name": "mergeStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_staker", + "type": "address" + } + ], + "name": "migrate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "minAllowableLockedTokens", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minLockedPeriods", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minWorkerPeriods", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "mintingCoefficient", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "policyManager", + "outputs": [ + { + "internalType": "contract PolicyManagerInterface", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "previousPeriodSupply", + "outputs": [ + { + "internalType": "uint128", + "name": "", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "previousTarget", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + }, + { + "internalType": "uint16", + "name": "_additionalDuration", + "type": "uint16" + } + ], + "name": "prolongStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_tokenContract", + "type": "address" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "receiveApproval", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_index", + "type": "uint16" + } + ], + "name": "removeUnusedSubStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "secondsPerPeriod", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_reStake", + "type": "bool" + } + ], + "name": "setReStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_enableSnapshots", + "type": "bool" + } + ], + "name": "setSnapshots", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_windDown", + "type": "bool" + } + ], + "name": "setWindDown", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_staker", + "type": "address" + }, + { + "internalType": "bool", + "name": "_measureWork", + "type": "bool" + } + ], + "name": "setWorkMeasurement", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "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": "", + "type": "address" + } + ], + "name": "stakerFromWorker", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "stakerInfo", + "outputs": [ + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint16", + "name": "currentCommittedPeriod", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "nextCommittedPeriod", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "lastCommittedPeriod", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "stub1", + "type": "uint16" + }, + { + "internalType": "uint256", + "name": "completedWork", + "type": "uint256" + }, + { + "internalType": "uint16", + "name": "workerStartPeriod", + "type": "uint16" + }, + { + "internalType": "address", + "name": "worker", + "type": "address" + }, + { + "internalType": "uint256", + "name": "flags", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reservedSlot1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reservedSlot2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reservedSlot3", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reservedSlot4", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reservedSlot5", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "stakers", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "supportsHistory", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "target", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token", + "outputs": [ + { + "internalType": "contract NuCypherToken", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_blockNumber", + "type": "uint256" + } + ], + "name": "totalStakedAt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_blockNumber", + "type": "uint256" + } + ], + "name": "totalStakedForAt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint128", + "name": "", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_testTarget", + "type": "address" + } + ], + "name": "verifyState", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "workLock", + "outputs": [ + { + "internalType": "contract WorkLockInterface", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "numDeployments": 2 +} \ No newline at end of file diff --git a/deployments/mainnet/NuCypherToken.json b/deployments/mainnet/NuCypherToken.json new file mode 100644 index 00000000..ee8cb6f6 --- /dev/null +++ b/deployments/mainnet/NuCypherToken.json @@ -0,0 +1,316 @@ +{ + "address": "0x4fE83213D56308330EC302a8BD641f1d0113A4Cc", + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "_totalSupplyOfTokens", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_extraData", + "type": "bytes" + } + ], + "name": "approveAndCall", + "outputs": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "numDeployments": 2 +} \ No newline at end of file diff --git a/deployments/mainnet/T.json b/deployments/mainnet/T.json new file mode 100644 index 00000000..3c629144 --- /dev/null +++ b/deployments/mainnet/T.json @@ -0,0 +1,1134 @@ +{ + "address": "0xCdF7028ceAB81fA0C6971208e83fa7872994beE5", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "fromDelegate", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "toDelegate", + "type": "address" + } + ], + "name": "DelegateChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "previousBalance", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newBalance", + "type": "uint256" + } + ], + "name": "DelegateVotesChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "DELEGATION_TYPEHASH", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PERMIT_TYPEHASH", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "name": "approveAndCall", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burnFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "cachedChainId", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "cachedDomainSeparator", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint32", + "name": "pos", + "type": "uint32" + } + ], + "name": "checkpoints", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "fromBlock", + "type": "uint32" + }, + { + "internalType": "uint96", + "name": "votes", + "type": "uint96" + } + ], + "internalType": "struct Checkpoints.Checkpoint", + "name": "checkpoint", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "delegatee", + "type": "address" + } + ], + "name": "delegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "signatory", + "type": "address" + }, + { + "internalType": "address", + "name": "delegatee", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "delegateBySig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "delegates", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "blockNumber", + "type": "uint256" + } + ], + "name": "getPastTotalSupply", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "blockNumber", + "type": "uint256" + } + ], + "name": "getPastVotes", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getVotes", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "nonce", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "numCheckpoints", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "recoverERC20", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC721", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "recoverERC721", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xdfc479f92a88c0a7a2148227c0d4c07db077df75ced4b0409465459a6b1a2454", + "receipt": { + "to": null, + "from": "0x123694886DBf5Ac94DDA07135349534536D14cAf", + "contractAddress": "0xCdF7028ceAB81fA0C6971208e83fa7872994beE5", + "transactionIndex": 34, + "gasUsed": "2244990", + "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000800000000000000000000000000000000000000000000000000000400000000000000000000000000000000000001000000000000000000000000000000000000020000000000010000000800000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xbfc68de83f2c428cd0d55861fd2d63b16e3ac3226814788d2782fc52621be0c9", + "transactionHash": "0xdfc479f92a88c0a7a2148227c0d4c07db077df75ced4b0409465459a6b1a2454", + "logs": [ + { + "transactionIndex": 34, + "blockNumber": 13912436, + "transactionHash": "0xdfc479f92a88c0a7a2148227c0d4c07db077df75ced4b0409465459a6b1a2454", + "address": "0xCdF7028ceAB81fA0C6971208e83fa7872994beE5", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000123694886dbf5ac94dda07135349534536d14caf" + ], + "data": "0x", + "logIndex": 21, + "blockHash": "0xbfc68de83f2c428cd0d55861fd2d63b16e3ac3226814788d2782fc52621be0c9" + } + ], + "blockNumber": 13912436, + "cumulativeGasUsed": "3554050", + "status": 1, + "byzantium": true + }, + "args": [], + "solcInputHash": "43eb8b17fe7c2ce0e21167459a2d9d30", + "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"fromDelegate\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"toDelegate\",\"type\":\"address\"}],\"name\":\"DelegateChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegate\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"previousBalance\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newBalance\",\"type\":\"uint256\"}],\"name\":\"DelegateVotesChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DELEGATION_TYPEHASH\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DOMAIN_SEPARATOR\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PERMIT_TYPEHASH\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"approveAndCall\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"burnFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"cachedChainId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"cachedDomainSeparator\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"pos\",\"type\":\"uint32\"}],\"name\":\"checkpoints\",\"outputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"fromBlock\",\"type\":\"uint32\"},{\"internalType\":\"uint96\",\"name\":\"votes\",\"type\":\"uint96\"}],\"internalType\":\"struct Checkpoints.Checkpoint\",\"name\":\"checkpoint\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"delegatee\",\"type\":\"address\"}],\"name\":\"delegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"signatory\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"delegatee\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"delegateBySig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"delegates\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"}],\"name\":\"getPastTotalSupply\",\"outputs\":[{\"internalType\":\"uint96\",\"name\":\"\",\"type\":\"uint96\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"}],\"name\":\"getPastVotes\",\"outputs\":[{\"internalType\":\"uint96\",\"name\":\"\",\"type\":\"uint96\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getVotes\",\"outputs\":[{\"internalType\":\"uint96\",\"name\":\"\",\"type\":\"uint96\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"mint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"nonce\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"numCheckpoints\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"permit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"recoverERC20\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC721\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"recoverERC721\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"By default, token balance does not account for voting power. This makes transfers cheaper. The downside is that it requires users to delegate to themselves to activate checkpoints and have their voting power tracked.\",\"kind\":\"dev\",\"methods\":{\"approve(address,uint256)\":{\"details\":\"If the `amount` is set to `type(uint256).max` then `transferFrom` and `burnFrom` will not reduce an allowance. Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\",\"returns\":{\"_0\":\"True if the operation succeeded.\"}},\"approveAndCall(address,uint256,bytes)\":{\"details\":\"If the `amount` is set to `type(uint256).max` then `transferFrom` and `burnFrom` will not reduce an allowance.\",\"returns\":{\"_0\":\"True if both approval and `receiveApproval` calls succeeded.\"}},\"burn(uint256)\":{\"details\":\"Requirements: - the caller must have a balance of at least `amount`.\"},\"burnFrom(address,uint256)\":{\"details\":\"Requirements: - `account` must have a balance of at least `amount`, - the caller must have allowance for `account`'s tokens of at least `amount`.\"},\"delegate(address)\":{\"params\":{\"delegatee\":\"The address to delegate votes to\"}},\"delegateBySig(address,address,uint256,uint8,bytes32,bytes32)\":{\"params\":{\"deadline\":\"The time at which to expire the signature\",\"delegatee\":\"The address to delegate votes to\",\"r\":\"Half of the ECDSA signature pair\",\"s\":\"Half of the ECDSA signature pair\",\"v\":\"The recovery byte of the signature\"}},\"getPastTotalSupply(uint256)\":{\"details\":\"`blockNumber` must have been already mined\",\"params\":{\"blockNumber\":\"The block number to get the total supply at\"}},\"getPastVotes(address,uint256)\":{\"details\":\"Block number must be a finalized block or else this function will revert to prevent misinformation.\",\"params\":{\"account\":\"The address of the account to check\",\"blockNumber\":\"The block number to get the vote balance at\"},\"returns\":{\"_0\":\"The number of votes the account had as of the given block\"}},\"getVotes(address)\":{\"params\":{\"account\":\"The address to get votes balance\"},\"returns\":{\"_0\":\"The number of current votes for `account`\"}},\"mint(address,uint256)\":{\"details\":\"Requirements: - `recipient` cannot be the zero address.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"permit(address,address,uint256,uint256,uint8,bytes32,bytes32)\":{\"details\":\"The deadline argument can be set to `type(uint256).max to create permits that effectively never expire. If the `amount` is set to `type(uint256).max` then `transferFrom` and `burnFrom` will not reduce an allowance.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transfer(address,uint256)\":{\"details\":\"Requirements: - `recipient` cannot be the zero address, - the caller must have a balance of at least `amount`.\",\"returns\":{\"_0\":\"True if the operation succeeded, reverts otherwise.\"}},\"transferFrom(address,address,uint256)\":{\"details\":\"Requirements: - `spender` and `recipient` cannot be the zero address, - `spender` must have a balance of at least `amount`, - the caller must have allowance for `spender`'s tokens of at least `amount`.\",\"returns\":{\"_0\":\"True if the operation succeeded, reverts otherwise.\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"title\":\"T token\",\"version\":1},\"userdoc\":{\"events\":{\"DelegateChanged(address,address,address)\":{\"notice\":\"Emitted when an account changes their delegate.\"},\"DelegateVotesChanged(address,uint256,uint256)\":{\"notice\":\"Emitted when a balance or delegate change results in changes to an account's voting power.\"}},\"kind\":\"user\",\"methods\":{\"DELEGATION_TYPEHASH()\":{\"notice\":\"The EIP-712 typehash for the delegation struct used by `delegateBySig`.\"},\"DOMAIN_SEPARATOR()\":{\"notice\":\"Returns hash of EIP712 Domain struct with the token name as a signing domain and token contract as a verifying contract. Used to construct EIP2612 signature provided to `permit` function.\"},\"PERMIT_TYPEHASH()\":{\"notice\":\"Returns EIP2612 Permit message hash. Used to construct EIP2612 signature provided to `permit` function.\"},\"allowance(address,address)\":{\"notice\":\"The remaining number of tokens that spender will be allowed to spend on behalf of owner through `transferFrom` and `burnFrom`. This is zero by default.\"},\"approve(address,uint256)\":{\"notice\":\"Sets `amount` as the allowance of `spender` over the caller's tokens.\"},\"approveAndCall(address,uint256,bytes)\":{\"notice\":\"Calls `receiveApproval` function on spender previously approving the spender to withdraw from the caller multiple times, up to the `amount` amount. If this function is called again, it overwrites the current allowance with `amount`. Reverts if the approval reverted or if `receiveApproval` call on the spender reverted.\"},\"balanceOf(address)\":{\"notice\":\"The amount of tokens owned by the given account.\"},\"burn(uint256)\":{\"notice\":\"Destroys `amount` tokens from the caller.\"},\"burnFrom(address,uint256)\":{\"notice\":\"Destroys `amount` of tokens from `account` using the allowance mechanism. `amount` is then deducted from the caller's allowance unless the allowance was made for `type(uint256).max`.\"},\"decimals()\":{\"notice\":\"The decimals places of the token.\"},\"delegate(address)\":{\"notice\":\"Delegate votes from `msg.sender` to `delegatee`.\"},\"delegateBySig(address,address,uint256,uint8,bytes32,bytes32)\":{\"notice\":\"Delegates votes from signatory to `delegatee`\"},\"delegates(address)\":{\"notice\":\"Get the address `account` is currently delegating to.\"},\"getPastTotalSupply(uint256)\":{\"notice\":\"Retrieve the `totalSupply` at the end of `blockNumber`. Note, this value is the sum of all balances, but it is NOT the sum of all the delegated votes!\"},\"getPastVotes(address,uint256)\":{\"notice\":\"Determine the prior number of votes for an account as of a block number.\"},\"getVotes(address)\":{\"notice\":\"Gets the current votes balance for `account`.\"},\"mint(address,uint256)\":{\"notice\":\"Creates `amount` tokens and assigns them to `account`, increasing the total supply.\"},\"name()\":{\"notice\":\"The name of the token.\"},\"nonce(address)\":{\"notice\":\"Returns the current nonce for EIP2612 permission for the provided token owner for a replay protection. Used to construct EIP2612 signature provided to `permit` function.\"},\"numCheckpoints(address)\":{\"notice\":\"Get number of checkpoints for `account`.\"},\"permit(address,address,uint256,uint256,uint8,bytes32,bytes32)\":{\"notice\":\"EIP2612 approval made with secp256k1 signature. Users can authorize a transfer of their tokens with a signature conforming EIP712 standard, rather than an on-chain transaction from their address. Anyone can submit this signature on the user's behalf by calling the permit function, paying gas fees, and possibly performing other actions in the same transaction.\"},\"symbol()\":{\"notice\":\"The symbol of the token.\"},\"totalSupply()\":{\"notice\":\"The amount of tokens in existence.\"},\"transfer(address,uint256)\":{\"notice\":\"Moves `amount` tokens from the caller's account to `recipient`.\"},\"transferFrom(address,address,uint256)\":{\"notice\":\"Moves `amount` tokens from `spender` to `recipient` using the allowance mechanism. `amount` is then deducted from the caller's allowance unless the allowance was made for `type(uint256).max`.\"}},\"notice\":\"Threshold Network T token\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/token/T.sol\":\"T\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.0 (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev 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\":\"0xa1b27b3f44ff825974e5268e8f63ad3b03add5b464880d860fbb8cae043e17f7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.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 `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, 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 `sender` to `recipient` 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 sender,\\n address recipient,\\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\":\"0xc1452b054778f1926419196ef12ae200758a4ee728df69ae1cd13e5c16ca7df7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.0 (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\":\"0x842c66d5965ed0bf77f274732c2a93a7e2223d53171ec9cccc473bde75104ead\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.0 (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\":\"0x671741933530f343f023a40e58e61bc09d62494b96c6f3e39e647f315facd519\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.0 (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, 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\":\"0x872ba21af7c1f0ae04a715beca31e8fcac764d6c8762940b0fe1bfb6ed8e86f4\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.0 (utils/Address.sol)\\n\\npragma solidity ^0.8.0;\\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 function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n assembly {\\n size := extcodesize(account)\\n }\\n return size > 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\":\"0x9944d1038f27dcebff810d7ba16b3b8058b967173d76874fb72dd7cd84129656\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.0 (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\":\"0x7736c187e6f1358c1ea9350a2a21aa8528dec1c2f43b374a9067465a3a51f5d3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.0 (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n}\\n\",\"keccak256\":\"0x5fa25f305839292fab713256214f2868e0257d29826b14282bbd7f1e34f5af38\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.0 (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n } else if (error == RecoverError.InvalidSignatureV) {\\n revert(\\\"ECDSA: invalid signature 'v' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n // Check the signature length\\n // - case 65: r,s,v signature (standard)\\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else if (signature.length == 64) {\\n bytes32 r;\\n bytes32 vs;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n assembly {\\n r := mload(add(signature, 0x20))\\n vs := mload(add(signature, 0x40))\\n }\\n return tryRecover(hash, r, vs);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s;\\n uint8 v;\\n assembly {\\n s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)\\n v := add(shr(255, vs), 27)\\n }\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n if (v != 27 && v != 28) {\\n return (address(0), RecoverError.InvalidSignatureV);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0x594efd2fa154f4fbe0fa92c2356cb2a9531ef3902e35784c2bc69764d0d8886a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.0 (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\":\"0x6aa521718bf139b44ce56f194f6aea1d590cacef995b5a84703fb1579fa49be9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.0 (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n /**\\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\":\"0xe936fc79332de2ca7b1c06a70f81345aa2466958aab00f463e312ca0585e85cf\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.0 (utils/math/SafeCast.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\\n * checks.\\n *\\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\\n * easily result in undesired exploitation or bugs, since developers usually\\n * assume that overflows raise errors. `SafeCast` restores this intuition by\\n * reverting the transaction when such an operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n *\\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\\n * all math on `uint256` and `int256` and then downcasting.\\n */\\nlibrary 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\":\"0x47c0131bd8a972c31596958aa86752ea18d60e33f1cd94d412b9e29fd6ab25a6\",\"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/utils/cryptography/ECDSA.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/math/Math.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/math/SafeCast.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.\\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 /// @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 SafeCast.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 SafeCast.toUint96(newWeight)\\n );\\n return (oldWeight, newWeight);\\n }\\n }\\n\\n ckpts.push(\\n encodeCheckpoint(\\n SafeCast.toUint32(block.number),\\n SafeCast.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 = Math.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\":\"0x25f420d34548648aa59703bccdad450815da5c9e18adf575845a659f0945d131\",\"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/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\"}},\"version\":1}", + "bytecode": "0x60c06040523480156200001157600080fd5b506040518060400160405280601781526020017f5468726573686f6c64204e6574776f726b20546f6b656e000000000000000000815250604051806040016040528060018152602001601560fa1b8152506200007c62000076620000c260201b60201c565b620000c6565b815162000091906005906020850190620001c7565b508051620000a7906006906020840190620001c7565b5046608052620000b662000116565b60a052506200034e9050565b3390565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60056040516200014a9190620002aa565b60408051918290038220828201825260018352603160f81b6020938401528151928301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b828054620001d5906200026d565b90600052602060002090601f016020900481019282620001f9576000855562000244565b82601f106200021457805160ff191683800117855562000244565b8280016001018555821562000244579182015b828111156200024457825182559160200191906001019062000227565b506200025292915062000256565b5090565b5b8082111562000252576000815560010162000257565b600181811c908216806200028257607f821691505b60208210811415620002a457634e487b7160e01b600052602260045260246000fd5b50919050565b600080835481600182811c915080831680620002c757607f831692505b6020808410821415620002e857634e487b7160e01b86526022600452602486fd5b818015620002ff5760018114620003115762000340565b60ff1986168952848901965062000340565b60008a81526020902060005b86811015620003385781548b8201529085019083016200031d565b505084890196505b509498975050505050505050565b60805160a05161262d620003826000396000818161042301526106f501526000818161038d01526106cc015261262d6000f3fe608060405234801561001057600080fd5b50600436106101bb5760003560e01c8063715018a6116100fa578063b20d7fa91161009d578063b20d7fa91461040b578063b4f94b2e1461041e578063cae9ca5114610445578063d505accf14610458578063dd62ed3e1461046b578063e7a324dc14610496578063f1127ed8146104bd578063f2fde38b146104fa578063fc4e51f61461050d57600080fd5b8063715018a614610380578063771da5c51461038857806379cc6790146103af5780638da5cb5b146103c25780638e539e8c146103ca57806395d89b41146103dd5780639ab24eb0146103e5578063a9059cbb146103f857600080fd5b80633a46b1a8116101625780633a46b1a81461028957806340c10f19146102b457806342966c68146102c7578063587cde1e146102da5780635c19a95c146103055780636fcfff451461031857806370a082311461034057806370ae92d21461036057600080fd5b806306fdde03146101c0578063095ea7b3146101de5780631171bda91461020157806318160ddd1461021657806323b872dd1461022d57806330adf81f14610240578063313ce567146102675780633644e51514610281575b600080fd5b6101c8610520565b6040516101d59190611f0c565b60405180910390f35b6101f16101ec366004611f34565b6105ae565b60405190151581526020016101d5565b61021461020f366004611f60565b6105c4565b005b61021f60045481565b6040519081526020016101d5565b6101f161023b366004611f60565b610615565b61021f7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b61026f601281565b60405160ff90911681526020016101d5565b61021f6106c8565b61029c610297366004611f34565b610724565b6040516001600160601b0390911681526020016101d5565b6102146102c2366004611f34565b610746565b6102146102d5366004611fa1565b610849565b6102ed6102e8366004611fba565b610856565b6040516001600160a01b0390911681526020016101d5565b610214610313366004611fba565b610874565b61032b610326366004611fba565b61087e565b60405163ffffffff90911681526020016101d5565b61021f61034e366004611fba565b60016020526000908152604090205481565b61021f61036e366004611fba565b60036020526000908152604090205481565b6102146108a6565b61021f7f000000000000000000000000000000000000000000000000000000000000000081565b6102146103bd366004611f34565b6108e1565b6102ed610977565b61029c6103d8366004611fa1565b610986565b6101c8610993565b61029c6103f3366004611fba565b6109a0565b6101f1610406366004611f34565b610a30565b610214610419366004611fed565b610a3d565b61021f7f000000000000000000000000000000000000000000000000000000000000000081565b6101f1610453366004612066565b610c6a565b610214610466366004612133565b610cf2565b61021f6104793660046121a1565b600260209081526000928352604080842090915290825290205481565b61021f7f76995fe87be88484696cfd6792aeb71e0b61f81dfa3b641e5adffa38a0d3b8e281565b6104d06104cb3660046121da565b610f2c565b60408051825163ffffffff1681526020928301516001600160601b031692810192909252016101d5565b610214610508366004611fba565b610fd8565b61021461051b366004612211565b611075565b6005805461052d906122b0565b80601f0160208091040260200160405190810160405280929190818152602001828054610559906122b0565b80156105a65780601f1061057b576101008083540402835291602001916105a6565b820191906000526020600020905b81548152906001019060200180831161058957829003601f168201915b505050505081565b60006105bb338484611106565b50600192915050565b336105cd610977565b6001600160a01b0316146105fc5760405162461bcd60e51b81526004016105f3906122eb565b60405180910390fd5b6106106001600160a01b0384168383611214565b505050565b6001600160a01b038316600090815260026020908152604080832033845290915281205460001981146106b0578281101561069c5760405162461bcd60e51b815260206004820152602160248201527f5472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636044820152606560f81b60648201526084016105f3565b6106b085336106ab8685612336565b611106565b6106bb858585611266565b60019150505b9392505050565b60007f000000000000000000000000000000000000000000000000000000000000000046141561071757507f000000000000000000000000000000000000000000000000000000000000000090565b61071f611467565b905090565b6001600160a01b03821660009081526008602052604081206106c19083611516565b3361074f610977565b6001600160a01b0316146107755760405162461bcd60e51b81526004016105f3906122eb565b6001600160a01b0382166107c65760405162461bcd60e51b81526020600482015260186024820152774d696e7420746f20746865207a65726f206164647265737360401b60448201526064016105f3565b6107d260008383611611565b80600460008282546107e4919061234d565b90915550506001600160a01b0382166000908152600160205260408120805483929061081190849061234d565b90915550506040518181526001600160a01b038316906000906000805160206125d88339815191529060200160405180910390a35050565b61085333826116fd565b50565b6001600160a01b039081166000908152600760205260409020541690565b61085333826117db565b6001600160a01b0381166000908152600860205260408120546108a09061187d565b92915050565b336108af610977565b6001600160a01b0316146108d55760405162461bcd60e51b81526004016105f3906122eb565b6108df60006118e6565b565b6001600160a01b0382166000908152600260209081526040808320338452909152902054600019811461096d578181101561095e5760405162461bcd60e51b815260206004820152601d60248201527f4275726e20616d6f756e74206578636565647320616c6c6f77616e636500000060448201526064016105f3565b61096d83336106ab8585612336565b61061083836116fd565b6000546001600160a01b031690565b60006108a0600983611516565b6006805461052d906122b0565b6001600160a01b0381166000908152600860205260408120548015610a27576001600160a01b0383166000908152600860205260409020610a22906109e6600184612336565b815481106109f6576109f6612365565b90600052602060002090600291828204019190066010029054906101000a90046001600160801b031690565b6106c1565b60009392505050565b60006105bb338484611266565b42841015610a825760405162461bcd60e51b815260206004820152601260248201527111195b1959d85d1a5bdb88195e1c1a5c995960721b60448201526064016105f3565b6fa2a8918ca85bafe22016d0b997e4df60600160ff1b03811115610ab85760405162461bcd60e51b81526004016105f39061237b565b8260ff16601b1480610acd57508260ff16601c145b610ae95760405162461bcd60e51b81526004016105f3906123b2565b6000610af36106c8565b6001600160a01b038816600090815260036020526040812080547f76995fe87be88484696cfd6792aeb71e0b61f81dfa3b641e5adffa38a0d3b8e2928a9290610b3b836123e9565b9190505588604051602001610b7294939291909384526001600160a01b039290921660208401526040830152606082015260800190565b60405160208183030381529060405280519060200120604051602001610b99929190612404565b60408051601f198184030181528282528051602091820120600080855291840180845281905260ff88169284019290925260608301869052608083018590529092509060019060a0016020604051602081039080840390855afa158015610c04573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811615801590610c3a5750876001600160a01b0316816001600160a01b0316145b610c565760405162461bcd60e51b81526004016105f39061241f565b610c6088886117db565b5050505050505050565b6000610c7684846105ae565b15610ce857604051638f4ffcb160e01b81526001600160a01b03851690638f4ffcb190610cad90339087903090889060040161244a565b600060405180830381600087803b158015610cc757600080fd5b505af1158015610cdb573d6000803e3d6000fd5b50505050600190506106c1565b5060009392505050565b42841015610d375760405162461bcd60e51b815260206004820152601260248201527114195c9b5a5cdcda5bdb88195e1c1a5c995960721b60448201526064016105f3565b6fa2a8918ca85bafe22016d0b997e4df60600160ff1b03811115610d6d5760405162461bcd60e51b81526004016105f39061237b565b8260ff16601b1480610d8257508260ff16601c145b610d9e5760405162461bcd60e51b81526004016105f3906123b2565b6000610da86106c8565b6001600160a01b038916600090815260036020526040812080547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9928c928c928c92909190610df6836123e9565b909155506040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810187905260e00160405160208183030381529060405280519060200120604051602001610e59929190612404565b60408051601f198184030181528282528051602091820120600080855291840180845281905260ff88169284019290925260608301869052608083018590529092509060019060a0016020604051602081039080840390855afa158015610ec4573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811615801590610efa5750886001600160a01b0316816001600160a01b0316145b610f165760405162461bcd60e51b81526004016105f39061241f565b610f21898989611106565b505050505050505050565b60408051808201909152600080825260208201526001600160a01b038316600090815260086020526040812080548291610fad9163ffffffff8716908110610f7657610f76612365565b90600052602060002090600291828204019190066010029054906101000a90046001600160801b031663ffffffff606082901c1691565b6040805180820190915263ffffffff90921682526001600160601b0316602082015295945050505050565b33610fe1610977565b6001600160a01b0316146110075760405162461bcd60e51b81526004016105f3906122eb565b6001600160a01b03811661106c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f3565b610853816118e6565b3361107e610977565b6001600160a01b0316146110a45760405162461bcd60e51b81526004016105f3906122eb565b604051635c46a7ef60e11b81526001600160a01b0386169063b88d4fde906110d89030908890889088908890600401612487565b600060405180830381600087803b1580156110f257600080fd5b505af1158015610f21573d6000803e3d6000fd5b6001600160a01b03831661115c5760405162461bcd60e51b815260206004820152601d60248201527f417070726f76652066726f6d20746865207a65726f206164647265737300000060448201526064016105f3565b6001600160a01b0382166111b25760405162461bcd60e51b815260206004820152601b60248201527f417070726f766520746f20746865207a65726f2061646472657373000000000060448201526064016105f3565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610610908490611936565b6001600160a01b0383166112bc5760405162461bcd60e51b815260206004820152601e60248201527f5472616e736665722066726f6d20746865207a65726f2061646472657373000060448201526064016105f3565b6001600160a01b0382166113125760405162461bcd60e51b815260206004820152601c60248201527f5472616e7366657220746f20746865207a65726f20616464726573730000000060448201526064016105f3565b6001600160a01b03821630141561136b5760405162461bcd60e51b815260206004820152601d60248201527f5472616e7366657220746f2074686520746f6b656e206164647265737300000060448201526064016105f3565b611376838383611611565b6001600160a01b038316600090815260016020526040902054818110156113df5760405162461bcd60e51b815260206004820152601f60248201527f5472616e7366657220616d6f756e7420657863656564732062616c616e63650060448201526064016105f3565b6113e98282612336565b6001600160a01b03808616600090815260016020526040808220939093559085168152908120805484929061141f90849061234d565b92505081905550826001600160a01b0316846001600160a01b03166000805160206125d88339815191528460405161145991815260200190565b60405180910390a350505050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f600560405161149991906124db565b60408051918290038220828201825260018352603160f81b6020938401528151928301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b60004382106115625760405162461bcd60e51b8152602060048201526018602482015277109b1bd8dac81b9bdd081e595d0819195d195c9b5a5b995960421b60448201526064016105f3565b825460005b818110156115eb57600061157b8284611a08565b905060006115be87838154811061159457611594612365565b6000918252602090912060028204015463ffffffff60019092166010026101000a900460601c1690565b9050858163ffffffff1611156115d6578193506115e4565b6115e182600161234d565b92505b5050611567565b811561160557611600856109e6600185612336565b611608565b60005b95945050505050565b600061161c82611a23565b90506001600160a01b0384166116ab576004546001600160601b039061164390849061234d565b11156116915760405162461bcd60e51b815260206004820152601d60248201527f4d6178696d756d20746f74616c20737570706c7920657863656564656400000060448201526064016105f3565b6116a86009611a8b836001600160601b0316611a97565b50505b6001600160a01b0383166116d3576116d06009611bf3836001600160601b0316611a97565b50505b6116f76116df85610856565b6116e885610856565b836001600160601b0316611bff565b50505050565b6001600160a01b038216600090815260016020526040902054818110156117665760405162461bcd60e51b815260206004820152601b60248201527f4275726e20616d6f756e7420657863656564732062616c616e6365000000000060448201526064016105f3565b61177283600084611611565b61177c8282612336565b6001600160a01b038416600090815260016020526040812091909155600480548492906117aa908490612336565b90915550506040518281526000906001600160a01b038516906000805160206125d883398151915290602001611207565b60006117e683610856565b6001600160a01b0384166000908152600160205260408120549192509061180c90611a23565b6001600160a01b0385811660008181526007602052604080822080546001600160a01b031916898616908117909155905194955093928616927f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a46116f78284836001600160601b0316611bff565b600063ffffffff8211156118e25760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201526532206269747360d01b60648201526084016105f3565b5090565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600061198b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611d3c9092919063ffffffff16565b80519091501561061057808060200190518101906119a99190612577565b6106105760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016105f3565b6000611a176002848418612599565b6106c19084841661234d565b60006001600160601b038211156118e25760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203960448201526536206269747360d01b60648201526084016105f3565b60006106c1828461234d565b825460009081908015611ab857611ab3866109e6600184612336565b611abb565b60005b6001600160601b03169250611ad483858763ffffffff16565b91508015611b94576000611afd87611aed600185612336565b8154811061159457611594612365565b9050438163ffffffff161415611b9257611b3681611b1a85611a23565b6001600160601b031660609190911b63ffffffff60601b161790565b87611b42600185612336565b81548110611b5257611b52612365565b90600052602060002090600291828204019190066010026101000a8154816001600160801b0302191690836001600160801b031602179055505050611beb565b505b85611baa611ba14361187d565b611b1a85611a23565b81546001818101845560009384526020909320600282040180546001600160801b03938416601093909516929092026101000a938402929093021916179055505b935093915050565b60006106c18284612336565b816001600160a01b0316836001600160a01b031614158015611c215750600081115b15610610576001600160a01b03831615611caf576001600160a01b03831660009081526008602052604081208190611c5c90611bf385611a97565b91509150846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248383604051611ca4929190918252602082015260400190565b60405180910390a250505b6001600160a01b03821615610610576001600160a01b03821660009081526008602052604081208190611ce590611a8b85611a97565b91509150836001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248383604051611d2d929190918252602082015260400190565b60405180910390a25050505050565b6060611d4b8484600085611d53565b949350505050565b606082471015611db45760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016105f3565b843b611e025760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105f3565b600080866001600160a01b03168587604051611e1e91906125bb565b60006040518083038185875af1925050503d8060008114611e5b576040519150601f19603f3d011682016040523d82523d6000602084013e611e60565b606091505b5091509150611e70828286611e7b565b979650505050505050565b60608315611e8a5750816106c1565b825115611e9a5782518084602001fd5b8160405162461bcd60e51b81526004016105f39190611f0c565b60005b83811015611ecf578181015183820152602001611eb7565b838111156116f75750506000910152565b60008151808452611ef8816020860160208601611eb4565b601f01601f19169290920160200192915050565b6020815260006106c16020830184611ee0565b6001600160a01b038116811461085357600080fd5b60008060408385031215611f4757600080fd5b8235611f5281611f1f565b946020939093013593505050565b600080600060608486031215611f7557600080fd5b8335611f8081611f1f565b92506020840135611f9081611f1f565b929592945050506040919091013590565b600060208284031215611fb357600080fd5b5035919050565b600060208284031215611fcc57600080fd5b81356106c181611f1f565b803560ff81168114611fe857600080fd5b919050565b60008060008060008060c0878903121561200657600080fd5b863561201181611f1f565b9550602087013561202181611f1f565b94506040870135935061203660608801611fd7565b92506080870135915060a087013590509295509295509295565b634e487b7160e01b600052604160045260246000fd5b60008060006060848603121561207b57600080fd5b833561208681611f1f565b925060208401359150604084013567ffffffffffffffff808211156120aa57600080fd5b818601915086601f8301126120be57600080fd5b8135818111156120d0576120d0612050565b604051601f8201601f19908116603f011681019083821181831017156120f8576120f8612050565b8160405282815289602084870101111561211157600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b600080600080600080600060e0888a03121561214e57600080fd5b873561215981611f1f565b9650602088013561216981611f1f565b9550604088013594506060880135935061218560808901611fd7565b925060a0880135915060c0880135905092959891949750929550565b600080604083850312156121b457600080fd5b82356121bf81611f1f565b915060208301356121cf81611f1f565b809150509250929050565b600080604083850312156121ed57600080fd5b82356121f881611f1f565b9150602083013563ffffffff811681146121cf57600080fd5b60008060008060006080868803121561222957600080fd5b853561223481611f1f565b9450602086013561224481611f1f565b935060408601359250606086013567ffffffffffffffff8082111561226857600080fd5b818801915088601f83011261227c57600080fd5b81358181111561228b57600080fd5b89602082850101111561229d57600080fd5b9699959850939650602001949392505050565b600181811c908216806122c457607f821691505b602082108114156122e557634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b60008282101561234857612348612320565b500390565b6000821982111561236057612360612320565b500190565b634e487b7160e01b600052603260045260246000fd5b6020808252601b908201527f496e76616c6964207369676e6174757265202773272076616c75650000000000604082015260600190565b6020808252601b908201527f496e76616c6964207369676e6174757265202776272076616c75650000000000604082015260600190565b60006000198214156123fd576123fd612320565b5060010190565b61190160f01b81526002810192909252602282015260420190565b602080825260119082015270496e76616c6964207369676e617475726560781b604082015260600190565b6001600160a01b038581168252602082018590528316604082015260806060820181905260009061247d90830184611ee0565b9695505050505050565b6001600160a01b038681168252851660208201526040810184905260806060820181905281018290526000828460a0840137600060a0848401015260a0601f19601f85011683010190509695505050505050565b600080835481600182811c9150808316806124f757607f831692505b602080841082141561251757634e487b7160e01b86526022600452602486fd5b81801561252b576001811461253c57612569565b60ff19861689528489019650612569565b60008a81526020902060005b868110156125615781548b820152908501908301612548565b505084890196505b509498975050505050505050565b60006020828403121561258957600080fd5b815180151581146106c157600080fd5b6000826125b657634e487b7160e01b600052601260045260246000fd5b500490565b600082516125cd818460208701611eb4565b919091019291505056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212207eecbfb333a500c574d750bd13d9d3944c632e0e6cfefb9d5262bd9cbb14fb8364736f6c63430008090033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101bb5760003560e01c8063715018a6116100fa578063b20d7fa91161009d578063b20d7fa91461040b578063b4f94b2e1461041e578063cae9ca5114610445578063d505accf14610458578063dd62ed3e1461046b578063e7a324dc14610496578063f1127ed8146104bd578063f2fde38b146104fa578063fc4e51f61461050d57600080fd5b8063715018a614610380578063771da5c51461038857806379cc6790146103af5780638da5cb5b146103c25780638e539e8c146103ca57806395d89b41146103dd5780639ab24eb0146103e5578063a9059cbb146103f857600080fd5b80633a46b1a8116101625780633a46b1a81461028957806340c10f19146102b457806342966c68146102c7578063587cde1e146102da5780635c19a95c146103055780636fcfff451461031857806370a082311461034057806370ae92d21461036057600080fd5b806306fdde03146101c0578063095ea7b3146101de5780631171bda91461020157806318160ddd1461021657806323b872dd1461022d57806330adf81f14610240578063313ce567146102675780633644e51514610281575b600080fd5b6101c8610520565b6040516101d59190611f0c565b60405180910390f35b6101f16101ec366004611f34565b6105ae565b60405190151581526020016101d5565b61021461020f366004611f60565b6105c4565b005b61021f60045481565b6040519081526020016101d5565b6101f161023b366004611f60565b610615565b61021f7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b61026f601281565b60405160ff90911681526020016101d5565b61021f6106c8565b61029c610297366004611f34565b610724565b6040516001600160601b0390911681526020016101d5565b6102146102c2366004611f34565b610746565b6102146102d5366004611fa1565b610849565b6102ed6102e8366004611fba565b610856565b6040516001600160a01b0390911681526020016101d5565b610214610313366004611fba565b610874565b61032b610326366004611fba565b61087e565b60405163ffffffff90911681526020016101d5565b61021f61034e366004611fba565b60016020526000908152604090205481565b61021f61036e366004611fba565b60036020526000908152604090205481565b6102146108a6565b61021f7f000000000000000000000000000000000000000000000000000000000000000081565b6102146103bd366004611f34565b6108e1565b6102ed610977565b61029c6103d8366004611fa1565b610986565b6101c8610993565b61029c6103f3366004611fba565b6109a0565b6101f1610406366004611f34565b610a30565b610214610419366004611fed565b610a3d565b61021f7f000000000000000000000000000000000000000000000000000000000000000081565b6101f1610453366004612066565b610c6a565b610214610466366004612133565b610cf2565b61021f6104793660046121a1565b600260209081526000928352604080842090915290825290205481565b61021f7f76995fe87be88484696cfd6792aeb71e0b61f81dfa3b641e5adffa38a0d3b8e281565b6104d06104cb3660046121da565b610f2c565b60408051825163ffffffff1681526020928301516001600160601b031692810192909252016101d5565b610214610508366004611fba565b610fd8565b61021461051b366004612211565b611075565b6005805461052d906122b0565b80601f0160208091040260200160405190810160405280929190818152602001828054610559906122b0565b80156105a65780601f1061057b576101008083540402835291602001916105a6565b820191906000526020600020905b81548152906001019060200180831161058957829003601f168201915b505050505081565b60006105bb338484611106565b50600192915050565b336105cd610977565b6001600160a01b0316146105fc5760405162461bcd60e51b81526004016105f3906122eb565b60405180910390fd5b6106106001600160a01b0384168383611214565b505050565b6001600160a01b038316600090815260026020908152604080832033845290915281205460001981146106b0578281101561069c5760405162461bcd60e51b815260206004820152602160248201527f5472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636044820152606560f81b60648201526084016105f3565b6106b085336106ab8685612336565b611106565b6106bb858585611266565b60019150505b9392505050565b60007f000000000000000000000000000000000000000000000000000000000000000046141561071757507f000000000000000000000000000000000000000000000000000000000000000090565b61071f611467565b905090565b6001600160a01b03821660009081526008602052604081206106c19083611516565b3361074f610977565b6001600160a01b0316146107755760405162461bcd60e51b81526004016105f3906122eb565b6001600160a01b0382166107c65760405162461bcd60e51b81526020600482015260186024820152774d696e7420746f20746865207a65726f206164647265737360401b60448201526064016105f3565b6107d260008383611611565b80600460008282546107e4919061234d565b90915550506001600160a01b0382166000908152600160205260408120805483929061081190849061234d565b90915550506040518181526001600160a01b038316906000906000805160206125d88339815191529060200160405180910390a35050565b61085333826116fd565b50565b6001600160a01b039081166000908152600760205260409020541690565b61085333826117db565b6001600160a01b0381166000908152600860205260408120546108a09061187d565b92915050565b336108af610977565b6001600160a01b0316146108d55760405162461bcd60e51b81526004016105f3906122eb565b6108df60006118e6565b565b6001600160a01b0382166000908152600260209081526040808320338452909152902054600019811461096d578181101561095e5760405162461bcd60e51b815260206004820152601d60248201527f4275726e20616d6f756e74206578636565647320616c6c6f77616e636500000060448201526064016105f3565b61096d83336106ab8585612336565b61061083836116fd565b6000546001600160a01b031690565b60006108a0600983611516565b6006805461052d906122b0565b6001600160a01b0381166000908152600860205260408120548015610a27576001600160a01b0383166000908152600860205260409020610a22906109e6600184612336565b815481106109f6576109f6612365565b90600052602060002090600291828204019190066010029054906101000a90046001600160801b031690565b6106c1565b60009392505050565b60006105bb338484611266565b42841015610a825760405162461bcd60e51b815260206004820152601260248201527111195b1959d85d1a5bdb88195e1c1a5c995960721b60448201526064016105f3565b6fa2a8918ca85bafe22016d0b997e4df60600160ff1b03811115610ab85760405162461bcd60e51b81526004016105f39061237b565b8260ff16601b1480610acd57508260ff16601c145b610ae95760405162461bcd60e51b81526004016105f3906123b2565b6000610af36106c8565b6001600160a01b038816600090815260036020526040812080547f76995fe87be88484696cfd6792aeb71e0b61f81dfa3b641e5adffa38a0d3b8e2928a9290610b3b836123e9565b9190505588604051602001610b7294939291909384526001600160a01b039290921660208401526040830152606082015260800190565b60405160208183030381529060405280519060200120604051602001610b99929190612404565b60408051601f198184030181528282528051602091820120600080855291840180845281905260ff88169284019290925260608301869052608083018590529092509060019060a0016020604051602081039080840390855afa158015610c04573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811615801590610c3a5750876001600160a01b0316816001600160a01b0316145b610c565760405162461bcd60e51b81526004016105f39061241f565b610c6088886117db565b5050505050505050565b6000610c7684846105ae565b15610ce857604051638f4ffcb160e01b81526001600160a01b03851690638f4ffcb190610cad90339087903090889060040161244a565b600060405180830381600087803b158015610cc757600080fd5b505af1158015610cdb573d6000803e3d6000fd5b50505050600190506106c1565b5060009392505050565b42841015610d375760405162461bcd60e51b815260206004820152601260248201527114195c9b5a5cdcda5bdb88195e1c1a5c995960721b60448201526064016105f3565b6fa2a8918ca85bafe22016d0b997e4df60600160ff1b03811115610d6d5760405162461bcd60e51b81526004016105f39061237b565b8260ff16601b1480610d8257508260ff16601c145b610d9e5760405162461bcd60e51b81526004016105f3906123b2565b6000610da86106c8565b6001600160a01b038916600090815260036020526040812080547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9928c928c928c92909190610df6836123e9565b909155506040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810187905260e00160405160208183030381529060405280519060200120604051602001610e59929190612404565b60408051601f198184030181528282528051602091820120600080855291840180845281905260ff88169284019290925260608301869052608083018590529092509060019060a0016020604051602081039080840390855afa158015610ec4573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811615801590610efa5750886001600160a01b0316816001600160a01b0316145b610f165760405162461bcd60e51b81526004016105f39061241f565b610f21898989611106565b505050505050505050565b60408051808201909152600080825260208201526001600160a01b038316600090815260086020526040812080548291610fad9163ffffffff8716908110610f7657610f76612365565b90600052602060002090600291828204019190066010029054906101000a90046001600160801b031663ffffffff606082901c1691565b6040805180820190915263ffffffff90921682526001600160601b0316602082015295945050505050565b33610fe1610977565b6001600160a01b0316146110075760405162461bcd60e51b81526004016105f3906122eb565b6001600160a01b03811661106c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f3565b610853816118e6565b3361107e610977565b6001600160a01b0316146110a45760405162461bcd60e51b81526004016105f3906122eb565b604051635c46a7ef60e11b81526001600160a01b0386169063b88d4fde906110d89030908890889088908890600401612487565b600060405180830381600087803b1580156110f257600080fd5b505af1158015610f21573d6000803e3d6000fd5b6001600160a01b03831661115c5760405162461bcd60e51b815260206004820152601d60248201527f417070726f76652066726f6d20746865207a65726f206164647265737300000060448201526064016105f3565b6001600160a01b0382166111b25760405162461bcd60e51b815260206004820152601b60248201527f417070726f766520746f20746865207a65726f2061646472657373000000000060448201526064016105f3565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610610908490611936565b6001600160a01b0383166112bc5760405162461bcd60e51b815260206004820152601e60248201527f5472616e736665722066726f6d20746865207a65726f2061646472657373000060448201526064016105f3565b6001600160a01b0382166113125760405162461bcd60e51b815260206004820152601c60248201527f5472616e7366657220746f20746865207a65726f20616464726573730000000060448201526064016105f3565b6001600160a01b03821630141561136b5760405162461bcd60e51b815260206004820152601d60248201527f5472616e7366657220746f2074686520746f6b656e206164647265737300000060448201526064016105f3565b611376838383611611565b6001600160a01b038316600090815260016020526040902054818110156113df5760405162461bcd60e51b815260206004820152601f60248201527f5472616e7366657220616d6f756e7420657863656564732062616c616e63650060448201526064016105f3565b6113e98282612336565b6001600160a01b03808616600090815260016020526040808220939093559085168152908120805484929061141f90849061234d565b92505081905550826001600160a01b0316846001600160a01b03166000805160206125d88339815191528460405161145991815260200190565b60405180910390a350505050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f600560405161149991906124db565b60408051918290038220828201825260018352603160f81b6020938401528151928301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b60004382106115625760405162461bcd60e51b8152602060048201526018602482015277109b1bd8dac81b9bdd081e595d0819195d195c9b5a5b995960421b60448201526064016105f3565b825460005b818110156115eb57600061157b8284611a08565b905060006115be87838154811061159457611594612365565b6000918252602090912060028204015463ffffffff60019092166010026101000a900460601c1690565b9050858163ffffffff1611156115d6578193506115e4565b6115e182600161234d565b92505b5050611567565b811561160557611600856109e6600185612336565b611608565b60005b95945050505050565b600061161c82611a23565b90506001600160a01b0384166116ab576004546001600160601b039061164390849061234d565b11156116915760405162461bcd60e51b815260206004820152601d60248201527f4d6178696d756d20746f74616c20737570706c7920657863656564656400000060448201526064016105f3565b6116a86009611a8b836001600160601b0316611a97565b50505b6001600160a01b0383166116d3576116d06009611bf3836001600160601b0316611a97565b50505b6116f76116df85610856565b6116e885610856565b836001600160601b0316611bff565b50505050565b6001600160a01b038216600090815260016020526040902054818110156117665760405162461bcd60e51b815260206004820152601b60248201527f4275726e20616d6f756e7420657863656564732062616c616e6365000000000060448201526064016105f3565b61177283600084611611565b61177c8282612336565b6001600160a01b038416600090815260016020526040812091909155600480548492906117aa908490612336565b90915550506040518281526000906001600160a01b038516906000805160206125d883398151915290602001611207565b60006117e683610856565b6001600160a01b0384166000908152600160205260408120549192509061180c90611a23565b6001600160a01b0385811660008181526007602052604080822080546001600160a01b031916898616908117909155905194955093928616927f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a46116f78284836001600160601b0316611bff565b600063ffffffff8211156118e25760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201526532206269747360d01b60648201526084016105f3565b5090565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600061198b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611d3c9092919063ffffffff16565b80519091501561061057808060200190518101906119a99190612577565b6106105760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016105f3565b6000611a176002848418612599565b6106c19084841661234d565b60006001600160601b038211156118e25760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203960448201526536206269747360d01b60648201526084016105f3565b60006106c1828461234d565b825460009081908015611ab857611ab3866109e6600184612336565b611abb565b60005b6001600160601b03169250611ad483858763ffffffff16565b91508015611b94576000611afd87611aed600185612336565b8154811061159457611594612365565b9050438163ffffffff161415611b9257611b3681611b1a85611a23565b6001600160601b031660609190911b63ffffffff60601b161790565b87611b42600185612336565b81548110611b5257611b52612365565b90600052602060002090600291828204019190066010026101000a8154816001600160801b0302191690836001600160801b031602179055505050611beb565b505b85611baa611ba14361187d565b611b1a85611a23565b81546001818101845560009384526020909320600282040180546001600160801b03938416601093909516929092026101000a938402929093021916179055505b935093915050565b60006106c18284612336565b816001600160a01b0316836001600160a01b031614158015611c215750600081115b15610610576001600160a01b03831615611caf576001600160a01b03831660009081526008602052604081208190611c5c90611bf385611a97565b91509150846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248383604051611ca4929190918252602082015260400190565b60405180910390a250505b6001600160a01b03821615610610576001600160a01b03821660009081526008602052604081208190611ce590611a8b85611a97565b91509150836001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248383604051611d2d929190918252602082015260400190565b60405180910390a25050505050565b6060611d4b8484600085611d53565b949350505050565b606082471015611db45760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016105f3565b843b611e025760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105f3565b600080866001600160a01b03168587604051611e1e91906125bb565b60006040518083038185875af1925050503d8060008114611e5b576040519150601f19603f3d011682016040523d82523d6000602084013e611e60565b606091505b5091509150611e70828286611e7b565b979650505050505050565b60608315611e8a5750816106c1565b825115611e9a5782518084602001fd5b8160405162461bcd60e51b81526004016105f39190611f0c565b60005b83811015611ecf578181015183820152602001611eb7565b838111156116f75750506000910152565b60008151808452611ef8816020860160208601611eb4565b601f01601f19169290920160200192915050565b6020815260006106c16020830184611ee0565b6001600160a01b038116811461085357600080fd5b60008060408385031215611f4757600080fd5b8235611f5281611f1f565b946020939093013593505050565b600080600060608486031215611f7557600080fd5b8335611f8081611f1f565b92506020840135611f9081611f1f565b929592945050506040919091013590565b600060208284031215611fb357600080fd5b5035919050565b600060208284031215611fcc57600080fd5b81356106c181611f1f565b803560ff81168114611fe857600080fd5b919050565b60008060008060008060c0878903121561200657600080fd5b863561201181611f1f565b9550602087013561202181611f1f565b94506040870135935061203660608801611fd7565b92506080870135915060a087013590509295509295509295565b634e487b7160e01b600052604160045260246000fd5b60008060006060848603121561207b57600080fd5b833561208681611f1f565b925060208401359150604084013567ffffffffffffffff808211156120aa57600080fd5b818601915086601f8301126120be57600080fd5b8135818111156120d0576120d0612050565b604051601f8201601f19908116603f011681019083821181831017156120f8576120f8612050565b8160405282815289602084870101111561211157600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b600080600080600080600060e0888a03121561214e57600080fd5b873561215981611f1f565b9650602088013561216981611f1f565b9550604088013594506060880135935061218560808901611fd7565b925060a0880135915060c0880135905092959891949750929550565b600080604083850312156121b457600080fd5b82356121bf81611f1f565b915060208301356121cf81611f1f565b809150509250929050565b600080604083850312156121ed57600080fd5b82356121f881611f1f565b9150602083013563ffffffff811681146121cf57600080fd5b60008060008060006080868803121561222957600080fd5b853561223481611f1f565b9450602086013561224481611f1f565b935060408601359250606086013567ffffffffffffffff8082111561226857600080fd5b818801915088601f83011261227c57600080fd5b81358181111561228b57600080fd5b89602082850101111561229d57600080fd5b9699959850939650602001949392505050565b600181811c908216806122c457607f821691505b602082108114156122e557634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b60008282101561234857612348612320565b500390565b6000821982111561236057612360612320565b500190565b634e487b7160e01b600052603260045260246000fd5b6020808252601b908201527f496e76616c6964207369676e6174757265202773272076616c75650000000000604082015260600190565b6020808252601b908201527f496e76616c6964207369676e6174757265202776272076616c75650000000000604082015260600190565b60006000198214156123fd576123fd612320565b5060010190565b61190160f01b81526002810192909252602282015260420190565b602080825260119082015270496e76616c6964207369676e617475726560781b604082015260600190565b6001600160a01b038581168252602082018590528316604082015260806060820181905260009061247d90830184611ee0565b9695505050505050565b6001600160a01b038681168252851660208201526040810184905260806060820181905281018290526000828460a0840137600060a0848401015260a0601f19601f85011683010190509695505050505050565b600080835481600182811c9150808316806124f757607f831692505b602080841082141561251757634e487b7160e01b86526022600452602486fd5b81801561252b576001811461253c57612569565b60ff19861689528489019650612569565b60008a81526020902060005b868110156125615781548b820152908501908301612548565b505084890196505b509498975050505050505050565b60006020828403121561258957600080fd5b815180151581146106c157600080fd5b6000826125b657634e487b7160e01b600052601260045260246000fd5b500490565b600082516125cd818460208701611eb4565b919091019291505056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212207eecbfb333a500c574d750bd13d9d3944c632e0e6cfefb9d5262bd9cbb14fb8364736f6c63430008090033", + "devdoc": { + "details": "By default, token balance does not account for voting power. This makes transfers cheaper. The downside is that it requires users to delegate to themselves to activate checkpoints and have their voting power tracked.", + "kind": "dev", + "methods": { + "approve(address,uint256)": { + "details": "If the `amount` is set to `type(uint256).max` then `transferFrom` and `burnFrom` will not reduce an allowance. Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729", + "returns": { + "_0": "True if the operation succeeded." + } + }, + "approveAndCall(address,uint256,bytes)": { + "details": "If the `amount` is set to `type(uint256).max` then `transferFrom` and `burnFrom` will not reduce an allowance.", + "returns": { + "_0": "True if both approval and `receiveApproval` calls succeeded." + } + }, + "burn(uint256)": { + "details": "Requirements: - the caller must have a balance of at least `amount`." + }, + "burnFrom(address,uint256)": { + "details": "Requirements: - `account` must have a balance of at least `amount`, - the caller must have allowance for `account`'s tokens of at least `amount`." + }, + "delegate(address)": { + "params": { + "delegatee": "The address to delegate votes to" + } + }, + "delegateBySig(address,address,uint256,uint8,bytes32,bytes32)": { + "params": { + "deadline": "The time at which to expire the signature", + "delegatee": "The address to delegate votes to", + "r": "Half of the ECDSA signature pair", + "s": "Half of the ECDSA signature pair", + "v": "The recovery byte of the signature" + } + }, + "getPastTotalSupply(uint256)": { + "details": "`blockNumber` must have been already mined", + "params": { + "blockNumber": "The block number to get the total supply at" + } + }, + "getPastVotes(address,uint256)": { + "details": "Block number must be a finalized block or else this function will revert to prevent misinformation.", + "params": { + "account": "The address of the account to check", + "blockNumber": "The block number to get the vote balance at" + }, + "returns": { + "_0": "The number of votes the account had as of the given block" + } + }, + "getVotes(address)": { + "params": { + "account": "The address to get votes balance" + }, + "returns": { + "_0": "The number of current votes for `account`" + } + }, + "mint(address,uint256)": { + "details": "Requirements: - `recipient` cannot be the zero address." + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "permit(address,address,uint256,uint256,uint8,bytes32,bytes32)": { + "details": "The deadline argument can be set to `type(uint256).max to create permits that effectively never expire. If the `amount` is set to `type(uint256).max` then `transferFrom` and `burnFrom` will not reduce an allowance." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "transfer(address,uint256)": { + "details": "Requirements: - `recipient` cannot be the zero address, - the caller must have a balance of at least `amount`.", + "returns": { + "_0": "True if the operation succeeded, reverts otherwise." + } + }, + "transferFrom(address,address,uint256)": { + "details": "Requirements: - `spender` and `recipient` cannot be the zero address, - `spender` must have a balance of at least `amount`, - the caller must have allowance for `spender`'s tokens of at least `amount`.", + "returns": { + "_0": "True if the operation succeeded, reverts otherwise." + } + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "title": "T token", + "version": 1 + }, + "userdoc": { + "events": { + "DelegateChanged(address,address,address)": { + "notice": "Emitted when an account changes their delegate." + }, + "DelegateVotesChanged(address,uint256,uint256)": { + "notice": "Emitted when a balance or delegate change results in changes to an account's voting power." + } + }, + "kind": "user", + "methods": { + "DELEGATION_TYPEHASH()": { + "notice": "The EIP-712 typehash for the delegation struct used by `delegateBySig`." + }, + "DOMAIN_SEPARATOR()": { + "notice": "Returns hash of EIP712 Domain struct with the token name as a signing domain and token contract as a verifying contract. Used to construct EIP2612 signature provided to `permit` function." + }, + "PERMIT_TYPEHASH()": { + "notice": "Returns EIP2612 Permit message hash. Used to construct EIP2612 signature provided to `permit` function." + }, + "allowance(address,address)": { + "notice": "The remaining number of tokens that spender will be allowed to spend on behalf of owner through `transferFrom` and `burnFrom`. This is zero by default." + }, + "approve(address,uint256)": { + "notice": "Sets `amount` as the allowance of `spender` over the caller's tokens." + }, + "approveAndCall(address,uint256,bytes)": { + "notice": "Calls `receiveApproval` function on spender previously approving the spender to withdraw from the caller multiple times, up to the `amount` amount. If this function is called again, it overwrites the current allowance with `amount`. Reverts if the approval reverted or if `receiveApproval` call on the spender reverted." + }, + "balanceOf(address)": { + "notice": "The amount of tokens owned by the given account." + }, + "burn(uint256)": { + "notice": "Destroys `amount` tokens from the caller." + }, + "burnFrom(address,uint256)": { + "notice": "Destroys `amount` of tokens from `account` using the allowance mechanism. `amount` is then deducted from the caller's allowance unless the allowance was made for `type(uint256).max`." + }, + "decimals()": { + "notice": "The decimals places of the token." + }, + "delegate(address)": { + "notice": "Delegate votes from `msg.sender` to `delegatee`." + }, + "delegateBySig(address,address,uint256,uint8,bytes32,bytes32)": { + "notice": "Delegates votes from signatory to `delegatee`" + }, + "delegates(address)": { + "notice": "Get the address `account` is currently delegating to." + }, + "getPastTotalSupply(uint256)": { + "notice": "Retrieve the `totalSupply` at the end of `blockNumber`. Note, this value is the sum of all balances, but it is NOT the sum of all the delegated votes!" + }, + "getPastVotes(address,uint256)": { + "notice": "Determine the prior number of votes for an account as of a block number." + }, + "getVotes(address)": { + "notice": "Gets the current votes balance for `account`." + }, + "mint(address,uint256)": { + "notice": "Creates `amount` tokens and assigns them to `account`, increasing the total supply." + }, + "name()": { + "notice": "The name of the token." + }, + "nonce(address)": { + "notice": "Returns the current nonce for EIP2612 permission for the provided token owner for a replay protection. Used to construct EIP2612 signature provided to `permit` function." + }, + "numCheckpoints(address)": { + "notice": "Get number of checkpoints for `account`." + }, + "permit(address,address,uint256,uint256,uint8,bytes32,bytes32)": { + "notice": "EIP2612 approval made with secp256k1 signature. Users can authorize a transfer of their tokens with a signature conforming EIP712 standard, rather than an on-chain transaction from their address. Anyone can submit this signature on the user's behalf by calling the permit function, paying gas fees, and possibly performing other actions in the same transaction." + }, + "symbol()": { + "notice": "The symbol of the token." + }, + "totalSupply()": { + "notice": "The amount of tokens in existence." + }, + "transfer(address,uint256)": { + "notice": "Moves `amount` tokens from the caller's account to `recipient`." + }, + "transferFrom(address,address,uint256)": { + "notice": "Moves `amount` tokens from `spender` to `recipient` using the allowance mechanism. `amount` is then deducted from the caller's allowance unless the allowance was made for `type(uint256).max`." + } + }, + "notice": "Threshold Network T token", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 389, + "contract": "contracts/token/T.sol:T", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 6729, + "contract": "contracts/token/T.sol:T", + "label": "balanceOf", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 6737, + "contract": "contracts/token/T.sol:T", + "label": "allowance", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 6743, + "contract": "contracts/token/T.sol:T", + "label": "nonce", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 6758, + "contract": "contracts/token/T.sol:T", + "label": "totalSupply", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 6762, + "contract": "contracts/token/T.sol:T", + "label": "name", + "offset": 0, + "slot": "5", + "type": "t_string_storage" + }, + { + "astId": 6766, + "contract": "contracts/token/T.sol:T", + "label": "symbol", + "offset": 0, + "slot": "6", + "type": "t_string_storage" + }, + { + "astId": 7563, + "contract": "contracts/token/T.sol:T", + "label": "_delegates", + "offset": 0, + "slot": "7", + "type": "t_mapping(t_address,t_address)" + }, + { + "astId": 7568, + "contract": "contracts/token/T.sol:T", + "label": "_checkpoints", + "offset": 0, + "slot": "8", + "type": "t_mapping(t_address,t_array(t_uint128)dyn_storage)" + }, + { + "astId": 7571, + "contract": "contracts/token/T.sol:T", + "label": "_totalSupplyCheckpoints", + "offset": 0, + "slot": "9", + "type": "t_array(t_uint128)dyn_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint128)dyn_storage": { + "base": "t_uint128", + "encoding": "dynamic_array", + "label": "uint128[]", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_address)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => address)", + "numberOfBytes": "32", + "value": "t_address" + }, + "t_mapping(t_address,t_array(t_uint128)dyn_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint128[])", + "numberOfBytes": "32", + "value": "t_array(t_uint128)dyn_storage" + }, + "t_mapping(t_address,t_mapping(t_address,t_uint256))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_uint256)" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_uint128": { + "encoding": "inplace", + "label": "uint128", + "numberOfBytes": "16" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/deployments/mainnet/TokenStaking.json b/deployments/mainnet/TokenStaking.json new file mode 100644 index 00000000..043ce32a --- /dev/null +++ b/deployments/mainnet/TokenStaking.json @@ -0,0 +1,1591 @@ +{ + "address": "0x01B67b1194C75264d06F808A921228a95C765dd7", + "abi": [ + { + "inputs": [ + { + "internalType": "contract T", + "name": "_token", + "type": "address" + }, + { + "internalType": "contract IKeepTokenStaking", + "name": "_keepStakingContract", + "type": "address" + }, + { + "internalType": "contract INuCypherStakingEscrow", + "name": "_nucypherStakingContract", + "type": "address" + }, + { + "internalType": "contract VendingMachine", + "name": "_keepVendingMachine", + "type": "address" + }, + { + "internalType": "contract VendingMachine", + "name": "_nucypherVendingMachine", + "type": "address" + }, + { + "internalType": "contract KeepStake", + "name": "_keepStake", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "application", + "type": "address" + }, + { + "indexed": true, + "internalType": "enum TokenStaking.ApplicationStatus", + "name": "newStatus", + "type": "uint8" + } + ], + "name": "ApplicationStatusChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "ceiling", + "type": "uint256" + } + ], + "name": "AuthorizationCeilingSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "application", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "fromAmount", + "type": "uint96" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "toAmount", + "type": "uint96" + } + ], + "name": "AuthorizationDecreaseApproved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "application", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "fromAmount", + "type": "uint96" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "toAmount", + "type": "uint96" + } + ], + "name": "AuthorizationDecreaseRequested", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "application", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "fromAmount", + "type": "uint96" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "toAmount", + "type": "uint96" + } + ], + "name": "AuthorizationIncreased", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "application", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "fromAmount", + "type": "uint96" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "toAmount", + "type": "uint96" + }, + { + "indexed": true, + "internalType": "bool", + "name": "successfulCall", + "type": "bool" + } + ], + "name": "AuthorizationInvoluntaryDecreased", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "fromDelegate", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "toDelegate", + "type": "address" + } + ], + "name": "DelegateChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "previousBalance", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newBalance", + "type": "uint256" + } + ], + "name": "DelegateVotesChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldGovernance", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newGovernance", + "type": "address" + } + ], + "name": "GovernanceTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint96", + "name": "amount", + "type": "uint96" + } + ], + "name": "MinimumStakeAmountSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint96", + "name": "reward", + "type": "uint96" + } + ], + "name": "NotificationRewardPushed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint96", + "name": "reward", + "type": "uint96" + } + ], + "name": "NotificationRewardSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "amount", + "type": "uint96" + } + ], + "name": "NotificationRewardWithdrawn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "notifier", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "NotifierRewarded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "oldOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnerRefreshed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "application", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "panicButton", + "type": "address" + } + ], + "name": "PanicButtonSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "count", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tAmount", + "type": "uint256" + } + ], + "name": "SlashingProcessed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint96", + "name": "penalty", + "type": "uint96" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "rewardMultiplier", + "type": "uint256" + } + ], + "name": "StakeDiscrepancyPenaltySet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "enum IStaking.StakeType", + "name": "stakeType", + "type": "uint8" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "beneficiary", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "authorizer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "amount", + "type": "uint96" + } + ], + "name": "Staked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "amount", + "type": "uint96" + }, + { + "indexed": true, + "internalType": "bool", + "name": "discrepancy", + "type": "bool" + } + ], + "name": "TokensSeized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "amount", + "type": "uint96" + } + ], + "name": "ToppedUp", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "amount", + "type": "uint96" + } + ], + "name": "Unstaked", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "applicationInfo", + "outputs": [ + { + "internalType": "enum TokenStaking.ApplicationStatus", + "name": "status", + "type": "uint8" + }, + { + "internalType": "address", + "name": "panicButton", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "applications", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "application", + "type": "address" + } + ], + "name": "approveApplication", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingProvider", + "type": "address" + } + ], + "name": "approveAuthorizationDecrease", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "authorizationCeiling", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "application", + "type": "address" + } + ], + "name": "authorizedStake", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint32", + "name": "pos", + "type": "uint32" + } + ], + "name": "checkpoints", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "fromBlock", + "type": "uint32" + }, + { + "internalType": "uint96", + "name": "votes", + "type": "uint96" + } + ], + "internalType": "struct Checkpoints.Checkpoint", + "name": "checkpoint", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "delegatee", + "type": "address" + } + ], + "name": "delegateVoting", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "delegates", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "application", + "type": "address" + } + ], + "name": "disableApplication", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "application", + "type": "address" + } + ], + "name": "forceDecreaseAuthorization", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getApplicationsLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "application", + "type": "address" + } + ], + "name": "getAvailableToAuthorize", + "outputs": [ + { + "internalType": "uint96", + "name": "availableTValue", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "internalType": "enum IStaking.StakeType", + "name": "stakeTypes", + "type": "uint8" + } + ], + "name": "getMinStaked", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "blockNumber", + "type": "uint256" + } + ], + "name": "getPastTotalSupply", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "blockNumber", + "type": "uint256" + } + ], + "name": "getPastVotes", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getSlashingQueueLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingProvider", + "type": "address" + } + ], + "name": "getStartStakingTimestamp", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getVotes", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "governance", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "application", + "type": "address" + }, + { + "internalType": "uint96", + "name": "amount", + "type": "uint96" + } + ], + "name": "increaseAuthorization", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "minTStakeAmount", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "notificationReward", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "notifiersTreasury", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingProvider", + "type": "address" + } + ], + "name": "notifyKeepStakeDiscrepancy", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingProvider", + "type": "address" + } + ], + "name": "notifyNuStakeDiscrepancy", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "numCheckpoints", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "application", + "type": "address" + } + ], + "name": "pauseApplication", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "count", + "type": "uint256" + } + ], + "name": "processSlashing", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "reward", + "type": "uint96" + } + ], + "name": "pushNotificationReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingProvider", + "type": "address" + } + ], + "name": "refreshKeepStakeOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "application", + "type": "address" + }, + { + "internalType": "uint96", + "name": "amount", + "type": "uint96" + } + ], + "name": "requestAuthorizationDecrease", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingProvider", + "type": "address" + } + ], + "name": "requestAuthorizationDecrease", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingProvider", + "type": "address" + } + ], + "name": "rolesOf", + "outputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address payable", + "name": "beneficiary", + "type": "address" + }, + { + "internalType": "address", + "name": "authorizer", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "amount", + "type": "uint96" + }, + { + "internalType": "uint256", + "name": "rewardMultiplier", + "type": "uint256" + }, + { + "internalType": "address", + "name": "notifier", + "type": "address" + }, + { + "internalType": "address[]", + "name": "_stakingProviders", + "type": "address[]" + } + ], + "name": "seize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "ceiling", + "type": "uint256" + } + ], + "name": "setAuthorizationCeiling", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "amount", + "type": "uint96" + } + ], + "name": "setMinimumStakeAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "reward", + "type": "uint96" + } + ], + "name": "setNotificationReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "application", + "type": "address" + }, + { + "internalType": "address", + "name": "panicButton", + "type": "address" + } + ], + "name": "setPanicButton", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "penalty", + "type": "uint96" + }, + { + "internalType": "uint256", + "name": "rewardMultiplier", + "type": "uint256" + } + ], + "name": "setStakeDiscrepancyPenalty", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "amount", + "type": "uint96" + }, + { + "internalType": "address[]", + "name": "_stakingProviders", + "type": "address[]" + } + ], + "name": "slash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "slashingQueue", + "outputs": [ + { + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "internalType": "uint96", + "name": "amount", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "slashingQueueIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "internalType": "address payable", + "name": "beneficiary", + "type": "address" + }, + { + "internalType": "address", + "name": "authorizer", + "type": "address" + }, + { + "internalType": "uint96", + "name": "amount", + "type": "uint96" + } + ], + "name": "stake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "stakeDiscrepancyPenalty", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "stakeDiscrepancyRewardMultiplier", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingProvider", + "type": "address" + } + ], + "name": "stakeKeep", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "internalType": "address payable", + "name": "beneficiary", + "type": "address" + }, + { + "internalType": "address", + "name": "authorizer", + "type": "address" + } + ], + "name": "stakeNu", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingProvider", + "type": "address" + } + ], + "name": "stakedNu", + "outputs": [ + { + "internalType": "uint256", + "name": "nuAmount", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingProvider", + "type": "address" + } + ], + "name": "stakes", + "outputs": [ + { + "internalType": "uint96", + "name": "tStake", + "type": "uint96" + }, + { + "internalType": "uint96", + "name": "keepInTStake", + "type": "uint96" + }, + { + "internalType": "uint96", + "name": "nuInTStake", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "internalType": "uint96", + "name": "amount", + "type": "uint96" + } + ], + "name": "topUp", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingProvider", + "type": "address" + } + ], + "name": "topUpKeep", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingProvider", + "type": "address" + } + ], + "name": "topUpNu", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newGuvnor", + "type": "address" + } + ], + "name": "transferGovernance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingProvider", + "type": "address" + } + ], + "name": "unstakeAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingProvider", + "type": "address" + } + ], + "name": "unstakeKeep", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "internalType": "uint96", + "name": "amount", + "type": "uint96" + } + ], + "name": "unstakeNu", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "internalType": "uint96", + "name": "amount", + "type": "uint96" + } + ], + "name": "unstakeT", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint96", + "name": "amount", + "type": "uint96" + } + ], + "name": "withdrawNotificationReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] +} \ No newline at end of file diff --git a/deployments/mainnet/TokenholderGovernor.json b/deployments/mainnet/TokenholderGovernor.json new file mode 100644 index 00000000..f6675e88 --- /dev/null +++ b/deployments/mainnet/TokenholderGovernor.json @@ -0,0 +1,1796 @@ +{ + "address": "0xd101f2B25bCBF992BdF55dB67c104FE7646F5447", + "abi": [ + { + "inputs": [ + { + "internalType": "contract T", + "name": "_token", + "type": "address" + }, + { + "internalType": "contract IVotesHistory", + "name": "_staking", + "type": "address" + }, + { + "internalType": "contract TimelockController", + "name": "_timelock", + "type": "address" + }, + { + "internalType": "address", + "name": "vetoer", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "oldVoteExtension", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "newVoteExtension", + "type": "uint64" + } + ], + "name": "LateQuorumVoteExtensionSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "proposalId", + "type": "uint256" + } + ], + "name": "ProposalCanceled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "proposalId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "proposer", + "type": "address" + }, + { + "indexed": false, + "internalType": "address[]", + "name": "targets", + "type": "address[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "values", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "string[]", + "name": "signatures", + "type": "string[]" + }, + { + "indexed": false, + "internalType": "bytes[]", + "name": "calldatas", + "type": "bytes[]" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "startBlock", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "endBlock", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "string", + "name": "description", + "type": "string" + } + ], + "name": "ProposalCreated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "proposalId", + "type": "uint256" + } + ], + "name": "ProposalExecuted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "proposalId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "extendedDeadline", + "type": "uint64" + } + ], + "name": "ProposalExtended", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "proposalId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "eta", + "type": "uint256" + } + ], + "name": "ProposalQueued", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldThresholdNumerator", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newThresholdNumerator", + "type": "uint256" + } + ], + "name": "ProposalThresholdNumeratorUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldQuorumNumerator", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newQuorumNumerator", + "type": "uint256" + } + ], + "name": "QuorumNumeratorUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldTimelock", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newTimelock", + "type": "address" + } + ], + "name": "TimelockChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "voter", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "proposalId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "support", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "weight", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "string", + "name": "reason", + "type": "string" + } + ], + "name": "VoteCast", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldVotingDelay", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newVotingDelay", + "type": "uint256" + } + ], + "name": "VotingDelaySet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldVotingPeriod", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newVotingPeriod", + "type": "uint256" + } + ], + "name": "VotingPeriodSet", + "type": "event" + }, + { + "inputs": [], + "name": "BALLOT_TYPEHASH", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "COUNTING_MODE", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "FRACTION_DENOMINATOR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "VETO_POWER", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "targets", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "values", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "calldatas", + "type": "bytes[]" + }, + { + "internalType": "bytes32", + "name": "descriptionHash", + "type": "bytes32" + } + ], + "name": "cancel", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "proposalId", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "support", + "type": "uint8" + } + ], + "name": "castVote", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "proposalId", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "support", + "type": "uint8" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "castVoteBySig", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "proposalId", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "support", + "type": "uint8" + }, + { + "internalType": "string", + "name": "reason", + "type": "string" + } + ], + "name": "castVoteWithReason", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "targets", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "values", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "calldatas", + "type": "bytes[]" + }, + { + "internalType": "bytes32", + "name": "descriptionHash", + "type": "bytes32" + } + ], + "name": "execute", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "blockNumber", + "type": "uint256" + } + ], + "name": "getVotes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "proposalId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasVoted", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "targets", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "values", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "calldatas", + "type": "bytes[]" + }, + { + "internalType": "bytes32", + "name": "descriptionHash", + "type": "bytes32" + } + ], + "name": "hashProposal", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "lateQuorumVoteExtension", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "proposalId", + "type": "uint256" + } + ], + "name": "proposalDeadline", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "proposalId", + "type": "uint256" + } + ], + "name": "proposalEta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "proposalId", + "type": "uint256" + } + ], + "name": "proposalSnapshot", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "blockNumber", + "type": "uint256" + } + ], + "name": "proposalThreshold", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "proposalThreshold", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "proposalThresholdNumerator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "proposalId", + "type": "uint256" + } + ], + "name": "proposalVotes", + "outputs": [ + { + "internalType": "uint256", + "name": "againstVotes", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "forVotes", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "abstainVotes", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "targets", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "values", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "calldatas", + "type": "bytes[]" + }, + { + "internalType": "string", + "name": "description", + "type": "string" + } + ], + "name": "propose", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "targets", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "values", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "calldatas", + "type": "bytes[]" + }, + { + "internalType": "bytes32", + "name": "descriptionHash", + "type": "bytes32" + } + ], + "name": "queue", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "blockNumber", + "type": "uint256" + } + ], + "name": "quorum", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "quorumNumerator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "relay", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint64", + "name": "newVoteExtension", + "type": "uint64" + } + ], + "name": "setLateQuorumVoteExtension", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newVotingDelay", + "type": "uint256" + } + ], + "name": "setVotingDelay", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newVotingPeriod", + "type": "uint256" + } + ], + "name": "setVotingPeriod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "staking", + "outputs": [ + { + "internalType": "contract IVotesHistory", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "proposalId", + "type": "uint256" + } + ], + "name": "state", + "outputs": [ + { + "internalType": "enum IGovernor.ProposalState", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "timelock", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token", + "outputs": [ + { + "internalType": "contract IVotesHistory", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newNumerator", + "type": "uint256" + } + ], + "name": "updateProposalThresholdNumerator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newQuorumNumerator", + "type": "uint256" + } + ], + "name": "updateQuorumNumerator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract TimelockController", + "name": "newTimelock", + "type": "address" + } + ], + "name": "updateTimelock", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "version", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "votingDelay", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "votingPeriod", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x4f6c675d51b59a313b2151d5eb714c7df9bca079ad629718dcd8c7ddff1462fb", + "receipt": { + "to": null, + "from": "0xFfFd7092685bDeeBD121D1A0FEA3c349114Cce50", + "contractAddress": "0xd101f2B25bCBF992BdF55dB67c104FE7646F5447", + "transactionIndex": 157, + "gasUsed": "3456607", + "logsBloom": "0x00002004000000000100000000001000000040000000000000001000000008000000000020000000000000000000000000000000000000000000000400100002000000800000000000000010000000020000000000000000000010000000000000000000020000000002000000000800000000000000000000000000000000001000002000000000400002000040000000000000000000000000000020000202000000001040000000000000000000000000000000000000001000000000000000000000000000000000000040000000000000001000000100180000800020000000000000000000000000800080000000000000000000000000000000002000", + "blockHash": "0x3394485ff20f7414f9cd759cc0fed3f1b8372bcb8e272daaa02a1fc4a1aed8b4", + "transactionHash": "0x4f6c675d51b59a313b2151d5eb714c7df9bca079ad629718dcd8c7ddff1462fb", + "logs": [ + { + "transactionIndex": 157, + "blockNumber": 14261948, + "transactionHash": "0x4f6c675d51b59a313b2151d5eb714c7df9bca079ad629718dcd8c7ddff1462fb", + "address": "0xd101f2B25bCBF992BdF55dB67c104FE7646F5447", + "topics": [ + "0x0553476bf02ef2726e8ce5ced78d63e26e602e4a2257b1f559418e24b4633997" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000096", + "logIndex": 347, + "blockHash": "0x3394485ff20f7414f9cd759cc0fed3f1b8372bcb8e272daaa02a1fc4a1aed8b4" + }, + { + "transactionIndex": 157, + "blockNumber": 14261948, + "transactionHash": "0x4f6c675d51b59a313b2151d5eb714c7df9bca079ad629718dcd8c7ddff1462fb", + "address": "0xd101f2B25bCBF992BdF55dB67c104FE7646F5447", + "topics": [ + "0x47036a693fe84b7d8f31616a15f6b3e26b080688ffd77d9425e3a0283a3df261" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000019", + "logIndex": 348, + "blockHash": "0x3394485ff20f7414f9cd759cc0fed3f1b8372bcb8e272daaa02a1fc4a1aed8b4" + }, + { + "transactionIndex": 157, + "blockNumber": 14261948, + "transactionHash": "0x4f6c675d51b59a313b2151d5eb714c7df9bca079ad629718dcd8c7ddff1462fb", + "address": "0xd101f2B25bCBF992BdF55dB67c104FE7646F5447", + "topics": [ + "0xc565b045403dc03c2eea82b81a0465edad9e2e7fc4d97e11421c209da93d7a93" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000033ec", + "logIndex": 349, + "blockHash": "0x3394485ff20f7414f9cd759cc0fed3f1b8372bcb8e272daaa02a1fc4a1aed8b4" + }, + { + "transactionIndex": 157, + "blockNumber": 14261948, + "transactionHash": "0x4f6c675d51b59a313b2151d5eb714c7df9bca079ad629718dcd8c7ddff1462fb", + "address": "0xd101f2B25bCBF992BdF55dB67c104FE7646F5447", + "topics": [ + "0x7e3f7f0708a84de9203036abaa450dccc85ad5ff52f78c170f3edb55cf5e8828" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001039d", + "logIndex": 350, + "blockHash": "0x3394485ff20f7414f9cd759cc0fed3f1b8372bcb8e272daaa02a1fc4a1aed8b4" + }, + { + "transactionIndex": 157, + "blockNumber": 14261948, + "transactionHash": "0x4f6c675d51b59a313b2151d5eb714c7df9bca079ad629718dcd8c7ddff1462fb", + "address": "0xd101f2B25bCBF992BdF55dB67c104FE7646F5447", + "topics": [ + "0x7ca4ac117ed3cdce75c1161d8207c440389b1a15d69d096831664657c07dafc2" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000033ec", + "logIndex": 351, + "blockHash": "0x3394485ff20f7414f9cd759cc0fed3f1b8372bcb8e272daaa02a1fc4a1aed8b4" + }, + { + "transactionIndex": 157, + "blockNumber": 14261948, + "transactionHash": "0x4f6c675d51b59a313b2151d5eb714c7df9bca079ad629718dcd8c7ddff1462fb", + "address": "0xd101f2B25bCBF992BdF55dB67c104FE7646F5447", + "topics": [ + "0x08f74ea46ef7894f65eabfb5e6e695de773a000b47c529ab559178069b226401" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000087f005317692d05baa4193ab0c961c69e175f45f", + "logIndex": 352, + "blockHash": "0x3394485ff20f7414f9cd759cc0fed3f1b8372bcb8e272daaa02a1fc4a1aed8b4" + }, + { + "transactionIndex": 157, + "blockNumber": 14261948, + "transactionHash": "0x4f6c675d51b59a313b2151d5eb714c7df9bca079ad629718dcd8c7ddff1462fb", + "address": "0xd101f2B25bCBF992BdF55dB67c104FE7646F5447", + "topics": [ + "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", + "0x65784a4b4efdf70060d396b05be05b4852e8b22ae249d76915bea0da3f992c64", + "0x0000000000000000000000009f6e831c8f8939dc0c830c6e492e7cef4f9c2f5f", + "0x000000000000000000000000fffd7092685bdeebd121d1a0fea3c349114cce50" + ], + "data": "0x", + "logIndex": 353, + "blockHash": "0x3394485ff20f7414f9cd759cc0fed3f1b8372bcb8e272daaa02a1fc4a1aed8b4" + }, + { + "transactionIndex": 157, + "blockNumber": 14261948, + "transactionHash": "0x4f6c675d51b59a313b2151d5eb714c7df9bca079ad629718dcd8c7ddff1462fb", + "address": "0xd101f2B25bCBF992BdF55dB67c104FE7646F5447", + "topics": [ + "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x00000000000000000000000087f005317692d05baa4193ab0c961c69e175f45f", + "0x000000000000000000000000fffd7092685bdeebd121d1a0fea3c349114cce50" + ], + "data": "0x", + "logIndex": 354, + "blockHash": "0x3394485ff20f7414f9cd759cc0fed3f1b8372bcb8e272daaa02a1fc4a1aed8b4" + } + ], + "blockNumber": 14261948, + "cumulativeGasUsed": "21348819", + "status": 1, + "byzantium": true + }, + "args": [ + "0xCdF7028ceAB81fA0C6971208e83fa7872994beE5", + "0x01B67b1194C75264d06F808A921228a95C765dd7", + "0x87F005317692D05BAA4193AB0c961c69e175f45f", + "0x9F6e831c8F8939DC0C830C6e492e7cEf4f9C2F5f" + ], + "numDeployments": 1, + "solcInputHash": "9a2f45de388a8a02f9e065c8da7e4649", + "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract T\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"contract IVotesHistory\",\"name\":\"_staking\",\"type\":\"address\"},{\"internalType\":\"contract TimelockController\",\"name\":\"_timelock\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"vetoer\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"oldVoteExtension\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"newVoteExtension\",\"type\":\"uint64\"}],\"name\":\"LateQuorumVoteExtensionSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"proposalId\",\"type\":\"uint256\"}],\"name\":\"ProposalCanceled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"proposalId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"proposer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"targets\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"string[]\",\"name\":\"signatures\",\"type\":\"string[]\"},{\"indexed\":false,\"internalType\":\"bytes[]\",\"name\":\"calldatas\",\"type\":\"bytes[]\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startBlock\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"endBlock\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"description\",\"type\":\"string\"}],\"name\":\"ProposalCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"proposalId\",\"type\":\"uint256\"}],\"name\":\"ProposalExecuted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"proposalId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"extendedDeadline\",\"type\":\"uint64\"}],\"name\":\"ProposalExtended\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"proposalId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"eta\",\"type\":\"uint256\"}],\"name\":\"ProposalQueued\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldThresholdNumerator\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newThresholdNumerator\",\"type\":\"uint256\"}],\"name\":\"ProposalThresholdNumeratorUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldQuorumNumerator\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newQuorumNumerator\",\"type\":\"uint256\"}],\"name\":\"QuorumNumeratorUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"oldTimelock\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newTimelock\",\"type\":\"address\"}],\"name\":\"TimelockChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"voter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"proposalId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"support\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"reason\",\"type\":\"string\"}],\"name\":\"VoteCast\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldVotingDelay\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newVotingDelay\",\"type\":\"uint256\"}],\"name\":\"VotingDelaySet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldVotingPeriod\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newVotingPeriod\",\"type\":\"uint256\"}],\"name\":\"VotingPeriodSet\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BALLOT_TYPEHASH\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"COUNTING_MODE\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"FRACTION_DENOMINATOR\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"VETO_POWER\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"targets\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"calldatas\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes32\",\"name\":\"descriptionHash\",\"type\":\"bytes32\"}],\"name\":\"cancel\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"proposalId\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"support\",\"type\":\"uint8\"}],\"name\":\"castVote\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"proposalId\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"support\",\"type\":\"uint8\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"castVoteBySig\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"proposalId\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"support\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"reason\",\"type\":\"string\"}],\"name\":\"castVoteWithReason\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"targets\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"calldatas\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes32\",\"name\":\"descriptionHash\",\"type\":\"bytes32\"}],\"name\":\"execute\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"}],\"name\":\"getVotes\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"proposalId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasVoted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"targets\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"calldatas\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes32\",\"name\":\"descriptionHash\",\"type\":\"bytes32\"}],\"name\":\"hashProposal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lateQuorumVoteExtension\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"proposalId\",\"type\":\"uint256\"}],\"name\":\"proposalDeadline\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"proposalId\",\"type\":\"uint256\"}],\"name\":\"proposalEta\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"proposalId\",\"type\":\"uint256\"}],\"name\":\"proposalSnapshot\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"}],\"name\":\"proposalThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"proposalThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"proposalThresholdNumerator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"proposalId\",\"type\":\"uint256\"}],\"name\":\"proposalVotes\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"againstVotes\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"forVotes\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"abstainVotes\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"targets\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"calldatas\",\"type\":\"bytes[]\"},{\"internalType\":\"string\",\"name\":\"description\",\"type\":\"string\"}],\"name\":\"propose\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"targets\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"calldatas\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes32\",\"name\":\"descriptionHash\",\"type\":\"bytes32\"}],\"name\":\"queue\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"}],\"name\":\"quorum\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"quorumNumerator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"relay\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"newVoteExtension\",\"type\":\"uint64\"}],\"name\":\"setLateQuorumVoteExtension\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newVotingDelay\",\"type\":\"uint256\"}],\"name\":\"setVotingDelay\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newVotingPeriod\",\"type\":\"uint256\"}],\"name\":\"setVotingPeriod\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"staking\",\"outputs\":[{\"internalType\":\"contract IVotesHistory\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"proposalId\",\"type\":\"uint256\"}],\"name\":\"state\",\"outputs\":[{\"internalType\":\"enum IGovernor.ProposalState\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"timelock\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token\",\"outputs\":[{\"internalType\":\"contract IVotesHistory\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newNumerator\",\"type\":\"uint256\"}],\"name\":\"updateProposalThresholdNumerator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newQuorumNumerator\",\"type\":\"uint256\"}],\"name\":\"updateQuorumNumerator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract TimelockController\",\"name\":\"newTimelock\",\"type\":\"address\"}],\"name\":\"updateTimelock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"version\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"votingDelay\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"votingPeriod\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"COUNTING_MODE()\":{\"details\":\"See {IGovernor-COUNTING_MODE}.\"},\"castVote(uint256,uint8)\":{\"details\":\"See {IGovernor-castVote}.\"},\"castVoteBySig(uint256,uint8,uint8,bytes32,bytes32)\":{\"details\":\"See {IGovernor-castVoteBySig}.\"},\"castVoteWithReason(uint256,uint8,string)\":{\"details\":\"See {IGovernor-castVoteWithReason}.\"},\"execute(address[],uint256[],bytes[],bytes32)\":{\"details\":\"See {IGovernor-execute}.\"},\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"grantRole(bytes32,address)\":{\"details\":\"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"hasVoted(uint256,address)\":{\"details\":\"See {IGovernor-hasVoted}.\"},\"hashProposal(address[],uint256[],bytes[],bytes32)\":{\"details\":\"See {IGovernor-hashProposal}. The proposal id is produced by hashing the RLC encoded `targets` array, the `values` array, the `calldatas` array and the descriptionHash (bytes32 which itself is the keccak256 hash of the description string). This proposal id can be produced from the proposal data which is part of the {ProposalCreated} event. It can even be computed in advance, before the proposal is submitted. Note that the chainId and the governor address are not part of the proposal id computation. Consequently, the same proposal (with same operation and same description) will have the same id if submitted on multiple governors accross multiple networks. This also means that in order to execute the same operation twice (on the same governor) the proposer will have to change the description in order to avoid proposal id conflicts.\"},\"lateQuorumVoteExtension()\":{\"details\":\"Returns the current value of the vote extension parameter: the number of blocks that are required to pass from the time a proposal reaches quorum until its voting period ends.\"},\"name()\":{\"details\":\"See {IGovernor-name}.\"},\"proposalEta(uint256)\":{\"details\":\"Public accessor to check the eta of a queued proposal\"},\"proposalSnapshot(uint256)\":{\"details\":\"See {IGovernor-proposalSnapshot}.\"},\"proposalThreshold(uint256)\":{\"params\":{\"blockNumber\":\"The block number to get the proposal threshold at\"}},\"proposalVotes(uint256)\":{\"details\":\"Accessor to the internal vote counts.\"},\"queue(address[],uint256[],bytes[],bytes32)\":{\"details\":\"Function to queue a proposal to the timelock.\"},\"relay(address,uint256,bytes)\":{\"details\":\"Relays a transaction or function call to an arbitrary target. In cases where the governance executor is some contract other than the governor itself, like when using a timelock, this function can be invoked in a governance proposal to recover tokens or Ether that was sent to the governor contract by mistake. Note that if the executor is simply the governor itself, use of `relay` is redundant.\"},\"renounceRole(bytes32,address)\":{\"details\":\"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`.\"},\"revokeRole(bytes32,address)\":{\"details\":\"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role.\"},\"setLateQuorumVoteExtension(uint64)\":{\"details\":\"Changes the {lateQuorumVoteExtension}. This operation can only be performed by the governance executor, generally through a governance proposal. Emits a {LateQuorumVoteExtensionSet} event.\"},\"timelock()\":{\"details\":\"Public accessor to check the address of the timelock\"},\"updateTimelock(address)\":{\"details\":\"Public endpoint to update the underlying timelock instance. Restricted to the timelock itself, so updates must be proposed, scheduled, and executed through governance proposals. CAUTION: It is not recommended to change the timelock while there are other queued governance proposals.\"},\"version()\":{\"details\":\"See {IGovernor-version}.\"},\"votingDelay()\":{\"details\":\"Delay, in number of block, between the proposal is created and the vote starts. This can be increassed to leave time for users to buy voting power, of delegate it, before the voting of a proposal starts.\"},\"votingPeriod()\":{\"details\":\"Delay, in number of blocks, between the vote start and vote ends. NOTE: The {votingDelay} can delay the start of the vote. This must be considered when setting the voting duration compared to the voting delay.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"proposalThreshold(uint256)\":{\"notice\":\"Compute the required amount of voting power to create a proposal\"},\"setVotingDelay(uint256)\":{\"notice\":\"Update the voting delay. This operation can only be performed through a governance proposal. Emits a `VotingDelaySet` event.\"},\"setVotingPeriod(uint256)\":{\"notice\":\"Update the voting period. This operation can only be performed through a governance proposal. Emits a `VotingPeriodSet` event.\"},\"votingDelay()\":{\"notice\":\"module:user-config\"},\"votingPeriod()\":{\"notice\":\"module:user-config\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/governance/TokenholderGovernor.sol\":\"TokenholderGovernor\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10},\"remappings\":[]},\"sources\":{\"@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/AccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControl.sol\\\";\\nimport \\\"../utils/Context.sol\\\";\\nimport \\\"../utils/Strings.sol\\\";\\nimport \\\"../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev Contract module that allows children to implement role-based access\\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\\n * members except through off-chain means by accessing the contract event logs. Some\\n * applications may benefit from on-chain enumerability, for those cases see\\n * {AccessControlEnumerable}.\\n *\\n * Roles are referred to by their `bytes32` identifier. These should be exposed\\n * in the external API and be unique. The best way to achieve this is by\\n * using `public constant` hash digests:\\n *\\n * ```\\n * bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\");\\n * ```\\n *\\n * Roles can be used to represent a set of permissions. To restrict access to a\\n * function call, use {hasRole}:\\n *\\n * ```\\n * function foo() public {\\n * require(hasRole(MY_ROLE, msg.sender));\\n * ...\\n * }\\n * ```\\n *\\n * Roles can be granted and revoked dynamically via the {grantRole} and\\n * {revokeRole} functions. Each role has an associated admin role, and only\\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\\n *\\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\\n * that only accounts with this role will be able to grant or revoke other\\n * roles. More complex role relationships can be created by using\\n * {_setRoleAdmin}.\\n *\\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\\n * grant and revoke this role. Extra precautions should be taken to secure\\n * accounts that have been granted it.\\n */\\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\\n struct RoleData {\\n mapping(address => bool) members;\\n bytes32 adminRole;\\n }\\n\\n mapping(bytes32 => RoleData) private _roles;\\n\\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\\n\\n /**\\n * @dev Modifier that checks that an account has a specific role. Reverts\\n * with a standardized message including the required role.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n *\\n * _Available since v4.1._\\n */\\n modifier onlyRole(bytes32 role) {\\n _checkRole(role, _msgSender());\\n _;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\\n return _roles[role].members[account];\\n }\\n\\n /**\\n * @dev Revert with a standard message if `account` is missing `role`.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n */\\n function _checkRole(bytes32 role, address account) internal view virtual {\\n if (!hasRole(role, account)) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"AccessControl: account \\\",\\n Strings.toHexString(uint160(account), 20),\\n \\\" is missing role \\\",\\n Strings.toHexString(uint256(role), 32)\\n )\\n )\\n );\\n }\\n }\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\\n return _roles[role].adminRole;\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) public virtual override {\\n require(account == _msgSender(), \\\"AccessControl: can only renounce roles for self\\\");\\n\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event. Note that unlike {grantRole}, this function doesn't perform any\\n * checks on the calling account.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from the constructor when setting\\n * up the initial roles for the system.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {AccessControl}.\\n * ====\\n *\\n * NOTE: This function is deprecated in favor of {_grantRole}.\\n */\\n function _setupRole(bytes32 role, address account) internal virtual {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Sets `adminRole` as ``role``'s admin role.\\n *\\n * Emits a {RoleAdminChanged} event.\\n */\\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\\n bytes32 previousAdminRole = getRoleAdmin(role);\\n _roles[role].adminRole = adminRole;\\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * Internal function without access restriction.\\n */\\n function _grantRole(bytes32 role, address account) internal virtual {\\n if (!hasRole(role, account)) {\\n _roles[role].members[account] = true;\\n emit RoleGranted(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * Internal function without access restriction.\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual {\\n if (hasRole(role, account)) {\\n _roles[role].members[account] = false;\\n emit RoleRevoked(role, account, _msgSender());\\n }\\n }\\n}\\n\",\"keccak256\":\"0x4a1a0ba12bf1a33f10d9fe226278cf59675c0b929d29e4da99658a079b27fb84\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/IAccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IAccessControl {\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n * _Available since v3.1._\\n */\\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) external view returns (bool);\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n}\\n\",\"keccak256\":\"0x59ce320a585d7e1f163cd70390a0ef2ff9cec832e2aa544293a00692465a7a57\",\"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/governance/Governor.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (governance/Governor.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/cryptography/ECDSA.sol\\\";\\nimport \\\"../utils/cryptography/draft-EIP712.sol\\\";\\nimport \\\"../utils/introspection/ERC165.sol\\\";\\nimport \\\"../utils/math/SafeCast.sol\\\";\\nimport \\\"../utils/Address.sol\\\";\\nimport \\\"../utils/Context.sol\\\";\\nimport \\\"../utils/Timers.sol\\\";\\nimport \\\"./IGovernor.sol\\\";\\n\\n/**\\n * @dev Core of the governance system, designed to be extended though various modules.\\n *\\n * This contract is abstract and requires several function to be implemented in various modules:\\n *\\n * - A counting module must implement {quorum}, {_quorumReached}, {_voteSucceeded} and {_countVote}\\n * - A voting module must implement {getVotes}\\n * - Additionanly, the {votingPeriod} must also be implemented\\n *\\n * _Available since v4.3._\\n */\\nabstract contract Governor is Context, ERC165, EIP712, IGovernor {\\n using SafeCast for uint256;\\n using Timers for Timers.BlockNumber;\\n\\n bytes32 public constant BALLOT_TYPEHASH = keccak256(\\\"Ballot(uint256 proposalId,uint8 support)\\\");\\n\\n struct ProposalCore {\\n Timers.BlockNumber voteStart;\\n Timers.BlockNumber voteEnd;\\n bool executed;\\n bool canceled;\\n }\\n\\n string private _name;\\n\\n mapping(uint256 => ProposalCore) private _proposals;\\n\\n /**\\n * @dev Restrict access of functions to the governance executor, which may be the Governor itself or a timelock\\n * contract, as specified by {_executor}. This generally means that function with this modifier must be voted on and\\n * executed through the governance protocol.\\n */\\n modifier onlyGovernance() {\\n require(_msgSender() == _executor(), \\\"Governor: onlyGovernance\\\");\\n _;\\n }\\n\\n /**\\n * @dev Sets the value for {name} and {version}\\n */\\n constructor(string memory name_) EIP712(name_, version()) {\\n _name = name_;\\n }\\n\\n /**\\n * @dev Function to receive ETH that will be handled by the governor (disabled if executor is a third party contract)\\n */\\n receive() external payable virtual {\\n require(_executor() == address(this));\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) {\\n return interfaceId == type(IGovernor).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev See {IGovernor-name}.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev See {IGovernor-version}.\\n */\\n function version() public view virtual override returns (string memory) {\\n return \\\"1\\\";\\n }\\n\\n /**\\n * @dev See {IGovernor-hashProposal}.\\n *\\n * The proposal id is produced by hashing the RLC encoded `targets` array, the `values` array, the `calldatas` array\\n * and the descriptionHash (bytes32 which itself is the keccak256 hash of the description string). This proposal id\\n * can be produced from the proposal data which is part of the {ProposalCreated} event. It can even be computed in\\n * advance, before the proposal is submitted.\\n *\\n * Note that the chainId and the governor address are not part of the proposal id computation. Consequently, the\\n * same proposal (with same operation and same description) will have the same id if submitted on multiple governors\\n * accross multiple networks. This also means that in order to execute the same operation twice (on the same\\n * governor) the proposer will have to change the description in order to avoid proposal id conflicts.\\n */\\n function hashProposal(\\n address[] memory targets,\\n uint256[] memory values,\\n bytes[] memory calldatas,\\n bytes32 descriptionHash\\n ) public pure virtual override returns (uint256) {\\n return uint256(keccak256(abi.encode(targets, values, calldatas, descriptionHash)));\\n }\\n\\n /**\\n * @dev See {IGovernor-state}.\\n */\\n function state(uint256 proposalId) public view virtual override returns (ProposalState) {\\n ProposalCore storage proposal = _proposals[proposalId];\\n\\n if (proposal.executed) {\\n return ProposalState.Executed;\\n }\\n\\n if (proposal.canceled) {\\n return ProposalState.Canceled;\\n }\\n\\n uint256 snapshot = proposalSnapshot(proposalId);\\n\\n if (snapshot == 0) {\\n revert(\\\"Governor: unknown proposal id\\\");\\n }\\n\\n if (snapshot >= block.number) {\\n return ProposalState.Pending;\\n }\\n\\n uint256 deadline = proposalDeadline(proposalId);\\n\\n if (deadline >= block.number) {\\n return ProposalState.Active;\\n }\\n\\n if (_quorumReached(proposalId) && _voteSucceeded(proposalId)) {\\n return ProposalState.Succeeded;\\n } else {\\n return ProposalState.Defeated;\\n }\\n }\\n\\n /**\\n * @dev See {IGovernor-proposalSnapshot}.\\n */\\n function proposalSnapshot(uint256 proposalId) public view virtual override returns (uint256) {\\n return _proposals[proposalId].voteStart.getDeadline();\\n }\\n\\n /**\\n * @dev See {IGovernor-proposalDeadline}.\\n */\\n function proposalDeadline(uint256 proposalId) public view virtual override returns (uint256) {\\n return _proposals[proposalId].voteEnd.getDeadline();\\n }\\n\\n /**\\n * @dev Part of the Governor Bravo's interface: _\\\"The number of votes required in order for a voter to become a proposer\\\"_.\\n */\\n function proposalThreshold() public view virtual returns (uint256) {\\n return 0;\\n }\\n\\n /**\\n * @dev Amount of votes already cast passes the threshold limit.\\n */\\n function _quorumReached(uint256 proposalId) internal view virtual returns (bool);\\n\\n /**\\n * @dev Is the proposal successful or not.\\n */\\n function _voteSucceeded(uint256 proposalId) internal view virtual returns (bool);\\n\\n /**\\n * @dev Register a vote with a given support and voting weight.\\n *\\n * Note: Support is generic and can represent various things depending on the voting system used.\\n */\\n function _countVote(\\n uint256 proposalId,\\n address account,\\n uint8 support,\\n uint256 weight\\n ) internal virtual;\\n\\n /**\\n * @dev See {IGovernor-propose}.\\n */\\n function propose(\\n address[] memory targets,\\n uint256[] memory values,\\n bytes[] memory calldatas,\\n string memory description\\n ) public virtual override returns (uint256) {\\n require(\\n getVotes(msg.sender, block.number - 1) >= proposalThreshold(),\\n \\\"GovernorCompatibilityBravo: proposer votes below proposal threshold\\\"\\n );\\n\\n uint256 proposalId = hashProposal(targets, values, calldatas, keccak256(bytes(description)));\\n\\n require(targets.length == values.length, \\\"Governor: invalid proposal length\\\");\\n require(targets.length == calldatas.length, \\\"Governor: invalid proposal length\\\");\\n require(targets.length > 0, \\\"Governor: empty proposal\\\");\\n\\n ProposalCore storage proposal = _proposals[proposalId];\\n require(proposal.voteStart.isUnset(), \\\"Governor: proposal already exists\\\");\\n\\n uint64 snapshot = block.number.toUint64() + votingDelay().toUint64();\\n uint64 deadline = snapshot + votingPeriod().toUint64();\\n\\n proposal.voteStart.setDeadline(snapshot);\\n proposal.voteEnd.setDeadline(deadline);\\n\\n emit ProposalCreated(\\n proposalId,\\n _msgSender(),\\n targets,\\n values,\\n new string[](targets.length),\\n calldatas,\\n snapshot,\\n deadline,\\n description\\n );\\n\\n return proposalId;\\n }\\n\\n /**\\n * @dev See {IGovernor-execute}.\\n */\\n function execute(\\n address[] memory targets,\\n uint256[] memory values,\\n bytes[] memory calldatas,\\n bytes32 descriptionHash\\n ) public payable virtual override returns (uint256) {\\n uint256 proposalId = hashProposal(targets, values, calldatas, descriptionHash);\\n\\n ProposalState status = state(proposalId);\\n require(\\n status == ProposalState.Succeeded || status == ProposalState.Queued,\\n \\\"Governor: proposal not successful\\\"\\n );\\n _proposals[proposalId].executed = true;\\n\\n emit ProposalExecuted(proposalId);\\n\\n _execute(proposalId, targets, values, calldatas, descriptionHash);\\n\\n return proposalId;\\n }\\n\\n /**\\n * @dev Internal execution mechanism. Can be overriden to implement different execution mechanism\\n */\\n function _execute(\\n uint256, /* proposalId */\\n address[] memory targets,\\n uint256[] memory values,\\n bytes[] memory calldatas,\\n bytes32 /*descriptionHash*/\\n ) internal virtual {\\n string memory errorMessage = \\\"Governor: call reverted without message\\\";\\n for (uint256 i = 0; i < targets.length; ++i) {\\n (bool success, bytes memory returndata) = targets[i].call{value: values[i]}(calldatas[i]);\\n Address.verifyCallResult(success, returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Internal cancel mechanism: locks up the proposal timer, preventing it from being re-submitted. Marks it as\\n * canceled to allow distinguishing it from executed proposals.\\n *\\n * Emits a {IGovernor-ProposalCanceled} event.\\n */\\n function _cancel(\\n address[] memory targets,\\n uint256[] memory values,\\n bytes[] memory calldatas,\\n bytes32 descriptionHash\\n ) internal virtual returns (uint256) {\\n uint256 proposalId = hashProposal(targets, values, calldatas, descriptionHash);\\n ProposalState status = state(proposalId);\\n\\n require(\\n status != ProposalState.Canceled && status != ProposalState.Expired && status != ProposalState.Executed,\\n \\\"Governor: proposal not active\\\"\\n );\\n _proposals[proposalId].canceled = true;\\n\\n emit ProposalCanceled(proposalId);\\n\\n return proposalId;\\n }\\n\\n /**\\n * @dev See {IGovernor-castVote}.\\n */\\n function castVote(uint256 proposalId, uint8 support) public virtual override returns (uint256) {\\n address voter = _msgSender();\\n return _castVote(proposalId, voter, support, \\\"\\\");\\n }\\n\\n /**\\n * @dev See {IGovernor-castVoteWithReason}.\\n */\\n function castVoteWithReason(\\n uint256 proposalId,\\n uint8 support,\\n string calldata reason\\n ) public virtual override returns (uint256) {\\n address voter = _msgSender();\\n return _castVote(proposalId, voter, support, reason);\\n }\\n\\n /**\\n * @dev See {IGovernor-castVoteBySig}.\\n */\\n function castVoteBySig(\\n uint256 proposalId,\\n uint8 support,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) public virtual override returns (uint256) {\\n address voter = ECDSA.recover(\\n _hashTypedDataV4(keccak256(abi.encode(BALLOT_TYPEHASH, proposalId, support))),\\n v,\\n r,\\n s\\n );\\n return _castVote(proposalId, voter, support, \\\"\\\");\\n }\\n\\n /**\\n * @dev Internal vote casting mechanism: Check that the vote is pending, that it has not been cast yet, retrieve\\n * voting weight using {IGovernor-getVotes} and call the {_countVote} internal function.\\n *\\n * Emits a {IGovernor-VoteCast} event.\\n */\\n function _castVote(\\n uint256 proposalId,\\n address account,\\n uint8 support,\\n string memory reason\\n ) internal virtual returns (uint256) {\\n ProposalCore storage proposal = _proposals[proposalId];\\n require(state(proposalId) == ProposalState.Active, \\\"Governor: vote not currently active\\\");\\n\\n uint256 weight = getVotes(account, proposal.voteStart.getDeadline());\\n _countVote(proposalId, account, support, weight);\\n\\n emit VoteCast(account, proposalId, support, weight, reason);\\n\\n return weight;\\n }\\n\\n /**\\n * @dev Relays a transaction or function call to an arbitrary target. In cases where the governance executor\\n * is some contract other than the governor itself, like when using a timelock, this function can be invoked\\n * in a governance proposal to recover tokens or Ether that was sent to the governor contract by mistake.\\n * Note that if the executor is simply the governor itself, use of `relay` is redundant.\\n */\\n function relay(\\n address target,\\n uint256 value,\\n bytes calldata data\\n ) external virtual onlyGovernance {\\n Address.functionCallWithValue(target, data, value);\\n }\\n\\n /**\\n * @dev Address through which the governor executes action. Will be overloaded by module that execute actions\\n * through another contract such as a timelock.\\n */\\n function _executor() internal view virtual returns (address) {\\n return address(this);\\n }\\n}\\n\",\"keccak256\":\"0xfaf7663a441cf4161aeceda4907949d537d409b4348e6b242b2a74b4a2d56ce2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/governance/IGovernor.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (governance/IGovernor.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev Interface of the {Governor} core.\\n *\\n * _Available since v4.3._\\n */\\nabstract contract IGovernor is IERC165 {\\n enum ProposalState {\\n Pending,\\n Active,\\n Canceled,\\n Defeated,\\n Succeeded,\\n Queued,\\n Expired,\\n Executed\\n }\\n\\n /**\\n * @dev Emitted when a proposal is created.\\n */\\n event ProposalCreated(\\n uint256 proposalId,\\n address proposer,\\n address[] targets,\\n uint256[] values,\\n string[] signatures,\\n bytes[] calldatas,\\n uint256 startBlock,\\n uint256 endBlock,\\n string description\\n );\\n\\n /**\\n * @dev Emitted when a proposal is canceled.\\n */\\n event ProposalCanceled(uint256 proposalId);\\n\\n /**\\n * @dev Emitted when a proposal is executed.\\n */\\n event ProposalExecuted(uint256 proposalId);\\n\\n /**\\n * @dev Emitted when a vote is cast.\\n *\\n * Note: `support` values should be seen as buckets. There interpretation depends on the voting module used.\\n */\\n event VoteCast(address indexed voter, uint256 proposalId, uint8 support, uint256 weight, string reason);\\n\\n /**\\n * @notice module:core\\n * @dev Name of the governor instance (used in building the ERC712 domain separator).\\n */\\n function name() public view virtual returns (string memory);\\n\\n /**\\n * @notice module:core\\n * @dev Version of the governor instance (used in building the ERC712 domain separator). Default: \\\"1\\\"\\n */\\n function version() public view virtual returns (string memory);\\n\\n /**\\n * @notice module:voting\\n * @dev A description of the possible `support` values for {castVote} and the way these votes are counted, meant to\\n * be consumed by UIs to show correct vote options and interpret the results. The string is a URL-encoded sequence of\\n * key-value pairs that each describe one aspect, for example `support=bravo&quorum=for,abstain`.\\n *\\n * There are 2 standard keys: `support` and `quorum`.\\n *\\n * - `support=bravo` refers to the vote options 0 = Against, 1 = For, 2 = Abstain, as in `GovernorBravo`.\\n * - `quorum=bravo` means that only For votes are counted towards quorum.\\n * - `quorum=for,abstain` means that both For and Abstain votes are counted towards quorum.\\n *\\n * NOTE: The string can be decoded by the standard\\n * https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams[`URLSearchParams`]\\n * JavaScript class.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function COUNTING_MODE() public pure virtual returns (string memory);\\n\\n /**\\n * @notice module:core\\n * @dev Hashing function used to (re)build the proposal id from the proposal details..\\n */\\n function hashProposal(\\n address[] calldata targets,\\n uint256[] calldata values,\\n bytes[] calldata calldatas,\\n bytes32 descriptionHash\\n ) public pure virtual returns (uint256);\\n\\n /**\\n * @notice module:core\\n * @dev Current state of a proposal, following Compound's convention\\n */\\n function state(uint256 proposalId) public view virtual returns (ProposalState);\\n\\n /**\\n * @notice module:core\\n * @dev Block number used to retrieve user's votes and quorum. As per Compound's Comp and OpenZeppelin's\\n * ERC20Votes, the snapshot is performed at the end of this block. Hence, voting for this proposal starts at the\\n * beginning of the following block.\\n */\\n function proposalSnapshot(uint256 proposalId) public view virtual returns (uint256);\\n\\n /**\\n * @notice module:core\\n * @dev Block number at which votes close. Votes close at the end of this block, so it is possible to cast a vote\\n * during this block.\\n */\\n function proposalDeadline(uint256 proposalId) public view virtual returns (uint256);\\n\\n /**\\n * @notice module:user-config\\n * @dev Delay, in number of block, between the proposal is created and the vote starts. This can be increassed to\\n * leave time for users to buy voting power, of delegate it, before the voting of a proposal starts.\\n */\\n function votingDelay() public view virtual returns (uint256);\\n\\n /**\\n * @notice module:user-config\\n * @dev Delay, in number of blocks, between the vote start and vote ends.\\n *\\n * NOTE: The {votingDelay} can delay the start of the vote. This must be considered when setting the voting\\n * duration compared to the voting delay.\\n */\\n function votingPeriod() public view virtual returns (uint256);\\n\\n /**\\n * @notice module:user-config\\n * @dev Minimum number of cast voted required for a proposal to be successful.\\n *\\n * Note: The `blockNumber` parameter corresponds to the snaphot used for counting vote. This allows to scale the\\n * quroum depending on values such as the totalSupply of a token at this block (see {ERC20Votes}).\\n */\\n function quorum(uint256 blockNumber) public view virtual returns (uint256);\\n\\n /**\\n * @notice module:reputation\\n * @dev Voting power of an `account` at a specific `blockNumber`.\\n *\\n * Note: this can be implemented in a number of ways, for example by reading the delegated balance from one (or\\n * multiple), {ERC20Votes} tokens.\\n */\\n function getVotes(address account, uint256 blockNumber) public view virtual returns (uint256);\\n\\n /**\\n * @notice module:voting\\n * @dev Returns weither `account` has cast a vote on `proposalId`.\\n */\\n function hasVoted(uint256 proposalId, address account) public view virtual returns (bool);\\n\\n /**\\n * @dev Create a new proposal. Vote start {IGovernor-votingDelay} blocks after the proposal is created and ends\\n * {IGovernor-votingPeriod} blocks after the voting starts.\\n *\\n * Emits a {ProposalCreated} event.\\n */\\n function propose(\\n address[] memory targets,\\n uint256[] memory values,\\n bytes[] memory calldatas,\\n string memory description\\n ) public virtual returns (uint256 proposalId);\\n\\n /**\\n * @dev Execute a successful proposal. This requires the quorum to be reached, the vote to be successful, and the\\n * deadline to be reached.\\n *\\n * Emits a {ProposalExecuted} event.\\n *\\n * Note: some module can modify the requirements for execution, for example by adding an additional timelock.\\n */\\n function execute(\\n address[] memory targets,\\n uint256[] memory values,\\n bytes[] memory calldatas,\\n bytes32 descriptionHash\\n ) public payable virtual returns (uint256 proposalId);\\n\\n /**\\n * @dev Cast a vote\\n *\\n * Emits a {VoteCast} event.\\n */\\n function castVote(uint256 proposalId, uint8 support) public virtual returns (uint256 balance);\\n\\n /**\\n * @dev Cast a vote with a reason\\n *\\n * Emits a {VoteCast} event.\\n */\\n function castVoteWithReason(\\n uint256 proposalId,\\n uint8 support,\\n string calldata reason\\n ) public virtual returns (uint256 balance);\\n\\n /**\\n * @dev Cast a vote using the user cryptographic signature.\\n *\\n * Emits a {VoteCast} event.\\n */\\n function castVoteBySig(\\n uint256 proposalId,\\n uint8 support,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) public virtual returns (uint256 balance);\\n}\\n\",\"keccak256\":\"0x4a3702e2556bc04120a353119d50cb5edbc6f5c9c5504b04e598b9195b0e5471\",\"license\":\"MIT\"},\"@openzeppelin/contracts/governance/TimelockController.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (governance/TimelockController.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../access/AccessControl.sol\\\";\\n\\n/**\\n * @dev Contract module which acts as a timelocked controller. When set as the\\n * owner of an `Ownable` smart contract, it enforces a timelock on all\\n * `onlyOwner` maintenance operations. This gives time for users of the\\n * controlled contract to exit before a potentially dangerous maintenance\\n * operation is applied.\\n *\\n * By default, this contract is self administered, meaning administration tasks\\n * have to go through the timelock process. The proposer (resp executor) role\\n * is in charge of proposing (resp executing) operations. A common use case is\\n * to position this {TimelockController} as the owner of a smart contract, with\\n * a multisig or a DAO as the sole proposer.\\n *\\n * _Available since v3.3._\\n */\\ncontract TimelockController is AccessControl {\\n bytes32 public constant TIMELOCK_ADMIN_ROLE = keccak256(\\\"TIMELOCK_ADMIN_ROLE\\\");\\n bytes32 public constant PROPOSER_ROLE = keccak256(\\\"PROPOSER_ROLE\\\");\\n bytes32 public constant EXECUTOR_ROLE = keccak256(\\\"EXECUTOR_ROLE\\\");\\n uint256 internal constant _DONE_TIMESTAMP = uint256(1);\\n\\n mapping(bytes32 => uint256) private _timestamps;\\n uint256 private _minDelay;\\n\\n /**\\n * @dev Emitted when a call is scheduled as part of operation `id`.\\n */\\n event CallScheduled(\\n bytes32 indexed id,\\n uint256 indexed index,\\n address target,\\n uint256 value,\\n bytes data,\\n bytes32 predecessor,\\n uint256 delay\\n );\\n\\n /**\\n * @dev Emitted when a call is performed as part of operation `id`.\\n */\\n event CallExecuted(bytes32 indexed id, uint256 indexed index, address target, uint256 value, bytes data);\\n\\n /**\\n * @dev Emitted when operation `id` is cancelled.\\n */\\n event Cancelled(bytes32 indexed id);\\n\\n /**\\n * @dev Emitted when the minimum delay for future operations is modified.\\n */\\n event MinDelayChange(uint256 oldDuration, uint256 newDuration);\\n\\n /**\\n * @dev Initializes the contract with a given `minDelay`.\\n */\\n constructor(\\n uint256 minDelay,\\n address[] memory proposers,\\n address[] memory executors\\n ) {\\n _setRoleAdmin(TIMELOCK_ADMIN_ROLE, TIMELOCK_ADMIN_ROLE);\\n _setRoleAdmin(PROPOSER_ROLE, TIMELOCK_ADMIN_ROLE);\\n _setRoleAdmin(EXECUTOR_ROLE, TIMELOCK_ADMIN_ROLE);\\n\\n // deployer + self administration\\n _setupRole(TIMELOCK_ADMIN_ROLE, _msgSender());\\n _setupRole(TIMELOCK_ADMIN_ROLE, address(this));\\n\\n // register proposers\\n for (uint256 i = 0; i < proposers.length; ++i) {\\n _setupRole(PROPOSER_ROLE, proposers[i]);\\n }\\n\\n // register executors\\n for (uint256 i = 0; i < executors.length; ++i) {\\n _setupRole(EXECUTOR_ROLE, executors[i]);\\n }\\n\\n _minDelay = minDelay;\\n emit MinDelayChange(0, minDelay);\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only by a certain role. In\\n * addition to checking the sender's role, `address(0)` 's role is also\\n * considered. Granting a role to `address(0)` is equivalent to enabling\\n * this role for everyone.\\n */\\n modifier onlyRoleOrOpenRole(bytes32 role) {\\n if (!hasRole(role, address(0))) {\\n _checkRole(role, _msgSender());\\n }\\n _;\\n }\\n\\n /**\\n * @dev Contract might receive/hold ETH as part of the maintenance process.\\n */\\n receive() external payable {}\\n\\n /**\\n * @dev Returns whether an id correspond to a registered operation. This\\n * includes both Pending, Ready and Done operations.\\n */\\n function isOperation(bytes32 id) public view virtual returns (bool pending) {\\n return getTimestamp(id) > 0;\\n }\\n\\n /**\\n * @dev Returns whether an operation is pending or not.\\n */\\n function isOperationPending(bytes32 id) public view virtual returns (bool pending) {\\n return getTimestamp(id) > _DONE_TIMESTAMP;\\n }\\n\\n /**\\n * @dev Returns whether an operation is ready or not.\\n */\\n function isOperationReady(bytes32 id) public view virtual returns (bool ready) {\\n uint256 timestamp = getTimestamp(id);\\n return timestamp > _DONE_TIMESTAMP && timestamp <= block.timestamp;\\n }\\n\\n /**\\n * @dev Returns whether an operation is done or not.\\n */\\n function isOperationDone(bytes32 id) public view virtual returns (bool done) {\\n return getTimestamp(id) == _DONE_TIMESTAMP;\\n }\\n\\n /**\\n * @dev Returns the timestamp at with an operation becomes ready (0 for\\n * unset operations, 1 for done operations).\\n */\\n function getTimestamp(bytes32 id) public view virtual returns (uint256 timestamp) {\\n return _timestamps[id];\\n }\\n\\n /**\\n * @dev Returns the minimum delay for an operation to become valid.\\n *\\n * This value can be changed by executing an operation that calls `updateDelay`.\\n */\\n function getMinDelay() public view virtual returns (uint256 duration) {\\n return _minDelay;\\n }\\n\\n /**\\n * @dev Returns the identifier of an operation containing a single\\n * transaction.\\n */\\n function hashOperation(\\n address target,\\n uint256 value,\\n bytes calldata data,\\n bytes32 predecessor,\\n bytes32 salt\\n ) public pure virtual returns (bytes32 hash) {\\n return keccak256(abi.encode(target, value, data, predecessor, salt));\\n }\\n\\n /**\\n * @dev Returns the identifier of an operation containing a batch of\\n * transactions.\\n */\\n function hashOperationBatch(\\n address[] calldata targets,\\n uint256[] calldata values,\\n bytes[] calldata datas,\\n bytes32 predecessor,\\n bytes32 salt\\n ) public pure virtual returns (bytes32 hash) {\\n return keccak256(abi.encode(targets, values, datas, predecessor, salt));\\n }\\n\\n /**\\n * @dev Schedule an operation containing a single transaction.\\n *\\n * Emits a {CallScheduled} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have the 'proposer' role.\\n */\\n function schedule(\\n address target,\\n uint256 value,\\n bytes calldata data,\\n bytes32 predecessor,\\n bytes32 salt,\\n uint256 delay\\n ) public virtual onlyRole(PROPOSER_ROLE) {\\n bytes32 id = hashOperation(target, value, data, predecessor, salt);\\n _schedule(id, delay);\\n emit CallScheduled(id, 0, target, value, data, predecessor, delay);\\n }\\n\\n /**\\n * @dev Schedule an operation containing a batch of transactions.\\n *\\n * Emits one {CallScheduled} event per transaction in the batch.\\n *\\n * Requirements:\\n *\\n * - the caller must have the 'proposer' role.\\n */\\n function scheduleBatch(\\n address[] calldata targets,\\n uint256[] calldata values,\\n bytes[] calldata datas,\\n bytes32 predecessor,\\n bytes32 salt,\\n uint256 delay\\n ) public virtual onlyRole(PROPOSER_ROLE) {\\n require(targets.length == values.length, \\\"TimelockController: length mismatch\\\");\\n require(targets.length == datas.length, \\\"TimelockController: length mismatch\\\");\\n\\n bytes32 id = hashOperationBatch(targets, values, datas, predecessor, salt);\\n _schedule(id, delay);\\n for (uint256 i = 0; i < targets.length; ++i) {\\n emit CallScheduled(id, i, targets[i], values[i], datas[i], predecessor, delay);\\n }\\n }\\n\\n /**\\n * @dev Schedule an operation that is to becomes valid after a given delay.\\n */\\n function _schedule(bytes32 id, uint256 delay) private {\\n require(!isOperation(id), \\\"TimelockController: operation already scheduled\\\");\\n require(delay >= getMinDelay(), \\\"TimelockController: insufficient delay\\\");\\n _timestamps[id] = block.timestamp + delay;\\n }\\n\\n /**\\n * @dev Cancel an operation.\\n *\\n * Requirements:\\n *\\n * - the caller must have the 'proposer' role.\\n */\\n function cancel(bytes32 id) public virtual onlyRole(PROPOSER_ROLE) {\\n require(isOperationPending(id), \\\"TimelockController: operation cannot be cancelled\\\");\\n delete _timestamps[id];\\n\\n emit Cancelled(id);\\n }\\n\\n /**\\n * @dev Execute an (ready) operation containing a single transaction.\\n *\\n * Emits a {CallExecuted} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have the 'executor' role.\\n */\\n function execute(\\n address target,\\n uint256 value,\\n bytes calldata data,\\n bytes32 predecessor,\\n bytes32 salt\\n ) public payable virtual onlyRoleOrOpenRole(EXECUTOR_ROLE) {\\n bytes32 id = hashOperation(target, value, data, predecessor, salt);\\n _beforeCall(id, predecessor);\\n _call(id, 0, target, value, data);\\n _afterCall(id);\\n }\\n\\n /**\\n * @dev Execute an (ready) operation containing a batch of transactions.\\n *\\n * Emits one {CallExecuted} event per transaction in the batch.\\n *\\n * Requirements:\\n *\\n * - the caller must have the 'executor' role.\\n */\\n function executeBatch(\\n address[] calldata targets,\\n uint256[] calldata values,\\n bytes[] calldata datas,\\n bytes32 predecessor,\\n bytes32 salt\\n ) public payable virtual onlyRoleOrOpenRole(EXECUTOR_ROLE) {\\n require(targets.length == values.length, \\\"TimelockController: length mismatch\\\");\\n require(targets.length == datas.length, \\\"TimelockController: length mismatch\\\");\\n\\n bytes32 id = hashOperationBatch(targets, values, datas, predecessor, salt);\\n _beforeCall(id, predecessor);\\n for (uint256 i = 0; i < targets.length; ++i) {\\n _call(id, i, targets[i], values[i], datas[i]);\\n }\\n _afterCall(id);\\n }\\n\\n /**\\n * @dev Checks before execution of an operation's calls.\\n */\\n function _beforeCall(bytes32 id, bytes32 predecessor) private view {\\n require(isOperationReady(id), \\\"TimelockController: operation is not ready\\\");\\n require(predecessor == bytes32(0) || isOperationDone(predecessor), \\\"TimelockController: missing dependency\\\");\\n }\\n\\n /**\\n * @dev Checks after execution of an operation's calls.\\n */\\n function _afterCall(bytes32 id) private {\\n require(isOperationReady(id), \\\"TimelockController: operation is not ready\\\");\\n _timestamps[id] = _DONE_TIMESTAMP;\\n }\\n\\n /**\\n * @dev Execute an operation's call.\\n *\\n * Emits a {CallExecuted} event.\\n */\\n function _call(\\n bytes32 id,\\n uint256 index,\\n address target,\\n uint256 value,\\n bytes calldata data\\n ) private {\\n (bool success, ) = target.call{value: value}(data);\\n require(success, \\\"TimelockController: underlying transaction reverted\\\");\\n\\n emit CallExecuted(id, index, target, value, data);\\n }\\n\\n /**\\n * @dev Changes the minimum timelock duration for future operations.\\n *\\n * Emits a {MinDelayChange} event.\\n *\\n * Requirements:\\n *\\n * - the caller must be the timelock itself. This can only be achieved by scheduling and later executing\\n * an operation where the timelock is the target and the data is the ABI-encoded call to this function.\\n */\\n function updateDelay(uint256 newDelay) external virtual {\\n require(msg.sender == address(this), \\\"TimelockController: caller must be timelock\\\");\\n emit MinDelayChange(_minDelay, newDelay);\\n _minDelay = newDelay;\\n }\\n}\\n\",\"keccak256\":\"0x61357e3fe6a0a93c779bc75f730d219458b268ffd19c0c0a6f31c7eb0f435466\",\"license\":\"MIT\"},\"@openzeppelin/contracts/governance/extensions/GovernorCountingSimple.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (governance/extensions/GovernorCountingSimple.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Governor.sol\\\";\\n\\n/**\\n * @dev Extension of {Governor} for simple, 3 options, vote counting.\\n *\\n * _Available since v4.3._\\n */\\nabstract contract GovernorCountingSimple is Governor {\\n /**\\n * @dev Supported vote types. Matches Governor Bravo ordering.\\n */\\n enum VoteType {\\n Against,\\n For,\\n Abstain\\n }\\n\\n struct ProposalVote {\\n uint256 againstVotes;\\n uint256 forVotes;\\n uint256 abstainVotes;\\n mapping(address => bool) hasVoted;\\n }\\n\\n mapping(uint256 => ProposalVote) private _proposalVotes;\\n\\n /**\\n * @dev See {IGovernor-COUNTING_MODE}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function COUNTING_MODE() public pure virtual override returns (string memory) {\\n return \\\"support=bravo&quorum=for,abstain\\\";\\n }\\n\\n /**\\n * @dev See {IGovernor-hasVoted}.\\n */\\n function hasVoted(uint256 proposalId, address account) public view virtual override returns (bool) {\\n return _proposalVotes[proposalId].hasVoted[account];\\n }\\n\\n /**\\n * @dev Accessor to the internal vote counts.\\n */\\n function proposalVotes(uint256 proposalId)\\n public\\n view\\n virtual\\n returns (\\n uint256 againstVotes,\\n uint256 forVotes,\\n uint256 abstainVotes\\n )\\n {\\n ProposalVote storage proposalvote = _proposalVotes[proposalId];\\n return (proposalvote.againstVotes, proposalvote.forVotes, proposalvote.abstainVotes);\\n }\\n\\n /**\\n * @dev See {Governor-_quorumReached}.\\n */\\n function _quorumReached(uint256 proposalId) internal view virtual override returns (bool) {\\n ProposalVote storage proposalvote = _proposalVotes[proposalId];\\n\\n return quorum(proposalSnapshot(proposalId)) <= proposalvote.forVotes + proposalvote.abstainVotes;\\n }\\n\\n /**\\n * @dev See {Governor-_voteSucceeded}. In this module, the forVotes must be strictly over the againstVotes.\\n */\\n function _voteSucceeded(uint256 proposalId) internal view virtual override returns (bool) {\\n ProposalVote storage proposalvote = _proposalVotes[proposalId];\\n\\n return proposalvote.forVotes > proposalvote.againstVotes;\\n }\\n\\n /**\\n * @dev See {Governor-_countVote}. In this module, the support follows the `VoteType` enum (from Governor Bravo).\\n */\\n function _countVote(\\n uint256 proposalId,\\n address account,\\n uint8 support,\\n uint256 weight\\n ) internal virtual override {\\n ProposalVote storage proposalvote = _proposalVotes[proposalId];\\n\\n require(!proposalvote.hasVoted[account], \\\"GovernorVotingSimple: vote already cast\\\");\\n proposalvote.hasVoted[account] = true;\\n\\n if (support == uint8(VoteType.Against)) {\\n proposalvote.againstVotes += weight;\\n } else if (support == uint8(VoteType.For)) {\\n proposalvote.forVotes += weight;\\n } else if (support == uint8(VoteType.Abstain)) {\\n proposalvote.abstainVotes += weight;\\n } else {\\n revert(\\\"GovernorVotingSimple: invalid value for enum VoteType\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x42fdf674e422c97ee262f0dd1e636de1ee6c1556e61e38b167217e49381eff1f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/governance/extensions/GovernorPreventLateQuorum.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (governance/extensions/GovernorPreventLateQuorum.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Governor.sol\\\";\\nimport \\\"../../utils/math/Math.sol\\\";\\n\\n/**\\n * @dev A module that ensures there is a minimum voting period after quorum is reached. This prevents a large voter from\\n * swaying a vote and triggering quorum at the last minute, by ensuring there is always time for other voters to react\\n * and try to oppose the decision.\\n *\\n * If a vote causes quorum to be reached, the proposal's voting period may be extended so that it does not end before at\\n * least a given number of blocks have passed (the \\\"vote extension\\\" parameter). This parameter can be set by the\\n * governance executor (e.g. through a governance proposal).\\n *\\n * _Available since v4.5._\\n */\\nabstract contract GovernorPreventLateQuorum is Governor {\\n using SafeCast for uint256;\\n using Timers for Timers.BlockNumber;\\n\\n uint64 private _voteExtension;\\n mapping(uint256 => Timers.BlockNumber) private _extendedDeadlines;\\n\\n /// @dev Emitted when a proposal deadline is pushed back due to reaching quorum late in its voting period.\\n event ProposalExtended(uint256 indexed proposalId, uint64 extendedDeadline);\\n\\n /// @dev Emitted when the {lateQuorumVoteExtension} parameter is changed.\\n event LateQuorumVoteExtensionSet(uint64 oldVoteExtension, uint64 newVoteExtension);\\n\\n /**\\n * @dev Initializes the vote extension parameter: the number of blocks that are required to pass since a proposal\\n * reaches quorum until its voting period ends. If necessary the voting period will be extended beyond the one set\\n * at proposal creation.\\n */\\n constructor(uint64 initialVoteExtension) {\\n _setLateQuorumVoteExtension(initialVoteExtension);\\n }\\n\\n /**\\n * @dev Returns the proposal deadline, which may have been extended beyond that set at proposal creation, if the\\n * proposal reached quorum late in the voting period. See {Governor-proposalDeadline}.\\n */\\n function proposalDeadline(uint256 proposalId) public view virtual override returns (uint256) {\\n return Math.max(super.proposalDeadline(proposalId), _extendedDeadlines[proposalId].getDeadline());\\n }\\n\\n /**\\n * @dev Casts a vote and detects if it caused quorum to be reached, potentially extending the voting period. See\\n * {Governor-_castVote}.\\n *\\n * May emit a {ProposalExtended} event.\\n */\\n function _castVote(\\n uint256 proposalId,\\n address account,\\n uint8 support,\\n string memory reason\\n ) internal virtual override returns (uint256) {\\n uint256 result = super._castVote(proposalId, account, support, reason);\\n\\n Timers.BlockNumber storage extendedDeadline = _extendedDeadlines[proposalId];\\n\\n if (extendedDeadline.isUnset() && _quorumReached(proposalId)) {\\n uint64 extendedDeadlineValue = block.number.toUint64() + lateQuorumVoteExtension();\\n\\n if (extendedDeadlineValue > proposalDeadline(proposalId)) {\\n emit ProposalExtended(proposalId, extendedDeadlineValue);\\n }\\n\\n extendedDeadline.setDeadline(extendedDeadlineValue);\\n }\\n\\n return result;\\n }\\n\\n /**\\n * @dev Returns the current value of the vote extension parameter: the number of blocks that are required to pass\\n * from the time a proposal reaches quorum until its voting period ends.\\n */\\n function lateQuorumVoteExtension() public view virtual returns (uint64) {\\n return _voteExtension;\\n }\\n\\n /**\\n * @dev Changes the {lateQuorumVoteExtension}. This operation can only be performed by the governance executor,\\n * generally through a governance proposal.\\n *\\n * Emits a {LateQuorumVoteExtensionSet} event.\\n */\\n function setLateQuorumVoteExtension(uint64 newVoteExtension) public virtual onlyGovernance {\\n _setLateQuorumVoteExtension(newVoteExtension);\\n }\\n\\n /**\\n * @dev Changes the {lateQuorumVoteExtension}. This is an internal function that can be exposed in a public function\\n * like {setLateQuorumVoteExtension} if another access control mechanism is needed.\\n *\\n * Emits a {LateQuorumVoteExtensionSet} event.\\n */\\n function _setLateQuorumVoteExtension(uint64 newVoteExtension) internal virtual {\\n emit LateQuorumVoteExtensionSet(_voteExtension, newVoteExtension);\\n _voteExtension = newVoteExtension;\\n }\\n}\\n\",\"keccak256\":\"0x47b07271823af7e7e5926d5716bc877ad2357c8842b37c4fea93131a60ca2eb4\",\"license\":\"MIT\"},\"@openzeppelin/contracts/governance/extensions/GovernorTimelockControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (governance/extensions/GovernorTimelockControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IGovernorTimelock.sol\\\";\\nimport \\\"../Governor.sol\\\";\\nimport \\\"../TimelockController.sol\\\";\\n\\n/**\\n * @dev Extension of {Governor} that binds the execution process to an instance of {TimelockController}. This adds a\\n * delay, enforced by the {TimelockController} to all successful proposal (in addition to the voting duration). The\\n * {Governor} needs the proposer (and ideally the executor) roles for the {Governor} to work properly.\\n *\\n * Using this model means the proposal will be operated by the {TimelockController} and not by the {Governor}. Thus,\\n * the assets and permissions must be attached to the {TimelockController}. Any asset sent to the {Governor} will be\\n * inaccessible.\\n *\\n * WARNING: Setting up the TimelockController to have additional proposers besides the governor is very risky, as it\\n * grants them powers that they must be trusted or known not to use: 1) {onlyGovernance} functions like {relay} are\\n * available to them through the timelock, and 2) approved governance proposals can be blocked by them, effectively\\n * executing a Denial of Service attack. This risk will be mitigated in a future release.\\n *\\n * _Available since v4.3._\\n */\\nabstract contract GovernorTimelockControl is IGovernorTimelock, Governor {\\n TimelockController private _timelock;\\n mapping(uint256 => bytes32) private _timelockIds;\\n\\n /**\\n * @dev Emitted when the timelock controller used for proposal execution is modified.\\n */\\n event TimelockChange(address oldTimelock, address newTimelock);\\n\\n /**\\n * @dev Set the timelock.\\n */\\n constructor(TimelockController timelockAddress) {\\n _updateTimelock(timelockAddress);\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, Governor) returns (bool) {\\n return interfaceId == type(IGovernorTimelock).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Overriden version of the {Governor-state} function with added support for the `Queued` status.\\n */\\n function state(uint256 proposalId) public view virtual override(IGovernor, Governor) returns (ProposalState) {\\n ProposalState status = super.state(proposalId);\\n\\n if (status != ProposalState.Succeeded) {\\n return status;\\n }\\n\\n // core tracks execution, so we just have to check if successful proposal have been queued.\\n bytes32 queueid = _timelockIds[proposalId];\\n if (queueid == bytes32(0)) {\\n return status;\\n } else if (_timelock.isOperationDone(queueid)) {\\n return ProposalState.Executed;\\n } else if (_timelock.isOperationPending(queueid)) {\\n return ProposalState.Queued;\\n } else {\\n return ProposalState.Canceled;\\n }\\n }\\n\\n /**\\n * @dev Public accessor to check the address of the timelock\\n */\\n function timelock() public view virtual override returns (address) {\\n return address(_timelock);\\n }\\n\\n /**\\n * @dev Public accessor to check the eta of a queued proposal\\n */\\n function proposalEta(uint256 proposalId) public view virtual override returns (uint256) {\\n uint256 eta = _timelock.getTimestamp(_timelockIds[proposalId]);\\n return eta == 1 ? 0 : eta; // _DONE_TIMESTAMP (1) should be replaced with a 0 value\\n }\\n\\n /**\\n * @dev Function to queue a proposal to the timelock.\\n */\\n function queue(\\n address[] memory targets,\\n uint256[] memory values,\\n bytes[] memory calldatas,\\n bytes32 descriptionHash\\n ) public virtual override returns (uint256) {\\n uint256 proposalId = hashProposal(targets, values, calldatas, descriptionHash);\\n\\n require(state(proposalId) == ProposalState.Succeeded, \\\"Governor: proposal not successful\\\");\\n\\n uint256 delay = _timelock.getMinDelay();\\n _timelockIds[proposalId] = _timelock.hashOperationBatch(targets, values, calldatas, 0, descriptionHash);\\n _timelock.scheduleBatch(targets, values, calldatas, 0, descriptionHash, delay);\\n\\n emit ProposalQueued(proposalId, block.timestamp + delay);\\n\\n return proposalId;\\n }\\n\\n /**\\n * @dev Overriden execute function that run the already queued proposal through the timelock.\\n */\\n function _execute(\\n uint256, /* proposalId */\\n address[] memory targets,\\n uint256[] memory values,\\n bytes[] memory calldatas,\\n bytes32 descriptionHash\\n ) internal virtual override {\\n _timelock.executeBatch{value: msg.value}(targets, values, calldatas, 0, descriptionHash);\\n }\\n\\n /**\\n * @dev Overriden version of the {Governor-_cancel} function to cancel the timelocked proposal if it as already\\n * been queued.\\n */\\n function _cancel(\\n address[] memory targets,\\n uint256[] memory values,\\n bytes[] memory calldatas,\\n bytes32 descriptionHash\\n ) internal virtual override returns (uint256) {\\n uint256 proposalId = super._cancel(targets, values, calldatas, descriptionHash);\\n\\n if (_timelockIds[proposalId] != 0) {\\n _timelock.cancel(_timelockIds[proposalId]);\\n delete _timelockIds[proposalId];\\n }\\n\\n return proposalId;\\n }\\n\\n /**\\n * @dev Address through which the governor executes action. In this case, the timelock.\\n */\\n function _executor() internal view virtual override returns (address) {\\n return address(_timelock);\\n }\\n\\n /**\\n * @dev Public endpoint to update the underlying timelock instance. Restricted to the timelock itself, so updates\\n * must be proposed, scheduled, and executed through governance proposals.\\n *\\n * CAUTION: It is not recommended to change the timelock while there are other queued governance proposals.\\n */\\n function updateTimelock(TimelockController newTimelock) external virtual onlyGovernance {\\n _updateTimelock(newTimelock);\\n }\\n\\n function _updateTimelock(TimelockController newTimelock) private {\\n emit TimelockChange(address(_timelock), address(newTimelock));\\n _timelock = newTimelock;\\n }\\n}\\n\",\"keccak256\":\"0x027e928dff85e88a4c24d5530f61fd6db43052e1430f3f3c7469b6d54ed87f87\",\"license\":\"MIT\"},\"@openzeppelin/contracts/governance/extensions/IGovernorTimelock.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (governance/extensions/IGovernorTimelock.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IGovernor.sol\\\";\\n\\n/**\\n * @dev Extension of the {IGovernor} for timelock supporting modules.\\n *\\n * _Available since v4.3._\\n */\\nabstract contract IGovernorTimelock is IGovernor {\\n event ProposalQueued(uint256 proposalId, uint256 eta);\\n\\n function timelock() public view virtual returns (address);\\n\\n function proposalEta(uint256 proposalId) public view virtual returns (uint256);\\n\\n function queue(\\n address[] memory targets,\\n uint256[] memory values,\\n bytes[] memory calldatas,\\n bytes32 descriptionHash\\n ) public virtual returns (uint256 proposalId);\\n}\\n\",\"keccak256\":\"0xe6234ac4ba0508a3371a46543cdf4bf3a1a404d2d3c3470006741a0da294f974\",\"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/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n}\\n\",\"keccak256\":\"0x32c202bd28995dd20c4347b7c6467a6d3241c74c8ad3edcbb610cd9205916c45\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Timers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Timers.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Tooling for timepoints, timers and delays\\n */\\nlibrary Timers {\\n struct Timestamp {\\n uint64 _deadline;\\n }\\n\\n function getDeadline(Timestamp memory timer) internal pure returns (uint64) {\\n return timer._deadline;\\n }\\n\\n function setDeadline(Timestamp storage timer, uint64 timestamp) internal {\\n timer._deadline = timestamp;\\n }\\n\\n function reset(Timestamp storage timer) internal {\\n timer._deadline = 0;\\n }\\n\\n function isUnset(Timestamp memory timer) internal pure returns (bool) {\\n return timer._deadline == 0;\\n }\\n\\n function isStarted(Timestamp memory timer) internal pure returns (bool) {\\n return timer._deadline > 0;\\n }\\n\\n function isPending(Timestamp memory timer) internal view returns (bool) {\\n return timer._deadline > block.timestamp;\\n }\\n\\n function isExpired(Timestamp memory timer) internal view returns (bool) {\\n return isStarted(timer) && timer._deadline <= block.timestamp;\\n }\\n\\n struct BlockNumber {\\n uint64 _deadline;\\n }\\n\\n function getDeadline(BlockNumber memory timer) internal pure returns (uint64) {\\n return timer._deadline;\\n }\\n\\n function setDeadline(BlockNumber storage timer, uint64 timestamp) internal {\\n timer._deadline = timestamp;\\n }\\n\\n function reset(BlockNumber storage timer) internal {\\n timer._deadline = 0;\\n }\\n\\n function isUnset(BlockNumber memory timer) internal pure returns (bool) {\\n return timer._deadline == 0;\\n }\\n\\n function isStarted(BlockNumber memory timer) internal pure returns (bool) {\\n return timer._deadline > 0;\\n }\\n\\n function isPending(BlockNumber memory timer) internal view returns (bool) {\\n return timer._deadline > block.number;\\n }\\n\\n function isExpired(BlockNumber memory timer) internal view returns (bool) {\\n return isStarted(timer) && timer._deadline <= block.number;\\n }\\n}\\n\",\"keccak256\":\"0x29791a62950a7983e02a673639c1a781d1e448691800456c2ce4b99715391b14\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n } else if (error == RecoverError.InvalidSignatureV) {\\n revert(\\\"ECDSA: invalid signature 'v' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n // Check the signature length\\n // - case 65: r,s,v signature (standard)\\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else if (signature.length == 64) {\\n bytes32 r;\\n bytes32 vs;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n assembly {\\n r := mload(add(signature, 0x20))\\n vs := mload(add(signature, 0x40))\\n }\\n return tryRecover(hash, r, vs);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n if (v != 27 && v != 28) {\\n return (address(0), RecoverError.InvalidSignatureV);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0x3c07f43e60e099b3b157243b3152722e73b80eeb7985c2cd73712828d7f7da29\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./ECDSA.sol\\\";\\n\\n/**\\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\\n *\\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\\n *\\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\\n * ({_hashTypedDataV4}).\\n *\\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\\n * the chain id to protect against replay attacks on an eventual fork of the chain.\\n *\\n * NOTE: This contract implements the version of the encoding known as \\\"v4\\\", as implemented by the JSON RPC method\\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\\n *\\n * _Available since v3.4._\\n */\\nabstract contract EIP712 {\\n /* solhint-disable var-name-mixedcase */\\n // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to\\n // invalidate the cached domain separator if the chain id changes.\\n bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;\\n uint256 private immutable _CACHED_CHAIN_ID;\\n address private immutable _CACHED_THIS;\\n\\n bytes32 private immutable _HASHED_NAME;\\n bytes32 private immutable _HASHED_VERSION;\\n bytes32 private immutable _TYPE_HASH;\\n\\n /* solhint-enable var-name-mixedcase */\\n\\n /**\\n * @dev Initializes the domain separator and parameter caches.\\n *\\n * The meaning of `name` and `version` is specified in\\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\\n *\\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\\n * - `version`: the current major version of the signing domain.\\n *\\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\\n * contract upgrade].\\n */\\n constructor(string memory name, string memory version) {\\n bytes32 hashedName = keccak256(bytes(name));\\n bytes32 hashedVersion = keccak256(bytes(version));\\n bytes32 typeHash = keccak256(\\n \\\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\\\"\\n );\\n _HASHED_NAME = hashedName;\\n _HASHED_VERSION = hashedVersion;\\n _CACHED_CHAIN_ID = block.chainid;\\n _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);\\n _CACHED_THIS = address(this);\\n _TYPE_HASH = typeHash;\\n }\\n\\n /**\\n * @dev Returns the domain separator for the current chain.\\n */\\n function _domainSeparatorV4() internal view returns (bytes32) {\\n if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {\\n return _CACHED_DOMAIN_SEPARATOR;\\n } else {\\n return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);\\n }\\n }\\n\\n function _buildDomainSeparator(\\n bytes32 typeHash,\\n bytes32 nameHash,\\n bytes32 versionHash\\n ) private view returns (bytes32) {\\n return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));\\n }\\n\\n /**\\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\\n * function returns the hash of the fully encoded EIP712 message for this domain.\\n *\\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\\n *\\n * ```solidity\\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\\n * keccak256(\\\"Mail(address to,string contents)\\\"),\\n * mailTo,\\n * keccak256(bytes(mailContents))\\n * )));\\n * address signer = ECDSA.recover(digest, signature);\\n * ```\\n */\\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\\n return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\\n }\\n}\\n\",\"keccak256\":\"0x6688fad58b9ec0286d40fa957152e575d5d8bd4c3aa80985efdb11b44f776ae7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.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 Math {\\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\":\"0xc995bddbca1ae19788db9f8b61e63385edd3fddf89693b612d5abd1a275974d2\",\"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/BaseTokenholderGovernor.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 \\\"./TokenholderGovernorVotes.sol\\\";\\nimport \\\"../token/T.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/AccessControl.sol\\\";\\nimport \\\"@openzeppelin/contracts/governance/Governor.sol\\\";\\nimport \\\"@openzeppelin/contracts/governance/extensions/GovernorCountingSimple.sol\\\";\\nimport \\\"@openzeppelin/contracts/governance/extensions/GovernorPreventLateQuorum.sol\\\";\\nimport \\\"@openzeppelin/contracts/governance/extensions/GovernorTimelockControl.sol\\\";\\n\\ncontract BaseTokenholderGovernor is\\n AccessControl,\\n GovernorCountingSimple,\\n TokenholderGovernorVotes,\\n GovernorPreventLateQuorum,\\n GovernorTimelockControl\\n{\\n bytes32 public constant VETO_POWER =\\n keccak256(\\\"Power to veto proposals in Threshold's Tokenholder DAO\\\");\\n\\n constructor(\\n T _token,\\n IVotesHistory _staking,\\n TimelockController _timelock,\\n address _vetoer,\\n uint256 _quorumNumerator,\\n uint256 _proposalThresholdNumerator,\\n uint256 votingDelay,\\n uint256 votingPeriod,\\n uint64 votingExtension\\n )\\n Governor(\\\"TokenholderGovernor\\\")\\n GovernorParameters(\\n _quorumNumerator,\\n _proposalThresholdNumerator,\\n votingDelay,\\n votingPeriod\\n )\\n GovernorPreventLateQuorum(votingExtension)\\n TokenholderGovernorVotes(_token, _staking)\\n GovernorTimelockControl(_timelock)\\n {\\n _setupRole(VETO_POWER, _vetoer);\\n _setupRole(DEFAULT_ADMIN_ROLE, address(_timelock));\\n }\\n\\n function cancel(\\n address[] memory targets,\\n uint256[] memory values,\\n bytes[] memory calldatas,\\n bytes32 descriptionHash\\n ) external onlyRole(VETO_POWER) returns (uint256) {\\n return _cancel(targets, values, calldatas, descriptionHash);\\n }\\n\\n function propose(\\n address[] memory targets,\\n uint256[] memory values,\\n bytes[] memory calldatas,\\n string memory description\\n ) public override(Governor, IGovernor) returns (uint256) {\\n return super.propose(targets, values, calldatas, description);\\n }\\n\\n function quorum(uint256 blockNumber)\\n public\\n view\\n override(IGovernor, GovernorParameters)\\n returns (uint256)\\n {\\n return super.quorum(blockNumber);\\n }\\n\\n function proposalThreshold()\\n public\\n view\\n override(Governor, GovernorParameters)\\n returns (uint256)\\n {\\n return super.proposalThreshold();\\n }\\n\\n function getVotes(address account, uint256 blockNumber)\\n public\\n view\\n override(IGovernor, TokenholderGovernorVotes)\\n returns (uint256)\\n {\\n return super.getVotes(account, blockNumber);\\n }\\n\\n function state(uint256 proposalId)\\n public\\n view\\n override(Governor, GovernorTimelockControl)\\n returns (ProposalState)\\n {\\n return super.state(proposalId);\\n }\\n\\n function supportsInterface(bytes4 interfaceId)\\n public\\n view\\n override(Governor, GovernorTimelockControl, AccessControl)\\n returns (bool)\\n {\\n return super.supportsInterface(interfaceId);\\n }\\n\\n function _execute(\\n uint256 proposalId,\\n address[] memory targets,\\n uint256[] memory values,\\n bytes[] memory calldatas,\\n bytes32 descriptionHash\\n ) internal override(Governor, GovernorTimelockControl) {\\n super._execute(proposalId, targets, values, calldatas, descriptionHash);\\n }\\n\\n function _cancel(\\n address[] memory targets,\\n uint256[] memory values,\\n bytes[] memory calldatas,\\n bytes32 descriptionHash\\n ) internal override(Governor, GovernorTimelockControl) returns (uint256) {\\n return super._cancel(targets, values, calldatas, descriptionHash);\\n }\\n\\n function _executor()\\n internal\\n view\\n override(Governor, GovernorTimelockControl)\\n returns (address)\\n {\\n return super._executor();\\n }\\n\\n function proposalDeadline(uint256 proposalId)\\n public\\n view\\n virtual\\n override(IGovernor, Governor, GovernorPreventLateQuorum)\\n returns (uint256)\\n {\\n return super.proposalDeadline(proposalId);\\n }\\n\\n function _castVote(\\n uint256 proposalId,\\n address account,\\n uint8 support,\\n string memory reason\\n )\\n internal\\n virtual\\n override(Governor, GovernorPreventLateQuorum)\\n returns (uint256)\\n {\\n return super._castVote(proposalId, account, support, reason);\\n }\\n}\\n\",\"keccak256\":\"0x1b956b2d7c58245e3d7d6ab55b116804dbf097a211ad8b8b75fb4bafcd2b3cea\",\"license\":\"GPL-3.0-or-later\"},\"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/GovernorParameters.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/governance/Governor.sol\\\";\\n\\n/// @title GovernorParameters\\n/// @notice Abstract contract to handle governance parameters\\n/// @dev Based on `GovernorVotesQuorumFraction`, but without being opinionated\\n/// on what's the source of voting power, and extended to handle proposal\\n/// thresholds too. See OpenZeppelin's GovernorVotesQuorumFraction,\\n/// GovernorVotes and GovernorSettings for reference.\\nabstract contract GovernorParameters is Governor {\\n uint256 public constant FRACTION_DENOMINATOR = 10000;\\n uint64 internal constant AVERAGE_BLOCK_TIME_IN_SECONDS = 13;\\n\\n uint256 public quorumNumerator;\\n uint256 public proposalThresholdNumerator;\\n\\n uint256 private _votingDelay;\\n uint256 private _votingPeriod;\\n\\n event QuorumNumeratorUpdated(\\n uint256 oldQuorumNumerator,\\n uint256 newQuorumNumerator\\n );\\n\\n event ProposalThresholdNumeratorUpdated(\\n uint256 oldThresholdNumerator,\\n uint256 newThresholdNumerator\\n );\\n\\n event VotingDelaySet(uint256 oldVotingDelay, uint256 newVotingDelay);\\n event VotingPeriodSet(uint256 oldVotingPeriod, uint256 newVotingPeriod);\\n\\n constructor(\\n uint256 quorumNumeratorValue,\\n uint256 proposalNumeratorValue,\\n uint256 initialVotingDelay,\\n uint256 initialVotingPeriod\\n ) {\\n _updateQuorumNumerator(quorumNumeratorValue);\\n _updateProposalThresholdNumerator(proposalNumeratorValue);\\n _setVotingDelay(initialVotingDelay);\\n _setVotingPeriod(initialVotingPeriod);\\n }\\n\\n function updateQuorumNumerator(uint256 newQuorumNumerator)\\n external\\n virtual\\n onlyGovernance\\n {\\n _updateQuorumNumerator(newQuorumNumerator);\\n }\\n\\n function updateProposalThresholdNumerator(uint256 newNumerator)\\n external\\n virtual\\n onlyGovernance\\n {\\n _updateProposalThresholdNumerator(newNumerator);\\n }\\n\\n /// @notice Update the voting delay. This operation can only be performed\\n /// through a governance proposal. Emits a `VotingDelaySet` event.\\n function setVotingDelay(uint256 newVotingDelay)\\n external\\n virtual\\n onlyGovernance\\n {\\n _setVotingDelay(newVotingDelay);\\n }\\n\\n /// @notice Update the voting period. This operation can only be performed\\n /// through a governance proposal. Emits a `VotingPeriodSet` event.\\n function setVotingPeriod(uint256 newVotingPeriod)\\n external\\n virtual\\n onlyGovernance\\n {\\n _setVotingPeriod(newVotingPeriod);\\n }\\n\\n /// @notice Compute the required amount of voting power to reach quorum\\n /// @param blockNumber The block number to get the quorum at\\n function quorum(uint256 blockNumber)\\n public\\n view\\n virtual\\n override\\n returns (uint256)\\n {\\n return\\n (_getPastTotalSupply(blockNumber) * quorumNumerator) /\\n FRACTION_DENOMINATOR;\\n }\\n\\n /// @notice Compute the required amount of voting power to create a proposal\\n /// at the last block height\\n /// @dev This function is implemented to comply with Governor API but we\\n /// we will actually use `proposalThreshold(uint256 blockNumber)`,\\n /// as in our DAOs the threshold amount changes according to supply.\\n function proposalThreshold()\\n public\\n view\\n virtual\\n override\\n returns (uint256)\\n {\\n return proposalThreshold(block.number - 1);\\n }\\n\\n /// @notice Compute the required amount of voting power to create a proposal\\n /// @param blockNumber The block number to get the proposal threshold at\\n function proposalThreshold(uint256 blockNumber)\\n public\\n view\\n returns (uint256)\\n {\\n return\\n (_getPastTotalSupply(blockNumber) * proposalThresholdNumerator) /\\n FRACTION_DENOMINATOR;\\n }\\n\\n function votingDelay() public view virtual override returns (uint256) {\\n return _votingDelay;\\n }\\n\\n function votingPeriod() public view virtual override returns (uint256) {\\n return _votingPeriod;\\n }\\n\\n function _updateQuorumNumerator(uint256 newQuorumNumerator)\\n internal\\n virtual\\n {\\n require(\\n newQuorumNumerator <= FRACTION_DENOMINATOR,\\n \\\"quorumNumerator > Denominator\\\"\\n );\\n\\n uint256 oldQuorumNumerator = quorumNumerator;\\n quorumNumerator = newQuorumNumerator;\\n\\n emit QuorumNumeratorUpdated(oldQuorumNumerator, newQuorumNumerator);\\n }\\n\\n function _updateProposalThresholdNumerator(uint256 proposalNumerator)\\n internal\\n virtual\\n {\\n require(\\n proposalNumerator <= FRACTION_DENOMINATOR,\\n \\\"proposalNumerator > Denominator\\\"\\n );\\n\\n uint256 oldNumerator = proposalThresholdNumerator;\\n proposalThresholdNumerator = proposalNumerator;\\n\\n emit ProposalThresholdNumeratorUpdated(oldNumerator, proposalNumerator);\\n }\\n\\n function _setVotingDelay(uint256 newVotingDelay) internal virtual {\\n emit VotingDelaySet(_votingDelay, newVotingDelay);\\n _votingDelay = newVotingDelay;\\n }\\n\\n function _setVotingPeriod(uint256 newVotingPeriod) internal virtual {\\n // voting period must be at least one block long\\n require(newVotingPeriod > 0, \\\"Voting period too low\\\");\\n emit VotingPeriodSet(_votingPeriod, newVotingPeriod);\\n _votingPeriod = newVotingPeriod;\\n }\\n\\n /// @notice Compute the past total voting power at a particular block\\n /// @param blockNumber The block number to get the vote power at\\n // slither-disable-next-line dead-code\\n function _getPastTotalSupply(uint256 blockNumber)\\n internal\\n view\\n virtual\\n returns (uint256);\\n}\\n\",\"keccak256\":\"0x5e8cfcd6db07fe4fbb3ae1af3c5232415243e86c779c254dde55b1163fa5955b\",\"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/governance/TokenholderGovernor.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 \\\"./BaseTokenholderGovernor.sol\\\";\\n\\ncontract TokenholderGovernor is BaseTokenholderGovernor {\\n uint256 private constant INITIAL_QUORUM_NUMERATOR = 150; // Defined in basis points, i.e., 1.5%\\n uint256 private constant INITIAL_PROPOSAL_THRESHOLD_NUMERATOR = 25; // Defined in basis points, i.e., 0.25%\\n uint256 private constant INITIAL_VOTING_DELAY =\\n 2 days / AVERAGE_BLOCK_TIME_IN_SECONDS;\\n uint256 private constant INITIAL_VOTING_PERIOD =\\n 10 days / AVERAGE_BLOCK_TIME_IN_SECONDS;\\n uint64 private constant INITIAL_VOTING_EXTENSION =\\n uint64(2 days) / AVERAGE_BLOCK_TIME_IN_SECONDS;\\n\\n constructor(\\n T _token,\\n IVotesHistory _staking,\\n TimelockController _timelock,\\n address vetoer\\n )\\n BaseTokenholderGovernor(\\n _token,\\n _staking,\\n _timelock,\\n vetoer,\\n INITIAL_QUORUM_NUMERATOR,\\n INITIAL_PROPOSAL_THRESHOLD_NUMERATOR,\\n INITIAL_VOTING_DELAY,\\n INITIAL_VOTING_PERIOD,\\n INITIAL_VOTING_EXTENSION\\n )\\n {}\\n}\\n\",\"keccak256\":\"0xaf347718aee945569adc2ed500866e9f3073699b7bc027f9bdd371888acf06ee\",\"license\":\"GPL-3.0-or-later\"},\"contracts/governance/TokenholderGovernorVotes.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 \\\"./GovernorParameters.sol\\\";\\nimport \\\"./IVotesHistory.sol\\\";\\n\\n/// @title TokenholderGovernorVotes\\n/// @notice Tokenholder DAO voting power extraction from both liquid and staked\\n/// T token positions, including legacy stakes (NU/KEEP).\\nabstract contract TokenholderGovernorVotes is GovernorParameters {\\n IVotesHistory public immutable token;\\n IVotesHistory public immutable staking;\\n\\n constructor(IVotesHistory tokenAddress, IVotesHistory tStakingAddress) {\\n token = tokenAddress;\\n staking = tStakingAddress;\\n }\\n\\n /// @notice Read the voting weight from the snapshot mechanism in the token\\n /// and staking contracts. For Tokenholder DAO, there are currently\\n /// two voting power sources:\\n /// - Liquid T, tracked by the T token contract\\n /// - Stakes in the T network, tracked by the T staking contract.\\n /// Note that this also tracks legacy stakes (NU/KEEP); legacy\\n /// stakes count for tokenholders' voting power, but not for the\\n /// total voting power of the Tokenholder DAO\\n /// (see {_getPastTotalSupply}).\\n /// @param account Tokenholder account in the T network\\n /// @param blockNumber The block number to get the vote balance at\\n /// @dev See {IGovernor-getVotes}\\n function getVotes(address account, uint256 blockNumber)\\n public\\n view\\n virtual\\n override\\n returns (uint256)\\n {\\n uint256 liquidVotes = token.getPastVotes(account, blockNumber);\\n uint256 stakedVotes = staking.getPastVotes(account, blockNumber);\\n return liquidVotes + stakedVotes;\\n }\\n\\n /// @notice Compute the total voting power for Tokenholder DAO. Note how it\\n /// only uses the token total supply as source, as native T tokens\\n /// that are staked continue existing, but as deposits in the\\n /// staking contract. However, legacy stakes can't contribute to the\\n /// total voting power as they're already implicitly counted as part\\n /// of Vending Machines' liquid balance; hence, we only need to read\\n /// total voting power from the token.\\n /// @param blockNumber The block number to get the vote power at\\n function _getPastTotalSupply(uint256 blockNumber)\\n internal\\n view\\n virtual\\n override\\n returns (uint256)\\n {\\n return token.getPastTotalSupply(blockNumber);\\n }\\n}\\n\",\"keccak256\":\"0x1548a3bf0c6d9a42379a824f4204fa3ed35c54e42b6aa827d98f6b1b433ebbb4\",\"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\"}},\"version\":1}", + "bytecode": "0x6101806040523480156200001257600080fd5b506040516200410538038062004105833981016040819052620000359162000680565b83838383609660196200004d600d6202a300620006e8565b6001600160401b031662000066600d620d2f00620006e8565b6001600160401b03166200007f600d6202a300620006e8565b86818a8a888888886040518060400160405280601381526020017f546f6b656e686f6c646572476f7665726e6f720000000000000000000000000081525080620000ce6200021f60201b60201c565b815160208084019190912082518383012060e08290526101008190524660a0818152604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81880181905281830187905260608201869052608082019490945230818401528151808203909301835260c00190528051940193909320919290916080523060c0526101205250508251620001749250600191506020840190620005c1565b50620001829050846200023a565b6200018d83620002d8565b62000198826200036b565b620001a381620003ac565b5050506001600160a01b0392831661014052501661016052620001c6816200043f565b50620001d281620004a8565b50620001ff7f65784a4b4efdf70060d396b05be05b4852e8b22ae249d76915bea0da3f992c648762000511565b6200020c60008862000511565b505050505050505050505050506200075a565b6040805180820190915260018152603160f81b602082015290565b612710811115620002925760405162461bcd60e51b815260206004820152601d60248201527f71756f72756d4e756d657261746f72203e2044656e6f6d696e61746f7200000060448201526064015b60405180910390fd5b600480549082905560408051828152602081018490527f0553476bf02ef2726e8ce5ced78d63e26e602e4a2257b1f559418e24b463399791015b60405180910390a15050565b6127108111156200032c5760405162461bcd60e51b815260206004820152601f60248201527f70726f706f73616c4e756d657261746f72203e2044656e6f6d696e61746f7200604482015260640162000289565b600580549082905560408051828152602081018490527f47036a693fe84b7d8f31616a15f6b3e26b080688ffd77d9425e3a0283a3df2619101620002cc565b60065460408051918252602082018390527fc565b045403dc03c2eea82b81a0465edad9e2e7fc4d97e11421c209da93d7a93910160405180910390a1600655565b60008111620003fe5760405162461bcd60e51b815260206004820152601560248201527f566f74696e6720706572696f6420746f6f206c6f770000000000000000000000604482015260640162000289565b60075460408051918252602082018390527f7e3f7f0708a84de9203036abaa450dccc85ad5ff52f78c170f3edb55cf5e8828910160405180910390a1600755565b600854604080516001600160401b03928316815291831660208301527f7ca4ac117ed3cdce75c1161d8207c440389b1a15d69d096831664657c07dafc2910160405180910390a1600880546001600160401b0319166001600160401b0392909216919091179055565b600a54604080516001600160a01b03928316815291831660208301527f08f74ea46ef7894f65eabfb5e6e695de773a000b47c529ab559178069b226401910160405180910390a1600a80546001600160a01b0319166001600160a01b0392909216919091179055565b6200051d828262000521565b5050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166200051d576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556200057d3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b828054620005cf906200071d565b90600052602060002090601f016020900481019282620005f357600085556200063e565b82601f106200060e57805160ff19168380011785556200063e565b828001600101855582156200063e579182015b828111156200063e57825182559160200191906001019062000621565b506200064c92915062000650565b5090565b5b808211156200064c576000815560010162000651565b6001600160a01b03811681146200067d57600080fd5b50565b600080600080608085870312156200069757600080fd5b8451620006a48162000667565b6020860151909450620006b78162000667565b6040860151909350620006ca8162000667565b6060860151909250620006dd8162000667565b939692955090935050565b60006001600160401b03838116806200071157634e487b7160e01b600052601260045260246000fd5b92169190910492915050565b600181811c908216806200073257607f821691505b602082108114156200075457634e487b7160e01b600052602260045260246000fd5b50919050565b60805160a05160c05160e05161010051610120516101405161016051613930620007d56000396000818161049d0152611cc401526000818161087d015281816116740152611c1901526000612044015260006120930152600061206e01526000611fc701526000611ff10152600061201b01526139306000f3fe6080604052600436106102115760003560e01c806301ffc9a71461023957806302a251a31461026e57806306f3f9e61461028d57806306fdde03146102ad578063160cbed7146102cf578063248a9ca3146102ef5780632656227d1461030f5780632d63f693146103225780632f2ff15d14610342578063327a71e71461036257806332b8113e1461037857806336568abe146103a05780633932abb1146103c05780633bccf4fd146103d55780633e4f49e6146103f55780634385963214610422578063452115d61461046b5780634cf088d91461048b578063544ffc9c146104d757806354fd4d501461052c57806356781388146105565780635d6434931461057657806370b0f6601461058c5780637629a4ac146105ac5780637b3c71d3146105cc5780637d5e81e2146105ec5780638834987d1461060c57806391d148541461062e578063a217fddf1461064e578063a7713a7014610663578063a890c91014610679578063ab58fb8e14610699578063b58131b0146106b9578063c01f9e37146106ce578063c28bc2fa146106ee578063c59057e41461070e578063d07f91e91461072e578063d33219b41461074e578063d547741f14610763578063dd4e2ba514610783578063deaaa7cc146107c9578063e0cf1f9b146107eb578063ea0217cf1461080b578063eb9019d41461082b578063f8ce560a1461084b578063fc0c546a1461086b57600080fd5b36610234573061021f61089f565b6001600160a01b03161461023257600080fd5b005b600080fd5b34801561024557600080fd5b50610259610254366004612c50565b6108ae565b60405190151581526020015b60405180910390f35b34801561027a57600080fd5b506007545b604051908152602001610265565b34801561029957600080fd5b506102326102a8366004612c7a565b6108bf565b3480156102b957600080fd5b506102c261090c565b6040516102659190612cef565b3480156102db57600080fd5b5061027f6102ea366004612f3a565b61099e565b3480156102fb57600080fd5b5061027f61030a366004612c7a565b610bba565b61027f61031d366004612f3a565b610bcf565b34801561032e57600080fd5b5061027f61033d366004612c7a565b610ca7565b34801561034e57600080fd5b5061023261035d366004612fc9565b610cde565b34801561036e57600080fd5b5061027f60055481565b34801561038457600080fd5b506008546040516001600160401b039091168152602001610265565b3480156103ac57600080fd5b506102326103bb366004612fc9565b610d00565b3480156103cc57600080fd5b5060065461027f565b3480156103e157600080fd5b5061027f6103f036600461300f565b610d7e565b34801561040157600080fd5b50610415610410366004612c7a565b610e00565b6040516102659190613073565b34801561042e57600080fd5b5061025961043d366004612fc9565b60008281526003602081815260408084206001600160a01b0386168552909201905290205460ff1692915050565b34801561047757600080fd5b5061027f610486366004612f3a565b610e0b565b34801561049757600080fd5b506104bf7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610265565b3480156104e357600080fd5b506105116104f2366004612c7a565b6000908152600360205260409020805460018201546002909201549092565b60408051938452602084019290925290820152606001610265565b34801561053857600080fd5b506040805180820190915260018152603160f81b60208201526102c2565b34801561056257600080fd5b5061027f61057136600461309b565b610e3c565b34801561058257600080fd5b5061027f61271081565b34801561059857600080fd5b506102326105a7366004612c7a565b610e65565b3480156105b857600080fd5b5061027f6105c7366004612c7a565b610ea6565b3480156105d857600080fd5b5061027f6105e736600461310f565b610ecb565b3480156105f857600080fd5b5061027f610607366004613168565b610f13565b34801561061857600080fd5b5061027f6000805160206138b283398151915281565b34801561063a57600080fd5b50610259610649366004612fc9565b610f2a565b34801561065a57600080fd5b5061027f600081565b34801561066f57600080fd5b5061027f60045481565b34801561068557600080fd5b50610232610694366004613228565b610f53565b3480156106a557600080fd5b5061027f6106b4366004612c7a565b610f94565b3480156106c557600080fd5b5061027f61103e565b3480156106da57600080fd5b5061027f6106e9366004612c7a565b611048565b3480156106fa57600080fd5b50610232610709366004613245565b611053565b34801561071a57600080fd5b5061027f610729366004612f3a565b6110d4565b34801561073a57600080fd5b50610232610749366004613288565b61110e565b34801561075a57600080fd5b506104bf61114f565b34801561076f57600080fd5b5061023261077e366004612fc9565b61115e565b34801561078f57600080fd5b506040805180820190915260208082527f737570706f72743d627261766f2671756f72756d3d666f722c6162737461696e908201526102c2565b3480156107d557600080fd5b5061027f60008051602061389283398151915281565b3480156107f757600080fd5b50610232610806366004612c7a565b61117b565b34801561081757600080fd5b50610232610826366004612c7a565b6111bc565b34801561083757600080fd5b5061027f6108463660046132b1565b6111fd565b34801561085757600080fd5b5061027f610866366004612c7a565b611209565b34801561087757600080fd5b506104bf7f000000000000000000000000000000000000000000000000000000000000000081565b60006108a961114f565b905090565b60006108b982611214565b92915050565b6108c761089f565b6001600160a01b0316336001600160a01b0316146109005760405162461bcd60e51b81526004016108f7906132dd565b60405180910390fd5b61090981611239565b50565b60606001805461091b9061330f565b80601f01602080910402602001604051908101604052809291908181526020018280546109479061330f565b80156109945780601f1061096957610100808354040283529160200191610994565b820191906000526020600020905b81548152906001019060200180831161097757829003601f168201915b5050505050905090565b6000806109ad868686866110d4565b905060046109ba82610e00565b60078111156109cb576109cb61305d565b146109e85760405162461bcd60e51b81526004016108f79061334a565b600a546040805163793d064960e11b815290516000926001600160a01b03169163f27a0c92916004808301926020929190829003018186803b158015610a2d57600080fd5b505afa158015610a41573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a65919061338b565b600a5460405163b1c5f42760e01b81529192506001600160a01b03169063b1c5f42790610a9f908a908a908a906000908b9060040161346d565b60206040518083038186803b158015610ab757600080fd5b505afa158015610acb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aef919061338b565b6000838152600b602052604080822092909255600a5491516308f2a0bb60e41b81526001600160a01b0390921691638f2a0bb091610b3a918b918b918b91908b9089906004016134bb565b600060405180830381600087803b158015610b5457600080fd5b505af1158015610b68573d6000803e3d6000fd5b505050507f9a2e42fd6722813d69113e7d0079d3d940171428df7373df9c7f7617cfda2892828242610b9a9190613529565b604051610ba8929190613541565b60405180910390a15095945050505050565b60009081526020819052604090206001015490565b600080610bde868686866110d4565b90506000610beb82610e00565b90506004816007811115610c0157610c0161305d565b1480610c1e57506005816007811115610c1c57610c1c61305d565b145b610c3a5760405162461bcd60e51b81526004016108f79061334a565b60008281526002602081905260409182902001805460ff19166001179055517f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f90610c889084815260200190565b60405180910390a1610c9d82888888886112d1565b5095945050505050565b60008181526002602090815260408083208151928301909152546001600160401b0316908190525b6001600160401b031692915050565b610ce782610bba565b610cf181336112de565b610cfb8383611342565b505050565b6001600160a01b0381163314610d705760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016108f7565b610d7a82826113c6565b5050565b60408051600080516020613892833981519152602082015290810186905260ff851660608201526000908190610dd890610dd0906080016040516020818303038152906040528051906020012061142b565b868686611479565b9050610df587828860405180602001604052806000815250611497565b979650505050505050565b60006108b9826114a5565b60006000805160206138b2833981519152610e2681336112de565b610e328686868661160d565b9695505050505050565b600080339050610e5d84828560405180602001604052806000815250611497565b949350505050565b610e6d61089f565b6001600160a01b0316336001600160a01b031614610e9d5760405162461bcd60e51b81526004016108f7906132dd565b6109098161161b565b6000612710600554610eb78461165b565b610ec1919061354f565b6108b9919061356e565b600080339050610e3286828787878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061149792505050565b6000610f2185858585611705565b95945050505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b610f5b61089f565b6001600160a01b0316336001600160a01b031614610f8b5760405162461bcd60e51b81526004016108f7906132dd565b610909816119bc565b600a546000828152600b602052604080822054905163d45c443560e01b81526004810191909152909182916001600160a01b039091169063d45c44359060240160206040518083038186803b158015610fec57600080fd5b505afa158015611000573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611024919061338b565b9050806001146110345780611037565b60005b9392505050565b60006108a9611a25565b60006108b982611a35565b61105b61089f565b6001600160a01b0316336001600160a01b03161461108b5760405162461bcd60e51b81526004016108f7906132dd565b6110cd8483838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250889250611a71915050565b5050505050565b6000848484846040516020016110ed9493929190613590565b60408051601f19818403018152919052805160209091012095945050505050565b61111661089f565b6001600160a01b0316336001600160a01b0316146111465760405162461bcd60e51b81526004016108f7906132dd565b61090981611a97565b600a546001600160a01b031690565b61116782610bba565b61117181336112de565b610cfb83836113c6565b61118361089f565b6001600160a01b0316336001600160a01b0316146111b35760405162461bcd60e51b81526004016108f7906132dd565b61090981611b00565b6111c461089f565b6001600160a01b0316336001600160a01b0316146111f45760405162461bcd60e51b81526004016108f7906132dd565b61090981611b8c565b60006110378383611c14565b60006108b982611d75565b60006001600160e01b03198216636e665ced60e01b14806108b957506108b982611d86565b61271081111561128b5760405162461bcd60e51b815260206004820152601d60248201527f71756f72756d4e756d657261746f72203e2044656e6f6d696e61746f7200000060448201526064016108f7565b60048054908290556040517f0553476bf02ef2726e8ce5ced78d63e26e602e4a2257b1f559418e24b4633997906112c59083908590613541565b60405180910390a15050565b6110cd8585858585611dab565b6112e88282610f2a565b610d7a57611300816001600160a01b03166014611e1f565b61130b836020611e1f565b60405160200161131c9291906135db565b60408051601f198184030181529082905262461bcd60e51b82526108f791600401612cef565b61134c8282610f2a565b610d7a576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556113823390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6113d08282610f2a565b15610d7a576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60006108b9611438611fba565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b600080600061148a878787876120e1565b91509150610c9d816121c4565b6000610f218585858561237a565b6000806114b183612463565b905060048160078111156114c7576114c761305d565b146114d25792915050565b6000838152600b6020526040902054806114ed575092915050565b600a54604051632ab0f52960e01b8152600481018390526001600160a01b0390911690632ab0f5299060240160206040518083038186803b15801561153157600080fd5b505afa158015611545573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611569919061364a565b15611578575060079392505050565b600a54604051632c258a9f60e11b8152600481018390526001600160a01b039091169063584b153e9060240160206040518083038186803b1580156115bc57600080fd5b505afa1580156115d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115f4919061364a565b15611603575060059392505050565b5060029392505050565b6000610f2185858585612570565b7fc565b045403dc03c2eea82b81a0465edad9e2e7fc4d97e11421c209da93d7a936006548260405161164e929190613541565b60405180910390a1600655565b604051632394e7a360e21b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690638e539e8c9060240160206040518083038186803b1580156116be57600080fd5b505afa1580156116d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116f6919061366c565b6001600160601b031692915050565b600061170f61103e565b61171e33610846600143613695565b101561179e5760405162461bcd60e51b815260206004820152604360248201527f476f7665726e6f72436f6d7061746962696c697479427261766f3a2070726f7060448201527f6f73657220766f7465732062656c6f772070726f706f73616c207468726573686064820152621bdb1960ea1b608482015260a4016108f7565b60006117b386868686805190602001206110d4565b905084518651146117d65760405162461bcd60e51b81526004016108f7906136ac565b83518651146117f75760405162461bcd60e51b81526004016108f7906136ac565b60008651116118435760405162461bcd60e51b815260206004820152601860248201527711dbdd995c9b9bdc8e88195b5c1d1e481c1c9bdc1bdcd85b60421b60448201526064016108f7565b600081815260026020908152604091829020825191820190925281546001600160401b031690819052156118c35760405162461bcd60e51b815260206004820152602160248201527f476f7665726e6f723a2070726f706f73616c20616c72656164792065786973746044820152607360f81b60648201526084016108f7565b60006118d66118d160065490565b612622565b6118df43612622565b6118e991906136ed565b905060006118f96118d160075490565b61190390836136ed565b905061190f838361268e565b61191c600184018261268e565b7f7d84a6263ae0d98d3329bd7b46bb4e8d6f98cd35a7adb45c274c8b7fd5ebd5e084338b8b8d516001600160401b0381111561195a5761195a612d02565b60405190808252806020026020018201604052801561198d57816020015b60608152602001906001900390816119785790505b508c88888e6040516119a799989796959493929190613718565b60405180910390a15091979650505050505050565b600a54604080516001600160a01b03928316815291831660208301527f08f74ea46ef7894f65eabfb5e6e695de773a000b47c529ab559178069b226401910160405180910390a1600a80546001600160a01b0319166001600160a01b0392909216919091179055565b60006108a96105c7600143613695565b60006108b9611a43836126ab565b600084815260096020908152604091829020825191820190925290546001600160401b0316908190526126da565b6060610e5d8484846040518060600160405280602981526020016138d2602991396126f1565b600854604080516001600160401b03928316815291831660208301527f7ca4ac117ed3cdce75c1161d8207c440389b1a15d69d096831664657c07dafc2910160405180910390a1600880546001600160401b0319166001600160401b0392909216919091179055565b612710811115611b525760405162461bcd60e51b815260206004820152601f60248201527f70726f706f73616c4e756d657261746f72203e2044656e6f6d696e61746f720060448201526064016108f7565b60058054908290556040517f47036a693fe84b7d8f31616a15f6b3e26b080688ffd77d9425e3a0283a3df261906112c59083908590613541565b60008111611bd45760405162461bcd60e51b8152602060048201526015602482015274566f74696e6720706572696f6420746f6f206c6f7760581b60448201526064016108f7565b7f7e3f7f0708a84de9203036abaa450dccc85ad5ff52f78c170f3edb55cf5e882860075482604051611c07929190613541565b60405180910390a1600755565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633a46b1a885856040518363ffffffff1660e01b8152600401611c65929190613807565b60206040518083038186803b158015611c7d57600080fd5b505afa158015611c91573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cb5919061366c565b6001600160601b0316905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633a46b1a886866040518363ffffffff1660e01b8152600401611d10929190613807565b60206040518083038186803b158015611d2857600080fd5b505afa158015611d3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d60919061366c565b6001600160601b03169050610f218183613529565b6000612710600454610eb78461165b565b60006001600160e01b0319821663bf26d89760e01b14806108b957506108b982612817565b600a5460405163e38335e560e01b81526001600160a01b039091169063e38335e5903490611de690889088908890600090899060040161346d565b6000604051808303818588803b158015611dff57600080fd5b505af1158015611e13573d6000803e3d6000fd5b50505050505050505050565b60606000611e2e83600261354f565b611e39906002613529565b6001600160401b03811115611e5057611e50612d02565b6040519080825280601f01601f191660200182016040528015611e7a576020820181803683370190505b509050600360fc1b81600081518110611e9557611e95613820565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110611ec457611ec4613820565b60200101906001600160f81b031916908160001a9053506000611ee884600261354f565b611ef3906001613529565b90505b6001811115611f6b576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110611f2757611f27613820565b1a60f81b828281518110611f3d57611f3d613820565b60200101906001600160f81b031916908160001a90535060049490941c93611f6481613836565b9050611ef6565b5083156110375760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016108f7565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561201357507f000000000000000000000000000000000000000000000000000000000000000046145b1561203d57507f000000000000000000000000000000000000000000000000000000000000000090565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f000000000000000000000000000000000000000000000000000000000000000060608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b0383111561210e57506000905060036121bb565b8460ff16601b1415801561212657508460ff16601c14155b1561213757506000905060046121bb565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561218b573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166121b4576000600192509250506121bb565b9150600090505b94509492505050565b60008160048111156121d8576121d861305d565b14156121e15750565b60018160048111156121f5576121f561305d565b141561223e5760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b60448201526064016108f7565b60028160048111156122525761225261305d565b14156122a05760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016108f7565b60038160048111156122b4576122b461305d565b141561230d5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016108f7565b60048160048111156123215761232161305d565b14156109095760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016108f7565b6000806123898686868661284c565b600087815260096020908152604091829020825191820190925281546001600160401b031690819052919250901580156123c757506123c787612956565b15610c9d5760006123e06008546001600160401b031690565b6123e943612622565b6123f391906136ed565b90506123fe88611048565b816001600160401b0316111561244d576040516001600160401b038216815288907f541f725fb9f7c98a30cc9c0ff32fbb14358cd7159c847a3aa20a2bdc442ba5119060200160405180910390a25b612457828261268e565b50509050949350505050565b600081815260026020819052604082209081015460ff16156124885750600792915050565b6002810154610100900460ff16156124a35750600292915050565b60006124ae84610ca7565b9050806124fd5760405162461bcd60e51b815260206004820152601d60248201527f476f7665726e6f723a20756e6b6e6f776e2070726f706f73616c20696400000060448201526064016108f7565b43811061250e575060009392505050565b600061251985611048565b905043811061252d57506001949350505050565b61253685612956565b8015612555575060008581526003602052604090208054600190910154115b1561256557506004949350505050565b506003949350505050565b60008061257f8686868661298d565b6000818152600b602052604090205490915015610f2157600a546000828152600b60205260409081902054905163c4d252f560e01b81526001600160a01b039092169163c4d252f5916125d89160040190815260200190565b600060405180830381600087803b1580156125f257600080fd5b505af1158015612606573d6000803e3d6000fd5b5050506000828152600b60205260408120555095945050505050565b60006001600160401b0382111561268a5760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203660448201526534206269747360d01b60648201526084016108f7565b5090565b81546001600160401b0319166001600160401b0391909116179055565b60008181526002602090815260408083208151928301909152600101546001600160401b031690819052610ccf565b6000818310156126ea5781611037565b5090919050565b6060824710156127525760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016108f7565b6001600160a01b0385163b6127a95760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016108f7565b600080866001600160a01b031685876040516127c5919061384d565b60006040518083038185875af1925050503d8060008114612802576040519150601f19603f3d011682016040523d82523d6000602084013e612807565b606091505b5091509150610df5828286612a99565b60006001600160e01b03198216637965db0b60e01b14806108b957506301ffc9a760e01b6001600160e01b03198316146108b9565b6000848152600260205260408120600161286587610e00565b60078111156128765761287661305d565b146128cf5760405162461bcd60e51b815260206004820152602360248201527f476f7665726e6f723a20766f7465206e6f742063757272656e746c792061637460448201526269766560e81b60648201526084016108f7565b604080516020810190915281546001600160401b0316908190526000906128f79087906111fd565b905061290587878784612ad2565b856001600160a01b03167fb8e138887d0aa13bab447e82de9d5c1777041ecd21ca36ba824ff1e6c07ddda4888784886040516129449493929190613869565b60405180910390a29695505050505050565b6000818152600360205260408120600281015460018201546129789190613529565b61298461086685610ca7565b11159392505050565b60008061299c868686866110d4565b905060006129a982610e00565b905060028160078111156129bf576129bf61305d565b141580156129df575060068160078111156129dc576129dc61305d565b14155b80156129fd575060078160078111156129fa576129fa61305d565b14155b612a495760405162461bcd60e51b815260206004820152601d60248201527f476f7665726e6f723a2070726f706f73616c206e6f742061637469766500000060448201526064016108f7565b60008281526002602081905260409182902001805461ff001916610100179055517f789cf55be980739dad1d0699b93b58e806b51c9d96619bfa8fe0a28abaa7b30c90610ba89084815260200190565b60608315612aa8575081611037565b825115612ab85782518084602001fd5b8160405162461bcd60e51b81526004016108f79190612cef565b60008481526003602081815260408084206001600160a01b03881685529283019091529091205460ff1615612b595760405162461bcd60e51b815260206004820152602760248201527f476f7665726e6f72566f74696e6753696d706c653a20766f746520616c726561604482015266191e4818d85cdd60ca1b60648201526084016108f7565b6001600160a01b03841660009081526003820160205260408120805460ff1916600117905560ff168360ff161415612baa5781816000016000828254612b9f9190613529565b909155506110cd9050565b60ff831660011415612bca5781816001016000828254612b9f9190613529565b60ff831660021415612bea5781816002016000828254612b9f9190613529565b60405162461bcd60e51b815260206004820152603560248201527f476f7665726e6f72566f74696e6753696d706c653a20696e76616c69642076616044820152746c756520666f7220656e756d20566f74655479706560581b60648201526084016108f7565b600060208284031215612c6257600080fd5b81356001600160e01b03198116811461103757600080fd5b600060208284031215612c8c57600080fd5b5035919050565b60005b83811015612cae578181015183820152602001612c96565b83811115612cbd576000848401525b50505050565b60008151808452612cdb816020860160208601612c93565b601f01601f19169290920160200192915050565b6020815260006110376020830184612cc3565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715612d4057612d40612d02565b604052919050565b60006001600160401b03821115612d6157612d61612d02565b5060051b60200190565b6001600160a01b038116811461090957600080fd5b600082601f830112612d9157600080fd5b81356020612da6612da183612d48565b612d18565b82815260059290921b84018101918181019086841115612dc557600080fd5b8286015b84811015612de9578035612ddc81612d6b565b8352918301918301612dc9565b509695505050505050565b600082601f830112612e0557600080fd5b81356020612e15612da183612d48565b82815260059290921b84018101918181019086841115612e3457600080fd5b8286015b84811015612de95780358352918301918301612e38565b60006001600160401b03831115612e6857612e68612d02565b612e7b601f8401601f1916602001612d18565b9050828152838383011115612e8f57600080fd5b828260208301376000602084830101529392505050565b600082601f830112612eb757600080fd5b81356020612ec7612da183612d48565b82815260059290921b84018101918181019086841115612ee657600080fd5b8286015b84811015612de95780356001600160401b03811115612f095760008081fd5b8701603f81018913612f1b5760008081fd5b612f2c898683013560408401612e4f565b845250918301918301612eea565b60008060008060808587031215612f5057600080fd5b84356001600160401b0380821115612f6757600080fd5b612f7388838901612d80565b95506020870135915080821115612f8957600080fd5b612f9588838901612df4565b94506040870135915080821115612fab57600080fd5b50612fb887828801612ea6565b949793965093946060013593505050565b60008060408385031215612fdc57600080fd5b823591506020830135612fee81612d6b565b809150509250929050565b803560ff8116811461300a57600080fd5b919050565b600080600080600060a0868803121561302757600080fd5b8535945061303760208701612ff9565b935061304560408701612ff9565b94979396509394606081013594506080013592915050565b634e487b7160e01b600052602160045260246000fd5b602081016008831061309557634e487b7160e01b600052602160045260246000fd5b91905290565b600080604083850312156130ae57600080fd5b823591506130be60208401612ff9565b90509250929050565b60008083601f8401126130d957600080fd5b5081356001600160401b038111156130f057600080fd5b60208301915083602082850101111561310857600080fd5b9250929050565b6000806000806060858703121561312557600080fd5b8435935061313560208601612ff9565b925060408501356001600160401b0381111561315057600080fd5b61315c878288016130c7565b95989497509550505050565b6000806000806080858703121561317e57600080fd5b84356001600160401b038082111561319557600080fd5b6131a188838901612d80565b955060208701359150808211156131b757600080fd5b6131c388838901612df4565b945060408701359150808211156131d957600080fd5b6131e588838901612ea6565b935060608701359150808211156131fb57600080fd5b508501601f8101871361320d57600080fd5b61321c87823560208401612e4f565b91505092959194509250565b60006020828403121561323a57600080fd5b813561103781612d6b565b6000806000806060858703121561325b57600080fd5b843561326681612d6b565b93506020850135925060408501356001600160401b0381111561315057600080fd5b60006020828403121561329a57600080fd5b81356001600160401b038116811461103757600080fd5b600080604083850312156132c457600080fd5b82356132cf81612d6b565b946020939093013593505050565b602080825260189082015277476f7665726e6f723a206f6e6c79476f7665726e616e636560401b604082015260600190565b600181811c9082168061332357607f821691505b6020821081141561334457634e487b7160e01b600052602260045260246000fd5b50919050565b60208082526021908201527f476f7665726e6f723a2070726f706f73616c206e6f74207375636365737366756040820152601b60fa1b606082015260800190565b60006020828403121561339d57600080fd5b5051919050565b600081518084526020808501945080840160005b838110156133dd5781516001600160a01b0316875295820195908201906001016133b8565b509495945050505050565b600081518084526020808501945080840160005b838110156133dd578151875295820195908201906001016133fc565b600081518084526020808501808196508360051b8101915082860160005b8581101561346057828403895261344e848351612cc3565b98850198935090840190600101613436565b5091979650505050505050565b60a08152600061348060a08301886133a4565b828103602084015261349281886133e8565b905082810360408401526134a68187613418565b60608401959095525050608001529392505050565b60c0815260006134ce60c08301896133a4565b82810360208401526134e081896133e8565b905082810360408401526134f48188613418565b60608401969096525050608081019290925260a0909101529392505050565b634e487b7160e01b600052601160045260246000fd5b6000821982111561353c5761353c613513565b500190565b918252602082015260400190565b600081600019048311821515161561356957613569613513565b500290565b60008261358b57634e487b7160e01b600052601260045260246000fd5b500490565b6080815260006135a360808301876133a4565b82810360208401526135b581876133e8565b905082810360408401526135c98186613418565b91505082606083015295945050505050565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b81526000835161360d816017850160208801612c93565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161363e816028840160208801612c93565b01602801949350505050565b60006020828403121561365c57600080fd5b8151801515811461103757600080fd5b60006020828403121561367e57600080fd5b81516001600160601b038116811461103757600080fd5b6000828210156136a7576136a7613513565b500390565b60208082526021908201527f476f7665726e6f723a20696e76616c69642070726f706f73616c206c656e67746040820152600d60fb1b606082015260800190565b60006001600160401b0382811684821680830382111561370f5761370f613513565b01949350505050565b60006101208b8352602060018060a01b038c16818501528160408501526137418285018c6133a4565b91508382036060850152613755828b6133e8565b915083820360808501528189518084528284019150828160051b850101838c0160005b838110156137a657601f19878403018552613794838351612cc3565b94860194925090850190600101613778565b505086810360a08801526137ba818c613418565b9450505050506137d560c08401876001600160401b03169052565b6001600160401b03851660e08401528281036101008401526137f78185612cc3565b9c9b505050505050505050505050565b6001600160a01b03929092168252602082015260400190565b634e487b7160e01b600052603260045260246000fd5b60008161384557613845613513565b506000190190565b6000825161385f818460208701612c93565b9190910192915050565b84815260ff84166020820152826040820152608060608201526000610e326080830184612cc356fe150214d74d59b7d1e90c73fc22ef3d991dd0a76b046543d4d80ab92d2a50328f65784a4b4efdf70060d396b05be05b4852e8b22ae249d76915bea0da3f992c64416464726573733a206c6f772d6c6576656c2063616c6c20776974682076616c7565206661696c6564a2646970667358221220c7709da014f767592d03ee4e71607fe9c7a0daf610f0251c589e6c1f6037545664736f6c63430008090033", + "deployedBytecode": "0x6080604052600436106102115760003560e01c806301ffc9a71461023957806302a251a31461026e57806306f3f9e61461028d57806306fdde03146102ad578063160cbed7146102cf578063248a9ca3146102ef5780632656227d1461030f5780632d63f693146103225780632f2ff15d14610342578063327a71e71461036257806332b8113e1461037857806336568abe146103a05780633932abb1146103c05780633bccf4fd146103d55780633e4f49e6146103f55780634385963214610422578063452115d61461046b5780634cf088d91461048b578063544ffc9c146104d757806354fd4d501461052c57806356781388146105565780635d6434931461057657806370b0f6601461058c5780637629a4ac146105ac5780637b3c71d3146105cc5780637d5e81e2146105ec5780638834987d1461060c57806391d148541461062e578063a217fddf1461064e578063a7713a7014610663578063a890c91014610679578063ab58fb8e14610699578063b58131b0146106b9578063c01f9e37146106ce578063c28bc2fa146106ee578063c59057e41461070e578063d07f91e91461072e578063d33219b41461074e578063d547741f14610763578063dd4e2ba514610783578063deaaa7cc146107c9578063e0cf1f9b146107eb578063ea0217cf1461080b578063eb9019d41461082b578063f8ce560a1461084b578063fc0c546a1461086b57600080fd5b36610234573061021f61089f565b6001600160a01b03161461023257600080fd5b005b600080fd5b34801561024557600080fd5b50610259610254366004612c50565b6108ae565b60405190151581526020015b60405180910390f35b34801561027a57600080fd5b506007545b604051908152602001610265565b34801561029957600080fd5b506102326102a8366004612c7a565b6108bf565b3480156102b957600080fd5b506102c261090c565b6040516102659190612cef565b3480156102db57600080fd5b5061027f6102ea366004612f3a565b61099e565b3480156102fb57600080fd5b5061027f61030a366004612c7a565b610bba565b61027f61031d366004612f3a565b610bcf565b34801561032e57600080fd5b5061027f61033d366004612c7a565b610ca7565b34801561034e57600080fd5b5061023261035d366004612fc9565b610cde565b34801561036e57600080fd5b5061027f60055481565b34801561038457600080fd5b506008546040516001600160401b039091168152602001610265565b3480156103ac57600080fd5b506102326103bb366004612fc9565b610d00565b3480156103cc57600080fd5b5060065461027f565b3480156103e157600080fd5b5061027f6103f036600461300f565b610d7e565b34801561040157600080fd5b50610415610410366004612c7a565b610e00565b6040516102659190613073565b34801561042e57600080fd5b5061025961043d366004612fc9565b60008281526003602081815260408084206001600160a01b0386168552909201905290205460ff1692915050565b34801561047757600080fd5b5061027f610486366004612f3a565b610e0b565b34801561049757600080fd5b506104bf7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610265565b3480156104e357600080fd5b506105116104f2366004612c7a565b6000908152600360205260409020805460018201546002909201549092565b60408051938452602084019290925290820152606001610265565b34801561053857600080fd5b506040805180820190915260018152603160f81b60208201526102c2565b34801561056257600080fd5b5061027f61057136600461309b565b610e3c565b34801561058257600080fd5b5061027f61271081565b34801561059857600080fd5b506102326105a7366004612c7a565b610e65565b3480156105b857600080fd5b5061027f6105c7366004612c7a565b610ea6565b3480156105d857600080fd5b5061027f6105e736600461310f565b610ecb565b3480156105f857600080fd5b5061027f610607366004613168565b610f13565b34801561061857600080fd5b5061027f6000805160206138b283398151915281565b34801561063a57600080fd5b50610259610649366004612fc9565b610f2a565b34801561065a57600080fd5b5061027f600081565b34801561066f57600080fd5b5061027f60045481565b34801561068557600080fd5b50610232610694366004613228565b610f53565b3480156106a557600080fd5b5061027f6106b4366004612c7a565b610f94565b3480156106c557600080fd5b5061027f61103e565b3480156106da57600080fd5b5061027f6106e9366004612c7a565b611048565b3480156106fa57600080fd5b50610232610709366004613245565b611053565b34801561071a57600080fd5b5061027f610729366004612f3a565b6110d4565b34801561073a57600080fd5b50610232610749366004613288565b61110e565b34801561075a57600080fd5b506104bf61114f565b34801561076f57600080fd5b5061023261077e366004612fc9565b61115e565b34801561078f57600080fd5b506040805180820190915260208082527f737570706f72743d627261766f2671756f72756d3d666f722c6162737461696e908201526102c2565b3480156107d557600080fd5b5061027f60008051602061389283398151915281565b3480156107f757600080fd5b50610232610806366004612c7a565b61117b565b34801561081757600080fd5b50610232610826366004612c7a565b6111bc565b34801561083757600080fd5b5061027f6108463660046132b1565b6111fd565b34801561085757600080fd5b5061027f610866366004612c7a565b611209565b34801561087757600080fd5b506104bf7f000000000000000000000000000000000000000000000000000000000000000081565b60006108a961114f565b905090565b60006108b982611214565b92915050565b6108c761089f565b6001600160a01b0316336001600160a01b0316146109005760405162461bcd60e51b81526004016108f7906132dd565b60405180910390fd5b61090981611239565b50565b60606001805461091b9061330f565b80601f01602080910402602001604051908101604052809291908181526020018280546109479061330f565b80156109945780601f1061096957610100808354040283529160200191610994565b820191906000526020600020905b81548152906001019060200180831161097757829003601f168201915b5050505050905090565b6000806109ad868686866110d4565b905060046109ba82610e00565b60078111156109cb576109cb61305d565b146109e85760405162461bcd60e51b81526004016108f79061334a565b600a546040805163793d064960e11b815290516000926001600160a01b03169163f27a0c92916004808301926020929190829003018186803b158015610a2d57600080fd5b505afa158015610a41573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a65919061338b565b600a5460405163b1c5f42760e01b81529192506001600160a01b03169063b1c5f42790610a9f908a908a908a906000908b9060040161346d565b60206040518083038186803b158015610ab757600080fd5b505afa158015610acb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aef919061338b565b6000838152600b602052604080822092909255600a5491516308f2a0bb60e41b81526001600160a01b0390921691638f2a0bb091610b3a918b918b918b91908b9089906004016134bb565b600060405180830381600087803b158015610b5457600080fd5b505af1158015610b68573d6000803e3d6000fd5b505050507f9a2e42fd6722813d69113e7d0079d3d940171428df7373df9c7f7617cfda2892828242610b9a9190613529565b604051610ba8929190613541565b60405180910390a15095945050505050565b60009081526020819052604090206001015490565b600080610bde868686866110d4565b90506000610beb82610e00565b90506004816007811115610c0157610c0161305d565b1480610c1e57506005816007811115610c1c57610c1c61305d565b145b610c3a5760405162461bcd60e51b81526004016108f79061334a565b60008281526002602081905260409182902001805460ff19166001179055517f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f90610c889084815260200190565b60405180910390a1610c9d82888888886112d1565b5095945050505050565b60008181526002602090815260408083208151928301909152546001600160401b0316908190525b6001600160401b031692915050565b610ce782610bba565b610cf181336112de565b610cfb8383611342565b505050565b6001600160a01b0381163314610d705760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016108f7565b610d7a82826113c6565b5050565b60408051600080516020613892833981519152602082015290810186905260ff851660608201526000908190610dd890610dd0906080016040516020818303038152906040528051906020012061142b565b868686611479565b9050610df587828860405180602001604052806000815250611497565b979650505050505050565b60006108b9826114a5565b60006000805160206138b2833981519152610e2681336112de565b610e328686868661160d565b9695505050505050565b600080339050610e5d84828560405180602001604052806000815250611497565b949350505050565b610e6d61089f565b6001600160a01b0316336001600160a01b031614610e9d5760405162461bcd60e51b81526004016108f7906132dd565b6109098161161b565b6000612710600554610eb78461165b565b610ec1919061354f565b6108b9919061356e565b600080339050610e3286828787878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061149792505050565b6000610f2185858585611705565b95945050505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b610f5b61089f565b6001600160a01b0316336001600160a01b031614610f8b5760405162461bcd60e51b81526004016108f7906132dd565b610909816119bc565b600a546000828152600b602052604080822054905163d45c443560e01b81526004810191909152909182916001600160a01b039091169063d45c44359060240160206040518083038186803b158015610fec57600080fd5b505afa158015611000573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611024919061338b565b9050806001146110345780611037565b60005b9392505050565b60006108a9611a25565b60006108b982611a35565b61105b61089f565b6001600160a01b0316336001600160a01b03161461108b5760405162461bcd60e51b81526004016108f7906132dd565b6110cd8483838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250889250611a71915050565b5050505050565b6000848484846040516020016110ed9493929190613590565b60408051601f19818403018152919052805160209091012095945050505050565b61111661089f565b6001600160a01b0316336001600160a01b0316146111465760405162461bcd60e51b81526004016108f7906132dd565b61090981611a97565b600a546001600160a01b031690565b61116782610bba565b61117181336112de565b610cfb83836113c6565b61118361089f565b6001600160a01b0316336001600160a01b0316146111b35760405162461bcd60e51b81526004016108f7906132dd565b61090981611b00565b6111c461089f565b6001600160a01b0316336001600160a01b0316146111f45760405162461bcd60e51b81526004016108f7906132dd565b61090981611b8c565b60006110378383611c14565b60006108b982611d75565b60006001600160e01b03198216636e665ced60e01b14806108b957506108b982611d86565b61271081111561128b5760405162461bcd60e51b815260206004820152601d60248201527f71756f72756d4e756d657261746f72203e2044656e6f6d696e61746f7200000060448201526064016108f7565b60048054908290556040517f0553476bf02ef2726e8ce5ced78d63e26e602e4a2257b1f559418e24b4633997906112c59083908590613541565b60405180910390a15050565b6110cd8585858585611dab565b6112e88282610f2a565b610d7a57611300816001600160a01b03166014611e1f565b61130b836020611e1f565b60405160200161131c9291906135db565b60408051601f198184030181529082905262461bcd60e51b82526108f791600401612cef565b61134c8282610f2a565b610d7a576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556113823390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6113d08282610f2a565b15610d7a576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60006108b9611438611fba565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b600080600061148a878787876120e1565b91509150610c9d816121c4565b6000610f218585858561237a565b6000806114b183612463565b905060048160078111156114c7576114c761305d565b146114d25792915050565b6000838152600b6020526040902054806114ed575092915050565b600a54604051632ab0f52960e01b8152600481018390526001600160a01b0390911690632ab0f5299060240160206040518083038186803b15801561153157600080fd5b505afa158015611545573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611569919061364a565b15611578575060079392505050565b600a54604051632c258a9f60e11b8152600481018390526001600160a01b039091169063584b153e9060240160206040518083038186803b1580156115bc57600080fd5b505afa1580156115d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115f4919061364a565b15611603575060059392505050565b5060029392505050565b6000610f2185858585612570565b7fc565b045403dc03c2eea82b81a0465edad9e2e7fc4d97e11421c209da93d7a936006548260405161164e929190613541565b60405180910390a1600655565b604051632394e7a360e21b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690638e539e8c9060240160206040518083038186803b1580156116be57600080fd5b505afa1580156116d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116f6919061366c565b6001600160601b031692915050565b600061170f61103e565b61171e33610846600143613695565b101561179e5760405162461bcd60e51b815260206004820152604360248201527f476f7665726e6f72436f6d7061746962696c697479427261766f3a2070726f7060448201527f6f73657220766f7465732062656c6f772070726f706f73616c207468726573686064820152621bdb1960ea1b608482015260a4016108f7565b60006117b386868686805190602001206110d4565b905084518651146117d65760405162461bcd60e51b81526004016108f7906136ac565b83518651146117f75760405162461bcd60e51b81526004016108f7906136ac565b60008651116118435760405162461bcd60e51b815260206004820152601860248201527711dbdd995c9b9bdc8e88195b5c1d1e481c1c9bdc1bdcd85b60421b60448201526064016108f7565b600081815260026020908152604091829020825191820190925281546001600160401b031690819052156118c35760405162461bcd60e51b815260206004820152602160248201527f476f7665726e6f723a2070726f706f73616c20616c72656164792065786973746044820152607360f81b60648201526084016108f7565b60006118d66118d160065490565b612622565b6118df43612622565b6118e991906136ed565b905060006118f96118d160075490565b61190390836136ed565b905061190f838361268e565b61191c600184018261268e565b7f7d84a6263ae0d98d3329bd7b46bb4e8d6f98cd35a7adb45c274c8b7fd5ebd5e084338b8b8d516001600160401b0381111561195a5761195a612d02565b60405190808252806020026020018201604052801561198d57816020015b60608152602001906001900390816119785790505b508c88888e6040516119a799989796959493929190613718565b60405180910390a15091979650505050505050565b600a54604080516001600160a01b03928316815291831660208301527f08f74ea46ef7894f65eabfb5e6e695de773a000b47c529ab559178069b226401910160405180910390a1600a80546001600160a01b0319166001600160a01b0392909216919091179055565b60006108a96105c7600143613695565b60006108b9611a43836126ab565b600084815260096020908152604091829020825191820190925290546001600160401b0316908190526126da565b6060610e5d8484846040518060600160405280602981526020016138d2602991396126f1565b600854604080516001600160401b03928316815291831660208301527f7ca4ac117ed3cdce75c1161d8207c440389b1a15d69d096831664657c07dafc2910160405180910390a1600880546001600160401b0319166001600160401b0392909216919091179055565b612710811115611b525760405162461bcd60e51b815260206004820152601f60248201527f70726f706f73616c4e756d657261746f72203e2044656e6f6d696e61746f720060448201526064016108f7565b60058054908290556040517f47036a693fe84b7d8f31616a15f6b3e26b080688ffd77d9425e3a0283a3df261906112c59083908590613541565b60008111611bd45760405162461bcd60e51b8152602060048201526015602482015274566f74696e6720706572696f6420746f6f206c6f7760581b60448201526064016108f7565b7f7e3f7f0708a84de9203036abaa450dccc85ad5ff52f78c170f3edb55cf5e882860075482604051611c07929190613541565b60405180910390a1600755565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633a46b1a885856040518363ffffffff1660e01b8152600401611c65929190613807565b60206040518083038186803b158015611c7d57600080fd5b505afa158015611c91573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cb5919061366c565b6001600160601b0316905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633a46b1a886866040518363ffffffff1660e01b8152600401611d10929190613807565b60206040518083038186803b158015611d2857600080fd5b505afa158015611d3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d60919061366c565b6001600160601b03169050610f218183613529565b6000612710600454610eb78461165b565b60006001600160e01b0319821663bf26d89760e01b14806108b957506108b982612817565b600a5460405163e38335e560e01b81526001600160a01b039091169063e38335e5903490611de690889088908890600090899060040161346d565b6000604051808303818588803b158015611dff57600080fd5b505af1158015611e13573d6000803e3d6000fd5b50505050505050505050565b60606000611e2e83600261354f565b611e39906002613529565b6001600160401b03811115611e5057611e50612d02565b6040519080825280601f01601f191660200182016040528015611e7a576020820181803683370190505b509050600360fc1b81600081518110611e9557611e95613820565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110611ec457611ec4613820565b60200101906001600160f81b031916908160001a9053506000611ee884600261354f565b611ef3906001613529565b90505b6001811115611f6b576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110611f2757611f27613820565b1a60f81b828281518110611f3d57611f3d613820565b60200101906001600160f81b031916908160001a90535060049490941c93611f6481613836565b9050611ef6565b5083156110375760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016108f7565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561201357507f000000000000000000000000000000000000000000000000000000000000000046145b1561203d57507f000000000000000000000000000000000000000000000000000000000000000090565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f000000000000000000000000000000000000000000000000000000000000000060608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b0383111561210e57506000905060036121bb565b8460ff16601b1415801561212657508460ff16601c14155b1561213757506000905060046121bb565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561218b573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166121b4576000600192509250506121bb565b9150600090505b94509492505050565b60008160048111156121d8576121d861305d565b14156121e15750565b60018160048111156121f5576121f561305d565b141561223e5760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b60448201526064016108f7565b60028160048111156122525761225261305d565b14156122a05760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016108f7565b60038160048111156122b4576122b461305d565b141561230d5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016108f7565b60048160048111156123215761232161305d565b14156109095760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016108f7565b6000806123898686868661284c565b600087815260096020908152604091829020825191820190925281546001600160401b031690819052919250901580156123c757506123c787612956565b15610c9d5760006123e06008546001600160401b031690565b6123e943612622565b6123f391906136ed565b90506123fe88611048565b816001600160401b0316111561244d576040516001600160401b038216815288907f541f725fb9f7c98a30cc9c0ff32fbb14358cd7159c847a3aa20a2bdc442ba5119060200160405180910390a25b612457828261268e565b50509050949350505050565b600081815260026020819052604082209081015460ff16156124885750600792915050565b6002810154610100900460ff16156124a35750600292915050565b60006124ae84610ca7565b9050806124fd5760405162461bcd60e51b815260206004820152601d60248201527f476f7665726e6f723a20756e6b6e6f776e2070726f706f73616c20696400000060448201526064016108f7565b43811061250e575060009392505050565b600061251985611048565b905043811061252d57506001949350505050565b61253685612956565b8015612555575060008581526003602052604090208054600190910154115b1561256557506004949350505050565b506003949350505050565b60008061257f8686868661298d565b6000818152600b602052604090205490915015610f2157600a546000828152600b60205260409081902054905163c4d252f560e01b81526001600160a01b039092169163c4d252f5916125d89160040190815260200190565b600060405180830381600087803b1580156125f257600080fd5b505af1158015612606573d6000803e3d6000fd5b5050506000828152600b60205260408120555095945050505050565b60006001600160401b0382111561268a5760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203660448201526534206269747360d01b60648201526084016108f7565b5090565b81546001600160401b0319166001600160401b0391909116179055565b60008181526002602090815260408083208151928301909152600101546001600160401b031690819052610ccf565b6000818310156126ea5781611037565b5090919050565b6060824710156127525760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016108f7565b6001600160a01b0385163b6127a95760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016108f7565b600080866001600160a01b031685876040516127c5919061384d565b60006040518083038185875af1925050503d8060008114612802576040519150601f19603f3d011682016040523d82523d6000602084013e612807565b606091505b5091509150610df5828286612a99565b60006001600160e01b03198216637965db0b60e01b14806108b957506301ffc9a760e01b6001600160e01b03198316146108b9565b6000848152600260205260408120600161286587610e00565b60078111156128765761287661305d565b146128cf5760405162461bcd60e51b815260206004820152602360248201527f476f7665726e6f723a20766f7465206e6f742063757272656e746c792061637460448201526269766560e81b60648201526084016108f7565b604080516020810190915281546001600160401b0316908190526000906128f79087906111fd565b905061290587878784612ad2565b856001600160a01b03167fb8e138887d0aa13bab447e82de9d5c1777041ecd21ca36ba824ff1e6c07ddda4888784886040516129449493929190613869565b60405180910390a29695505050505050565b6000818152600360205260408120600281015460018201546129789190613529565b61298461086685610ca7565b11159392505050565b60008061299c868686866110d4565b905060006129a982610e00565b905060028160078111156129bf576129bf61305d565b141580156129df575060068160078111156129dc576129dc61305d565b14155b80156129fd575060078160078111156129fa576129fa61305d565b14155b612a495760405162461bcd60e51b815260206004820152601d60248201527f476f7665726e6f723a2070726f706f73616c206e6f742061637469766500000060448201526064016108f7565b60008281526002602081905260409182902001805461ff001916610100179055517f789cf55be980739dad1d0699b93b58e806b51c9d96619bfa8fe0a28abaa7b30c90610ba89084815260200190565b60608315612aa8575081611037565b825115612ab85782518084602001fd5b8160405162461bcd60e51b81526004016108f79190612cef565b60008481526003602081815260408084206001600160a01b03881685529283019091529091205460ff1615612b595760405162461bcd60e51b815260206004820152602760248201527f476f7665726e6f72566f74696e6753696d706c653a20766f746520616c726561604482015266191e4818d85cdd60ca1b60648201526084016108f7565b6001600160a01b03841660009081526003820160205260408120805460ff1916600117905560ff168360ff161415612baa5781816000016000828254612b9f9190613529565b909155506110cd9050565b60ff831660011415612bca5781816001016000828254612b9f9190613529565b60ff831660021415612bea5781816002016000828254612b9f9190613529565b60405162461bcd60e51b815260206004820152603560248201527f476f7665726e6f72566f74696e6753696d706c653a20696e76616c69642076616044820152746c756520666f7220656e756d20566f74655479706560581b60648201526084016108f7565b600060208284031215612c6257600080fd5b81356001600160e01b03198116811461103757600080fd5b600060208284031215612c8c57600080fd5b5035919050565b60005b83811015612cae578181015183820152602001612c96565b83811115612cbd576000848401525b50505050565b60008151808452612cdb816020860160208601612c93565b601f01601f19169290920160200192915050565b6020815260006110376020830184612cc3565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715612d4057612d40612d02565b604052919050565b60006001600160401b03821115612d6157612d61612d02565b5060051b60200190565b6001600160a01b038116811461090957600080fd5b600082601f830112612d9157600080fd5b81356020612da6612da183612d48565b612d18565b82815260059290921b84018101918181019086841115612dc557600080fd5b8286015b84811015612de9578035612ddc81612d6b565b8352918301918301612dc9565b509695505050505050565b600082601f830112612e0557600080fd5b81356020612e15612da183612d48565b82815260059290921b84018101918181019086841115612e3457600080fd5b8286015b84811015612de95780358352918301918301612e38565b60006001600160401b03831115612e6857612e68612d02565b612e7b601f8401601f1916602001612d18565b9050828152838383011115612e8f57600080fd5b828260208301376000602084830101529392505050565b600082601f830112612eb757600080fd5b81356020612ec7612da183612d48565b82815260059290921b84018101918181019086841115612ee657600080fd5b8286015b84811015612de95780356001600160401b03811115612f095760008081fd5b8701603f81018913612f1b5760008081fd5b612f2c898683013560408401612e4f565b845250918301918301612eea565b60008060008060808587031215612f5057600080fd5b84356001600160401b0380821115612f6757600080fd5b612f7388838901612d80565b95506020870135915080821115612f8957600080fd5b612f9588838901612df4565b94506040870135915080821115612fab57600080fd5b50612fb887828801612ea6565b949793965093946060013593505050565b60008060408385031215612fdc57600080fd5b823591506020830135612fee81612d6b565b809150509250929050565b803560ff8116811461300a57600080fd5b919050565b600080600080600060a0868803121561302757600080fd5b8535945061303760208701612ff9565b935061304560408701612ff9565b94979396509394606081013594506080013592915050565b634e487b7160e01b600052602160045260246000fd5b602081016008831061309557634e487b7160e01b600052602160045260246000fd5b91905290565b600080604083850312156130ae57600080fd5b823591506130be60208401612ff9565b90509250929050565b60008083601f8401126130d957600080fd5b5081356001600160401b038111156130f057600080fd5b60208301915083602082850101111561310857600080fd5b9250929050565b6000806000806060858703121561312557600080fd5b8435935061313560208601612ff9565b925060408501356001600160401b0381111561315057600080fd5b61315c878288016130c7565b95989497509550505050565b6000806000806080858703121561317e57600080fd5b84356001600160401b038082111561319557600080fd5b6131a188838901612d80565b955060208701359150808211156131b757600080fd5b6131c388838901612df4565b945060408701359150808211156131d957600080fd5b6131e588838901612ea6565b935060608701359150808211156131fb57600080fd5b508501601f8101871361320d57600080fd5b61321c87823560208401612e4f565b91505092959194509250565b60006020828403121561323a57600080fd5b813561103781612d6b565b6000806000806060858703121561325b57600080fd5b843561326681612d6b565b93506020850135925060408501356001600160401b0381111561315057600080fd5b60006020828403121561329a57600080fd5b81356001600160401b038116811461103757600080fd5b600080604083850312156132c457600080fd5b82356132cf81612d6b565b946020939093013593505050565b602080825260189082015277476f7665726e6f723a206f6e6c79476f7665726e616e636560401b604082015260600190565b600181811c9082168061332357607f821691505b6020821081141561334457634e487b7160e01b600052602260045260246000fd5b50919050565b60208082526021908201527f476f7665726e6f723a2070726f706f73616c206e6f74207375636365737366756040820152601b60fa1b606082015260800190565b60006020828403121561339d57600080fd5b5051919050565b600081518084526020808501945080840160005b838110156133dd5781516001600160a01b0316875295820195908201906001016133b8565b509495945050505050565b600081518084526020808501945080840160005b838110156133dd578151875295820195908201906001016133fc565b600081518084526020808501808196508360051b8101915082860160005b8581101561346057828403895261344e848351612cc3565b98850198935090840190600101613436565b5091979650505050505050565b60a08152600061348060a08301886133a4565b828103602084015261349281886133e8565b905082810360408401526134a68187613418565b60608401959095525050608001529392505050565b60c0815260006134ce60c08301896133a4565b82810360208401526134e081896133e8565b905082810360408401526134f48188613418565b60608401969096525050608081019290925260a0909101529392505050565b634e487b7160e01b600052601160045260246000fd5b6000821982111561353c5761353c613513565b500190565b918252602082015260400190565b600081600019048311821515161561356957613569613513565b500290565b60008261358b57634e487b7160e01b600052601260045260246000fd5b500490565b6080815260006135a360808301876133a4565b82810360208401526135b581876133e8565b905082810360408401526135c98186613418565b91505082606083015295945050505050565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b81526000835161360d816017850160208801612c93565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161363e816028840160208801612c93565b01602801949350505050565b60006020828403121561365c57600080fd5b8151801515811461103757600080fd5b60006020828403121561367e57600080fd5b81516001600160601b038116811461103757600080fd5b6000828210156136a7576136a7613513565b500390565b60208082526021908201527f476f7665726e6f723a20696e76616c69642070726f706f73616c206c656e67746040820152600d60fb1b606082015260800190565b60006001600160401b0382811684821680830382111561370f5761370f613513565b01949350505050565b60006101208b8352602060018060a01b038c16818501528160408501526137418285018c6133a4565b91508382036060850152613755828b6133e8565b915083820360808501528189518084528284019150828160051b850101838c0160005b838110156137a657601f19878403018552613794838351612cc3565b94860194925090850190600101613778565b505086810360a08801526137ba818c613418565b9450505050506137d560c08401876001600160401b03169052565b6001600160401b03851660e08401528281036101008401526137f78185612cc3565b9c9b505050505050505050505050565b6001600160a01b03929092168252602082015260400190565b634e487b7160e01b600052603260045260246000fd5b60008161384557613845613513565b506000190190565b6000825161385f818460208701612c93565b9190910192915050565b84815260ff84166020820152826040820152608060608201526000610e326080830184612cc356fe150214d74d59b7d1e90c73fc22ef3d991dd0a76b046543d4d80ab92d2a50328f65784a4b4efdf70060d396b05be05b4852e8b22ae249d76915bea0da3f992c64416464726573733a206c6f772d6c6576656c2063616c6c20776974682076616c7565206661696c6564a2646970667358221220c7709da014f767592d03ee4e71607fe9c7a0daf610f0251c589e6c1f6037545664736f6c63430008090033", + "devdoc": { + "kind": "dev", + "methods": { + "COUNTING_MODE()": { + "details": "See {IGovernor-COUNTING_MODE}." + }, + "castVote(uint256,uint8)": { + "details": "See {IGovernor-castVote}." + }, + "castVoteBySig(uint256,uint8,uint8,bytes32,bytes32)": { + "details": "See {IGovernor-castVoteBySig}." + }, + "castVoteWithReason(uint256,uint8,string)": { + "details": "See {IGovernor-castVoteWithReason}." + }, + "execute(address[],uint256[],bytes[],bytes32)": { + "details": "See {IGovernor-execute}." + }, + "getRoleAdmin(bytes32)": { + "details": "Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}." + }, + "grantRole(bytes32,address)": { + "details": "Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role." + }, + "hasRole(bytes32,address)": { + "details": "Returns `true` if `account` has been granted `role`." + }, + "hasVoted(uint256,address)": { + "details": "See {IGovernor-hasVoted}." + }, + "hashProposal(address[],uint256[],bytes[],bytes32)": { + "details": "See {IGovernor-hashProposal}. The proposal id is produced by hashing the RLC encoded `targets` array, the `values` array, the `calldatas` array and the descriptionHash (bytes32 which itself is the keccak256 hash of the description string). This proposal id can be produced from the proposal data which is part of the {ProposalCreated} event. It can even be computed in advance, before the proposal is submitted. Note that the chainId and the governor address are not part of the proposal id computation. Consequently, the same proposal (with same operation and same description) will have the same id if submitted on multiple governors accross multiple networks. This also means that in order to execute the same operation twice (on the same governor) the proposer will have to change the description in order to avoid proposal id conflicts." + }, + "lateQuorumVoteExtension()": { + "details": "Returns the current value of the vote extension parameter: the number of blocks that are required to pass from the time a proposal reaches quorum until its voting period ends." + }, + "name()": { + "details": "See {IGovernor-name}." + }, + "proposalEta(uint256)": { + "details": "Public accessor to check the eta of a queued proposal" + }, + "proposalSnapshot(uint256)": { + "details": "See {IGovernor-proposalSnapshot}." + }, + "proposalThreshold(uint256)": { + "params": { + "blockNumber": "The block number to get the proposal threshold at" + } + }, + "proposalVotes(uint256)": { + "details": "Accessor to the internal vote counts." + }, + "queue(address[],uint256[],bytes[],bytes32)": { + "details": "Function to queue a proposal to the timelock." + }, + "relay(address,uint256,bytes)": { + "details": "Relays a transaction or function call to an arbitrary target. In cases where the governance executor is some contract other than the governor itself, like when using a timelock, this function can be invoked in a governance proposal to recover tokens or Ether that was sent to the governor contract by mistake. Note that if the executor is simply the governor itself, use of `relay` is redundant." + }, + "renounceRole(bytes32,address)": { + "details": "Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`." + }, + "revokeRole(bytes32,address)": { + "details": "Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role." + }, + "setLateQuorumVoteExtension(uint64)": { + "details": "Changes the {lateQuorumVoteExtension}. This operation can only be performed by the governance executor, generally through a governance proposal. Emits a {LateQuorumVoteExtensionSet} event." + }, + "timelock()": { + "details": "Public accessor to check the address of the timelock" + }, + "updateTimelock(address)": { + "details": "Public endpoint to update the underlying timelock instance. Restricted to the timelock itself, so updates must be proposed, scheduled, and executed through governance proposals. CAUTION: It is not recommended to change the timelock while there are other queued governance proposals." + }, + "version()": { + "details": "See {IGovernor-version}." + }, + "votingDelay()": { + "details": "Delay, in number of block, between the proposal is created and the vote starts. This can be increassed to leave time for users to buy voting power, of delegate it, before the voting of a proposal starts." + }, + "votingPeriod()": { + "details": "Delay, in number of blocks, between the vote start and vote ends. NOTE: The {votingDelay} can delay the start of the vote. This must be considered when setting the voting duration compared to the voting delay." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "proposalThreshold(uint256)": { + "notice": "Compute the required amount of voting power to create a proposal" + }, + "setVotingDelay(uint256)": { + "notice": "Update the voting delay. This operation can only be performed through a governance proposal. Emits a `VotingDelaySet` event." + }, + "setVotingPeriod(uint256)": { + "notice": "Update the voting period. This operation can only be performed through a governance proposal. Emits a `VotingPeriodSet` event." + }, + "votingDelay()": { + "notice": "module:user-config" + }, + "votingPeriod()": { + "notice": "module:user-config" + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 1124, + "contract": "contracts/governance/TokenholderGovernor.sol:TokenholderGovernor", + "label": "_roles", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_bytes32,t_struct(RoleData)1119_storage)" + }, + { + "astId": 1630, + "contract": "contracts/governance/TokenholderGovernor.sol:TokenholderGovernor", + "label": "_name", + "offset": 0, + "slot": "1", + "type": "t_string_storage" + }, + { + "astId": 1635, + "contract": "contracts/governance/TokenholderGovernor.sol:TokenholderGovernor", + "label": "_proposals", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_uint256,t_struct(ProposalCore)1628_storage)" + }, + { + "astId": 3482, + "contract": "contracts/governance/TokenholderGovernor.sol:TokenholderGovernor", + "label": "_proposalVotes", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint256,t_struct(ProposalVote)3477_storage)" + }, + { + "astId": 10696, + "contract": "contracts/governance/TokenholderGovernor.sol:TokenholderGovernor", + "label": "quorumNumerator", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 10698, + "contract": "contracts/governance/TokenholderGovernor.sol:TokenholderGovernor", + "label": "proposalThresholdNumerator", + "offset": 0, + "slot": "5", + "type": "t_uint256" + }, + { + "astId": 10700, + "contract": "contracts/governance/TokenholderGovernor.sol:TokenholderGovernor", + "label": "_votingDelay", + "offset": 0, + "slot": "6", + "type": "t_uint256" + }, + { + "astId": 10702, + "contract": "contracts/governance/TokenholderGovernor.sol:TokenholderGovernor", + "label": "_votingPeriod", + "offset": 0, + "slot": "7", + "type": "t_uint256" + }, + { + "astId": 3696, + "contract": "contracts/governance/TokenholderGovernor.sol:TokenholderGovernor", + "label": "_voteExtension", + "offset": 0, + "slot": "8", + "type": "t_uint64" + }, + { + "astId": 3701, + "contract": "contracts/governance/TokenholderGovernor.sol:TokenholderGovernor", + "label": "_extendedDeadlines", + "offset": 0, + "slot": "9", + "type": "t_mapping(t_uint256,t_struct(BlockNumber)7779_storage)" + }, + { + "astId": 3875, + "contract": "contracts/governance/TokenholderGovernor.sol:TokenholderGovernor", + "label": "_timelock", + "offset": 0, + "slot": "10", + "type": "t_contract(TimelockController)3456" + }, + { + "astId": 3879, + "contract": "contracts/governance/TokenholderGovernor.sol:TokenholderGovernor", + "label": "_timelockIds", + "offset": 0, + "slot": "11", + "type": "t_mapping(t_uint256,t_bytes32)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(TimelockController)3456": { + "encoding": "inplace", + "label": "contract TimelockController", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_bytes32,t_struct(RoleData)1119_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct AccessControl.RoleData)", + "numberOfBytes": "32", + "value": "t_struct(RoleData)1119_storage" + }, + "t_mapping(t_uint256,t_bytes32)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => bytes32)", + "numberOfBytes": "32", + "value": "t_bytes32" + }, + "t_mapping(t_uint256,t_struct(BlockNumber)7779_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct Timers.BlockNumber)", + "numberOfBytes": "32", + "value": "t_struct(BlockNumber)7779_storage" + }, + "t_mapping(t_uint256,t_struct(ProposalCore)1628_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct Governor.ProposalCore)", + "numberOfBytes": "32", + "value": "t_struct(ProposalCore)1628_storage" + }, + "t_mapping(t_uint256,t_struct(ProposalVote)3477_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct GovernorCountingSimple.ProposalVote)", + "numberOfBytes": "32", + "value": "t_struct(ProposalVote)3477_storage" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(BlockNumber)7779_storage": { + "encoding": "inplace", + "label": "struct Timers.BlockNumber", + "members": [ + { + "astId": 7778, + "contract": "contracts/governance/TokenholderGovernor.sol:TokenholderGovernor", + "label": "_deadline", + "offset": 0, + "slot": "0", + "type": "t_uint64" + } + ], + "numberOfBytes": "32" + }, + "t_struct(ProposalCore)1628_storage": { + "encoding": "inplace", + "label": "struct Governor.ProposalCore", + "members": [ + { + "astId": 1620, + "contract": "contracts/governance/TokenholderGovernor.sol:TokenholderGovernor", + "label": "voteStart", + "offset": 0, + "slot": "0", + "type": "t_struct(BlockNumber)7779_storage" + }, + { + "astId": 1623, + "contract": "contracts/governance/TokenholderGovernor.sol:TokenholderGovernor", + "label": "voteEnd", + "offset": 0, + "slot": "1", + "type": "t_struct(BlockNumber)7779_storage" + }, + { + "astId": 1625, + "contract": "contracts/governance/TokenholderGovernor.sol:TokenholderGovernor", + "label": "executed", + "offset": 0, + "slot": "2", + "type": "t_bool" + }, + { + "astId": 1627, + "contract": "contracts/governance/TokenholderGovernor.sol:TokenholderGovernor", + "label": "canceled", + "offset": 1, + "slot": "2", + "type": "t_bool" + } + ], + "numberOfBytes": "96" + }, + "t_struct(ProposalVote)3477_storage": { + "encoding": "inplace", + "label": "struct GovernorCountingSimple.ProposalVote", + "members": [ + { + "astId": 3468, + "contract": "contracts/governance/TokenholderGovernor.sol:TokenholderGovernor", + "label": "againstVotes", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 3470, + "contract": "contracts/governance/TokenholderGovernor.sol:TokenholderGovernor", + "label": "forVotes", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 3472, + "contract": "contracts/governance/TokenholderGovernor.sol:TokenholderGovernor", + "label": "abstainVotes", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 3476, + "contract": "contracts/governance/TokenholderGovernor.sol:TokenholderGovernor", + "label": "hasVoted", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_address,t_bool)" + } + ], + "numberOfBytes": "128" + }, + "t_struct(RoleData)1119_storage": { + "encoding": "inplace", + "label": "struct AccessControl.RoleData", + "members": [ + { + "astId": 1116, + "contract": "contracts/governance/TokenholderGovernor.sol:TokenholderGovernor", + "label": "members", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 1118, + "contract": "contracts/governance/TokenholderGovernor.sol:TokenholderGovernor", + "label": "adminRole", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint64": { + "encoding": "inplace", + "label": "uint64", + "numberOfBytes": "8" + } + } + } +} \ No newline at end of file diff --git a/deployments/mainnet/TokenholderTimelock.json b/deployments/mainnet/TokenholderTimelock.json new file mode 100644 index 00000000..11e5ac5f --- /dev/null +++ b/deployments/mainnet/TokenholderTimelock.json @@ -0,0 +1,1059 @@ +{ + "address": "0x87F005317692D05BAA4193AB0c961c69e175f45f", + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "minDelay", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "proposers", + "type": "address[]" + }, + { + "internalType": "address[]", + "name": "executors", + "type": "address[]" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "id", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "CallExecuted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "id", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "predecessor", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "delay", + "type": "uint256" + } + ], + "name": "CallScheduled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "id", + "type": "bytes32" + } + ], + "name": "Cancelled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldDuration", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newDuration", + "type": "uint256" + } + ], + "name": "MinDelayChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "EXECUTOR_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PROPOSER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TIMELOCK_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "id", + "type": "bytes32" + } + ], + "name": "cancel", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes32", + "name": "predecessor", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + } + ], + "name": "execute", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "targets", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "values", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "datas", + "type": "bytes[]" + }, + { + "internalType": "bytes32", + "name": "predecessor", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + } + ], + "name": "executeBatch", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "getMinDelay", + "outputs": [ + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "id", + "type": "bytes32" + } + ], + "name": "getTimestamp", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes32", + "name": "predecessor", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + } + ], + "name": "hashOperation", + "outputs": [ + { + "internalType": "bytes32", + "name": "hash", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "targets", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "values", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "datas", + "type": "bytes[]" + }, + { + "internalType": "bytes32", + "name": "predecessor", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + } + ], + "name": "hashOperationBatch", + "outputs": [ + { + "internalType": "bytes32", + "name": "hash", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "id", + "type": "bytes32" + } + ], + "name": "isOperation", + "outputs": [ + { + "internalType": "bool", + "name": "pending", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "id", + "type": "bytes32" + } + ], + "name": "isOperationDone", + "outputs": [ + { + "internalType": "bool", + "name": "done", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "id", + "type": "bytes32" + } + ], + "name": "isOperationPending", + "outputs": [ + { + "internalType": "bool", + "name": "pending", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "id", + "type": "bytes32" + } + ], + "name": "isOperationReady", + "outputs": [ + { + "internalType": "bool", + "name": "ready", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes32", + "name": "predecessor", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "delay", + "type": "uint256" + } + ], + "name": "schedule", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "targets", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "values", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "datas", + "type": "bytes[]" + }, + { + "internalType": "bytes32", + "name": "predecessor", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "delay", + "type": "uint256" + } + ], + "name": "scheduleBatch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newDelay", + "type": "uint256" + } + ], + "name": "updateDelay", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xe4a1fb3aaa5eef823042bc4f597e9e99271f5f6009cc32eed891630b1b26b07d", + "receipt": { + "to": null, + "from": "0xFfFd7092685bDeeBD121D1A0FEA3c349114Cce50", + "contractAddress": "0x87F005317692D05BAA4193AB0c961c69e175f45f", + "transactionIndex": 276, + "gasUsed": "1617384", + "logsBloom": "0x000000040000000008000000000000000a0000000000000000001000000000000000000000000000000000000001000000000000000000000200000010300002000000800000000000000000000000000000000000000000000000000001000000000000020000400000000000000800000000000000000000020000000000000000000000000000000000000000000000000040000001080000000000000000000000000020000000000000000000000000000000000000001000000000000000000000000000004000000000000100000200000000000100100000000020000000000000001000000000800000000000000000000000000000000000000000", + "blockHash": "0xf6ef4e4b6e4690f52095d903b9e4ab98e80a1d3e886a030fca4b2e089133c515", + "transactionHash": "0xe4a1fb3aaa5eef823042bc4f597e9e99271f5f6009cc32eed891630b1b26b07d", + "logs": [ + { + "transactionIndex": 276, + "blockNumber": 14261919, + "transactionHash": "0xe4a1fb3aaa5eef823042bc4f597e9e99271f5f6009cc32eed891630b1b26b07d", + "address": "0x87F005317692D05BAA4193AB0c961c69e175f45f", + "topics": [ + "0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff", + "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5" + ], + "data": "0x", + "logIndex": 393, + "blockHash": "0xf6ef4e4b6e4690f52095d903b9e4ab98e80a1d3e886a030fca4b2e089133c515" + }, + { + "transactionIndex": 276, + "blockNumber": 14261919, + "transactionHash": "0xe4a1fb3aaa5eef823042bc4f597e9e99271f5f6009cc32eed891630b1b26b07d", + "address": "0x87F005317692D05BAA4193AB0c961c69e175f45f", + "topics": [ + "0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff", + "0xb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc1", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5" + ], + "data": "0x", + "logIndex": 394, + "blockHash": "0xf6ef4e4b6e4690f52095d903b9e4ab98e80a1d3e886a030fca4b2e089133c515" + }, + { + "transactionIndex": 276, + "blockNumber": 14261919, + "transactionHash": "0xe4a1fb3aaa5eef823042bc4f597e9e99271f5f6009cc32eed891630b1b26b07d", + "address": "0x87F005317692D05BAA4193AB0c961c69e175f45f", + "topics": [ + "0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff", + "0xd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e63", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5" + ], + "data": "0x", + "logIndex": 395, + "blockHash": "0xf6ef4e4b6e4690f52095d903b9e4ab98e80a1d3e886a030fca4b2e089133c515" + }, + { + "transactionIndex": 276, + "blockNumber": 14261919, + "transactionHash": "0xe4a1fb3aaa5eef823042bc4f597e9e99271f5f6009cc32eed891630b1b26b07d", + "address": "0x87F005317692D05BAA4193AB0c961c69e175f45f", + "topics": [ + "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", + "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", + "0x000000000000000000000000fffd7092685bdeebd121d1a0fea3c349114cce50", + "0x000000000000000000000000fffd7092685bdeebd121d1a0fea3c349114cce50" + ], + "data": "0x", + "logIndex": 396, + "blockHash": "0xf6ef4e4b6e4690f52095d903b9e4ab98e80a1d3e886a030fca4b2e089133c515" + }, + { + "transactionIndex": 276, + "blockNumber": 14261919, + "transactionHash": "0xe4a1fb3aaa5eef823042bc4f597e9e99271f5f6009cc32eed891630b1b26b07d", + "address": "0x87F005317692D05BAA4193AB0c961c69e175f45f", + "topics": [ + "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", + "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", + "0x00000000000000000000000087f005317692d05baa4193ab0c961c69e175f45f", + "0x000000000000000000000000fffd7092685bdeebd121d1a0fea3c349114cce50" + ], + "data": "0x", + "logIndex": 397, + "blockHash": "0xf6ef4e4b6e4690f52095d903b9e4ab98e80a1d3e886a030fca4b2e089133c515" + }, + { + "transactionIndex": 276, + "blockNumber": 14261919, + "transactionHash": "0xe4a1fb3aaa5eef823042bc4f597e9e99271f5f6009cc32eed891630b1b26b07d", + "address": "0x87F005317692D05BAA4193AB0c961c69e175f45f", + "topics": [ + "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", + "0xd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e63", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000fffd7092685bdeebd121d1a0fea3c349114cce50" + ], + "data": "0x", + "logIndex": 398, + "blockHash": "0xf6ef4e4b6e4690f52095d903b9e4ab98e80a1d3e886a030fca4b2e089133c515" + }, + { + "transactionIndex": 276, + "blockNumber": 14261919, + "transactionHash": "0xe4a1fb3aaa5eef823042bc4f597e9e99271f5f6009cc32eed891630b1b26b07d", + "address": "0x87F005317692D05BAA4193AB0c961c69e175f45f", + "topics": [ + "0x11c24f4ead16507c69ac467fbd5e4eed5fb5c699626d2cc6d66421df253886d5" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a300", + "logIndex": 399, + "blockHash": "0xf6ef4e4b6e4690f52095d903b9e4ab98e80a1d3e886a030fca4b2e089133c515" + } + ], + "blockNumber": 14261919, + "cumulativeGasUsed": "21503601", + "status": 1, + "byzantium": true + }, + "args": [ + 172800, + [], + [ + "0x0000000000000000000000000000000000000000" + ] + ], + "numDeployments": 1, + "solcInputHash": "9a2f45de388a8a02f9e065c8da7e4649", + "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"minDelay\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"proposers\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"executors\",\"type\":\"address[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"CallExecuted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"predecessor\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"delay\",\"type\":\"uint256\"}],\"name\":\"CallScheduled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"}],\"name\":\"Cancelled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldDuration\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newDuration\",\"type\":\"uint256\"}],\"name\":\"MinDelayChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"EXECUTOR_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PROPOSER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TIMELOCK_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"}],\"name\":\"cancel\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"predecessor\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"}],\"name\":\"execute\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"targets\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"datas\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes32\",\"name\":\"predecessor\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"}],\"name\":\"executeBatch\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMinDelay\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"}],\"name\":\"getTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"predecessor\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"}],\"name\":\"hashOperation\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"hash\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"targets\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"datas\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes32\",\"name\":\"predecessor\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"}],\"name\":\"hashOperationBatch\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"hash\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"}],\"name\":\"isOperation\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"pending\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"}],\"name\":\"isOperationDone\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"done\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"}],\"name\":\"isOperationPending\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"pending\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"}],\"name\":\"isOperationReady\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"ready\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"predecessor\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"delay\",\"type\":\"uint256\"}],\"name\":\"schedule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"targets\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"datas\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes32\",\"name\":\"predecessor\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"delay\",\"type\":\"uint256\"}],\"name\":\"scheduleBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newDelay\",\"type\":\"uint256\"}],\"name\":\"updateDelay\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"Contract module which acts as a timelocked controller. When set as the owner of an `Ownable` smart contract, it enforces a timelock on all `onlyOwner` maintenance operations. This gives time for users of the controlled contract to exit before a potentially dangerous maintenance operation is applied. By default, this contract is self administered, meaning administration tasks have to go through the timelock process. The proposer (resp executor) role is in charge of proposing (resp executing) operations. A common use case is to position this {TimelockController} as the owner of a smart contract, with a multisig or a DAO as the sole proposer. _Available since v3.3._\",\"events\":{\"CallExecuted(bytes32,uint256,address,uint256,bytes)\":{\"details\":\"Emitted when a call is performed as part of operation `id`.\"},\"CallScheduled(bytes32,uint256,address,uint256,bytes,bytes32,uint256)\":{\"details\":\"Emitted when a call is scheduled as part of operation `id`.\"},\"Cancelled(bytes32)\":{\"details\":\"Emitted when operation `id` is cancelled.\"},\"MinDelayChange(uint256,uint256)\":{\"details\":\"Emitted when the minimum delay for future operations is modified.\"}},\"kind\":\"dev\",\"methods\":{\"cancel(bytes32)\":{\"details\":\"Cancel an operation. Requirements: - the caller must have the 'proposer' role.\"},\"constructor\":{\"details\":\"Initializes the contract with a given `minDelay`.\"},\"execute(address,uint256,bytes,bytes32,bytes32)\":{\"details\":\"Execute an (ready) operation containing a single transaction. Emits a {CallExecuted} event. Requirements: - the caller must have the 'executor' role.\"},\"executeBatch(address[],uint256[],bytes[],bytes32,bytes32)\":{\"details\":\"Execute an (ready) operation containing a batch of transactions. Emits one {CallExecuted} event per transaction in the batch. Requirements: - the caller must have the 'executor' role.\"},\"getMinDelay()\":{\"details\":\"Returns the minimum delay for an operation to become valid. This value can be changed by executing an operation that calls `updateDelay`.\"},\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"getTimestamp(bytes32)\":{\"details\":\"Returns the timestamp at with an operation becomes ready (0 for unset operations, 1 for done operations).\"},\"grantRole(bytes32,address)\":{\"details\":\"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"hashOperation(address,uint256,bytes,bytes32,bytes32)\":{\"details\":\"Returns the identifier of an operation containing a single transaction.\"},\"hashOperationBatch(address[],uint256[],bytes[],bytes32,bytes32)\":{\"details\":\"Returns the identifier of an operation containing a batch of transactions.\"},\"isOperation(bytes32)\":{\"details\":\"Returns whether an id correspond to a registered operation. This includes both Pending, Ready and Done operations.\"},\"isOperationDone(bytes32)\":{\"details\":\"Returns whether an operation is done or not.\"},\"isOperationPending(bytes32)\":{\"details\":\"Returns whether an operation is pending or not.\"},\"isOperationReady(bytes32)\":{\"details\":\"Returns whether an operation is ready or not.\"},\"renounceRole(bytes32,address)\":{\"details\":\"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`.\"},\"revokeRole(bytes32,address)\":{\"details\":\"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role.\"},\"schedule(address,uint256,bytes,bytes32,bytes32,uint256)\":{\"details\":\"Schedule an operation containing a single transaction. Emits a {CallScheduled} event. Requirements: - the caller must have the 'proposer' role.\"},\"scheduleBatch(address[],uint256[],bytes[],bytes32,bytes32,uint256)\":{\"details\":\"Schedule an operation containing a batch of transactions. Emits one {CallScheduled} event per transaction in the batch. Requirements: - the caller must have the 'proposer' role.\"},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"},\"updateDelay(uint256)\":{\"details\":\"Changes the minimum timelock duration for future operations. Emits a {MinDelayChange} event. Requirements: - the caller must be the timelock itself. This can only be achieved by scheduling and later executing an operation where the timelock is the target and the data is the ABI-encoded call to this function.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/governance/TimelockController.sol\":\"TimelockController\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/AccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControl.sol\\\";\\nimport \\\"../utils/Context.sol\\\";\\nimport \\\"../utils/Strings.sol\\\";\\nimport \\\"../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev Contract module that allows children to implement role-based access\\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\\n * members except through off-chain means by accessing the contract event logs. Some\\n * applications may benefit from on-chain enumerability, for those cases see\\n * {AccessControlEnumerable}.\\n *\\n * Roles are referred to by their `bytes32` identifier. These should be exposed\\n * in the external API and be unique. The best way to achieve this is by\\n * using `public constant` hash digests:\\n *\\n * ```\\n * bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\");\\n * ```\\n *\\n * Roles can be used to represent a set of permissions. To restrict access to a\\n * function call, use {hasRole}:\\n *\\n * ```\\n * function foo() public {\\n * require(hasRole(MY_ROLE, msg.sender));\\n * ...\\n * }\\n * ```\\n *\\n * Roles can be granted and revoked dynamically via the {grantRole} and\\n * {revokeRole} functions. Each role has an associated admin role, and only\\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\\n *\\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\\n * that only accounts with this role will be able to grant or revoke other\\n * roles. More complex role relationships can be created by using\\n * {_setRoleAdmin}.\\n *\\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\\n * grant and revoke this role. Extra precautions should be taken to secure\\n * accounts that have been granted it.\\n */\\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\\n struct RoleData {\\n mapping(address => bool) members;\\n bytes32 adminRole;\\n }\\n\\n mapping(bytes32 => RoleData) private _roles;\\n\\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\\n\\n /**\\n * @dev Modifier that checks that an account has a specific role. Reverts\\n * with a standardized message including the required role.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n *\\n * _Available since v4.1._\\n */\\n modifier onlyRole(bytes32 role) {\\n _checkRole(role, _msgSender());\\n _;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\\n return _roles[role].members[account];\\n }\\n\\n /**\\n * @dev Revert with a standard message if `account` is missing `role`.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n */\\n function _checkRole(bytes32 role, address account) internal view virtual {\\n if (!hasRole(role, account)) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"AccessControl: account \\\",\\n Strings.toHexString(uint160(account), 20),\\n \\\" is missing role \\\",\\n Strings.toHexString(uint256(role), 32)\\n )\\n )\\n );\\n }\\n }\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\\n return _roles[role].adminRole;\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) public virtual override {\\n require(account == _msgSender(), \\\"AccessControl: can only renounce roles for self\\\");\\n\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event. Note that unlike {grantRole}, this function doesn't perform any\\n * checks on the calling account.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from the constructor when setting\\n * up the initial roles for the system.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {AccessControl}.\\n * ====\\n *\\n * NOTE: This function is deprecated in favor of {_grantRole}.\\n */\\n function _setupRole(bytes32 role, address account) internal virtual {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Sets `adminRole` as ``role``'s admin role.\\n *\\n * Emits a {RoleAdminChanged} event.\\n */\\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\\n bytes32 previousAdminRole = getRoleAdmin(role);\\n _roles[role].adminRole = adminRole;\\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * Internal function without access restriction.\\n */\\n function _grantRole(bytes32 role, address account) internal virtual {\\n if (!hasRole(role, account)) {\\n _roles[role].members[account] = true;\\n emit RoleGranted(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * Internal function without access restriction.\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual {\\n if (hasRole(role, account)) {\\n _roles[role].members[account] = false;\\n emit RoleRevoked(role, account, _msgSender());\\n }\\n }\\n}\\n\",\"keccak256\":\"0x4a1a0ba12bf1a33f10d9fe226278cf59675c0b929d29e4da99658a079b27fb84\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/IAccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IAccessControl {\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n * _Available since v3.1._\\n */\\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) external view returns (bool);\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n}\\n\",\"keccak256\":\"0x59ce320a585d7e1f163cd70390a0ef2ff9cec832e2aa544293a00692465a7a57\",\"license\":\"MIT\"},\"@openzeppelin/contracts/governance/TimelockController.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (governance/TimelockController.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../access/AccessControl.sol\\\";\\n\\n/**\\n * @dev Contract module which acts as a timelocked controller. When set as the\\n * owner of an `Ownable` smart contract, it enforces a timelock on all\\n * `onlyOwner` maintenance operations. This gives time for users of the\\n * controlled contract to exit before a potentially dangerous maintenance\\n * operation is applied.\\n *\\n * By default, this contract is self administered, meaning administration tasks\\n * have to go through the timelock process. The proposer (resp executor) role\\n * is in charge of proposing (resp executing) operations. A common use case is\\n * to position this {TimelockController} as the owner of a smart contract, with\\n * a multisig or a DAO as the sole proposer.\\n *\\n * _Available since v3.3._\\n */\\ncontract TimelockController is AccessControl {\\n bytes32 public constant TIMELOCK_ADMIN_ROLE = keccak256(\\\"TIMELOCK_ADMIN_ROLE\\\");\\n bytes32 public constant PROPOSER_ROLE = keccak256(\\\"PROPOSER_ROLE\\\");\\n bytes32 public constant EXECUTOR_ROLE = keccak256(\\\"EXECUTOR_ROLE\\\");\\n uint256 internal constant _DONE_TIMESTAMP = uint256(1);\\n\\n mapping(bytes32 => uint256) private _timestamps;\\n uint256 private _minDelay;\\n\\n /**\\n * @dev Emitted when a call is scheduled as part of operation `id`.\\n */\\n event CallScheduled(\\n bytes32 indexed id,\\n uint256 indexed index,\\n address target,\\n uint256 value,\\n bytes data,\\n bytes32 predecessor,\\n uint256 delay\\n );\\n\\n /**\\n * @dev Emitted when a call is performed as part of operation `id`.\\n */\\n event CallExecuted(bytes32 indexed id, uint256 indexed index, address target, uint256 value, bytes data);\\n\\n /**\\n * @dev Emitted when operation `id` is cancelled.\\n */\\n event Cancelled(bytes32 indexed id);\\n\\n /**\\n * @dev Emitted when the minimum delay for future operations is modified.\\n */\\n event MinDelayChange(uint256 oldDuration, uint256 newDuration);\\n\\n /**\\n * @dev Initializes the contract with a given `minDelay`.\\n */\\n constructor(\\n uint256 minDelay,\\n address[] memory proposers,\\n address[] memory executors\\n ) {\\n _setRoleAdmin(TIMELOCK_ADMIN_ROLE, TIMELOCK_ADMIN_ROLE);\\n _setRoleAdmin(PROPOSER_ROLE, TIMELOCK_ADMIN_ROLE);\\n _setRoleAdmin(EXECUTOR_ROLE, TIMELOCK_ADMIN_ROLE);\\n\\n // deployer + self administration\\n _setupRole(TIMELOCK_ADMIN_ROLE, _msgSender());\\n _setupRole(TIMELOCK_ADMIN_ROLE, address(this));\\n\\n // register proposers\\n for (uint256 i = 0; i < proposers.length; ++i) {\\n _setupRole(PROPOSER_ROLE, proposers[i]);\\n }\\n\\n // register executors\\n for (uint256 i = 0; i < executors.length; ++i) {\\n _setupRole(EXECUTOR_ROLE, executors[i]);\\n }\\n\\n _minDelay = minDelay;\\n emit MinDelayChange(0, minDelay);\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only by a certain role. In\\n * addition to checking the sender's role, `address(0)` 's role is also\\n * considered. Granting a role to `address(0)` is equivalent to enabling\\n * this role for everyone.\\n */\\n modifier onlyRoleOrOpenRole(bytes32 role) {\\n if (!hasRole(role, address(0))) {\\n _checkRole(role, _msgSender());\\n }\\n _;\\n }\\n\\n /**\\n * @dev Contract might receive/hold ETH as part of the maintenance process.\\n */\\n receive() external payable {}\\n\\n /**\\n * @dev Returns whether an id correspond to a registered operation. This\\n * includes both Pending, Ready and Done operations.\\n */\\n function isOperation(bytes32 id) public view virtual returns (bool pending) {\\n return getTimestamp(id) > 0;\\n }\\n\\n /**\\n * @dev Returns whether an operation is pending or not.\\n */\\n function isOperationPending(bytes32 id) public view virtual returns (bool pending) {\\n return getTimestamp(id) > _DONE_TIMESTAMP;\\n }\\n\\n /**\\n * @dev Returns whether an operation is ready or not.\\n */\\n function isOperationReady(bytes32 id) public view virtual returns (bool ready) {\\n uint256 timestamp = getTimestamp(id);\\n return timestamp > _DONE_TIMESTAMP && timestamp <= block.timestamp;\\n }\\n\\n /**\\n * @dev Returns whether an operation is done or not.\\n */\\n function isOperationDone(bytes32 id) public view virtual returns (bool done) {\\n return getTimestamp(id) == _DONE_TIMESTAMP;\\n }\\n\\n /**\\n * @dev Returns the timestamp at with an operation becomes ready (0 for\\n * unset operations, 1 for done operations).\\n */\\n function getTimestamp(bytes32 id) public view virtual returns (uint256 timestamp) {\\n return _timestamps[id];\\n }\\n\\n /**\\n * @dev Returns the minimum delay for an operation to become valid.\\n *\\n * This value can be changed by executing an operation that calls `updateDelay`.\\n */\\n function getMinDelay() public view virtual returns (uint256 duration) {\\n return _minDelay;\\n }\\n\\n /**\\n * @dev Returns the identifier of an operation containing a single\\n * transaction.\\n */\\n function hashOperation(\\n address target,\\n uint256 value,\\n bytes calldata data,\\n bytes32 predecessor,\\n bytes32 salt\\n ) public pure virtual returns (bytes32 hash) {\\n return keccak256(abi.encode(target, value, data, predecessor, salt));\\n }\\n\\n /**\\n * @dev Returns the identifier of an operation containing a batch of\\n * transactions.\\n */\\n function hashOperationBatch(\\n address[] calldata targets,\\n uint256[] calldata values,\\n bytes[] calldata datas,\\n bytes32 predecessor,\\n bytes32 salt\\n ) public pure virtual returns (bytes32 hash) {\\n return keccak256(abi.encode(targets, values, datas, predecessor, salt));\\n }\\n\\n /**\\n * @dev Schedule an operation containing a single transaction.\\n *\\n * Emits a {CallScheduled} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have the 'proposer' role.\\n */\\n function schedule(\\n address target,\\n uint256 value,\\n bytes calldata data,\\n bytes32 predecessor,\\n bytes32 salt,\\n uint256 delay\\n ) public virtual onlyRole(PROPOSER_ROLE) {\\n bytes32 id = hashOperation(target, value, data, predecessor, salt);\\n _schedule(id, delay);\\n emit CallScheduled(id, 0, target, value, data, predecessor, delay);\\n }\\n\\n /**\\n * @dev Schedule an operation containing a batch of transactions.\\n *\\n * Emits one {CallScheduled} event per transaction in the batch.\\n *\\n * Requirements:\\n *\\n * - the caller must have the 'proposer' role.\\n */\\n function scheduleBatch(\\n address[] calldata targets,\\n uint256[] calldata values,\\n bytes[] calldata datas,\\n bytes32 predecessor,\\n bytes32 salt,\\n uint256 delay\\n ) public virtual onlyRole(PROPOSER_ROLE) {\\n require(targets.length == values.length, \\\"TimelockController: length mismatch\\\");\\n require(targets.length == datas.length, \\\"TimelockController: length mismatch\\\");\\n\\n bytes32 id = hashOperationBatch(targets, values, datas, predecessor, salt);\\n _schedule(id, delay);\\n for (uint256 i = 0; i < targets.length; ++i) {\\n emit CallScheduled(id, i, targets[i], values[i], datas[i], predecessor, delay);\\n }\\n }\\n\\n /**\\n * @dev Schedule an operation that is to becomes valid after a given delay.\\n */\\n function _schedule(bytes32 id, uint256 delay) private {\\n require(!isOperation(id), \\\"TimelockController: operation already scheduled\\\");\\n require(delay >= getMinDelay(), \\\"TimelockController: insufficient delay\\\");\\n _timestamps[id] = block.timestamp + delay;\\n }\\n\\n /**\\n * @dev Cancel an operation.\\n *\\n * Requirements:\\n *\\n * - the caller must have the 'proposer' role.\\n */\\n function cancel(bytes32 id) public virtual onlyRole(PROPOSER_ROLE) {\\n require(isOperationPending(id), \\\"TimelockController: operation cannot be cancelled\\\");\\n delete _timestamps[id];\\n\\n emit Cancelled(id);\\n }\\n\\n /**\\n * @dev Execute an (ready) operation containing a single transaction.\\n *\\n * Emits a {CallExecuted} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have the 'executor' role.\\n */\\n function execute(\\n address target,\\n uint256 value,\\n bytes calldata data,\\n bytes32 predecessor,\\n bytes32 salt\\n ) public payable virtual onlyRoleOrOpenRole(EXECUTOR_ROLE) {\\n bytes32 id = hashOperation(target, value, data, predecessor, salt);\\n _beforeCall(id, predecessor);\\n _call(id, 0, target, value, data);\\n _afterCall(id);\\n }\\n\\n /**\\n * @dev Execute an (ready) operation containing a batch of transactions.\\n *\\n * Emits one {CallExecuted} event per transaction in the batch.\\n *\\n * Requirements:\\n *\\n * - the caller must have the 'executor' role.\\n */\\n function executeBatch(\\n address[] calldata targets,\\n uint256[] calldata values,\\n bytes[] calldata datas,\\n bytes32 predecessor,\\n bytes32 salt\\n ) public payable virtual onlyRoleOrOpenRole(EXECUTOR_ROLE) {\\n require(targets.length == values.length, \\\"TimelockController: length mismatch\\\");\\n require(targets.length == datas.length, \\\"TimelockController: length mismatch\\\");\\n\\n bytes32 id = hashOperationBatch(targets, values, datas, predecessor, salt);\\n _beforeCall(id, predecessor);\\n for (uint256 i = 0; i < targets.length; ++i) {\\n _call(id, i, targets[i], values[i], datas[i]);\\n }\\n _afterCall(id);\\n }\\n\\n /**\\n * @dev Checks before execution of an operation's calls.\\n */\\n function _beforeCall(bytes32 id, bytes32 predecessor) private view {\\n require(isOperationReady(id), \\\"TimelockController: operation is not ready\\\");\\n require(predecessor == bytes32(0) || isOperationDone(predecessor), \\\"TimelockController: missing dependency\\\");\\n }\\n\\n /**\\n * @dev Checks after execution of an operation's calls.\\n */\\n function _afterCall(bytes32 id) private {\\n require(isOperationReady(id), \\\"TimelockController: operation is not ready\\\");\\n _timestamps[id] = _DONE_TIMESTAMP;\\n }\\n\\n /**\\n * @dev Execute an operation's call.\\n *\\n * Emits a {CallExecuted} event.\\n */\\n function _call(\\n bytes32 id,\\n uint256 index,\\n address target,\\n uint256 value,\\n bytes calldata data\\n ) private {\\n (bool success, ) = target.call{value: value}(data);\\n require(success, \\\"TimelockController: underlying transaction reverted\\\");\\n\\n emit CallExecuted(id, index, target, value, data);\\n }\\n\\n /**\\n * @dev Changes the minimum timelock duration for future operations.\\n *\\n * Emits a {MinDelayChange} event.\\n *\\n * Requirements:\\n *\\n * - the caller must be the timelock itself. This can only be achieved by scheduling and later executing\\n * an operation where the timelock is the target and the data is the ABI-encoded call to this function.\\n */\\n function updateDelay(uint256 newDelay) external virtual {\\n require(msg.sender == address(this), \\\"TimelockController: caller must be timelock\\\");\\n emit MinDelayChange(_minDelay, newDelay);\\n _minDelay = newDelay;\\n }\\n}\\n\",\"keccak256\":\"0x61357e3fe6a0a93c779bc75f730d219458b268ffd19c0c0a6f31c7eb0f435466\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n}\\n\",\"keccak256\":\"0x32c202bd28995dd20c4347b7c6467a6d3241c74c8ad3edcbb610cd9205916c45\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b5060405162001da438038062001da48339810160408190526200003491620003a4565b6200004f60008051602062001d4483398151915280620001c9565b6200007960008051602062001d6483398151915260008051602062001d44833981519152620001c9565b620000a360008051602062001d8483398151915260008051602062001d44833981519152620001c9565b620000be60008051602062001d448339815191523362000214565b620000d960008051602062001d448339815191523062000214565b60005b825181101562000136576200012360008051602062001d648339815191528483815181106200010f576200010f62000418565b60200260200101516200021460201b60201c565b6200012e816200042e565b9050620000dc565b5060005b815181101562000180576200016d60008051602062001d848339815191528383815181106200010f576200010f62000418565b62000178816200042e565b90506200013a565b5060028390556040805160008152602081018590527f11c24f4ead16507c69ac467fbd5e4eed5fb5c699626d2cc6d66421df253886d5910160405180910390a150505062000458565b600082815260208190526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b62000220828262000224565b5050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1662000220576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620002803390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b634e487b7160e01b600052604160045260246000fd5b80516001600160a01b0381168114620002f257600080fd5b919050565b600082601f8301126200030957600080fd5b815160206001600160401b0380831115620003285762000328620002c4565b8260051b604051601f19603f83011681018181108482111715620003505762000350620002c4565b6040529384528581018301938381019250878511156200036f57600080fd5b83870191505b8482101562000399576200038982620002da565b8352918301919083019062000375565b979650505050505050565b600080600060608486031215620003ba57600080fd5b835160208501519093506001600160401b0380821115620003da57600080fd5b620003e887838801620002f7565b93506040860151915080821115620003ff57600080fd5b506200040e86828701620002f7565b9150509250925092565b634e487b7160e01b600052603260045260246000fd5b60006000198214156200045157634e487b7160e01b600052601160045260246000fd5b5060010190565b6118dc80620004686000396000f3fe60806040526004361061011f5760003560e01c806301d5062a1461012b57806301ffc9a71461014d57806307bd0265146101825780630d3cf6fc146101b2578063134008d3146101e657806313bc9f20146101f9578063248a9ca3146102195780632ab0f529146102395780632f2ff15d1461025957806331d507501461027957806336568abe14610299578063584b153e146102b957806364d62353146102d95780638065657f146102f95780638f2a0bb0146103195780638f61f4f51461033957806391d148541461035b578063a217fddf1461037b578063b1c5f42714610390578063c4d252f5146103b0578063d45c4435146103d0578063d547741f146103f0578063e38335e514610410578063f27a0c921461042357600080fd5b3661012657005b600080fd5b34801561013757600080fd5b5061014b610146366004611109565b610438565b005b34801561015957600080fd5b5061016d61016836600461117d565b6104aa565b60405190151581526020015b60405180910390f35b34801561018e57600080fd5b506101a460008051602061186783398151915281565b604051908152602001610179565b3480156101be57600080fd5b506101a47f5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca581565b61014b6101f43660046111a7565b6104e1565b34801561020557600080fd5b5061016d610214366004611212565b610547565b34801561022557600080fd5b506101a4610234366004611212565b61056c565b34801561024557600080fd5b5061016d610254366004611212565b610581565b34801561026557600080fd5b5061014b61027436600461122b565b610595565b34801561028557600080fd5b5061016d610294366004611212565b6105b7565b3480156102a557600080fd5b5061014b6102b436600461122b565b6105ca565b3480156102c557600080fd5b5061016d6102d4366004611212565b61064d565b3480156102e557600080fd5b5061014b6102f4366004611212565b61065a565b34801561030557600080fd5b506101a46103143660046111a7565b6106fe565b34801561032557600080fd5b5061014b61033436600461129b565b61073d565b34801561034557600080fd5b506101a460008051602061184783398151915281565b34801561036757600080fd5b5061016d61037636600461122b565b61086c565b34801561038757600080fd5b506101a4600081565b34801561039c57600080fd5b506101a46103ab36600461134c565b610895565b3480156103bc57600080fd5b5061014b6103cb366004611212565b6108da565b3480156103dc57600080fd5b506101a46103eb366004611212565b61099e565b3480156103fc57600080fd5b5061014b61040b36600461122b565b6109b0565b61014b61041e36600461134c565b6109cd565b34801561042f57600080fd5b506002546101a4565b6000805160206118478339815191526104518133610af0565b60006104618989898989896106fe565b905061046d8184610b54565b6000816000805160206118878339815191528b8b8b8b8b8a6040516104979695949392919061141d565b60405180910390a3505050505050505050565b60006001600160e01b03198216637965db0b60e01b14806104db57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6000805160206118678339815191526104fb81600061086c565b610509576105098133610af0565b60006105198888888888886106fe565b90506105258185610c43565b6105348160008a8a8a8a610cd4565b61053d81610de8565b5050505050505050565b6000806105538361099e565b90506001811180156105655750428111155b9392505050565b60009081526020819052604090206001015490565b6000600161058e8361099e565b1492915050565b61059e8261056c565b6105a88133610af0565b6105b28383610e21565b505050565b6000806105c38361099e565b1192915050565b6001600160a01b038116331461063f5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6106498282610ea5565b5050565b600060016105c38361099e565b3330146106bd5760405162461bcd60e51b815260206004820152602b60248201527f54696d656c6f636b436f6e74726f6c6c65723a2063616c6c6572206d7573742060448201526a62652074696d656c6f636b60a81b6064820152608401610636565b60025460408051918252602082018390527f11c24f4ead16507c69ac467fbd5e4eed5fb5c699626d2cc6d66421df253886d5910160405180910390a1600255565b600086868686868660405160200161071b9695949392919061141d565b6040516020818303038152906040528051906020012090509695505050505050565b6000805160206118478339815191526107568133610af0565b8887146107755760405162461bcd60e51b81526004016106369061145a565b8885146107945760405162461bcd60e51b81526004016106369061145a565b60006107a68b8b8b8b8b8b8b8b610895565b90506107b28184610b54565b60005b8a81101561085e5780826000805160206118878339815191528e8e858181106107e0576107e061149d565b90506020020160208101906107f591906114b3565b8d8d868181106108075761080761149d565b905060200201358c8c878181106108205761082061149d565b905060200281019061083291906114ce565b8c8b6040516108469695949392919061141d565b60405180910390a36108578161152a565b90506107b5565b505050505050505050505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b600088888888888888886040516020016108b69897969594939291906115d9565b60405160208183030381529060405280519060200120905098975050505050505050565b6000805160206118478339815191526108f38133610af0565b6108fc8261064d565b6109625760405162461bcd60e51b815260206004820152603160248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e2063616044820152701b9b9bdd0818994818d85b98d95b1b1959607a1b6064820152608401610636565b6000828152600160205260408082208290555183917fbaa1eb22f2a492ba1a5fea61b8df4d27c6c8b5f3971e63bb58fa14ff72eedb7091a25050565b60009081526001602052604090205490565b6109b98261056c565b6109c38133610af0565b6105b28383610ea5565b6000805160206118678339815191526109e781600061086c565b6109f5576109f58133610af0565b878614610a145760405162461bcd60e51b81526004016106369061145a565b878414610a335760405162461bcd60e51b81526004016106369061145a565b6000610a458a8a8a8a8a8a8a8a610895565b9050610a518185610c43565b60005b89811015610ada57610aca82828d8d85818110610a7357610a7361149d565b9050602002016020810190610a8891906114b3565b8c8c86818110610a9a57610a9a61149d565b905060200201358b8b87818110610ab357610ab361149d565b9050602002810190610ac591906114ce565b610cd4565b610ad38161152a565b9050610a54565b50610ae481610de8565b50505050505050505050565b610afa828261086c565b61064957610b12816001600160a01b03166014610f0a565b610b1d836020610f0a565b604051602001610b2e9291906116b4565b60408051601f198184030181529082905262461bcd60e51b825261063691600401611723565b610b5d826105b7565b15610bc25760405162461bcd60e51b815260206004820152602f60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20616c60448201526e1c9958591e481cd8da19591d5b1959608a1b6064820152608401610636565b600254811015610c235760405162461bcd60e51b815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a20696e73756666696369656e746044820152652064656c617960d01b6064820152608401610636565b610c2d8142611756565b6000928352600160205260409092209190915550565b610c4c82610547565b610c685760405162461bcd60e51b81526004016106369061176e565b801580610c795750610c7981610581565b6106495760405162461bcd60e51b815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a206d697373696e6720646570656044820152656e64656e637960d01b6064820152608401610636565b6000846001600160a01b0316848484604051610cf19291906117b8565b60006040518083038185875af1925050503d8060008114610d2e576040519150601f19603f3d011682016040523d82523d6000602084013e610d33565b606091505b5050905080610da05760405162461bcd60e51b815260206004820152603360248201527f54696d656c6f636b436f6e74726f6c6c65723a20756e6465726c79696e6720746044820152721c985b9cd858dd1a5bdb881c995d995c9d1959606a1b6064820152608401610636565b85877fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b5887878787604051610dd794939291906117c8565b60405180910390a350505050505050565b610df181610547565b610e0d5760405162461bcd60e51b81526004016106369061176e565b600090815260016020819052604090912055565b610e2b828261086c565b610649576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610e613390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b610eaf828261086c565b15610649576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60606000610f198360026117fa565b610f24906002611756565b6001600160401b03811115610f3b57610f3b611819565b6040519080825280601f01601f191660200182016040528015610f65576020820181803683370190505b509050600360fc1b81600081518110610f8057610f8061149d565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110610faf57610faf61149d565b60200101906001600160f81b031916908160001a9053506000610fd38460026117fa565b610fde906001611756565b90505b6001811115611056576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106110125761101261149d565b1a60f81b8282815181106110285761102861149d565b60200101906001600160f81b031916908160001a90535060049490941c9361104f8161182f565b9050610fe1565b5083156105655760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610636565b80356001600160a01b03811681146110bc57600080fd5b919050565b60008083601f8401126110d357600080fd5b5081356001600160401b038111156110ea57600080fd5b60208301915083602082850101111561110257600080fd5b9250929050565b600080600080600080600060c0888a03121561112457600080fd5b61112d886110a5565b96506020880135955060408801356001600160401b0381111561114f57600080fd5b61115b8a828b016110c1565b989b979a50986060810135976080820135975060a09091013595509350505050565b60006020828403121561118f57600080fd5b81356001600160e01b03198116811461056557600080fd5b60008060008060008060a087890312156111c057600080fd5b6111c9876110a5565b95506020870135945060408701356001600160401b038111156111eb57600080fd5b6111f789828a016110c1565b979a9699509760608101359660809091013595509350505050565b60006020828403121561122457600080fd5b5035919050565b6000806040838503121561123e57600080fd5b8235915061124e602084016110a5565b90509250929050565b60008083601f84011261126957600080fd5b5081356001600160401b0381111561128057600080fd5b6020830191508360208260051b850101111561110257600080fd5b600080600080600080600080600060c08a8c0312156112b957600080fd5b89356001600160401b03808211156112d057600080fd5b6112dc8d838e01611257565b909b50995060208c01359150808211156112f557600080fd5b6113018d838e01611257565b909950975060408c013591508082111561131a57600080fd5b506113278c828d01611257565b9a9d999c50979a969997986060880135976080810135975060a0013595509350505050565b60008060008060008060008060a0898b03121561136857600080fd5b88356001600160401b038082111561137f57600080fd5b61138b8c838d01611257565b909a50985060208b01359150808211156113a457600080fd5b6113b08c838d01611257565b909850965060408b01359150808211156113c957600080fd5b506113d68b828c01611257565b999c989b509699959896976060870135966080013595509350505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60018060a01b038716815285602082015260a06040820152600061144560a0830186886113f4565b60608301949094525060800152949350505050565b60208082526023908201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d616040820152620e8c6d60eb1b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156114c557600080fd5b610565826110a5565b6000808335601e198436030181126114e557600080fd5b8301803591506001600160401b038211156114ff57600080fd5b60200191503681900382131561110257600080fd5b634e487b7160e01b600052601160045260246000fd5b600060001982141561153e5761153e611514565b5060010190565b60008383855260208086019550808560051b8301018460005b878110156115cc57848303601f19018952813536889003601e1901811261158457600080fd5b870180356001600160401b0381111561159c57600080fd5b8036038913156115ab57600080fd5b6115b885828885016113f4565b9a86019a945050509083019060010161155e565b5090979650505050505050565b60a0808252810188905260008960c08301825b8b81101561161a576001600160a01b03611605846110a5565b168252602092830192909101906001016115ec565b5083810360208501528881526001600160fb1b0389111561163a57600080fd5b8860051b9150818a60208301378181019150506020810160008152602084830301604085015261166b81888a611545565b6060850196909652505050608001529695505050505050565b60005b8381101561169f578181015183820152602001611687565b838111156116ae576000848401525b50505050565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8152600083516116e6816017850160208801611684565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351611717816028840160208801611684565b01602801949350505050565b6020815260008251806020840152611742816040850160208701611684565b601f01601f19169190910160400192915050565b6000821982111561176957611769611514565b500190565b6020808252602a908201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e206973604082015269206e6f7420726561647960b01b606082015260800190565b8183823760009101908152919050565b60018060a01b03851681528360208201526060604082015260006117f06060830184866113f4565b9695505050505050565b600081600019048311821515161561181457611814611514565b500290565b634e487b7160e01b600052604160045260246000fd5b60008161183e5761183e611514565b50600019019056feb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc1d8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e634cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dcaa26469706673582212202b42ead38295ff66035050c1591a3b27b3bdd5c052c9fa0645294c72e6e1961164736f6c634300080900335f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5b09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc1d8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e63", + "deployedBytecode": "0x60806040526004361061011f5760003560e01c806301d5062a1461012b57806301ffc9a71461014d57806307bd0265146101825780630d3cf6fc146101b2578063134008d3146101e657806313bc9f20146101f9578063248a9ca3146102195780632ab0f529146102395780632f2ff15d1461025957806331d507501461027957806336568abe14610299578063584b153e146102b957806364d62353146102d95780638065657f146102f95780638f2a0bb0146103195780638f61f4f51461033957806391d148541461035b578063a217fddf1461037b578063b1c5f42714610390578063c4d252f5146103b0578063d45c4435146103d0578063d547741f146103f0578063e38335e514610410578063f27a0c921461042357600080fd5b3661012657005b600080fd5b34801561013757600080fd5b5061014b610146366004611109565b610438565b005b34801561015957600080fd5b5061016d61016836600461117d565b6104aa565b60405190151581526020015b60405180910390f35b34801561018e57600080fd5b506101a460008051602061186783398151915281565b604051908152602001610179565b3480156101be57600080fd5b506101a47f5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca581565b61014b6101f43660046111a7565b6104e1565b34801561020557600080fd5b5061016d610214366004611212565b610547565b34801561022557600080fd5b506101a4610234366004611212565b61056c565b34801561024557600080fd5b5061016d610254366004611212565b610581565b34801561026557600080fd5b5061014b61027436600461122b565b610595565b34801561028557600080fd5b5061016d610294366004611212565b6105b7565b3480156102a557600080fd5b5061014b6102b436600461122b565b6105ca565b3480156102c557600080fd5b5061016d6102d4366004611212565b61064d565b3480156102e557600080fd5b5061014b6102f4366004611212565b61065a565b34801561030557600080fd5b506101a46103143660046111a7565b6106fe565b34801561032557600080fd5b5061014b61033436600461129b565b61073d565b34801561034557600080fd5b506101a460008051602061184783398151915281565b34801561036757600080fd5b5061016d61037636600461122b565b61086c565b34801561038757600080fd5b506101a4600081565b34801561039c57600080fd5b506101a46103ab36600461134c565b610895565b3480156103bc57600080fd5b5061014b6103cb366004611212565b6108da565b3480156103dc57600080fd5b506101a46103eb366004611212565b61099e565b3480156103fc57600080fd5b5061014b61040b36600461122b565b6109b0565b61014b61041e36600461134c565b6109cd565b34801561042f57600080fd5b506002546101a4565b6000805160206118478339815191526104518133610af0565b60006104618989898989896106fe565b905061046d8184610b54565b6000816000805160206118878339815191528b8b8b8b8b8a6040516104979695949392919061141d565b60405180910390a3505050505050505050565b60006001600160e01b03198216637965db0b60e01b14806104db57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6000805160206118678339815191526104fb81600061086c565b610509576105098133610af0565b60006105198888888888886106fe565b90506105258185610c43565b6105348160008a8a8a8a610cd4565b61053d81610de8565b5050505050505050565b6000806105538361099e565b90506001811180156105655750428111155b9392505050565b60009081526020819052604090206001015490565b6000600161058e8361099e565b1492915050565b61059e8261056c565b6105a88133610af0565b6105b28383610e21565b505050565b6000806105c38361099e565b1192915050565b6001600160a01b038116331461063f5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6106498282610ea5565b5050565b600060016105c38361099e565b3330146106bd5760405162461bcd60e51b815260206004820152602b60248201527f54696d656c6f636b436f6e74726f6c6c65723a2063616c6c6572206d7573742060448201526a62652074696d656c6f636b60a81b6064820152608401610636565b60025460408051918252602082018390527f11c24f4ead16507c69ac467fbd5e4eed5fb5c699626d2cc6d66421df253886d5910160405180910390a1600255565b600086868686868660405160200161071b9695949392919061141d565b6040516020818303038152906040528051906020012090509695505050505050565b6000805160206118478339815191526107568133610af0565b8887146107755760405162461bcd60e51b81526004016106369061145a565b8885146107945760405162461bcd60e51b81526004016106369061145a565b60006107a68b8b8b8b8b8b8b8b610895565b90506107b28184610b54565b60005b8a81101561085e5780826000805160206118878339815191528e8e858181106107e0576107e061149d565b90506020020160208101906107f591906114b3565b8d8d868181106108075761080761149d565b905060200201358c8c878181106108205761082061149d565b905060200281019061083291906114ce565b8c8b6040516108469695949392919061141d565b60405180910390a36108578161152a565b90506107b5565b505050505050505050505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b600088888888888888886040516020016108b69897969594939291906115d9565b60405160208183030381529060405280519060200120905098975050505050505050565b6000805160206118478339815191526108f38133610af0565b6108fc8261064d565b6109625760405162461bcd60e51b815260206004820152603160248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e2063616044820152701b9b9bdd0818994818d85b98d95b1b1959607a1b6064820152608401610636565b6000828152600160205260408082208290555183917fbaa1eb22f2a492ba1a5fea61b8df4d27c6c8b5f3971e63bb58fa14ff72eedb7091a25050565b60009081526001602052604090205490565b6109b98261056c565b6109c38133610af0565b6105b28383610ea5565b6000805160206118678339815191526109e781600061086c565b6109f5576109f58133610af0565b878614610a145760405162461bcd60e51b81526004016106369061145a565b878414610a335760405162461bcd60e51b81526004016106369061145a565b6000610a458a8a8a8a8a8a8a8a610895565b9050610a518185610c43565b60005b89811015610ada57610aca82828d8d85818110610a7357610a7361149d565b9050602002016020810190610a8891906114b3565b8c8c86818110610a9a57610a9a61149d565b905060200201358b8b87818110610ab357610ab361149d565b9050602002810190610ac591906114ce565b610cd4565b610ad38161152a565b9050610a54565b50610ae481610de8565b50505050505050505050565b610afa828261086c565b61064957610b12816001600160a01b03166014610f0a565b610b1d836020610f0a565b604051602001610b2e9291906116b4565b60408051601f198184030181529082905262461bcd60e51b825261063691600401611723565b610b5d826105b7565b15610bc25760405162461bcd60e51b815260206004820152602f60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20616c60448201526e1c9958591e481cd8da19591d5b1959608a1b6064820152608401610636565b600254811015610c235760405162461bcd60e51b815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a20696e73756666696369656e746044820152652064656c617960d01b6064820152608401610636565b610c2d8142611756565b6000928352600160205260409092209190915550565b610c4c82610547565b610c685760405162461bcd60e51b81526004016106369061176e565b801580610c795750610c7981610581565b6106495760405162461bcd60e51b815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a206d697373696e6720646570656044820152656e64656e637960d01b6064820152608401610636565b6000846001600160a01b0316848484604051610cf19291906117b8565b60006040518083038185875af1925050503d8060008114610d2e576040519150601f19603f3d011682016040523d82523d6000602084013e610d33565b606091505b5050905080610da05760405162461bcd60e51b815260206004820152603360248201527f54696d656c6f636b436f6e74726f6c6c65723a20756e6465726c79696e6720746044820152721c985b9cd858dd1a5bdb881c995d995c9d1959606a1b6064820152608401610636565b85877fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b5887878787604051610dd794939291906117c8565b60405180910390a350505050505050565b610df181610547565b610e0d5760405162461bcd60e51b81526004016106369061176e565b600090815260016020819052604090912055565b610e2b828261086c565b610649576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610e613390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b610eaf828261086c565b15610649576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60606000610f198360026117fa565b610f24906002611756565b6001600160401b03811115610f3b57610f3b611819565b6040519080825280601f01601f191660200182016040528015610f65576020820181803683370190505b509050600360fc1b81600081518110610f8057610f8061149d565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110610faf57610faf61149d565b60200101906001600160f81b031916908160001a9053506000610fd38460026117fa565b610fde906001611756565b90505b6001811115611056576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106110125761101261149d565b1a60f81b8282815181106110285761102861149d565b60200101906001600160f81b031916908160001a90535060049490941c9361104f8161182f565b9050610fe1565b5083156105655760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610636565b80356001600160a01b03811681146110bc57600080fd5b919050565b60008083601f8401126110d357600080fd5b5081356001600160401b038111156110ea57600080fd5b60208301915083602082850101111561110257600080fd5b9250929050565b600080600080600080600060c0888a03121561112457600080fd5b61112d886110a5565b96506020880135955060408801356001600160401b0381111561114f57600080fd5b61115b8a828b016110c1565b989b979a50986060810135976080820135975060a09091013595509350505050565b60006020828403121561118f57600080fd5b81356001600160e01b03198116811461056557600080fd5b60008060008060008060a087890312156111c057600080fd5b6111c9876110a5565b95506020870135945060408701356001600160401b038111156111eb57600080fd5b6111f789828a016110c1565b979a9699509760608101359660809091013595509350505050565b60006020828403121561122457600080fd5b5035919050565b6000806040838503121561123e57600080fd5b8235915061124e602084016110a5565b90509250929050565b60008083601f84011261126957600080fd5b5081356001600160401b0381111561128057600080fd5b6020830191508360208260051b850101111561110257600080fd5b600080600080600080600080600060c08a8c0312156112b957600080fd5b89356001600160401b03808211156112d057600080fd5b6112dc8d838e01611257565b909b50995060208c01359150808211156112f557600080fd5b6113018d838e01611257565b909950975060408c013591508082111561131a57600080fd5b506113278c828d01611257565b9a9d999c50979a969997986060880135976080810135975060a0013595509350505050565b60008060008060008060008060a0898b03121561136857600080fd5b88356001600160401b038082111561137f57600080fd5b61138b8c838d01611257565b909a50985060208b01359150808211156113a457600080fd5b6113b08c838d01611257565b909850965060408b01359150808211156113c957600080fd5b506113d68b828c01611257565b999c989b509699959896976060870135966080013595509350505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60018060a01b038716815285602082015260a06040820152600061144560a0830186886113f4565b60608301949094525060800152949350505050565b60208082526023908201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d616040820152620e8c6d60eb1b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156114c557600080fd5b610565826110a5565b6000808335601e198436030181126114e557600080fd5b8301803591506001600160401b038211156114ff57600080fd5b60200191503681900382131561110257600080fd5b634e487b7160e01b600052601160045260246000fd5b600060001982141561153e5761153e611514565b5060010190565b60008383855260208086019550808560051b8301018460005b878110156115cc57848303601f19018952813536889003601e1901811261158457600080fd5b870180356001600160401b0381111561159c57600080fd5b8036038913156115ab57600080fd5b6115b885828885016113f4565b9a86019a945050509083019060010161155e565b5090979650505050505050565b60a0808252810188905260008960c08301825b8b81101561161a576001600160a01b03611605846110a5565b168252602092830192909101906001016115ec565b5083810360208501528881526001600160fb1b0389111561163a57600080fd5b8860051b9150818a60208301378181019150506020810160008152602084830301604085015261166b81888a611545565b6060850196909652505050608001529695505050505050565b60005b8381101561169f578181015183820152602001611687565b838111156116ae576000848401525b50505050565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8152600083516116e6816017850160208801611684565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351611717816028840160208801611684565b01602801949350505050565b6020815260008251806020840152611742816040850160208701611684565b601f01601f19169190910160400192915050565b6000821982111561176957611769611514565b500190565b6020808252602a908201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e206973604082015269206e6f7420726561647960b01b606082015260800190565b8183823760009101908152919050565b60018060a01b03851681528360208201526060604082015260006117f06060830184866113f4565b9695505050505050565b600081600019048311821515161561181457611814611514565b500290565b634e487b7160e01b600052604160045260246000fd5b60008161183e5761183e611514565b50600019019056feb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc1d8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e634cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dcaa26469706673582212202b42ead38295ff66035050c1591a3b27b3bdd5c052c9fa0645294c72e6e1961164736f6c63430008090033", + "devdoc": { + "details": "Contract module which acts as a timelocked controller. When set as the owner of an `Ownable` smart contract, it enforces a timelock on all `onlyOwner` maintenance operations. This gives time for users of the controlled contract to exit before a potentially dangerous maintenance operation is applied. By default, this contract is self administered, meaning administration tasks have to go through the timelock process. The proposer (resp executor) role is in charge of proposing (resp executing) operations. A common use case is to position this {TimelockController} as the owner of a smart contract, with a multisig or a DAO as the sole proposer. _Available since v3.3._", + "events": { + "CallExecuted(bytes32,uint256,address,uint256,bytes)": { + "details": "Emitted when a call is performed as part of operation `id`." + }, + "CallScheduled(bytes32,uint256,address,uint256,bytes,bytes32,uint256)": { + "details": "Emitted when a call is scheduled as part of operation `id`." + }, + "Cancelled(bytes32)": { + "details": "Emitted when operation `id` is cancelled." + }, + "MinDelayChange(uint256,uint256)": { + "details": "Emitted when the minimum delay for future operations is modified." + } + }, + "kind": "dev", + "methods": { + "cancel(bytes32)": { + "details": "Cancel an operation. Requirements: - the caller must have the 'proposer' role." + }, + "constructor": { + "details": "Initializes the contract with a given `minDelay`." + }, + "execute(address,uint256,bytes,bytes32,bytes32)": { + "details": "Execute an (ready) operation containing a single transaction. Emits a {CallExecuted} event. Requirements: - the caller must have the 'executor' role." + }, + "executeBatch(address[],uint256[],bytes[],bytes32,bytes32)": { + "details": "Execute an (ready) operation containing a batch of transactions. Emits one {CallExecuted} event per transaction in the batch. Requirements: - the caller must have the 'executor' role." + }, + "getMinDelay()": { + "details": "Returns the minimum delay for an operation to become valid. This value can be changed by executing an operation that calls `updateDelay`." + }, + "getRoleAdmin(bytes32)": { + "details": "Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}." + }, + "getTimestamp(bytes32)": { + "details": "Returns the timestamp at with an operation becomes ready (0 for unset operations, 1 for done operations)." + }, + "grantRole(bytes32,address)": { + "details": "Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role." + }, + "hasRole(bytes32,address)": { + "details": "Returns `true` if `account` has been granted `role`." + }, + "hashOperation(address,uint256,bytes,bytes32,bytes32)": { + "details": "Returns the identifier of an operation containing a single transaction." + }, + "hashOperationBatch(address[],uint256[],bytes[],bytes32,bytes32)": { + "details": "Returns the identifier of an operation containing a batch of transactions." + }, + "isOperation(bytes32)": { + "details": "Returns whether an id correspond to a registered operation. This includes both Pending, Ready and Done operations." + }, + "isOperationDone(bytes32)": { + "details": "Returns whether an operation is done or not." + }, + "isOperationPending(bytes32)": { + "details": "Returns whether an operation is pending or not." + }, + "isOperationReady(bytes32)": { + "details": "Returns whether an operation is ready or not." + }, + "renounceRole(bytes32,address)": { + "details": "Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`." + }, + "revokeRole(bytes32,address)": { + "details": "Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role." + }, + "schedule(address,uint256,bytes,bytes32,bytes32,uint256)": { + "details": "Schedule an operation containing a single transaction. Emits a {CallScheduled} event. Requirements: - the caller must have the 'proposer' role." + }, + "scheduleBatch(address[],uint256[],bytes[],bytes32,bytes32,uint256)": { + "details": "Schedule an operation containing a batch of transactions. Emits one {CallScheduled} event per transaction in the batch. Requirements: - the caller must have the 'proposer' role." + }, + "supportsInterface(bytes4)": { + "details": "See {IERC165-supportsInterface}." + }, + "updateDelay(uint256)": { + "details": "Changes the minimum timelock duration for future operations. Emits a {MinDelayChange} event. Requirements: - the caller must be the timelock itself. This can only be achieved by scheduling and later executing an operation where the timelock is the target and the data is the ABI-encoded call to this function." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 1124, + "contract": "@openzeppelin/contracts/governance/TimelockController.sol:TimelockController", + "label": "_roles", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_bytes32,t_struct(RoleData)1119_storage)" + }, + { + "astId": 2708, + "contract": "@openzeppelin/contracts/governance/TimelockController.sol:TimelockController", + "label": "_timestamps", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_bytes32,t_uint256)" + }, + { + "astId": 2710, + "contract": "@openzeppelin/contracts/governance/TimelockController.sol:TimelockController", + "label": "_minDelay", + "offset": 0, + "slot": "2", + "type": "t_uint256" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_bytes32,t_struct(RoleData)1119_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct AccessControl.RoleData)", + "numberOfBytes": "32", + "value": "t_struct(RoleData)1119_storage" + }, + "t_mapping(t_bytes32,t_uint256)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_struct(RoleData)1119_storage": { + "encoding": "inplace", + "label": "struct AccessControl.RoleData", + "members": [ + { + "astId": 1116, + "contract": "@openzeppelin/contracts/governance/TimelockController.sol:TimelockController", + "label": "members", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 1118, + "contract": "@openzeppelin/contracts/governance/TimelockController.sol:TimelockController", + "label": "adminRole", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/deployments/mainnet/VendingMachineKeep.json b/deployments/mainnet/VendingMachineKeep.json new file mode 100644 index 00000000..c9eed6d4 --- /dev/null +++ b/deployments/mainnet/VendingMachineKeep.json @@ -0,0 +1,400 @@ +{ + "address": "0xE47c80e8c23f6B4A1aE41c34837a0599D5D16bb0", + "abi": [ + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "_wrappedToken", + "type": "address" + }, + { + "internalType": "contract T", + "name": "_tToken", + "type": "address" + }, + { + "internalType": "uint96", + "name": "_wrappedTokenAllocation", + "type": "uint96" + }, + { + "internalType": "uint96", + "name": "_tTokenAllocation", + "type": "uint96" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tTokenAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "wrappedTokenAmount", + "type": "uint256" + } + ], + "name": "Unwrapped", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "wrappedTokenAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tTokenAmount", + "type": "uint256" + } + ], + "name": "Wrapped", + "type": "event" + }, + { + "inputs": [], + "name": "FLOATING_POINT_DIVISOR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "WRAPPED_TOKEN_CONVERSION_PRECISION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "conversionFromT", + "outputs": [ + { + "internalType": "uint256", + "name": "wrappedAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tRemainder", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "conversionToT", + "outputs": [ + { + "internalType": "uint256", + "name": "tAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "wrappedRemainder", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ratio", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "receiveApproval", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "tToken", + "outputs": [ + { + "internalType": "contract T", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "unwrap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "wrap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "wrappedBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "wrappedToken", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x53e880961e210ed0f124005cb314e624b5a951c599db9c153aeba2123dce94f5", + "receipt": { + "to": null, + "from": "0x123694886DBf5Ac94DDA07135349534536D14cAf", + "contractAddress": "0xE47c80e8c23f6B4A1aE41c34837a0599D5D16bb0", + "transactionIndex": 45, + "gasUsed": "805864", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x78101893fcad87bd948c9f6687bc9da5899360f4573075693567121ec749eb18", + "transactionHash": "0x53e880961e210ed0f124005cb314e624b5a951c599db9c153aeba2123dce94f5", + "logs": [], + "blockNumber": 13912439, + "cumulativeGasUsed": "2337985", + "status": 1, + "byzantium": true + }, + "args": [ + "0x85Eee30c52B0b379b046Fb0F85F4f3Dc3009aFEC", + "0xCdF7028ceAB81fA0C6971208e83fa7872994beE5", + "940795010800000000000000000", + "4500000000000000000000000000" + ], + "solcInputHash": "43eb8b17fe7c2ce0e21167459a2d9d30", + "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"_wrappedToken\",\"type\":\"address\"},{\"internalType\":\"contract T\",\"name\":\"_tToken\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"_wrappedTokenAllocation\",\"type\":\"uint96\"},{\"internalType\":\"uint96\",\"name\":\"_tTokenAllocation\",\"type\":\"uint96\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tTokenAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"wrappedTokenAmount\",\"type\":\"uint256\"}],\"name\":\"Unwrapped\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"wrappedTokenAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tTokenAmount\",\"type\":\"uint256\"}],\"name\":\"Wrapped\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"FLOATING_POINT_DIVISOR\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WRAPPED_TOKEN_CONVERSION_PRECISION\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"conversionFromT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"wrappedAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"tRemainder\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"conversionToT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"tAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"wrappedRemainder\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ratio\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"receiveApproval\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tToken\",\"outputs\":[{\"internalType\":\"contract T\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"unwrap\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"wrap\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"wrappedBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"wrappedToken\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Multiplications in this contract can't overflow uint256 as we restrict `_wrappedTokenAllocation` and `_tTokenAllocation` to 96 bits and FLOATING_POINT_DIVISOR fits in less than 60 bits.\",\"params\":{\"_tToken\":\"Address of T token\",\"_tTokenAllocation\":\"The allocation of T this instance of Vending Machine will receive\",\"_wrappedToken\":\"Address to ERC20 token that will be wrapped to T\",\"_wrappedTokenAllocation\":\"The total supply of the token that will be wrapped to T\"}},\"receiveApproval(address,uint256,address,bytes)\":{\"params\":{\"amount\":\"The amount of KEEP/NU to be wrapped\",\"from\":\"Caller's address, must be the same as `wrappedToken` field\",\"token\":\"Token's address, must be the same as `wrappedToken` field\"}},\"unwrap(uint256)\":{\"params\":{\"amount\":\"The amount of T to unwrap back to the collateral (KEEP/NU)\"}},\"wrap(uint256)\":{\"params\":{\"amount\":\"The amount of KEEP/NU to be wrapped\"}}},\"title\":\"T token vending machine\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"FLOATING_POINT_DIVISOR()\":{\"notice\":\"Divisor for precision purposes, used to represent fractions.\"},\"WRAPPED_TOKEN_CONVERSION_PRECISION()\":{\"notice\":\"Number of decimal places of precision in conversion to/from wrapped tokens (assuming typical ERC20 token with 18 decimals). This implies that amounts of wrapped tokens below this precision won't take part in the conversion. E.g., for a value of 3, then for a conversion of 1.123456789 wrapped tokens, only 1.123 is convertible (i.e., 3 decimal places), and 0.000456789 is left.\"},\"constructor\":{\"notice\":\"Sets the reference to `wrappedToken` and `tToken`. Initializes conversion `ratio` between wrapped token and T based on the provided `_tTokenAllocation` and `_wrappedTokenAllocation`.\"},\"conversionFromT(uint256)\":{\"notice\":\"The amount of wrapped tokens (KEEP/NU) that's obtained from `amount` T tokens, and the remainder that can't be downgraded.\"},\"conversionToT(uint256)\":{\"notice\":\"Returns the T token amount that's obtained from `amount` wrapped tokens (KEEP/NU), and the remainder that can't be upgraded.\"},\"ratio()\":{\"notice\":\"The ratio with which T token is converted based on the provided token being wrapped (KEEP/NU), expressed in 1e18 precision. When wrapping: x [T] = amount [KEEP/NU] * ratio / FLOATING_POINT_DIVISOR When unwrapping: x [KEEP/NU] = amount [T] * FLOATING_POINT_DIVISOR / ratio\"},\"receiveApproval(address,uint256,address,bytes)\":{\"notice\":\"Wraps up to the given amount of the token (KEEP/NU) and releases T token proportionally to the amount being wrapped with respect to the wrap ratio. This is a shortcut to `wrap` function that avoids a separate approval transaction. Only KEEP/NU token is allowed as a caller, so please call this function via token's `approveAndCall`.\"},\"tToken()\":{\"notice\":\"T token contract.\"},\"unwrap(uint256)\":{\"notice\":\"Unwraps up to the given `amount` of T back to the legacy token (KEEP/NU) according to the wrap ratio. It can only be called by a token holder who previously wrapped their tokens in this vending machine contract. The token holder can't unwrap more tokens than they originally wrapped. The token holder needs to have at least the given amount of T tokens approved to transfer to the Vending Machine before calling this function.\"},\"wrap(uint256)\":{\"notice\":\"Wraps up to the the given `amount` of the token (KEEP/NU) and releases T token proportionally to the amount being wrapped with respect to the wrap ratio. The token holder needs to have at least the given amount of the wrapped token (KEEP/NU) approved to transfer to the Vending Machine before calling this function.\"},\"wrappedBalance(address)\":{\"notice\":\"The total balance of wrapped tokens for the given holder account. Only holders that have previously wrapped KEEP/NU to T can unwrap, up to the amount previously wrapped.\"},\"wrappedToken()\":{\"notice\":\"The token being wrapped to T (KEEP/NU).\"}},\"notice\":\"Contract implements a special update protocol to enable KEEP/NU token holders to wrap their tokens and obtain T tokens according to a fixed ratio. This will go on indefinitely and enable NU and KEEP token holders to join T network without needing to buy or sell any assets. Logistically, anyone holding NU or KEEP can wrap those assets in order to upgrade to T. They can also unwrap T in order to downgrade back to the underlying asset. There is a separate instance of this contract deployed for KEEP holders and a separate instance of this contract deployed for NU holders.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/vending/VendingMachine.sol\":\"VendingMachine\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.0 (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev 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\":\"0xa1b27b3f44ff825974e5268e8f63ad3b03add5b464880d860fbb8cae043e17f7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.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 `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, 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 `sender` to `recipient` 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 sender,\\n address recipient,\\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\":\"0xc1452b054778f1926419196ef12ae200758a4ee728df69ae1cd13e5c16ca7df7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.0 (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\":\"0x842c66d5965ed0bf77f274732c2a93a7e2223d53171ec9cccc473bde75104ead\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.0 (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\":\"0x671741933530f343f023a40e58e61bc09d62494b96c6f3e39e647f315facd519\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.0 (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, 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\":\"0x872ba21af7c1f0ae04a715beca31e8fcac764d6c8762940b0fe1bfb6ed8e86f4\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.0 (utils/Address.sol)\\n\\npragma solidity ^0.8.0;\\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 function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n assembly {\\n size := extcodesize(account)\\n }\\n return size > 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\":\"0x9944d1038f27dcebff810d7ba16b3b8058b967173d76874fb72dd7cd84129656\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.0 (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\":\"0x7736c187e6f1358c1ea9350a2a21aa8528dec1c2f43b374a9067465a3a51f5d3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.0 (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n}\\n\",\"keccak256\":\"0x5fa25f305839292fab713256214f2868e0257d29826b14282bbd7f1e34f5af38\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.0 (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n } else if (error == RecoverError.InvalidSignatureV) {\\n revert(\\\"ECDSA: invalid signature 'v' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n // Check the signature length\\n // - case 65: r,s,v signature (standard)\\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else if (signature.length == 64) {\\n bytes32 r;\\n bytes32 vs;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n assembly {\\n r := mload(add(signature, 0x20))\\n vs := mload(add(signature, 0x40))\\n }\\n return tryRecover(hash, r, vs);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s;\\n uint8 v;\\n assembly {\\n s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)\\n v := add(shr(255, vs), 27)\\n }\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n if (v != 27 && v != 28) {\\n return (address(0), RecoverError.InvalidSignatureV);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0x594efd2fa154f4fbe0fa92c2356cb2a9531ef3902e35784c2bc69764d0d8886a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.0 (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\":\"0x6aa521718bf139b44ce56f194f6aea1d590cacef995b5a84703fb1579fa49be9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.0 (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n /**\\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\":\"0xe936fc79332de2ca7b1c06a70f81345aa2466958aab00f463e312ca0585e85cf\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.0 (utils/math/SafeCast.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\\n * checks.\\n *\\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\\n * easily result in undesired exploitation or bugs, since developers usually\\n * assume that overflows raise errors. `SafeCast` restores this intuition by\\n * reverting the transaction when such an operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n *\\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\\n * all math on `uint256` and `int256` and then downcasting.\\n */\\nlibrary 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\":\"0x47c0131bd8a972c31596958aa86752ea18d60e33f1cd94d412b9e29fd6ab25a6\",\"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/utils/cryptography/ECDSA.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/math/Math.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/math/SafeCast.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.\\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 /// @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 SafeCast.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 SafeCast.toUint96(newWeight)\\n );\\n return (oldWeight, newWeight);\\n }\\n }\\n\\n ckpts.push(\\n encodeCheckpoint(\\n SafeCast.toUint32(block.number),\\n SafeCast.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 = Math.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\":\"0x25f420d34548648aa59703bccdad450815da5c9e18adf575845a659f0945d131\",\"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/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/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}", + "bytecode": "0x60e06040523480156200001157600080fd5b5060405162001097380380620010978339810160408190526200003491620000cc565b6001600160a01b03808516608052831660a0526001600160601b03808316908216620000636003601262000144565b6200007090600a6200025d565b6200007c919062000272565b62000088919062000294565b60c05250620002b792505050565b6001600160a01b0381168114620000ac57600080fd5b50565b80516001600160601b0381168114620000c757600080fd5b919050565b60008060008060808587031215620000e357600080fd5b8451620000f08162000096565b6020860151909450620001038162000096565b92506200011360408601620000af565b91506200012360608601620000af565b905092959194509250565b634e487b7160e01b600052601160045260246000fd5b6000828210156200015957620001596200012e565b500390565b600181815b808511156200019f5781600019048211156200018357620001836200012e565b808516156200019157918102915b93841c939080029062000163565b509250929050565b600082620001b85750600162000257565b81620001c75750600062000257565b8160018114620001e05760028114620001eb576200020b565b600191505062000257565b60ff841115620001ff57620001ff6200012e565b50506001821b62000257565b5060208310610133831016604e8410600b841016171562000230575081810a62000257565b6200023c83836200015e565b80600019048211156200025357620002536200012e565b0290505b92915050565b60006200026b8383620001a7565b9392505050565b60008160001904831182151516156200028f576200028f6200012e565b500290565b600082620002b257634e487b7160e01b600052601260045260246000fd5b500490565b60805160a05160c051610d72620003256000396000818160f601528181610244015281816103b601526103ed0152600081816101910152818161053101526106960152600081816101520152818161029701528181610326015281816104fc01526106cb0152610d726000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c8063996c6cc311610071578063996c6cc31461014d578063c35d64ea1461018c578063cff0eac5146101b3578063de0e9a3e146101c6578063ea598cb0146101d9578063f4fc2f47146101ec57600080fd5b80631c060cbe146100ae57806351b83ebc146100db57806371ca337d146100f15780637a93f256146101185780638f4ffcb114610138575b600080fd5b6100c16100bc3660046109de565b6101f4565b604080519283526020830191909152015b60405180910390f35b6100e361027b565b6040519081526020016100d2565b6100e37f000000000000000000000000000000000000000000000000000000000000000081565b6100e3610126366004610a13565b60006020819052908152604090205481565b61014b610146366004610a2e565b610295565b005b6101747f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100d2565b6101747f000000000000000000000000000000000000000000000000000000000000000081565b6100c16101c13660046109de565b6103ae565b61014b6101d43660046109de565b61042d565b61014b6101e73660046109de565b61043a565b6100e3600381565b60008061020360036012610adf565b61020e90600a610bdc565b6102189084610bfe565b905060006102268285610adf565b905061023460036012610adf565b61023f90600a610bdc565b6102697f000000000000000000000000000000000000000000000000000000000000000083610c12565b6102739190610c31565b925050915091565b61028760036012610adf565b61029290600a610bdc565b81565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b03161461031b5760405162461bcd60e51b815260206004820152601e60248201527f546f6b656e206973206e6f7420746865207772617070656420746f6b656e000060448201526064015b60405180910390fd5b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461039d5760405162461bcd60e51b815260206004820152602160248201527f4f6e6c79207772617070656420746f6b656e2063616c6c657220616c6c6f77656044820152601960fa1b6064820152608401610312565b6103a78585610440565b5050505050565b6000806103db7f000000000000000000000000000000000000000000000000000000000000000084610bfe565b905060006103e98285610adf565b90507f000000000000000000000000000000000000000000000000000000000000000061041860036012610adf565b61042390600a610bdc565b6102699083610c12565b610437338261055e565b50565b61043733825b60008061044c836101f4565b909250905061045b8184610adf565b92506000831161047d5760405162461bcd60e51b815260040161031290610c45565b60408051848152602081018490526001600160a01b038616917f727200b48f3c812bfb404b578574e1c03694edb122d80fa6dcb352a9e4f8a938910160405180910390a26001600160a01b038416600090815260208190526040812080548592906104e9908490610c87565b9091555061052490506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168530866106f2565b6105586001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016858461075d565b50505050565b60008061056a836103ae565b90925090506105798184610adf565b92506000831161059b5760405162461bcd60e51b815260040161031290610c45565b6001600160a01b0384166000908152602081905260409020548211156106175760405162461bcd60e51b815260206004820152602b60248201527f43616e206e6f7420756e77726170206d6f7265207468616e2070726576696f7560448201526a1cdb1e481ddc985c1c195960aa1b6064820152608401610312565b60408051848152602081018490526001600160a01b038616917ff64ae1cc3e0e07da9c895b3225439175cab5838aca24c4e74852704858c96a7b910160405180910390a26001600160a01b03841660009081526020819052604081208054849290610683908490610adf565b909155506106be90506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168530866106f2565b6105586001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016858461075d565b6040516001600160a01b03808516602483015283166044820152606481018290526105589085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610792565b6040516001600160a01b03831660248201526044810182905261078d90849063a9059cbb60e01b90606401610726565b505050565b60006107e7826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166108649092919063ffffffff16565b80519091501561078d57808060200190518101906108059190610c9f565b61078d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610312565b6060610873848460008561087d565b90505b9392505050565b6060824710156108de5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610312565b843b61092c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610312565b600080866001600160a01b031685876040516109489190610ced565b60006040518083038185875af1925050503d8060008114610985576040519150601f19603f3d011682016040523d82523d6000602084013e61098a565b606091505b509150915061099a8282866109a5565b979650505050505050565b606083156109b4575081610876565b8251156109c45782518084602001fd5b8160405162461bcd60e51b81526004016103129190610d09565b6000602082840312156109f057600080fd5b5035919050565b80356001600160a01b0381168114610a0e57600080fd5b919050565b600060208284031215610a2557600080fd5b610876826109f7565b600080600080600060808688031215610a4657600080fd5b610a4f866109f7565b945060208601359350610a64604087016109f7565b9250606086013567ffffffffffffffff80821115610a8157600080fd5b818801915088601f830112610a9557600080fd5b813581811115610aa457600080fd5b896020828501011115610ab657600080fd5b9699959850939650602001949392505050565b634e487b7160e01b600052601160045260246000fd5b600082821015610af157610af1610ac9565b500390565b600181815b80851115610b31578160001904821115610b1757610b17610ac9565b80851615610b2457918102915b93841c9390800290610afb565b509250929050565b600082610b4857506001610bd6565b81610b5557506000610bd6565b8160018114610b6b5760028114610b7557610b91565b6001915050610bd6565b60ff841115610b8657610b86610ac9565b50506001821b610bd6565b5060208310610133831016604e8410600b8410161715610bb4575081810a610bd6565b610bbe8383610af6565b8060001904821115610bd257610bd2610ac9565b0290505b92915050565b60006108768383610b39565b634e487b7160e01b600052601260045260246000fd5b600082610c0d57610c0d610be8565b500690565b6000816000190483118215151615610c2c57610c2c610ac9565b500290565b600082610c4057610c40610be8565b500490565b60208082526022908201527f446973616c6c6f7720636f6e76657273696f6e73206f66207a65726f2076616c604082015261756560f01b606082015260800190565b60008219821115610c9a57610c9a610ac9565b500190565b600060208284031215610cb157600080fd5b8151801515811461087657600080fd5b60005b83811015610cdc578181015183820152602001610cc4565b838111156105585750506000910152565b60008251610cff818460208701610cc1565b9190910192915050565b6020815260008251806020840152610d28816040850160208701610cc1565b601f01601f1916919091016040019291505056fea264697066735822122067d5c8bd0f1249a48948d1f378dbf5ab4ff1b77bc5d7fc1dca574055bd5d487264736f6c63430008090033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100a95760003560e01c8063996c6cc311610071578063996c6cc31461014d578063c35d64ea1461018c578063cff0eac5146101b3578063de0e9a3e146101c6578063ea598cb0146101d9578063f4fc2f47146101ec57600080fd5b80631c060cbe146100ae57806351b83ebc146100db57806371ca337d146100f15780637a93f256146101185780638f4ffcb114610138575b600080fd5b6100c16100bc3660046109de565b6101f4565b604080519283526020830191909152015b60405180910390f35b6100e361027b565b6040519081526020016100d2565b6100e37f000000000000000000000000000000000000000000000000000000000000000081565b6100e3610126366004610a13565b60006020819052908152604090205481565b61014b610146366004610a2e565b610295565b005b6101747f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100d2565b6101747f000000000000000000000000000000000000000000000000000000000000000081565b6100c16101c13660046109de565b6103ae565b61014b6101d43660046109de565b61042d565b61014b6101e73660046109de565b61043a565b6100e3600381565b60008061020360036012610adf565b61020e90600a610bdc565b6102189084610bfe565b905060006102268285610adf565b905061023460036012610adf565b61023f90600a610bdc565b6102697f000000000000000000000000000000000000000000000000000000000000000083610c12565b6102739190610c31565b925050915091565b61028760036012610adf565b61029290600a610bdc565b81565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b03161461031b5760405162461bcd60e51b815260206004820152601e60248201527f546f6b656e206973206e6f7420746865207772617070656420746f6b656e000060448201526064015b60405180910390fd5b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461039d5760405162461bcd60e51b815260206004820152602160248201527f4f6e6c79207772617070656420746f6b656e2063616c6c657220616c6c6f77656044820152601960fa1b6064820152608401610312565b6103a78585610440565b5050505050565b6000806103db7f000000000000000000000000000000000000000000000000000000000000000084610bfe565b905060006103e98285610adf565b90507f000000000000000000000000000000000000000000000000000000000000000061041860036012610adf565b61042390600a610bdc565b6102699083610c12565b610437338261055e565b50565b61043733825b60008061044c836101f4565b909250905061045b8184610adf565b92506000831161047d5760405162461bcd60e51b815260040161031290610c45565b60408051848152602081018490526001600160a01b038616917f727200b48f3c812bfb404b578574e1c03694edb122d80fa6dcb352a9e4f8a938910160405180910390a26001600160a01b038416600090815260208190526040812080548592906104e9908490610c87565b9091555061052490506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168530866106f2565b6105586001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016858461075d565b50505050565b60008061056a836103ae565b90925090506105798184610adf565b92506000831161059b5760405162461bcd60e51b815260040161031290610c45565b6001600160a01b0384166000908152602081905260409020548211156106175760405162461bcd60e51b815260206004820152602b60248201527f43616e206e6f7420756e77726170206d6f7265207468616e2070726576696f7560448201526a1cdb1e481ddc985c1c195960aa1b6064820152608401610312565b60408051848152602081018490526001600160a01b038616917ff64ae1cc3e0e07da9c895b3225439175cab5838aca24c4e74852704858c96a7b910160405180910390a26001600160a01b03841660009081526020819052604081208054849290610683908490610adf565b909155506106be90506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168530866106f2565b6105586001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016858461075d565b6040516001600160a01b03808516602483015283166044820152606481018290526105589085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610792565b6040516001600160a01b03831660248201526044810182905261078d90849063a9059cbb60e01b90606401610726565b505050565b60006107e7826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166108649092919063ffffffff16565b80519091501561078d57808060200190518101906108059190610c9f565b61078d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610312565b6060610873848460008561087d565b90505b9392505050565b6060824710156108de5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610312565b843b61092c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610312565b600080866001600160a01b031685876040516109489190610ced565b60006040518083038185875af1925050503d8060008114610985576040519150601f19603f3d011682016040523d82523d6000602084013e61098a565b606091505b509150915061099a8282866109a5565b979650505050505050565b606083156109b4575081610876565b8251156109c45782518084602001fd5b8160405162461bcd60e51b81526004016103129190610d09565b6000602082840312156109f057600080fd5b5035919050565b80356001600160a01b0381168114610a0e57600080fd5b919050565b600060208284031215610a2557600080fd5b610876826109f7565b600080600080600060808688031215610a4657600080fd5b610a4f866109f7565b945060208601359350610a64604087016109f7565b9250606086013567ffffffffffffffff80821115610a8157600080fd5b818801915088601f830112610a9557600080fd5b813581811115610aa457600080fd5b896020828501011115610ab657600080fd5b9699959850939650602001949392505050565b634e487b7160e01b600052601160045260246000fd5b600082821015610af157610af1610ac9565b500390565b600181815b80851115610b31578160001904821115610b1757610b17610ac9565b80851615610b2457918102915b93841c9390800290610afb565b509250929050565b600082610b4857506001610bd6565b81610b5557506000610bd6565b8160018114610b6b5760028114610b7557610b91565b6001915050610bd6565b60ff841115610b8657610b86610ac9565b50506001821b610bd6565b5060208310610133831016604e8410600b8410161715610bb4575081810a610bd6565b610bbe8383610af6565b8060001904821115610bd257610bd2610ac9565b0290505b92915050565b60006108768383610b39565b634e487b7160e01b600052601260045260246000fd5b600082610c0d57610c0d610be8565b500690565b6000816000190483118215151615610c2c57610c2c610ac9565b500290565b600082610c4057610c40610be8565b500490565b60208082526022908201527f446973616c6c6f7720636f6e76657273696f6e73206f66207a65726f2076616c604082015261756560f01b606082015260800190565b60008219821115610c9a57610c9a610ac9565b500190565b600060208284031215610cb157600080fd5b8151801515811461087657600080fd5b60005b83811015610cdc578181015183820152602001610cc4565b838111156105585750506000910152565b60008251610cff818460208701610cc1565b9190910192915050565b6020815260008251806020840152610d28816040850160208701610cc1565b601f01601f1916919091016040019291505056fea264697066735822122067d5c8bd0f1249a48948d1f378dbf5ab4ff1b77bc5d7fc1dca574055bd5d487264736f6c63430008090033", + "devdoc": { + "kind": "dev", + "methods": { + "constructor": { + "details": "Multiplications in this contract can't overflow uint256 as we restrict `_wrappedTokenAllocation` and `_tTokenAllocation` to 96 bits and FLOATING_POINT_DIVISOR fits in less than 60 bits.", + "params": { + "_tToken": "Address of T token", + "_tTokenAllocation": "The allocation of T this instance of Vending Machine will receive", + "_wrappedToken": "Address to ERC20 token that will be wrapped to T", + "_wrappedTokenAllocation": "The total supply of the token that will be wrapped to T" + } + }, + "receiveApproval(address,uint256,address,bytes)": { + "params": { + "amount": "The amount of KEEP/NU to be wrapped", + "from": "Caller's address, must be the same as `wrappedToken` field", + "token": "Token's address, must be the same as `wrappedToken` field" + } + }, + "unwrap(uint256)": { + "params": { + "amount": "The amount of T to unwrap back to the collateral (KEEP/NU)" + } + }, + "wrap(uint256)": { + "params": { + "amount": "The amount of KEEP/NU to be wrapped" + } + } + }, + "title": "T token vending machine", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "FLOATING_POINT_DIVISOR()": { + "notice": "Divisor for precision purposes, used to represent fractions." + }, + "WRAPPED_TOKEN_CONVERSION_PRECISION()": { + "notice": "Number of decimal places of precision in conversion to/from wrapped tokens (assuming typical ERC20 token with 18 decimals). This implies that amounts of wrapped tokens below this precision won't take part in the conversion. E.g., for a value of 3, then for a conversion of 1.123456789 wrapped tokens, only 1.123 is convertible (i.e., 3 decimal places), and 0.000456789 is left." + }, + "constructor": { + "notice": "Sets the reference to `wrappedToken` and `tToken`. Initializes conversion `ratio` between wrapped token and T based on the provided `_tTokenAllocation` and `_wrappedTokenAllocation`." + }, + "conversionFromT(uint256)": { + "notice": "The amount of wrapped tokens (KEEP/NU) that's obtained from `amount` T tokens, and the remainder that can't be downgraded." + }, + "conversionToT(uint256)": { + "notice": "Returns the T token amount that's obtained from `amount` wrapped tokens (KEEP/NU), and the remainder that can't be upgraded." + }, + "ratio()": { + "notice": "The ratio with which T token is converted based on the provided token being wrapped (KEEP/NU), expressed in 1e18 precision. When wrapping: x [T] = amount [KEEP/NU] * ratio / FLOATING_POINT_DIVISOR When unwrapping: x [KEEP/NU] = amount [T] * FLOATING_POINT_DIVISOR / ratio" + }, + "receiveApproval(address,uint256,address,bytes)": { + "notice": "Wraps up to the given amount of the token (KEEP/NU) and releases T token proportionally to the amount being wrapped with respect to the wrap ratio. This is a shortcut to `wrap` function that avoids a separate approval transaction. Only KEEP/NU token is allowed as a caller, so please call this function via token's `approveAndCall`." + }, + "tToken()": { + "notice": "T token contract." + }, + "unwrap(uint256)": { + "notice": "Unwraps up to the given `amount` of T back to the legacy token (KEEP/NU) according to the wrap ratio. It can only be called by a token holder who previously wrapped their tokens in this vending machine contract. The token holder can't unwrap more tokens than they originally wrapped. The token holder needs to have at least the given amount of T tokens approved to transfer to the Vending Machine before calling this function." + }, + "wrap(uint256)": { + "notice": "Wraps up to the the given `amount` of the token (KEEP/NU) and releases T token proportionally to the amount being wrapped with respect to the wrap ratio. The token holder needs to have at least the given amount of the wrapped token (KEEP/NU) approved to transfer to the Vending Machine before calling this function." + }, + "wrappedBalance(address)": { + "notice": "The total balance of wrapped tokens for the given holder account. Only holders that have previously wrapped KEEP/NU to T can unwrap, up to the amount previously wrapped." + }, + "wrappedToken()": { + "notice": "The token being wrapped to T (KEEP/NU)." + } + }, + "notice": "Contract implements a special update protocol to enable KEEP/NU token holders to wrap their tokens and obtain T tokens according to a fixed ratio. This will go on indefinitely and enable NU and KEEP token holders to join T network without needing to buy or sell any assets. Logistically, anyone holding NU or KEEP can wrap those assets in order to upgrade to T. They can also unwrap T in order to downgrade back to the underlying asset. There is a separate instance of this contract deployed for KEEP holders and a separate instance of this contract deployed for NU holders.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 15943, + "contract": "contracts/vending/VendingMachine.sol:VendingMachine", + "label": "wrappedBalance", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_address,t_uint256)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/deployments/mainnet/VendingMachineNuCypher.json b/deployments/mainnet/VendingMachineNuCypher.json new file mode 100644 index 00000000..f5877aae --- /dev/null +++ b/deployments/mainnet/VendingMachineNuCypher.json @@ -0,0 +1,400 @@ +{ + "address": "0x1CCA7E410eE41739792eA0A24e00349Dd247680e", + "abi": [ + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "_wrappedToken", + "type": "address" + }, + { + "internalType": "contract T", + "name": "_tToken", + "type": "address" + }, + { + "internalType": "uint96", + "name": "_wrappedTokenAllocation", + "type": "uint96" + }, + { + "internalType": "uint96", + "name": "_tTokenAllocation", + "type": "uint96" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tTokenAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "wrappedTokenAmount", + "type": "uint256" + } + ], + "name": "Unwrapped", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "wrappedTokenAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tTokenAmount", + "type": "uint256" + } + ], + "name": "Wrapped", + "type": "event" + }, + { + "inputs": [], + "name": "FLOATING_POINT_DIVISOR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "WRAPPED_TOKEN_CONVERSION_PRECISION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "conversionFromT", + "outputs": [ + { + "internalType": "uint256", + "name": "wrappedAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tRemainder", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "conversionToT", + "outputs": [ + { + "internalType": "uint256", + "name": "tAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "wrappedRemainder", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ratio", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "receiveApproval", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "tToken", + "outputs": [ + { + "internalType": "contract T", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "unwrap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "wrap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "wrappedBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "wrappedToken", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x448ce43a7b3b1bdae0abfc60f7325e41a456fd47b3eecd66c873ab92baf14b31", + "receipt": { + "to": null, + "from": "0x123694886DBf5Ac94DDA07135349534536D14cAf", + "contractAddress": "0x1CCA7E410eE41739792eA0A24e00349Dd247680e", + "transactionIndex": 379, + "gasUsed": "805876", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x34c821a1f3e32b5dddadf288f889e5fff6e0f234f3016039c0d89fe0e4c2b79c", + "transactionHash": "0x448ce43a7b3b1bdae0abfc60f7325e41a456fd47b3eecd66c873ab92baf14b31", + "logs": [], + "blockNumber": 13912444, + "cumulativeGasUsed": "19113186", + "status": 1, + "byzantium": true + }, + "args": [ + "0x4fE83213D56308330EC302a8BD641f1d0113A4Cc", + "0xCdF7028ceAB81fA0C6971208e83fa7872994beE5", + "1380688920644254727736959922", + "4500000000000000000000000000" + ], + "solcInputHash": "43eb8b17fe7c2ce0e21167459a2d9d30", + "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"_wrappedToken\",\"type\":\"address\"},{\"internalType\":\"contract T\",\"name\":\"_tToken\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"_wrappedTokenAllocation\",\"type\":\"uint96\"},{\"internalType\":\"uint96\",\"name\":\"_tTokenAllocation\",\"type\":\"uint96\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tTokenAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"wrappedTokenAmount\",\"type\":\"uint256\"}],\"name\":\"Unwrapped\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"wrappedTokenAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tTokenAmount\",\"type\":\"uint256\"}],\"name\":\"Wrapped\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"FLOATING_POINT_DIVISOR\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WRAPPED_TOKEN_CONVERSION_PRECISION\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"conversionFromT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"wrappedAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"tRemainder\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"conversionToT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"tAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"wrappedRemainder\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ratio\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"receiveApproval\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tToken\",\"outputs\":[{\"internalType\":\"contract T\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"unwrap\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"wrap\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"wrappedBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"wrappedToken\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Multiplications in this contract can't overflow uint256 as we restrict `_wrappedTokenAllocation` and `_tTokenAllocation` to 96 bits and FLOATING_POINT_DIVISOR fits in less than 60 bits.\",\"params\":{\"_tToken\":\"Address of T token\",\"_tTokenAllocation\":\"The allocation of T this instance of Vending Machine will receive\",\"_wrappedToken\":\"Address to ERC20 token that will be wrapped to T\",\"_wrappedTokenAllocation\":\"The total supply of the token that will be wrapped to T\"}},\"receiveApproval(address,uint256,address,bytes)\":{\"params\":{\"amount\":\"The amount of KEEP/NU to be wrapped\",\"from\":\"Caller's address, must be the same as `wrappedToken` field\",\"token\":\"Token's address, must be the same as `wrappedToken` field\"}},\"unwrap(uint256)\":{\"params\":{\"amount\":\"The amount of T to unwrap back to the collateral (KEEP/NU)\"}},\"wrap(uint256)\":{\"params\":{\"amount\":\"The amount of KEEP/NU to be wrapped\"}}},\"title\":\"T token vending machine\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"FLOATING_POINT_DIVISOR()\":{\"notice\":\"Divisor for precision purposes, used to represent fractions.\"},\"WRAPPED_TOKEN_CONVERSION_PRECISION()\":{\"notice\":\"Number of decimal places of precision in conversion to/from wrapped tokens (assuming typical ERC20 token with 18 decimals). This implies that amounts of wrapped tokens below this precision won't take part in the conversion. E.g., for a value of 3, then for a conversion of 1.123456789 wrapped tokens, only 1.123 is convertible (i.e., 3 decimal places), and 0.000456789 is left.\"},\"constructor\":{\"notice\":\"Sets the reference to `wrappedToken` and `tToken`. Initializes conversion `ratio` between wrapped token and T based on the provided `_tTokenAllocation` and `_wrappedTokenAllocation`.\"},\"conversionFromT(uint256)\":{\"notice\":\"The amount of wrapped tokens (KEEP/NU) that's obtained from `amount` T tokens, and the remainder that can't be downgraded.\"},\"conversionToT(uint256)\":{\"notice\":\"Returns the T token amount that's obtained from `amount` wrapped tokens (KEEP/NU), and the remainder that can't be upgraded.\"},\"ratio()\":{\"notice\":\"The ratio with which T token is converted based on the provided token being wrapped (KEEP/NU), expressed in 1e18 precision. When wrapping: x [T] = amount [KEEP/NU] * ratio / FLOATING_POINT_DIVISOR When unwrapping: x [KEEP/NU] = amount [T] * FLOATING_POINT_DIVISOR / ratio\"},\"receiveApproval(address,uint256,address,bytes)\":{\"notice\":\"Wraps up to the given amount of the token (KEEP/NU) and releases T token proportionally to the amount being wrapped with respect to the wrap ratio. This is a shortcut to `wrap` function that avoids a separate approval transaction. Only KEEP/NU token is allowed as a caller, so please call this function via token's `approveAndCall`.\"},\"tToken()\":{\"notice\":\"T token contract.\"},\"unwrap(uint256)\":{\"notice\":\"Unwraps up to the given `amount` of T back to the legacy token (KEEP/NU) according to the wrap ratio. It can only be called by a token holder who previously wrapped their tokens in this vending machine contract. The token holder can't unwrap more tokens than they originally wrapped. The token holder needs to have at least the given amount of T tokens approved to transfer to the Vending Machine before calling this function.\"},\"wrap(uint256)\":{\"notice\":\"Wraps up to the the given `amount` of the token (KEEP/NU) and releases T token proportionally to the amount being wrapped with respect to the wrap ratio. The token holder needs to have at least the given amount of the wrapped token (KEEP/NU) approved to transfer to the Vending Machine before calling this function.\"},\"wrappedBalance(address)\":{\"notice\":\"The total balance of wrapped tokens for the given holder account. Only holders that have previously wrapped KEEP/NU to T can unwrap, up to the amount previously wrapped.\"},\"wrappedToken()\":{\"notice\":\"The token being wrapped to T (KEEP/NU).\"}},\"notice\":\"Contract implements a special update protocol to enable KEEP/NU token holders to wrap their tokens and obtain T tokens according to a fixed ratio. This will go on indefinitely and enable NU and KEEP token holders to join T network without needing to buy or sell any assets. Logistically, anyone holding NU or KEEP can wrap those assets in order to upgrade to T. They can also unwrap T in order to downgrade back to the underlying asset. There is a separate instance of this contract deployed for KEEP holders and a separate instance of this contract deployed for NU holders.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/vending/VendingMachine.sol\":\"VendingMachine\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.0 (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev 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\":\"0xa1b27b3f44ff825974e5268e8f63ad3b03add5b464880d860fbb8cae043e17f7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.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 `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, 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 `sender` to `recipient` 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 sender,\\n address recipient,\\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\":\"0xc1452b054778f1926419196ef12ae200758a4ee728df69ae1cd13e5c16ca7df7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.0 (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\":\"0x842c66d5965ed0bf77f274732c2a93a7e2223d53171ec9cccc473bde75104ead\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.0 (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\":\"0x671741933530f343f023a40e58e61bc09d62494b96c6f3e39e647f315facd519\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.0 (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, 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\":\"0x872ba21af7c1f0ae04a715beca31e8fcac764d6c8762940b0fe1bfb6ed8e86f4\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.0 (utils/Address.sol)\\n\\npragma solidity ^0.8.0;\\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 function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n assembly {\\n size := extcodesize(account)\\n }\\n return size > 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\":\"0x9944d1038f27dcebff810d7ba16b3b8058b967173d76874fb72dd7cd84129656\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.0 (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\":\"0x7736c187e6f1358c1ea9350a2a21aa8528dec1c2f43b374a9067465a3a51f5d3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.0 (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n}\\n\",\"keccak256\":\"0x5fa25f305839292fab713256214f2868e0257d29826b14282bbd7f1e34f5af38\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.0 (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n } else if (error == RecoverError.InvalidSignatureV) {\\n revert(\\\"ECDSA: invalid signature 'v' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n // Check the signature length\\n // - case 65: r,s,v signature (standard)\\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else if (signature.length == 64) {\\n bytes32 r;\\n bytes32 vs;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n assembly {\\n r := mload(add(signature, 0x20))\\n vs := mload(add(signature, 0x40))\\n }\\n return tryRecover(hash, r, vs);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s;\\n uint8 v;\\n assembly {\\n s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)\\n v := add(shr(255, vs), 27)\\n }\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n if (v != 27 && v != 28) {\\n return (address(0), RecoverError.InvalidSignatureV);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0x594efd2fa154f4fbe0fa92c2356cb2a9531ef3902e35784c2bc69764d0d8886a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.0 (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\":\"0x6aa521718bf139b44ce56f194f6aea1d590cacef995b5a84703fb1579fa49be9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.0 (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n /**\\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\":\"0xe936fc79332de2ca7b1c06a70f81345aa2466958aab00f463e312ca0585e85cf\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.0 (utils/math/SafeCast.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\\n * checks.\\n *\\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\\n * easily result in undesired exploitation or bugs, since developers usually\\n * assume that overflows raise errors. `SafeCast` restores this intuition by\\n * reverting the transaction when such an operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n *\\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\\n * all math on `uint256` and `int256` and then downcasting.\\n */\\nlibrary 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\":\"0x47c0131bd8a972c31596958aa86752ea18d60e33f1cd94d412b9e29fd6ab25a6\",\"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/utils/cryptography/ECDSA.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/math/Math.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/math/SafeCast.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.\\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 /// @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 SafeCast.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 SafeCast.toUint96(newWeight)\\n );\\n return (oldWeight, newWeight);\\n }\\n }\\n\\n ckpts.push(\\n encodeCheckpoint(\\n SafeCast.toUint32(block.number),\\n SafeCast.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 = Math.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\":\"0x25f420d34548648aa59703bccdad450815da5c9e18adf575845a659f0945d131\",\"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/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/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}", + "bytecode": "0x60e06040523480156200001157600080fd5b5060405162001097380380620010978339810160408190526200003491620000cc565b6001600160a01b03808516608052831660a0526001600160601b03808316908216620000636003601262000144565b6200007090600a6200025d565b6200007c919062000272565b62000088919062000294565b60c05250620002b792505050565b6001600160a01b0381168114620000ac57600080fd5b50565b80516001600160601b0381168114620000c757600080fd5b919050565b60008060008060808587031215620000e357600080fd5b8451620000f08162000096565b6020860151909450620001038162000096565b92506200011360408601620000af565b91506200012360608601620000af565b905092959194509250565b634e487b7160e01b600052601160045260246000fd5b6000828210156200015957620001596200012e565b500390565b600181815b808511156200019f5781600019048211156200018357620001836200012e565b808516156200019157918102915b93841c939080029062000163565b509250929050565b600082620001b85750600162000257565b81620001c75750600062000257565b8160018114620001e05760028114620001eb576200020b565b600191505062000257565b60ff841115620001ff57620001ff6200012e565b50506001821b62000257565b5060208310610133831016604e8410600b841016171562000230575081810a62000257565b6200023c83836200015e565b80600019048211156200025357620002536200012e565b0290505b92915050565b60006200026b8383620001a7565b9392505050565b60008160001904831182151516156200028f576200028f6200012e565b500290565b600082620002b257634e487b7160e01b600052601260045260246000fd5b500490565b60805160a05160c051610d72620003256000396000818160f601528181610244015281816103b601526103ed0152600081816101910152818161053101526106960152600081816101520152818161029701528181610326015281816104fc01526106cb0152610d726000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c8063996c6cc311610071578063996c6cc31461014d578063c35d64ea1461018c578063cff0eac5146101b3578063de0e9a3e146101c6578063ea598cb0146101d9578063f4fc2f47146101ec57600080fd5b80631c060cbe146100ae57806351b83ebc146100db57806371ca337d146100f15780637a93f256146101185780638f4ffcb114610138575b600080fd5b6100c16100bc3660046109de565b6101f4565b604080519283526020830191909152015b60405180910390f35b6100e361027b565b6040519081526020016100d2565b6100e37f000000000000000000000000000000000000000000000000000000000000000081565b6100e3610126366004610a13565b60006020819052908152604090205481565b61014b610146366004610a2e565b610295565b005b6101747f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100d2565b6101747f000000000000000000000000000000000000000000000000000000000000000081565b6100c16101c13660046109de565b6103ae565b61014b6101d43660046109de565b61042d565b61014b6101e73660046109de565b61043a565b6100e3600381565b60008061020360036012610adf565b61020e90600a610bdc565b6102189084610bfe565b905060006102268285610adf565b905061023460036012610adf565b61023f90600a610bdc565b6102697f000000000000000000000000000000000000000000000000000000000000000083610c12565b6102739190610c31565b925050915091565b61028760036012610adf565b61029290600a610bdc565b81565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b03161461031b5760405162461bcd60e51b815260206004820152601e60248201527f546f6b656e206973206e6f7420746865207772617070656420746f6b656e000060448201526064015b60405180910390fd5b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461039d5760405162461bcd60e51b815260206004820152602160248201527f4f6e6c79207772617070656420746f6b656e2063616c6c657220616c6c6f77656044820152601960fa1b6064820152608401610312565b6103a78585610440565b5050505050565b6000806103db7f000000000000000000000000000000000000000000000000000000000000000084610bfe565b905060006103e98285610adf565b90507f000000000000000000000000000000000000000000000000000000000000000061041860036012610adf565b61042390600a610bdc565b6102699083610c12565b610437338261055e565b50565b61043733825b60008061044c836101f4565b909250905061045b8184610adf565b92506000831161047d5760405162461bcd60e51b815260040161031290610c45565b60408051848152602081018490526001600160a01b038616917f727200b48f3c812bfb404b578574e1c03694edb122d80fa6dcb352a9e4f8a938910160405180910390a26001600160a01b038416600090815260208190526040812080548592906104e9908490610c87565b9091555061052490506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168530866106f2565b6105586001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016858461075d565b50505050565b60008061056a836103ae565b90925090506105798184610adf565b92506000831161059b5760405162461bcd60e51b815260040161031290610c45565b6001600160a01b0384166000908152602081905260409020548211156106175760405162461bcd60e51b815260206004820152602b60248201527f43616e206e6f7420756e77726170206d6f7265207468616e2070726576696f7560448201526a1cdb1e481ddc985c1c195960aa1b6064820152608401610312565b60408051848152602081018490526001600160a01b038616917ff64ae1cc3e0e07da9c895b3225439175cab5838aca24c4e74852704858c96a7b910160405180910390a26001600160a01b03841660009081526020819052604081208054849290610683908490610adf565b909155506106be90506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168530866106f2565b6105586001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016858461075d565b6040516001600160a01b03808516602483015283166044820152606481018290526105589085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610792565b6040516001600160a01b03831660248201526044810182905261078d90849063a9059cbb60e01b90606401610726565b505050565b60006107e7826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166108649092919063ffffffff16565b80519091501561078d57808060200190518101906108059190610c9f565b61078d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610312565b6060610873848460008561087d565b90505b9392505050565b6060824710156108de5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610312565b843b61092c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610312565b600080866001600160a01b031685876040516109489190610ced565b60006040518083038185875af1925050503d8060008114610985576040519150601f19603f3d011682016040523d82523d6000602084013e61098a565b606091505b509150915061099a8282866109a5565b979650505050505050565b606083156109b4575081610876565b8251156109c45782518084602001fd5b8160405162461bcd60e51b81526004016103129190610d09565b6000602082840312156109f057600080fd5b5035919050565b80356001600160a01b0381168114610a0e57600080fd5b919050565b600060208284031215610a2557600080fd5b610876826109f7565b600080600080600060808688031215610a4657600080fd5b610a4f866109f7565b945060208601359350610a64604087016109f7565b9250606086013567ffffffffffffffff80821115610a8157600080fd5b818801915088601f830112610a9557600080fd5b813581811115610aa457600080fd5b896020828501011115610ab657600080fd5b9699959850939650602001949392505050565b634e487b7160e01b600052601160045260246000fd5b600082821015610af157610af1610ac9565b500390565b600181815b80851115610b31578160001904821115610b1757610b17610ac9565b80851615610b2457918102915b93841c9390800290610afb565b509250929050565b600082610b4857506001610bd6565b81610b5557506000610bd6565b8160018114610b6b5760028114610b7557610b91565b6001915050610bd6565b60ff841115610b8657610b86610ac9565b50506001821b610bd6565b5060208310610133831016604e8410600b8410161715610bb4575081810a610bd6565b610bbe8383610af6565b8060001904821115610bd257610bd2610ac9565b0290505b92915050565b60006108768383610b39565b634e487b7160e01b600052601260045260246000fd5b600082610c0d57610c0d610be8565b500690565b6000816000190483118215151615610c2c57610c2c610ac9565b500290565b600082610c4057610c40610be8565b500490565b60208082526022908201527f446973616c6c6f7720636f6e76657273696f6e73206f66207a65726f2076616c604082015261756560f01b606082015260800190565b60008219821115610c9a57610c9a610ac9565b500190565b600060208284031215610cb157600080fd5b8151801515811461087657600080fd5b60005b83811015610cdc578181015183820152602001610cc4565b838111156105585750506000910152565b60008251610cff818460208701610cc1565b9190910192915050565b6020815260008251806020840152610d28816040850160208701610cc1565b601f01601f1916919091016040019291505056fea264697066735822122067d5c8bd0f1249a48948d1f378dbf5ab4ff1b77bc5d7fc1dca574055bd5d487264736f6c63430008090033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100a95760003560e01c8063996c6cc311610071578063996c6cc31461014d578063c35d64ea1461018c578063cff0eac5146101b3578063de0e9a3e146101c6578063ea598cb0146101d9578063f4fc2f47146101ec57600080fd5b80631c060cbe146100ae57806351b83ebc146100db57806371ca337d146100f15780637a93f256146101185780638f4ffcb114610138575b600080fd5b6100c16100bc3660046109de565b6101f4565b604080519283526020830191909152015b60405180910390f35b6100e361027b565b6040519081526020016100d2565b6100e37f000000000000000000000000000000000000000000000000000000000000000081565b6100e3610126366004610a13565b60006020819052908152604090205481565b61014b610146366004610a2e565b610295565b005b6101747f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100d2565b6101747f000000000000000000000000000000000000000000000000000000000000000081565b6100c16101c13660046109de565b6103ae565b61014b6101d43660046109de565b61042d565b61014b6101e73660046109de565b61043a565b6100e3600381565b60008061020360036012610adf565b61020e90600a610bdc565b6102189084610bfe565b905060006102268285610adf565b905061023460036012610adf565b61023f90600a610bdc565b6102697f000000000000000000000000000000000000000000000000000000000000000083610c12565b6102739190610c31565b925050915091565b61028760036012610adf565b61029290600a610bdc565b81565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b03161461031b5760405162461bcd60e51b815260206004820152601e60248201527f546f6b656e206973206e6f7420746865207772617070656420746f6b656e000060448201526064015b60405180910390fd5b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461039d5760405162461bcd60e51b815260206004820152602160248201527f4f6e6c79207772617070656420746f6b656e2063616c6c657220616c6c6f77656044820152601960fa1b6064820152608401610312565b6103a78585610440565b5050505050565b6000806103db7f000000000000000000000000000000000000000000000000000000000000000084610bfe565b905060006103e98285610adf565b90507f000000000000000000000000000000000000000000000000000000000000000061041860036012610adf565b61042390600a610bdc565b6102699083610c12565b610437338261055e565b50565b61043733825b60008061044c836101f4565b909250905061045b8184610adf565b92506000831161047d5760405162461bcd60e51b815260040161031290610c45565b60408051848152602081018490526001600160a01b038616917f727200b48f3c812bfb404b578574e1c03694edb122d80fa6dcb352a9e4f8a938910160405180910390a26001600160a01b038416600090815260208190526040812080548592906104e9908490610c87565b9091555061052490506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168530866106f2565b6105586001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016858461075d565b50505050565b60008061056a836103ae565b90925090506105798184610adf565b92506000831161059b5760405162461bcd60e51b815260040161031290610c45565b6001600160a01b0384166000908152602081905260409020548211156106175760405162461bcd60e51b815260206004820152602b60248201527f43616e206e6f7420756e77726170206d6f7265207468616e2070726576696f7560448201526a1cdb1e481ddc985c1c195960aa1b6064820152608401610312565b60408051848152602081018490526001600160a01b038616917ff64ae1cc3e0e07da9c895b3225439175cab5838aca24c4e74852704858c96a7b910160405180910390a26001600160a01b03841660009081526020819052604081208054849290610683908490610adf565b909155506106be90506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168530866106f2565b6105586001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016858461075d565b6040516001600160a01b03808516602483015283166044820152606481018290526105589085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610792565b6040516001600160a01b03831660248201526044810182905261078d90849063a9059cbb60e01b90606401610726565b505050565b60006107e7826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166108649092919063ffffffff16565b80519091501561078d57808060200190518101906108059190610c9f565b61078d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610312565b6060610873848460008561087d565b90505b9392505050565b6060824710156108de5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610312565b843b61092c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610312565b600080866001600160a01b031685876040516109489190610ced565b60006040518083038185875af1925050503d8060008114610985576040519150601f19603f3d011682016040523d82523d6000602084013e61098a565b606091505b509150915061099a8282866109a5565b979650505050505050565b606083156109b4575081610876565b8251156109c45782518084602001fd5b8160405162461bcd60e51b81526004016103129190610d09565b6000602082840312156109f057600080fd5b5035919050565b80356001600160a01b0381168114610a0e57600080fd5b919050565b600060208284031215610a2557600080fd5b610876826109f7565b600080600080600060808688031215610a4657600080fd5b610a4f866109f7565b945060208601359350610a64604087016109f7565b9250606086013567ffffffffffffffff80821115610a8157600080fd5b818801915088601f830112610a9557600080fd5b813581811115610aa457600080fd5b896020828501011115610ab657600080fd5b9699959850939650602001949392505050565b634e487b7160e01b600052601160045260246000fd5b600082821015610af157610af1610ac9565b500390565b600181815b80851115610b31578160001904821115610b1757610b17610ac9565b80851615610b2457918102915b93841c9390800290610afb565b509250929050565b600082610b4857506001610bd6565b81610b5557506000610bd6565b8160018114610b6b5760028114610b7557610b91565b6001915050610bd6565b60ff841115610b8657610b86610ac9565b50506001821b610bd6565b5060208310610133831016604e8410600b8410161715610bb4575081810a610bd6565b610bbe8383610af6565b8060001904821115610bd257610bd2610ac9565b0290505b92915050565b60006108768383610b39565b634e487b7160e01b600052601260045260246000fd5b600082610c0d57610c0d610be8565b500690565b6000816000190483118215151615610c2c57610c2c610ac9565b500290565b600082610c4057610c40610be8565b500490565b60208082526022908201527f446973616c6c6f7720636f6e76657273696f6e73206f66207a65726f2076616c604082015261756560f01b606082015260800190565b60008219821115610c9a57610c9a610ac9565b500190565b600060208284031215610cb157600080fd5b8151801515811461087657600080fd5b60005b83811015610cdc578181015183820152602001610cc4565b838111156105585750506000910152565b60008251610cff818460208701610cc1565b9190910192915050565b6020815260008251806020840152610d28816040850160208701610cc1565b601f01601f1916919091016040019291505056fea264697066735822122067d5c8bd0f1249a48948d1f378dbf5ab4ff1b77bc5d7fc1dca574055bd5d487264736f6c63430008090033", + "devdoc": { + "kind": "dev", + "methods": { + "constructor": { + "details": "Multiplications in this contract can't overflow uint256 as we restrict `_wrappedTokenAllocation` and `_tTokenAllocation` to 96 bits and FLOATING_POINT_DIVISOR fits in less than 60 bits.", + "params": { + "_tToken": "Address of T token", + "_tTokenAllocation": "The allocation of T this instance of Vending Machine will receive", + "_wrappedToken": "Address to ERC20 token that will be wrapped to T", + "_wrappedTokenAllocation": "The total supply of the token that will be wrapped to T" + } + }, + "receiveApproval(address,uint256,address,bytes)": { + "params": { + "amount": "The amount of KEEP/NU to be wrapped", + "from": "Caller's address, must be the same as `wrappedToken` field", + "token": "Token's address, must be the same as `wrappedToken` field" + } + }, + "unwrap(uint256)": { + "params": { + "amount": "The amount of T to unwrap back to the collateral (KEEP/NU)" + } + }, + "wrap(uint256)": { + "params": { + "amount": "The amount of KEEP/NU to be wrapped" + } + } + }, + "title": "T token vending machine", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "FLOATING_POINT_DIVISOR()": { + "notice": "Divisor for precision purposes, used to represent fractions." + }, + "WRAPPED_TOKEN_CONVERSION_PRECISION()": { + "notice": "Number of decimal places of precision in conversion to/from wrapped tokens (assuming typical ERC20 token with 18 decimals). This implies that amounts of wrapped tokens below this precision won't take part in the conversion. E.g., for a value of 3, then for a conversion of 1.123456789 wrapped tokens, only 1.123 is convertible (i.e., 3 decimal places), and 0.000456789 is left." + }, + "constructor": { + "notice": "Sets the reference to `wrappedToken` and `tToken`. Initializes conversion `ratio` between wrapped token and T based on the provided `_tTokenAllocation` and `_wrappedTokenAllocation`." + }, + "conversionFromT(uint256)": { + "notice": "The amount of wrapped tokens (KEEP/NU) that's obtained from `amount` T tokens, and the remainder that can't be downgraded." + }, + "conversionToT(uint256)": { + "notice": "Returns the T token amount that's obtained from `amount` wrapped tokens (KEEP/NU), and the remainder that can't be upgraded." + }, + "ratio()": { + "notice": "The ratio with which T token is converted based on the provided token being wrapped (KEEP/NU), expressed in 1e18 precision. When wrapping: x [T] = amount [KEEP/NU] * ratio / FLOATING_POINT_DIVISOR When unwrapping: x [KEEP/NU] = amount [T] * FLOATING_POINT_DIVISOR / ratio" + }, + "receiveApproval(address,uint256,address,bytes)": { + "notice": "Wraps up to the given amount of the token (KEEP/NU) and releases T token proportionally to the amount being wrapped with respect to the wrap ratio. This is a shortcut to `wrap` function that avoids a separate approval transaction. Only KEEP/NU token is allowed as a caller, so please call this function via token's `approveAndCall`." + }, + "tToken()": { + "notice": "T token contract." + }, + "unwrap(uint256)": { + "notice": "Unwraps up to the given `amount` of T back to the legacy token (KEEP/NU) according to the wrap ratio. It can only be called by a token holder who previously wrapped their tokens in this vending machine contract. The token holder can't unwrap more tokens than they originally wrapped. The token holder needs to have at least the given amount of T tokens approved to transfer to the Vending Machine before calling this function." + }, + "wrap(uint256)": { + "notice": "Wraps up to the the given `amount` of the token (KEEP/NU) and releases T token proportionally to the amount being wrapped with respect to the wrap ratio. The token holder needs to have at least the given amount of the wrapped token (KEEP/NU) approved to transfer to the Vending Machine before calling this function." + }, + "wrappedBalance(address)": { + "notice": "The total balance of wrapped tokens for the given holder account. Only holders that have previously wrapped KEEP/NU to T can unwrap, up to the amount previously wrapped." + }, + "wrappedToken()": { + "notice": "The token being wrapped to T (KEEP/NU)." + } + }, + "notice": "Contract implements a special update protocol to enable KEEP/NU token holders to wrap their tokens and obtain T tokens according to a fixed ratio. This will go on indefinitely and enable NU and KEEP token holders to join T network without needing to buy or sell any assets. Logistically, anyone holding NU or KEEP can wrap those assets in order to upgrade to T. They can also unwrap T in order to downgrade back to the underlying asset. There is a separate instance of this contract deployed for KEEP holders and a separate instance of this contract deployed for NU holders.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 15943, + "contract": "contracts/vending/VendingMachine.sol:VendingMachine", + "label": "wrappedBalance", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_address,t_uint256)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/deployments/mainnet/solcInputs/9a2f45de388a8a02f9e065c8da7e4649.json b/deployments/mainnet/solcInputs/9a2f45de388a8a02f9e065c8da7e4649.json new file mode 100644 index 00000000..4c3d4b70 --- /dev/null +++ b/deployments/mainnet/solcInputs/9a2f45de388a8a02f9e065c8da7e4649.json @@ -0,0 +1,272 @@ +{ + "language": "Solidity", + "sources": { + "contracts/governance/BaseTokenholderGovernor.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n\npragma solidity 0.8.9;\n\nimport \"./TokenholderGovernorVotes.sol\";\nimport \"../token/T.sol\";\nimport \"@openzeppelin/contracts/access/AccessControl.sol\";\nimport \"@openzeppelin/contracts/governance/Governor.sol\";\nimport \"@openzeppelin/contracts/governance/extensions/GovernorCountingSimple.sol\";\nimport \"@openzeppelin/contracts/governance/extensions/GovernorPreventLateQuorum.sol\";\nimport \"@openzeppelin/contracts/governance/extensions/GovernorTimelockControl.sol\";\n\ncontract BaseTokenholderGovernor is\n AccessControl,\n GovernorCountingSimple,\n TokenholderGovernorVotes,\n GovernorPreventLateQuorum,\n GovernorTimelockControl\n{\n bytes32 public constant VETO_POWER =\n keccak256(\"Power to veto proposals in Threshold's Tokenholder DAO\");\n\n constructor(\n T _token,\n IVotesHistory _staking,\n TimelockController _timelock,\n address _vetoer,\n uint256 _quorumNumerator,\n uint256 _proposalThresholdNumerator,\n uint256 votingDelay,\n uint256 votingPeriod,\n uint64 votingExtension\n )\n Governor(\"TokenholderGovernor\")\n GovernorParameters(\n _quorumNumerator,\n _proposalThresholdNumerator,\n votingDelay,\n votingPeriod\n )\n GovernorPreventLateQuorum(votingExtension)\n TokenholderGovernorVotes(_token, _staking)\n GovernorTimelockControl(_timelock)\n {\n _setupRole(VETO_POWER, _vetoer);\n _setupRole(DEFAULT_ADMIN_ROLE, address(_timelock));\n }\n\n function cancel(\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n bytes32 descriptionHash\n ) external onlyRole(VETO_POWER) returns (uint256) {\n return _cancel(targets, values, calldatas, descriptionHash);\n }\n\n function propose(\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n string memory description\n ) public override(Governor, IGovernor) returns (uint256) {\n return super.propose(targets, values, calldatas, description);\n }\n\n function quorum(uint256 blockNumber)\n public\n view\n override(IGovernor, GovernorParameters)\n returns (uint256)\n {\n return super.quorum(blockNumber);\n }\n\n function proposalThreshold()\n public\n view\n override(Governor, GovernorParameters)\n returns (uint256)\n {\n return super.proposalThreshold();\n }\n\n function getVotes(address account, uint256 blockNumber)\n public\n view\n override(IGovernor, TokenholderGovernorVotes)\n returns (uint256)\n {\n return super.getVotes(account, blockNumber);\n }\n\n function state(uint256 proposalId)\n public\n view\n override(Governor, GovernorTimelockControl)\n returns (ProposalState)\n {\n return super.state(proposalId);\n }\n\n function supportsInterface(bytes4 interfaceId)\n public\n view\n override(Governor, GovernorTimelockControl, AccessControl)\n returns (bool)\n {\n return super.supportsInterface(interfaceId);\n }\n\n function _execute(\n uint256 proposalId,\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n bytes32 descriptionHash\n ) internal override(Governor, GovernorTimelockControl) {\n super._execute(proposalId, targets, values, calldatas, descriptionHash);\n }\n\n function _cancel(\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n bytes32 descriptionHash\n ) internal override(Governor, GovernorTimelockControl) returns (uint256) {\n return super._cancel(targets, values, calldatas, descriptionHash);\n }\n\n function _executor()\n internal\n view\n override(Governor, GovernorTimelockControl)\n returns (address)\n {\n return super._executor();\n }\n\n function proposalDeadline(uint256 proposalId)\n public\n view\n virtual\n override(IGovernor, Governor, GovernorPreventLateQuorum)\n returns (uint256)\n {\n return super.proposalDeadline(proposalId);\n }\n\n function _castVote(\n uint256 proposalId,\n address account,\n uint8 support,\n string memory reason\n )\n internal\n virtual\n override(Governor, GovernorPreventLateQuorum)\n returns (uint256)\n {\n return super._castVote(proposalId, account, support, reason);\n }\n}\n" + }, + "contracts/governance/TokenholderGovernorVotes.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n\npragma solidity 0.8.9;\n\nimport \"./GovernorParameters.sol\";\nimport \"./IVotesHistory.sol\";\n\n/// @title TokenholderGovernorVotes\n/// @notice Tokenholder DAO voting power extraction from both liquid and staked\n/// T token positions, including legacy stakes (NU/KEEP).\nabstract contract TokenholderGovernorVotes is GovernorParameters {\n IVotesHistory public immutable token;\n IVotesHistory public immutable staking;\n\n constructor(IVotesHistory tokenAddress, IVotesHistory tStakingAddress) {\n token = tokenAddress;\n staking = tStakingAddress;\n }\n\n /// @notice Read the voting weight from the snapshot mechanism in the token\n /// and staking contracts. For Tokenholder DAO, there are currently\n /// two voting power sources:\n /// - Liquid T, tracked by the T token contract\n /// - Stakes in the T network, tracked by the T staking contract.\n /// Note that this also tracks legacy stakes (NU/KEEP); legacy\n /// stakes count for tokenholders' voting power, but not for the\n /// total voting power of the Tokenholder DAO\n /// (see {_getPastTotalSupply}).\n /// @param account Tokenholder account in the T network\n /// @param blockNumber The block number to get the vote balance at\n /// @dev See {IGovernor-getVotes}\n function getVotes(address account, uint256 blockNumber)\n public\n view\n virtual\n override\n returns (uint256)\n {\n uint256 liquidVotes = token.getPastVotes(account, blockNumber);\n uint256 stakedVotes = staking.getPastVotes(account, blockNumber);\n return liquidVotes + stakedVotes;\n }\n\n /// @notice Compute the total voting power for Tokenholder DAO. Note how it\n /// only uses the token total supply as source, as native T tokens\n /// that are staked continue existing, but as deposits in the\n /// staking contract. However, legacy stakes can't contribute to the\n /// total voting power as they're already implicitly counted as part\n /// of Vending Machines' liquid balance; hence, we only need to read\n /// total voting power from the token.\n /// @param blockNumber The block number to get the vote power at\n function _getPastTotalSupply(uint256 blockNumber)\n internal\n view\n virtual\n override\n returns (uint256)\n {\n return token.getPastTotalSupply(blockNumber);\n }\n}\n" + }, + "contracts/token/T.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\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" + }, + "@openzeppelin/contracts/access/AccessControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControl.sol\";\nimport \"../utils/Context.sol\";\nimport \"../utils/Strings.sol\";\nimport \"../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role, _msgSender());\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n Strings.toHexString(uint160(account), 20),\n \" is missing role \",\n Strings.toHexString(uint256(role), 32)\n )\n )\n );\n }\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n *\n * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\n _grantRole(role, account);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n}\n" + }, + "@openzeppelin/contracts/governance/Governor.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (governance/Governor.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/cryptography/ECDSA.sol\";\nimport \"../utils/cryptography/draft-EIP712.sol\";\nimport \"../utils/introspection/ERC165.sol\";\nimport \"../utils/math/SafeCast.sol\";\nimport \"../utils/Address.sol\";\nimport \"../utils/Context.sol\";\nimport \"../utils/Timers.sol\";\nimport \"./IGovernor.sol\";\n\n/**\n * @dev Core of the governance system, designed to be extended though various modules.\n *\n * This contract is abstract and requires several function to be implemented in various modules:\n *\n * - A counting module must implement {quorum}, {_quorumReached}, {_voteSucceeded} and {_countVote}\n * - A voting module must implement {getVotes}\n * - Additionanly, the {votingPeriod} must also be implemented\n *\n * _Available since v4.3._\n */\nabstract contract Governor is Context, ERC165, EIP712, IGovernor {\n using SafeCast for uint256;\n using Timers for Timers.BlockNumber;\n\n bytes32 public constant BALLOT_TYPEHASH = keccak256(\"Ballot(uint256 proposalId,uint8 support)\");\n\n struct ProposalCore {\n Timers.BlockNumber voteStart;\n Timers.BlockNumber voteEnd;\n bool executed;\n bool canceled;\n }\n\n string private _name;\n\n mapping(uint256 => ProposalCore) private _proposals;\n\n /**\n * @dev Restrict access of functions to the governance executor, which may be the Governor itself or a timelock\n * contract, as specified by {_executor}. This generally means that function with this modifier must be voted on and\n * executed through the governance protocol.\n */\n modifier onlyGovernance() {\n require(_msgSender() == _executor(), \"Governor: onlyGovernance\");\n _;\n }\n\n /**\n * @dev Sets the value for {name} and {version}\n */\n constructor(string memory name_) EIP712(name_, version()) {\n _name = name_;\n }\n\n /**\n * @dev Function to receive ETH that will be handled by the governor (disabled if executor is a third party contract)\n */\n receive() external payable virtual {\n require(_executor() == address(this));\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) {\n return interfaceId == type(IGovernor).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IGovernor-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IGovernor-version}.\n */\n function version() public view virtual override returns (string memory) {\n return \"1\";\n }\n\n /**\n * @dev See {IGovernor-hashProposal}.\n *\n * The proposal id is produced by hashing the RLC encoded `targets` array, the `values` array, the `calldatas` array\n * and the descriptionHash (bytes32 which itself is the keccak256 hash of the description string). This proposal id\n * can be produced from the proposal data which is part of the {ProposalCreated} event. It can even be computed in\n * advance, before the proposal is submitted.\n *\n * Note that the chainId and the governor address are not part of the proposal id computation. Consequently, the\n * same proposal (with same operation and same description) will have the same id if submitted on multiple governors\n * accross multiple networks. This also means that in order to execute the same operation twice (on the same\n * governor) the proposer will have to change the description in order to avoid proposal id conflicts.\n */\n function hashProposal(\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n bytes32 descriptionHash\n ) public pure virtual override returns (uint256) {\n return uint256(keccak256(abi.encode(targets, values, calldatas, descriptionHash)));\n }\n\n /**\n * @dev See {IGovernor-state}.\n */\n function state(uint256 proposalId) public view virtual override returns (ProposalState) {\n ProposalCore storage proposal = _proposals[proposalId];\n\n if (proposal.executed) {\n return ProposalState.Executed;\n }\n\n if (proposal.canceled) {\n return ProposalState.Canceled;\n }\n\n uint256 snapshot = proposalSnapshot(proposalId);\n\n if (snapshot == 0) {\n revert(\"Governor: unknown proposal id\");\n }\n\n if (snapshot >= block.number) {\n return ProposalState.Pending;\n }\n\n uint256 deadline = proposalDeadline(proposalId);\n\n if (deadline >= block.number) {\n return ProposalState.Active;\n }\n\n if (_quorumReached(proposalId) && _voteSucceeded(proposalId)) {\n return ProposalState.Succeeded;\n } else {\n return ProposalState.Defeated;\n }\n }\n\n /**\n * @dev See {IGovernor-proposalSnapshot}.\n */\n function proposalSnapshot(uint256 proposalId) public view virtual override returns (uint256) {\n return _proposals[proposalId].voteStart.getDeadline();\n }\n\n /**\n * @dev See {IGovernor-proposalDeadline}.\n */\n function proposalDeadline(uint256 proposalId) public view virtual override returns (uint256) {\n return _proposals[proposalId].voteEnd.getDeadline();\n }\n\n /**\n * @dev Part of the Governor Bravo's interface: _\"The number of votes required in order for a voter to become a proposer\"_.\n */\n function proposalThreshold() public view virtual returns (uint256) {\n return 0;\n }\n\n /**\n * @dev Amount of votes already cast passes the threshold limit.\n */\n function _quorumReached(uint256 proposalId) internal view virtual returns (bool);\n\n /**\n * @dev Is the proposal successful or not.\n */\n function _voteSucceeded(uint256 proposalId) internal view virtual returns (bool);\n\n /**\n * @dev Register a vote with a given support and voting weight.\n *\n * Note: Support is generic and can represent various things depending on the voting system used.\n */\n function _countVote(\n uint256 proposalId,\n address account,\n uint8 support,\n uint256 weight\n ) internal virtual;\n\n /**\n * @dev See {IGovernor-propose}.\n */\n function propose(\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n string memory description\n ) public virtual override returns (uint256) {\n require(\n getVotes(msg.sender, block.number - 1) >= proposalThreshold(),\n \"GovernorCompatibilityBravo: proposer votes below proposal threshold\"\n );\n\n uint256 proposalId = hashProposal(targets, values, calldatas, keccak256(bytes(description)));\n\n require(targets.length == values.length, \"Governor: invalid proposal length\");\n require(targets.length == calldatas.length, \"Governor: invalid proposal length\");\n require(targets.length > 0, \"Governor: empty proposal\");\n\n ProposalCore storage proposal = _proposals[proposalId];\n require(proposal.voteStart.isUnset(), \"Governor: proposal already exists\");\n\n uint64 snapshot = block.number.toUint64() + votingDelay().toUint64();\n uint64 deadline = snapshot + votingPeriod().toUint64();\n\n proposal.voteStart.setDeadline(snapshot);\n proposal.voteEnd.setDeadline(deadline);\n\n emit ProposalCreated(\n proposalId,\n _msgSender(),\n targets,\n values,\n new string[](targets.length),\n calldatas,\n snapshot,\n deadline,\n description\n );\n\n return proposalId;\n }\n\n /**\n * @dev See {IGovernor-execute}.\n */\n function execute(\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n bytes32 descriptionHash\n ) public payable virtual override returns (uint256) {\n uint256 proposalId = hashProposal(targets, values, calldatas, descriptionHash);\n\n ProposalState status = state(proposalId);\n require(\n status == ProposalState.Succeeded || status == ProposalState.Queued,\n \"Governor: proposal not successful\"\n );\n _proposals[proposalId].executed = true;\n\n emit ProposalExecuted(proposalId);\n\n _execute(proposalId, targets, values, calldatas, descriptionHash);\n\n return proposalId;\n }\n\n /**\n * @dev Internal execution mechanism. Can be overriden to implement different execution mechanism\n */\n function _execute(\n uint256, /* proposalId */\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n bytes32 /*descriptionHash*/\n ) internal virtual {\n string memory errorMessage = \"Governor: call reverted without message\";\n for (uint256 i = 0; i < targets.length; ++i) {\n (bool success, bytes memory returndata) = targets[i].call{value: values[i]}(calldatas[i]);\n Address.verifyCallResult(success, returndata, errorMessage);\n }\n }\n\n /**\n * @dev Internal cancel mechanism: locks up the proposal timer, preventing it from being re-submitted. Marks it as\n * canceled to allow distinguishing it from executed proposals.\n *\n * Emits a {IGovernor-ProposalCanceled} event.\n */\n function _cancel(\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n bytes32 descriptionHash\n ) internal virtual returns (uint256) {\n uint256 proposalId = hashProposal(targets, values, calldatas, descriptionHash);\n ProposalState status = state(proposalId);\n\n require(\n status != ProposalState.Canceled && status != ProposalState.Expired && status != ProposalState.Executed,\n \"Governor: proposal not active\"\n );\n _proposals[proposalId].canceled = true;\n\n emit ProposalCanceled(proposalId);\n\n return proposalId;\n }\n\n /**\n * @dev See {IGovernor-castVote}.\n */\n function castVote(uint256 proposalId, uint8 support) public virtual override returns (uint256) {\n address voter = _msgSender();\n return _castVote(proposalId, voter, support, \"\");\n }\n\n /**\n * @dev See {IGovernor-castVoteWithReason}.\n */\n function castVoteWithReason(\n uint256 proposalId,\n uint8 support,\n string calldata reason\n ) public virtual override returns (uint256) {\n address voter = _msgSender();\n return _castVote(proposalId, voter, support, reason);\n }\n\n /**\n * @dev See {IGovernor-castVoteBySig}.\n */\n function castVoteBySig(\n uint256 proposalId,\n uint8 support,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual override returns (uint256) {\n address voter = ECDSA.recover(\n _hashTypedDataV4(keccak256(abi.encode(BALLOT_TYPEHASH, proposalId, support))),\n v,\n r,\n s\n );\n return _castVote(proposalId, voter, support, \"\");\n }\n\n /**\n * @dev Internal vote casting mechanism: Check that the vote is pending, that it has not been cast yet, retrieve\n * voting weight using {IGovernor-getVotes} and call the {_countVote} internal function.\n *\n * Emits a {IGovernor-VoteCast} event.\n */\n function _castVote(\n uint256 proposalId,\n address account,\n uint8 support,\n string memory reason\n ) internal virtual returns (uint256) {\n ProposalCore storage proposal = _proposals[proposalId];\n require(state(proposalId) == ProposalState.Active, \"Governor: vote not currently active\");\n\n uint256 weight = getVotes(account, proposal.voteStart.getDeadline());\n _countVote(proposalId, account, support, weight);\n\n emit VoteCast(account, proposalId, support, weight, reason);\n\n return weight;\n }\n\n /**\n * @dev Relays a transaction or function call to an arbitrary target. In cases where the governance executor\n * is some contract other than the governor itself, like when using a timelock, this function can be invoked\n * in a governance proposal to recover tokens or Ether that was sent to the governor contract by mistake.\n * Note that if the executor is simply the governor itself, use of `relay` is redundant.\n */\n function relay(\n address target,\n uint256 value,\n bytes calldata data\n ) external virtual onlyGovernance {\n Address.functionCallWithValue(target, data, value);\n }\n\n /**\n * @dev Address through which the governor executes action. Will be overloaded by module that execute actions\n * through another contract such as a timelock.\n */\n function _executor() internal view virtual returns (address) {\n return address(this);\n }\n}\n" + }, + "@openzeppelin/contracts/governance/extensions/GovernorCountingSimple.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (governance/extensions/GovernorCountingSimple.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Governor.sol\";\n\n/**\n * @dev Extension of {Governor} for simple, 3 options, vote counting.\n *\n * _Available since v4.3._\n */\nabstract contract GovernorCountingSimple is Governor {\n /**\n * @dev Supported vote types. Matches Governor Bravo ordering.\n */\n enum VoteType {\n Against,\n For,\n Abstain\n }\n\n struct ProposalVote {\n uint256 againstVotes;\n uint256 forVotes;\n uint256 abstainVotes;\n mapping(address => bool) hasVoted;\n }\n\n mapping(uint256 => ProposalVote) private _proposalVotes;\n\n /**\n * @dev See {IGovernor-COUNTING_MODE}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function COUNTING_MODE() public pure virtual override returns (string memory) {\n return \"support=bravo&quorum=for,abstain\";\n }\n\n /**\n * @dev See {IGovernor-hasVoted}.\n */\n function hasVoted(uint256 proposalId, address account) public view virtual override returns (bool) {\n return _proposalVotes[proposalId].hasVoted[account];\n }\n\n /**\n * @dev Accessor to the internal vote counts.\n */\n function proposalVotes(uint256 proposalId)\n public\n view\n virtual\n returns (\n uint256 againstVotes,\n uint256 forVotes,\n uint256 abstainVotes\n )\n {\n ProposalVote storage proposalvote = _proposalVotes[proposalId];\n return (proposalvote.againstVotes, proposalvote.forVotes, proposalvote.abstainVotes);\n }\n\n /**\n * @dev See {Governor-_quorumReached}.\n */\n function _quorumReached(uint256 proposalId) internal view virtual override returns (bool) {\n ProposalVote storage proposalvote = _proposalVotes[proposalId];\n\n return quorum(proposalSnapshot(proposalId)) <= proposalvote.forVotes + proposalvote.abstainVotes;\n }\n\n /**\n * @dev See {Governor-_voteSucceeded}. In this module, the forVotes must be strictly over the againstVotes.\n */\n function _voteSucceeded(uint256 proposalId) internal view virtual override returns (bool) {\n ProposalVote storage proposalvote = _proposalVotes[proposalId];\n\n return proposalvote.forVotes > proposalvote.againstVotes;\n }\n\n /**\n * @dev See {Governor-_countVote}. In this module, the support follows the `VoteType` enum (from Governor Bravo).\n */\n function _countVote(\n uint256 proposalId,\n address account,\n uint8 support,\n uint256 weight\n ) internal virtual override {\n ProposalVote storage proposalvote = _proposalVotes[proposalId];\n\n require(!proposalvote.hasVoted[account], \"GovernorVotingSimple: vote already cast\");\n proposalvote.hasVoted[account] = true;\n\n if (support == uint8(VoteType.Against)) {\n proposalvote.againstVotes += weight;\n } else if (support == uint8(VoteType.For)) {\n proposalvote.forVotes += weight;\n } else if (support == uint8(VoteType.Abstain)) {\n proposalvote.abstainVotes += weight;\n } else {\n revert(\"GovernorVotingSimple: invalid value for enum VoteType\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/governance/extensions/GovernorPreventLateQuorum.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (governance/extensions/GovernorPreventLateQuorum.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Governor.sol\";\nimport \"../../utils/math/Math.sol\";\n\n/**\n * @dev A module that ensures there is a minimum voting period after quorum is reached. This prevents a large voter from\n * swaying a vote and triggering quorum at the last minute, by ensuring there is always time for other voters to react\n * and try to oppose the decision.\n *\n * If a vote causes quorum to be reached, the proposal's voting period may be extended so that it does not end before at\n * least a given number of blocks have passed (the \"vote extension\" parameter). This parameter can be set by the\n * governance executor (e.g. through a governance proposal).\n *\n * _Available since v4.5._\n */\nabstract contract GovernorPreventLateQuorum is Governor {\n using SafeCast for uint256;\n using Timers for Timers.BlockNumber;\n\n uint64 private _voteExtension;\n mapping(uint256 => Timers.BlockNumber) private _extendedDeadlines;\n\n /// @dev Emitted when a proposal deadline is pushed back due to reaching quorum late in its voting period.\n event ProposalExtended(uint256 indexed proposalId, uint64 extendedDeadline);\n\n /// @dev Emitted when the {lateQuorumVoteExtension} parameter is changed.\n event LateQuorumVoteExtensionSet(uint64 oldVoteExtension, uint64 newVoteExtension);\n\n /**\n * @dev Initializes the vote extension parameter: the number of blocks that are required to pass since a proposal\n * reaches quorum until its voting period ends. If necessary the voting period will be extended beyond the one set\n * at proposal creation.\n */\n constructor(uint64 initialVoteExtension) {\n _setLateQuorumVoteExtension(initialVoteExtension);\n }\n\n /**\n * @dev Returns the proposal deadline, which may have been extended beyond that set at proposal creation, if the\n * proposal reached quorum late in the voting period. See {Governor-proposalDeadline}.\n */\n function proposalDeadline(uint256 proposalId) public view virtual override returns (uint256) {\n return Math.max(super.proposalDeadline(proposalId), _extendedDeadlines[proposalId].getDeadline());\n }\n\n /**\n * @dev Casts a vote and detects if it caused quorum to be reached, potentially extending the voting period. See\n * {Governor-_castVote}.\n *\n * May emit a {ProposalExtended} event.\n */\n function _castVote(\n uint256 proposalId,\n address account,\n uint8 support,\n string memory reason\n ) internal virtual override returns (uint256) {\n uint256 result = super._castVote(proposalId, account, support, reason);\n\n Timers.BlockNumber storage extendedDeadline = _extendedDeadlines[proposalId];\n\n if (extendedDeadline.isUnset() && _quorumReached(proposalId)) {\n uint64 extendedDeadlineValue = block.number.toUint64() + lateQuorumVoteExtension();\n\n if (extendedDeadlineValue > proposalDeadline(proposalId)) {\n emit ProposalExtended(proposalId, extendedDeadlineValue);\n }\n\n extendedDeadline.setDeadline(extendedDeadlineValue);\n }\n\n return result;\n }\n\n /**\n * @dev Returns the current value of the vote extension parameter: the number of blocks that are required to pass\n * from the time a proposal reaches quorum until its voting period ends.\n */\n function lateQuorumVoteExtension() public view virtual returns (uint64) {\n return _voteExtension;\n }\n\n /**\n * @dev Changes the {lateQuorumVoteExtension}. This operation can only be performed by the governance executor,\n * generally through a governance proposal.\n *\n * Emits a {LateQuorumVoteExtensionSet} event.\n */\n function setLateQuorumVoteExtension(uint64 newVoteExtension) public virtual onlyGovernance {\n _setLateQuorumVoteExtension(newVoteExtension);\n }\n\n /**\n * @dev Changes the {lateQuorumVoteExtension}. This is an internal function that can be exposed in a public function\n * like {setLateQuorumVoteExtension} if another access control mechanism is needed.\n *\n * Emits a {LateQuorumVoteExtensionSet} event.\n */\n function _setLateQuorumVoteExtension(uint64 newVoteExtension) internal virtual {\n emit LateQuorumVoteExtensionSet(_voteExtension, newVoteExtension);\n _voteExtension = newVoteExtension;\n }\n}\n" + }, + "@openzeppelin/contracts/governance/extensions/GovernorTimelockControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (governance/extensions/GovernorTimelockControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IGovernorTimelock.sol\";\nimport \"../Governor.sol\";\nimport \"../TimelockController.sol\";\n\n/**\n * @dev Extension of {Governor} that binds the execution process to an instance of {TimelockController}. This adds a\n * delay, enforced by the {TimelockController} to all successful proposal (in addition to the voting duration). The\n * {Governor} needs the proposer (and ideally the executor) roles for the {Governor} to work properly.\n *\n * Using this model means the proposal will be operated by the {TimelockController} and not by the {Governor}. Thus,\n * the assets and permissions must be attached to the {TimelockController}. Any asset sent to the {Governor} will be\n * inaccessible.\n *\n * WARNING: Setting up the TimelockController to have additional proposers besides the governor is very risky, as it\n * grants them powers that they must be trusted or known not to use: 1) {onlyGovernance} functions like {relay} are\n * available to them through the timelock, and 2) approved governance proposals can be blocked by them, effectively\n * executing a Denial of Service attack. This risk will be mitigated in a future release.\n *\n * _Available since v4.3._\n */\nabstract contract GovernorTimelockControl is IGovernorTimelock, Governor {\n TimelockController private _timelock;\n mapping(uint256 => bytes32) private _timelockIds;\n\n /**\n * @dev Emitted when the timelock controller used for proposal execution is modified.\n */\n event TimelockChange(address oldTimelock, address newTimelock);\n\n /**\n * @dev Set the timelock.\n */\n constructor(TimelockController timelockAddress) {\n _updateTimelock(timelockAddress);\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, Governor) returns (bool) {\n return interfaceId == type(IGovernorTimelock).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Overriden version of the {Governor-state} function with added support for the `Queued` status.\n */\n function state(uint256 proposalId) public view virtual override(IGovernor, Governor) returns (ProposalState) {\n ProposalState status = super.state(proposalId);\n\n if (status != ProposalState.Succeeded) {\n return status;\n }\n\n // core tracks execution, so we just have to check if successful proposal have been queued.\n bytes32 queueid = _timelockIds[proposalId];\n if (queueid == bytes32(0)) {\n return status;\n } else if (_timelock.isOperationDone(queueid)) {\n return ProposalState.Executed;\n } else if (_timelock.isOperationPending(queueid)) {\n return ProposalState.Queued;\n } else {\n return ProposalState.Canceled;\n }\n }\n\n /**\n * @dev Public accessor to check the address of the timelock\n */\n function timelock() public view virtual override returns (address) {\n return address(_timelock);\n }\n\n /**\n * @dev Public accessor to check the eta of a queued proposal\n */\n function proposalEta(uint256 proposalId) public view virtual override returns (uint256) {\n uint256 eta = _timelock.getTimestamp(_timelockIds[proposalId]);\n return eta == 1 ? 0 : eta; // _DONE_TIMESTAMP (1) should be replaced with a 0 value\n }\n\n /**\n * @dev Function to queue a proposal to the timelock.\n */\n function queue(\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n bytes32 descriptionHash\n ) public virtual override returns (uint256) {\n uint256 proposalId = hashProposal(targets, values, calldatas, descriptionHash);\n\n require(state(proposalId) == ProposalState.Succeeded, \"Governor: proposal not successful\");\n\n uint256 delay = _timelock.getMinDelay();\n _timelockIds[proposalId] = _timelock.hashOperationBatch(targets, values, calldatas, 0, descriptionHash);\n _timelock.scheduleBatch(targets, values, calldatas, 0, descriptionHash, delay);\n\n emit ProposalQueued(proposalId, block.timestamp + delay);\n\n return proposalId;\n }\n\n /**\n * @dev Overriden execute function that run the already queued proposal through the timelock.\n */\n function _execute(\n uint256, /* proposalId */\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n bytes32 descriptionHash\n ) internal virtual override {\n _timelock.executeBatch{value: msg.value}(targets, values, calldatas, 0, descriptionHash);\n }\n\n /**\n * @dev Overriden version of the {Governor-_cancel} function to cancel the timelocked proposal if it as already\n * been queued.\n */\n function _cancel(\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n bytes32 descriptionHash\n ) internal virtual override returns (uint256) {\n uint256 proposalId = super._cancel(targets, values, calldatas, descriptionHash);\n\n if (_timelockIds[proposalId] != 0) {\n _timelock.cancel(_timelockIds[proposalId]);\n delete _timelockIds[proposalId];\n }\n\n return proposalId;\n }\n\n /**\n * @dev Address through which the governor executes action. In this case, the timelock.\n */\n function _executor() internal view virtual override returns (address) {\n return address(_timelock);\n }\n\n /**\n * @dev Public endpoint to update the underlying timelock instance. Restricted to the timelock itself, so updates\n * must be proposed, scheduled, and executed through governance proposals.\n *\n * CAUTION: It is not recommended to change the timelock while there are other queued governance proposals.\n */\n function updateTimelock(TimelockController newTimelock) external virtual onlyGovernance {\n _updateTimelock(newTimelock);\n }\n\n function _updateTimelock(TimelockController newTimelock) private {\n emit TimelockChange(address(_timelock), address(newTimelock));\n _timelock = newTimelock;\n }\n}\n" + }, + "contracts/governance/GovernorParameters.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n\npragma solidity 0.8.9;\n\nimport \"@openzeppelin/contracts/governance/Governor.sol\";\n\n/// @title GovernorParameters\n/// @notice Abstract contract to handle governance parameters\n/// @dev Based on `GovernorVotesQuorumFraction`, but without being opinionated\n/// on what's the source of voting power, and extended to handle proposal\n/// thresholds too. See OpenZeppelin's GovernorVotesQuorumFraction,\n/// GovernorVotes and GovernorSettings for reference.\nabstract contract GovernorParameters is Governor {\n uint256 public constant FRACTION_DENOMINATOR = 10000;\n uint64 internal constant AVERAGE_BLOCK_TIME_IN_SECONDS = 13;\n\n uint256 public quorumNumerator;\n uint256 public proposalThresholdNumerator;\n\n uint256 private _votingDelay;\n uint256 private _votingPeriod;\n\n event QuorumNumeratorUpdated(\n uint256 oldQuorumNumerator,\n uint256 newQuorumNumerator\n );\n\n event ProposalThresholdNumeratorUpdated(\n uint256 oldThresholdNumerator,\n uint256 newThresholdNumerator\n );\n\n event VotingDelaySet(uint256 oldVotingDelay, uint256 newVotingDelay);\n event VotingPeriodSet(uint256 oldVotingPeriod, uint256 newVotingPeriod);\n\n constructor(\n uint256 quorumNumeratorValue,\n uint256 proposalNumeratorValue,\n uint256 initialVotingDelay,\n uint256 initialVotingPeriod\n ) {\n _updateQuorumNumerator(quorumNumeratorValue);\n _updateProposalThresholdNumerator(proposalNumeratorValue);\n _setVotingDelay(initialVotingDelay);\n _setVotingPeriod(initialVotingPeriod);\n }\n\n function updateQuorumNumerator(uint256 newQuorumNumerator)\n external\n virtual\n onlyGovernance\n {\n _updateQuorumNumerator(newQuorumNumerator);\n }\n\n function updateProposalThresholdNumerator(uint256 newNumerator)\n external\n virtual\n onlyGovernance\n {\n _updateProposalThresholdNumerator(newNumerator);\n }\n\n /// @notice Update the voting delay. This operation can only be performed\n /// through a governance proposal. Emits a `VotingDelaySet` event.\n function setVotingDelay(uint256 newVotingDelay)\n external\n virtual\n onlyGovernance\n {\n _setVotingDelay(newVotingDelay);\n }\n\n /// @notice Update the voting period. This operation can only be performed\n /// through a governance proposal. Emits a `VotingPeriodSet` event.\n function setVotingPeriod(uint256 newVotingPeriod)\n external\n virtual\n onlyGovernance\n {\n _setVotingPeriod(newVotingPeriod);\n }\n\n /// @notice Compute the required amount of voting power to reach quorum\n /// @param blockNumber The block number to get the quorum at\n function quorum(uint256 blockNumber)\n public\n view\n virtual\n override\n returns (uint256)\n {\n return\n (_getPastTotalSupply(blockNumber) * quorumNumerator) /\n FRACTION_DENOMINATOR;\n }\n\n /// @notice Compute the required amount of voting power to create a proposal\n /// at the last block height\n /// @dev This function is implemented to comply with Governor API but we\n /// we will actually use `proposalThreshold(uint256 blockNumber)`,\n /// as in our DAOs the threshold amount changes according to supply.\n function proposalThreshold()\n public\n view\n virtual\n override\n returns (uint256)\n {\n return proposalThreshold(block.number - 1);\n }\n\n /// @notice Compute the required amount of voting power to create a proposal\n /// @param blockNumber The block number to get the proposal threshold at\n function proposalThreshold(uint256 blockNumber)\n public\n view\n returns (uint256)\n {\n return\n (_getPastTotalSupply(blockNumber) * proposalThresholdNumerator) /\n FRACTION_DENOMINATOR;\n }\n\n function votingDelay() public view virtual override returns (uint256) {\n return _votingDelay;\n }\n\n function votingPeriod() public view virtual override returns (uint256) {\n return _votingPeriod;\n }\n\n function _updateQuorumNumerator(uint256 newQuorumNumerator)\n internal\n virtual\n {\n require(\n newQuorumNumerator <= FRACTION_DENOMINATOR,\n \"quorumNumerator > Denominator\"\n );\n\n uint256 oldQuorumNumerator = quorumNumerator;\n quorumNumerator = newQuorumNumerator;\n\n emit QuorumNumeratorUpdated(oldQuorumNumerator, newQuorumNumerator);\n }\n\n function _updateProposalThresholdNumerator(uint256 proposalNumerator)\n internal\n virtual\n {\n require(\n proposalNumerator <= FRACTION_DENOMINATOR,\n \"proposalNumerator > Denominator\"\n );\n\n uint256 oldNumerator = proposalThresholdNumerator;\n proposalThresholdNumerator = proposalNumerator;\n\n emit ProposalThresholdNumeratorUpdated(oldNumerator, proposalNumerator);\n }\n\n function _setVotingDelay(uint256 newVotingDelay) internal virtual {\n emit VotingDelaySet(_votingDelay, newVotingDelay);\n _votingDelay = newVotingDelay;\n }\n\n function _setVotingPeriod(uint256 newVotingPeriod) internal virtual {\n // voting period must be at least one block long\n require(newVotingPeriod > 0, \"Voting period too low\");\n emit VotingPeriodSet(_votingPeriod, newVotingPeriod);\n _votingPeriod = newVotingPeriod;\n }\n\n /// @notice Compute the past total voting power at a particular block\n /// @param blockNumber The block number to get the vote power at\n // slither-disable-next-line dead-code\n function _getPastTotalSupply(uint256 blockNumber)\n internal\n view\n virtual\n returns (uint256);\n}\n" + }, + "contracts/governance/IVotesHistory.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\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" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n } else if (error == RecoverError.InvalidSignatureV) {\n revert(\"ECDSA: invalid signature 'v' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n // Check the signature length\n // - case 65: r,s,v signature (standard)\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else if (signature.length == 64) {\n bytes32 r;\n bytes32 vs;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly {\n r := mload(add(signature, 0x20))\n vs := mload(add(signature, 0x40))\n }\n return tryRecover(hash, r, vs);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n if (v != 27 && v != 28) {\n return (address(0), RecoverError.InvalidSignatureV);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSA.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * _Available since v3.4._\n */\nabstract contract EIP712 {\n /* solhint-disable var-name-mixedcase */\n // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to\n // invalidate the cached domain separator if the chain id changes.\n bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;\n uint256 private immutable _CACHED_CHAIN_ID;\n address private immutable _CACHED_THIS;\n\n bytes32 private immutable _HASHED_NAME;\n bytes32 private immutable _HASHED_VERSION;\n bytes32 private immutable _TYPE_HASH;\n\n /* solhint-enable var-name-mixedcase */\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n constructor(string memory name, string memory version) {\n bytes32 hashedName = keccak256(bytes(name));\n bytes32 hashedVersion = keccak256(bytes(version));\n bytes32 typeHash = keccak256(\n \"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"\n );\n _HASHED_NAME = hashedName;\n _HASHED_VERSION = hashedVersion;\n _CACHED_CHAIN_ID = block.chainid;\n _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);\n _CACHED_THIS = address(this);\n _TYPE_HASH = typeHash;\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {\n return _CACHED_DOMAIN_SEPARATOR;\n } else {\n return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);\n }\n }\n\n function _buildDomainSeparator(\n bytes32 typeHash,\n bytes32 nameHash,\n bytes32 versionHash\n ) private view returns (bytes32) {\n return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/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" + }, + "@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" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Timers.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Timers.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Tooling for timepoints, timers and delays\n */\nlibrary Timers {\n struct Timestamp {\n uint64 _deadline;\n }\n\n function getDeadline(Timestamp memory timer) internal pure returns (uint64) {\n return timer._deadline;\n }\n\n function setDeadline(Timestamp storage timer, uint64 timestamp) internal {\n timer._deadline = timestamp;\n }\n\n function reset(Timestamp storage timer) internal {\n timer._deadline = 0;\n }\n\n function isUnset(Timestamp memory timer) internal pure returns (bool) {\n return timer._deadline == 0;\n }\n\n function isStarted(Timestamp memory timer) internal pure returns (bool) {\n return timer._deadline > 0;\n }\n\n function isPending(Timestamp memory timer) internal view returns (bool) {\n return timer._deadline > block.timestamp;\n }\n\n function isExpired(Timestamp memory timer) internal view returns (bool) {\n return isStarted(timer) && timer._deadline <= block.timestamp;\n }\n\n struct BlockNumber {\n uint64 _deadline;\n }\n\n function getDeadline(BlockNumber memory timer) internal pure returns (uint64) {\n return timer._deadline;\n }\n\n function setDeadline(BlockNumber storage timer, uint64 timestamp) internal {\n timer._deadline = timestamp;\n }\n\n function reset(BlockNumber storage timer) internal {\n timer._deadline = 0;\n }\n\n function isUnset(BlockNumber memory timer) internal pure returns (bool) {\n return timer._deadline == 0;\n }\n\n function isStarted(BlockNumber memory timer) internal pure returns (bool) {\n return timer._deadline > 0;\n }\n\n function isPending(BlockNumber memory timer) internal view returns (bool) {\n return timer._deadline > block.number;\n }\n\n function isExpired(BlockNumber memory timer) internal view returns (bool) {\n return isStarted(timer) && timer._deadline <= block.number;\n }\n}\n" + }, + "@openzeppelin/contracts/governance/IGovernor.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (governance/IGovernor.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Interface of the {Governor} core.\n *\n * _Available since v4.3._\n */\nabstract contract IGovernor is IERC165 {\n enum ProposalState {\n Pending,\n Active,\n Canceled,\n Defeated,\n Succeeded,\n Queued,\n Expired,\n Executed\n }\n\n /**\n * @dev Emitted when a proposal is created.\n */\n event ProposalCreated(\n uint256 proposalId,\n address proposer,\n address[] targets,\n uint256[] values,\n string[] signatures,\n bytes[] calldatas,\n uint256 startBlock,\n uint256 endBlock,\n string description\n );\n\n /**\n * @dev Emitted when a proposal is canceled.\n */\n event ProposalCanceled(uint256 proposalId);\n\n /**\n * @dev Emitted when a proposal is executed.\n */\n event ProposalExecuted(uint256 proposalId);\n\n /**\n * @dev Emitted when a vote is cast.\n *\n * Note: `support` values should be seen as buckets. There interpretation depends on the voting module used.\n */\n event VoteCast(address indexed voter, uint256 proposalId, uint8 support, uint256 weight, string reason);\n\n /**\n * @notice module:core\n * @dev Name of the governor instance (used in building the ERC712 domain separator).\n */\n function name() public view virtual returns (string memory);\n\n /**\n * @notice module:core\n * @dev Version of the governor instance (used in building the ERC712 domain separator). Default: \"1\"\n */\n function version() public view virtual returns (string memory);\n\n /**\n * @notice module:voting\n * @dev A description of the possible `support` values for {castVote} and the way these votes are counted, meant to\n * be consumed by UIs to show correct vote options and interpret the results. The string is a URL-encoded sequence of\n * key-value pairs that each describe one aspect, for example `support=bravo&quorum=for,abstain`.\n *\n * There are 2 standard keys: `support` and `quorum`.\n *\n * - `support=bravo` refers to the vote options 0 = Against, 1 = For, 2 = Abstain, as in `GovernorBravo`.\n * - `quorum=bravo` means that only For votes are counted towards quorum.\n * - `quorum=for,abstain` means that both For and Abstain votes are counted towards quorum.\n *\n * NOTE: The string can be decoded by the standard\n * https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams[`URLSearchParams`]\n * JavaScript class.\n */\n // solhint-disable-next-line func-name-mixedcase\n function COUNTING_MODE() public pure virtual returns (string memory);\n\n /**\n * @notice module:core\n * @dev Hashing function used to (re)build the proposal id from the proposal details..\n */\n function hashProposal(\n address[] calldata targets,\n uint256[] calldata values,\n bytes[] calldata calldatas,\n bytes32 descriptionHash\n ) public pure virtual returns (uint256);\n\n /**\n * @notice module:core\n * @dev Current state of a proposal, following Compound's convention\n */\n function state(uint256 proposalId) public view virtual returns (ProposalState);\n\n /**\n * @notice module:core\n * @dev Block number used to retrieve user's votes and quorum. As per Compound's Comp and OpenZeppelin's\n * ERC20Votes, the snapshot is performed at the end of this block. Hence, voting for this proposal starts at the\n * beginning of the following block.\n */\n function proposalSnapshot(uint256 proposalId) public view virtual returns (uint256);\n\n /**\n * @notice module:core\n * @dev Block number at which votes close. Votes close at the end of this block, so it is possible to cast a vote\n * during this block.\n */\n function proposalDeadline(uint256 proposalId) public view virtual returns (uint256);\n\n /**\n * @notice module:user-config\n * @dev Delay, in number of block, between the proposal is created and the vote starts. This can be increassed to\n * leave time for users to buy voting power, of delegate it, before the voting of a proposal starts.\n */\n function votingDelay() public view virtual returns (uint256);\n\n /**\n * @notice module:user-config\n * @dev Delay, in number of blocks, between the vote start and vote ends.\n *\n * NOTE: The {votingDelay} can delay the start of the vote. This must be considered when setting the voting\n * duration compared to the voting delay.\n */\n function votingPeriod() public view virtual returns (uint256);\n\n /**\n * @notice module:user-config\n * @dev Minimum number of cast voted required for a proposal to be successful.\n *\n * Note: The `blockNumber` parameter corresponds to the snaphot used for counting vote. This allows to scale the\n * quroum depending on values such as the totalSupply of a token at this block (see {ERC20Votes}).\n */\n function quorum(uint256 blockNumber) public view virtual returns (uint256);\n\n /**\n * @notice module:reputation\n * @dev Voting power of an `account` at a specific `blockNumber`.\n *\n * Note: this can be implemented in a number of ways, for example by reading the delegated balance from one (or\n * multiple), {ERC20Votes} tokens.\n */\n function getVotes(address account, uint256 blockNumber) public view virtual returns (uint256);\n\n /**\n * @notice module:voting\n * @dev Returns weither `account` has cast a vote on `proposalId`.\n */\n function hasVoted(uint256 proposalId, address account) public view virtual returns (bool);\n\n /**\n * @dev Create a new proposal. Vote start {IGovernor-votingDelay} blocks after the proposal is created and ends\n * {IGovernor-votingPeriod} blocks after the voting starts.\n *\n * Emits a {ProposalCreated} event.\n */\n function propose(\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n string memory description\n ) public virtual returns (uint256 proposalId);\n\n /**\n * @dev Execute a successful proposal. This requires the quorum to be reached, the vote to be successful, and the\n * deadline to be reached.\n *\n * Emits a {ProposalExecuted} event.\n *\n * Note: some module can modify the requirements for execution, for example by adding an additional timelock.\n */\n function execute(\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n bytes32 descriptionHash\n ) public payable virtual returns (uint256 proposalId);\n\n /**\n * @dev Cast a vote\n *\n * Emits a {VoteCast} event.\n */\n function castVote(uint256 proposalId, uint8 support) public virtual returns (uint256 balance);\n\n /**\n * @dev Cast a vote with a reason\n *\n * Emits a {VoteCast} event.\n */\n function castVoteWithReason(\n uint256 proposalId,\n uint8 support,\n string calldata reason\n ) public virtual returns (uint256 balance);\n\n /**\n * @dev Cast a vote using the user cryptographic signature.\n *\n * Emits a {VoteCast} event.\n */\n function castVoteBySig(\n uint256 proposalId,\n uint8 support,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual returns (uint256 balance);\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n}\n" + }, + "@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" + }, + "contracts/governance/Checkpoints.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\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" + }, + "@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" + }, + "@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" + }, + "@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" + }, + "@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" + }, + "@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" + }, + "@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" + }, + "@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" + }, + "@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" + }, + "@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" + }, + "@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" + }, + "@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" + }, + "@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" + }, + "@openzeppelin/contracts/access/IAccessControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {AccessControl-_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.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 Math {\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" + }, + "@openzeppelin/contracts/governance/extensions/IGovernorTimelock.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (governance/extensions/IGovernorTimelock.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IGovernor.sol\";\n\n/**\n * @dev Extension of the {IGovernor} for timelock supporting modules.\n *\n * _Available since v4.3._\n */\nabstract contract IGovernorTimelock is IGovernor {\n event ProposalQueued(uint256 proposalId, uint256 eta);\n\n function timelock() public view virtual returns (address);\n\n function proposalEta(uint256 proposalId) public view virtual returns (uint256);\n\n function queue(\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n bytes32 descriptionHash\n ) public virtual returns (uint256 proposalId);\n}\n" + }, + "@openzeppelin/contracts/governance/TimelockController.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (governance/TimelockController.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../access/AccessControl.sol\";\n\n/**\n * @dev Contract module which acts as a timelocked controller. When set as the\n * owner of an `Ownable` smart contract, it enforces a timelock on all\n * `onlyOwner` maintenance operations. This gives time for users of the\n * controlled contract to exit before a potentially dangerous maintenance\n * operation is applied.\n *\n * By default, this contract is self administered, meaning administration tasks\n * have to go through the timelock process. The proposer (resp executor) role\n * is in charge of proposing (resp executing) operations. A common use case is\n * to position this {TimelockController} as the owner of a smart contract, with\n * a multisig or a DAO as the sole proposer.\n *\n * _Available since v3.3._\n */\ncontract TimelockController is AccessControl {\n bytes32 public constant TIMELOCK_ADMIN_ROLE = keccak256(\"TIMELOCK_ADMIN_ROLE\");\n bytes32 public constant PROPOSER_ROLE = keccak256(\"PROPOSER_ROLE\");\n bytes32 public constant EXECUTOR_ROLE = keccak256(\"EXECUTOR_ROLE\");\n uint256 internal constant _DONE_TIMESTAMP = uint256(1);\n\n mapping(bytes32 => uint256) private _timestamps;\n uint256 private _minDelay;\n\n /**\n * @dev Emitted when a call is scheduled as part of operation `id`.\n */\n event CallScheduled(\n bytes32 indexed id,\n uint256 indexed index,\n address target,\n uint256 value,\n bytes data,\n bytes32 predecessor,\n uint256 delay\n );\n\n /**\n * @dev Emitted when a call is performed as part of operation `id`.\n */\n event CallExecuted(bytes32 indexed id, uint256 indexed index, address target, uint256 value, bytes data);\n\n /**\n * @dev Emitted when operation `id` is cancelled.\n */\n event Cancelled(bytes32 indexed id);\n\n /**\n * @dev Emitted when the minimum delay for future operations is modified.\n */\n event MinDelayChange(uint256 oldDuration, uint256 newDuration);\n\n /**\n * @dev Initializes the contract with a given `minDelay`.\n */\n constructor(\n uint256 minDelay,\n address[] memory proposers,\n address[] memory executors\n ) {\n _setRoleAdmin(TIMELOCK_ADMIN_ROLE, TIMELOCK_ADMIN_ROLE);\n _setRoleAdmin(PROPOSER_ROLE, TIMELOCK_ADMIN_ROLE);\n _setRoleAdmin(EXECUTOR_ROLE, TIMELOCK_ADMIN_ROLE);\n\n // deployer + self administration\n _setupRole(TIMELOCK_ADMIN_ROLE, _msgSender());\n _setupRole(TIMELOCK_ADMIN_ROLE, address(this));\n\n // register proposers\n for (uint256 i = 0; i < proposers.length; ++i) {\n _setupRole(PROPOSER_ROLE, proposers[i]);\n }\n\n // register executors\n for (uint256 i = 0; i < executors.length; ++i) {\n _setupRole(EXECUTOR_ROLE, executors[i]);\n }\n\n _minDelay = minDelay;\n emit MinDelayChange(0, minDelay);\n }\n\n /**\n * @dev Modifier to make a function callable only by a certain role. In\n * addition to checking the sender's role, `address(0)` 's role is also\n * considered. Granting a role to `address(0)` is equivalent to enabling\n * this role for everyone.\n */\n modifier onlyRoleOrOpenRole(bytes32 role) {\n if (!hasRole(role, address(0))) {\n _checkRole(role, _msgSender());\n }\n _;\n }\n\n /**\n * @dev Contract might receive/hold ETH as part of the maintenance process.\n */\n receive() external payable {}\n\n /**\n * @dev Returns whether an id correspond to a registered operation. This\n * includes both Pending, Ready and Done operations.\n */\n function isOperation(bytes32 id) public view virtual returns (bool pending) {\n return getTimestamp(id) > 0;\n }\n\n /**\n * @dev Returns whether an operation is pending or not.\n */\n function isOperationPending(bytes32 id) public view virtual returns (bool pending) {\n return getTimestamp(id) > _DONE_TIMESTAMP;\n }\n\n /**\n * @dev Returns whether an operation is ready or not.\n */\n function isOperationReady(bytes32 id) public view virtual returns (bool ready) {\n uint256 timestamp = getTimestamp(id);\n return timestamp > _DONE_TIMESTAMP && timestamp <= block.timestamp;\n }\n\n /**\n * @dev Returns whether an operation is done or not.\n */\n function isOperationDone(bytes32 id) public view virtual returns (bool done) {\n return getTimestamp(id) == _DONE_TIMESTAMP;\n }\n\n /**\n * @dev Returns the timestamp at with an operation becomes ready (0 for\n * unset operations, 1 for done operations).\n */\n function getTimestamp(bytes32 id) public view virtual returns (uint256 timestamp) {\n return _timestamps[id];\n }\n\n /**\n * @dev Returns the minimum delay for an operation to become valid.\n *\n * This value can be changed by executing an operation that calls `updateDelay`.\n */\n function getMinDelay() public view virtual returns (uint256 duration) {\n return _minDelay;\n }\n\n /**\n * @dev Returns the identifier of an operation containing a single\n * transaction.\n */\n function hashOperation(\n address target,\n uint256 value,\n bytes calldata data,\n bytes32 predecessor,\n bytes32 salt\n ) public pure virtual returns (bytes32 hash) {\n return keccak256(abi.encode(target, value, data, predecessor, salt));\n }\n\n /**\n * @dev Returns the identifier of an operation containing a batch of\n * transactions.\n */\n function hashOperationBatch(\n address[] calldata targets,\n uint256[] calldata values,\n bytes[] calldata datas,\n bytes32 predecessor,\n bytes32 salt\n ) public pure virtual returns (bytes32 hash) {\n return keccak256(abi.encode(targets, values, datas, predecessor, salt));\n }\n\n /**\n * @dev Schedule an operation containing a single transaction.\n *\n * Emits a {CallScheduled} event.\n *\n * Requirements:\n *\n * - the caller must have the 'proposer' role.\n */\n function schedule(\n address target,\n uint256 value,\n bytes calldata data,\n bytes32 predecessor,\n bytes32 salt,\n uint256 delay\n ) public virtual onlyRole(PROPOSER_ROLE) {\n bytes32 id = hashOperation(target, value, data, predecessor, salt);\n _schedule(id, delay);\n emit CallScheduled(id, 0, target, value, data, predecessor, delay);\n }\n\n /**\n * @dev Schedule an operation containing a batch of transactions.\n *\n * Emits one {CallScheduled} event per transaction in the batch.\n *\n * Requirements:\n *\n * - the caller must have the 'proposer' role.\n */\n function scheduleBatch(\n address[] calldata targets,\n uint256[] calldata values,\n bytes[] calldata datas,\n bytes32 predecessor,\n bytes32 salt,\n uint256 delay\n ) public virtual onlyRole(PROPOSER_ROLE) {\n require(targets.length == values.length, \"TimelockController: length mismatch\");\n require(targets.length == datas.length, \"TimelockController: length mismatch\");\n\n bytes32 id = hashOperationBatch(targets, values, datas, predecessor, salt);\n _schedule(id, delay);\n for (uint256 i = 0; i < targets.length; ++i) {\n emit CallScheduled(id, i, targets[i], values[i], datas[i], predecessor, delay);\n }\n }\n\n /**\n * @dev Schedule an operation that is to becomes valid after a given delay.\n */\n function _schedule(bytes32 id, uint256 delay) private {\n require(!isOperation(id), \"TimelockController: operation already scheduled\");\n require(delay >= getMinDelay(), \"TimelockController: insufficient delay\");\n _timestamps[id] = block.timestamp + delay;\n }\n\n /**\n * @dev Cancel an operation.\n *\n * Requirements:\n *\n * - the caller must have the 'proposer' role.\n */\n function cancel(bytes32 id) public virtual onlyRole(PROPOSER_ROLE) {\n require(isOperationPending(id), \"TimelockController: operation cannot be cancelled\");\n delete _timestamps[id];\n\n emit Cancelled(id);\n }\n\n /**\n * @dev Execute an (ready) operation containing a single transaction.\n *\n * Emits a {CallExecuted} event.\n *\n * Requirements:\n *\n * - the caller must have the 'executor' role.\n */\n function execute(\n address target,\n uint256 value,\n bytes calldata data,\n bytes32 predecessor,\n bytes32 salt\n ) public payable virtual onlyRoleOrOpenRole(EXECUTOR_ROLE) {\n bytes32 id = hashOperation(target, value, data, predecessor, salt);\n _beforeCall(id, predecessor);\n _call(id, 0, target, value, data);\n _afterCall(id);\n }\n\n /**\n * @dev Execute an (ready) operation containing a batch of transactions.\n *\n * Emits one {CallExecuted} event per transaction in the batch.\n *\n * Requirements:\n *\n * - the caller must have the 'executor' role.\n */\n function executeBatch(\n address[] calldata targets,\n uint256[] calldata values,\n bytes[] calldata datas,\n bytes32 predecessor,\n bytes32 salt\n ) public payable virtual onlyRoleOrOpenRole(EXECUTOR_ROLE) {\n require(targets.length == values.length, \"TimelockController: length mismatch\");\n require(targets.length == datas.length, \"TimelockController: length mismatch\");\n\n bytes32 id = hashOperationBatch(targets, values, datas, predecessor, salt);\n _beforeCall(id, predecessor);\n for (uint256 i = 0; i < targets.length; ++i) {\n _call(id, i, targets[i], values[i], datas[i]);\n }\n _afterCall(id);\n }\n\n /**\n * @dev Checks before execution of an operation's calls.\n */\n function _beforeCall(bytes32 id, bytes32 predecessor) private view {\n require(isOperationReady(id), \"TimelockController: operation is not ready\");\n require(predecessor == bytes32(0) || isOperationDone(predecessor), \"TimelockController: missing dependency\");\n }\n\n /**\n * @dev Checks after execution of an operation's calls.\n */\n function _afterCall(bytes32 id) private {\n require(isOperationReady(id), \"TimelockController: operation is not ready\");\n _timestamps[id] = _DONE_TIMESTAMP;\n }\n\n /**\n * @dev Execute an operation's call.\n *\n * Emits a {CallExecuted} event.\n */\n function _call(\n bytes32 id,\n uint256 index,\n address target,\n uint256 value,\n bytes calldata data\n ) private {\n (bool success, ) = target.call{value: value}(data);\n require(success, \"TimelockController: underlying transaction reverted\");\n\n emit CallExecuted(id, index, target, value, data);\n }\n\n /**\n * @dev Changes the minimum timelock duration for future operations.\n *\n * Emits a {MinDelayChange} event.\n *\n * Requirements:\n *\n * - the caller must be the timelock itself. This can only be achieved by scheduling and later executing\n * an operation where the timelock is the target and the data is the ABI-encoded call to this function.\n */\n function updateDelay(uint256 newDelay) external virtual {\n require(msg.sender == address(this), \"TimelockController: caller must be timelock\");\n emit MinDelayChange(_minDelay, newDelay);\n _minDelay = newDelay;\n }\n}\n" + }, + "contracts/governance/TokenholderGovernor.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n\npragma solidity 0.8.9;\n\nimport \"./BaseTokenholderGovernor.sol\";\n\ncontract TokenholderGovernor is BaseTokenholderGovernor {\n uint256 private constant INITIAL_QUORUM_NUMERATOR = 150; // Defined in basis points, i.e., 1.5%\n uint256 private constant INITIAL_PROPOSAL_THRESHOLD_NUMERATOR = 25; // Defined in basis points, i.e., 0.25%\n uint256 private constant INITIAL_VOTING_DELAY =\n 2 days / AVERAGE_BLOCK_TIME_IN_SECONDS;\n uint256 private constant INITIAL_VOTING_PERIOD =\n 10 days / AVERAGE_BLOCK_TIME_IN_SECONDS;\n uint64 private constant INITIAL_VOTING_EXTENSION =\n uint64(2 days) / AVERAGE_BLOCK_TIME_IN_SECONDS;\n\n constructor(\n T _token,\n IVotesHistory _staking,\n TimelockController _timelock,\n address vetoer\n )\n BaseTokenholderGovernor(\n _token,\n _staking,\n _timelock,\n vetoer,\n INITIAL_QUORUM_NUMERATOR,\n INITIAL_PROPOSAL_THRESHOLD_NUMERATOR,\n INITIAL_VOTING_DELAY,\n INITIAL_VOTING_PERIOD,\n INITIAL_VOTING_EXTENSION\n )\n {}\n}\n" + }, + "contracts/test/TestGovernorTestSet.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\npragma solidity 0.8.9;\n\nimport \"../governance/GovernorParameters.sol\";\nimport \"../governance/StakerGovernor.sol\";\nimport \"../governance/TokenholderGovernor.sol\";\nimport \"../token/T.sol\";\n\ncontract TestTokenholderGovernorStub {\n string public name = \"TokenholderGovernor\";\n address public timelock = address(0x42);\n}\n\ncontract TestTokenholderGovernorStubV2 {\n string public name = \"TokenholderGovernor\";\n address public timelock;\n\n constructor(address _timelock) {\n timelock = _timelock;\n }\n}\n\ncontract TestStakerGovernor is StakerGovernor {\n constructor(\n IVotesHistory tStaking,\n TokenholderGovernor tokenholderGov,\n address vetoer\n )\n StakerGovernor(\n tStaking,\n TimelockController(payable(0)),\n tokenholderGov,\n vetoer\n )\n {}\n\n function executor() external view returns (address) {\n return _executor();\n }\n}\n\ncontract TestTokenholderGovernor is BaseTokenholderGovernor {\n uint256 private constant INITIAL_QUORUM_NUMERATOR = 150; // Defined in basis points, i.e., 1.5%\n uint256 private constant INITIAL_PROPOSAL_THRESHOLD_NUMERATOR = 25; // Defined in basis points, i.e., 0.25%\n uint256 private constant INITIAL_VOTING_DELAY = 2;\n uint256 private constant INITIAL_VOTING_PERIOD = 8;\n uint64 private constant INITIAL_VOTING_EXTENSION = 4;\n\n constructor(\n T _tToken,\n IVotesHistory _tStaking,\n TimelockController _timelock,\n address _vetoer\n )\n BaseTokenholderGovernor(\n _tToken,\n _tStaking,\n _timelock,\n _vetoer,\n INITIAL_QUORUM_NUMERATOR,\n INITIAL_PROPOSAL_THRESHOLD_NUMERATOR,\n INITIAL_VOTING_DELAY,\n INITIAL_VOTING_PERIOD,\n INITIAL_VOTING_EXTENSION\n )\n {}\n}\n\ncontract TestGovernorParameters is GovernorParameters {\n address internal executor;\n\n constructor(address executorAddress)\n Governor(\"TestGovernorParameters\")\n GovernorParameters(10, 20, 30, 40)\n {\n executor = executorAddress;\n }\n\n function getVotes(address account, uint256 blockNumber)\n public\n view\n virtual\n override\n returns (uint256)\n {}\n\n function getPastTotalSupply(uint256 blockNumber)\n public\n view\n returns (uint256)\n {}\n\n function hasVoted(uint256 proposalId, address account)\n public\n view\n virtual\n override\n returns (bool)\n {}\n\n // solhint-disable-next-line func-name-mixedcase\n function COUNTING_MODE()\n public\n pure\n virtual\n override\n returns (string memory)\n {}\n\n function _countVote(\n uint256 proposalId,\n address account,\n uint8 support,\n uint256 weight\n ) internal virtual override {}\n\n function _quorumReached(uint256 proposalId)\n internal\n view\n virtual\n override\n returns (bool)\n {}\n\n function _voteSucceeded(uint256 proposalId)\n internal\n view\n virtual\n override\n returns (bool)\n {}\n\n function _getPastTotalSupply(uint256 blockNumber)\n internal\n view\n virtual\n override\n returns (uint256)\n {}\n\n function _executor() internal view virtual override returns (address) {\n return executor;\n }\n}\n" + }, + "contracts/governance/StakerGovernor.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n\npragma solidity 0.8.9;\n\nimport \"./StakerGovernorVotes.sol\";\nimport \"./TokenholderGovernor.sol\";\nimport \"../token/T.sol\";\nimport \"@openzeppelin/contracts/access/AccessControl.sol\";\nimport \"@openzeppelin/contracts/governance/Governor.sol\";\nimport \"@openzeppelin/contracts/governance/extensions/GovernorCountingSimple.sol\";\nimport \"@openzeppelin/contracts/governance/extensions/GovernorVotes.sol\";\nimport \"@openzeppelin/contracts/governance/extensions/GovernorTimelockControl.sol\";\n\ncontract StakerGovernor is\n AccessControl,\n GovernorCountingSimple,\n StakerGovernorVotes,\n GovernorTimelockControl\n{\n uint256 private constant INITIAL_QUORUM_NUMERATOR = 150; // Defined in basis points, i.e., 1.5%\n uint256 private constant INITIAL_PROPOSAL_THRESHOLD_NUMERATOR = 25; // Defined in basis points, i.e., 0.25%\n uint256 private constant INITIAL_VOTING_DELAY =\n 2 days / AVERAGE_BLOCK_TIME_IN_SECONDS;\n uint256 private constant INITIAL_VOTING_PERIOD =\n 10 days / AVERAGE_BLOCK_TIME_IN_SECONDS;\n\n bytes32 public constant VETO_POWER =\n keccak256(\"Power to veto proposals in Threshold's Staker DAO\");\n\n address internal immutable manager;\n\n constructor(\n IVotesHistory _staking,\n TimelockController _timelock,\n TokenholderGovernor tokenholderGovernor,\n address vetoer\n )\n Governor(\"StakerGovernor\")\n GovernorParameters(\n INITIAL_QUORUM_NUMERATOR,\n INITIAL_PROPOSAL_THRESHOLD_NUMERATOR,\n INITIAL_VOTING_DELAY,\n INITIAL_VOTING_PERIOD\n )\n StakerGovernorVotes(_staking)\n GovernorTimelockControl(_timelock)\n {\n require(\n keccak256(bytes(tokenholderGovernor.name())) ==\n keccak256(bytes(\"TokenholderGovernor\")),\n \"Incorrect TokenholderGovernor\"\n );\n manager = tokenholderGovernor.timelock();\n require(manager != address(0), \"No timelock founds\");\n _setupRole(VETO_POWER, vetoer);\n _setupRole(DEFAULT_ADMIN_ROLE, manager);\n }\n\n function cancel(\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n bytes32 descriptionHash\n ) external onlyRole(VETO_POWER) returns (uint256) {\n return _cancel(targets, values, calldatas, descriptionHash);\n }\n\n function propose(\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n string memory description\n ) public override(Governor, IGovernor) returns (uint256) {\n uint256 atLastBlock = block.number - 1;\n require(\n getVotes(msg.sender, atLastBlock) >= proposalThreshold(atLastBlock),\n \"Proposal below threshold\"\n );\n return super.propose(targets, values, calldatas, description);\n }\n\n function quorum(uint256 blockNumber)\n public\n view\n override(IGovernor, GovernorParameters)\n returns (uint256)\n {\n return super.quorum(blockNumber);\n }\n\n function proposalThreshold()\n public\n view\n override(Governor, GovernorParameters)\n returns (uint256)\n {\n return super.proposalThreshold();\n }\n\n function getVotes(address account, uint256 blockNumber)\n public\n view\n override(IGovernor, StakerGovernorVotes)\n returns (uint256)\n {\n return super.getVotes(account, blockNumber);\n }\n\n function state(uint256 proposalId)\n public\n view\n override(Governor, GovernorTimelockControl)\n returns (ProposalState)\n {\n return super.state(proposalId);\n }\n\n function supportsInterface(bytes4 interfaceId)\n public\n view\n override(Governor, GovernorTimelockControl, AccessControl)\n returns (bool)\n {\n return super.supportsInterface(interfaceId);\n }\n\n function _execute(\n uint256 proposalId,\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n bytes32 descriptionHash\n ) internal override(Governor, GovernorTimelockControl) {\n super._execute(proposalId, targets, values, calldatas, descriptionHash);\n }\n\n function _cancel(\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n bytes32 descriptionHash\n ) internal override(Governor, GovernorTimelockControl) returns (uint256) {\n return super._cancel(targets, values, calldatas, descriptionHash);\n }\n\n /// @notice Returns the address of the entity that acts as governance for\n /// this contract.\n /// @dev By default, Governor assumes this is either the Governor contract\n /// itself, or a timelock if there's one configured. We override this\n /// here for the StakerGovernor contract so it's the Tokenholder DAO's\n /// Timelock, which we obtain at constructor time.\n function _executor()\n internal\n view\n override(Governor, GovernorTimelockControl)\n returns (address)\n {\n return manager;\n }\n}\n" + }, + "contracts/governance/StakerGovernorVotes.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n\npragma solidity 0.8.9;\n\nimport \"./GovernorParameters.sol\";\nimport \"./IVotesHistory.sol\";\n\n/// @title StakerGovernorVotes\n/// @notice Staker DAO voting power extraction from staked T positions,\n// including legacy stakes (NU/KEEP).\nabstract contract StakerGovernorVotes is GovernorParameters {\n IVotesHistory public immutable staking;\n\n constructor(IVotesHistory tStakingAddress) {\n staking = tStakingAddress;\n }\n\n /// @notice Read the voting weight from the snapshot mechanism in the T\n /// staking contracts. Note that this also tracks legacy stakes\n /// (NU/KEEP).\n /// @param account Delegate account with T staking voting power\n /// @param blockNumber The block number to get the vote balance at\n /// @dev See {IGovernor-getVotes}\n function getVotes(address account, uint256 blockNumber)\n public\n view\n virtual\n override\n returns (uint256)\n {\n return staking.getPastVotes(account, blockNumber);\n }\n\n /// @notice Compute the total voting power for the Staker DAO.\n /// @param blockNumber The block number to get the voting power at\n function _getPastTotalSupply(uint256 blockNumber)\n internal\n view\n virtual\n override\n returns (uint256)\n {\n return staking.getPastTotalSupply(blockNumber);\n }\n}\n" + }, + "@openzeppelin/contracts/governance/extensions/GovernorVotes.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (governance/extensions/GovernorVotes.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Governor.sol\";\nimport \"../utils/IVotes.sol\";\n\n/**\n * @dev Extension of {Governor} for voting weight extraction from an {ERC20Votes} token, or since v4.5 an {ERC721Votes} token.\n *\n * _Available since v4.3._\n */\nabstract contract GovernorVotes is Governor {\n IVotes public immutable token;\n\n constructor(IVotes tokenAddress) {\n token = tokenAddress;\n }\n\n /**\n * Read the voting weight from the token's built in snapshot mechanism (see {IGovernor-getVotes}).\n */\n function getVotes(address account, uint256 blockNumber) public view virtual override returns (uint256) {\n return token.getPastVotes(account, blockNumber);\n }\n}\n" + }, + "@openzeppelin/contracts/governance/utils/IVotes.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (governance/utils/IVotes.sol)\npragma solidity ^0.8.0;\n\n/**\n * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts.\n *\n * _Available since v4.5._\n */\ninterface IVotes {\n /**\n * @dev Emitted when an account changes their delegate.\n */\n event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);\n\n /**\n * @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of votes.\n */\n event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);\n\n /**\n * @dev Returns the current amount of votes that `account` has.\n */\n function getVotes(address account) external view returns (uint256);\n\n /**\n * @dev Returns the amount of votes that `account` had at the end of a past block (`blockNumber`).\n */\n function getPastVotes(address account, uint256 blockNumber) external view returns (uint256);\n\n /**\n * @dev Returns the total supply of votes available at the end of a past block (`blockNumber`).\n *\n * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.\n * Votes that have not been delegated are still part of total supply, even though they would not participate in a\n * vote.\n */\n function getPastTotalSupply(uint256 blockNumber) external view returns (uint256);\n\n /**\n * @dev Returns the delegate that `account` has chosen.\n */\n function delegates(address account) external view returns (address);\n\n /**\n * @dev Delegates votes from the sender to `delegatee`.\n */\n function delegate(address delegatee) external;\n\n /**\n * @dev Delegates votes from signer to `delegatee`.\n */\n function delegateBySig(\n address delegatee,\n uint256 nonce,\n uint256 expiry,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n}\n" + }, + "contracts/test/TestTokenholderGovernorVotes.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\npragma solidity 0.8.9;\n\nimport \"../governance/TokenholderGovernorVotes.sol\";\nimport \"../token/T.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol\";\n\ncontract TestTokenholderGovernorVotes is TokenholderGovernorVotes {\n constructor(T _tToken, IVotesHistory _tStaking)\n Governor(\"TestTokenholderGovernor\")\n GovernorParameters(125, 75, 12, 34)\n TokenholderGovernorVotes(_tToken, _tStaking)\n {}\n\n function getPastTotalSupply(uint256 blockNumber)\n public\n view\n returns (uint256)\n {\n return _getPastTotalSupply(blockNumber);\n }\n\n function hasVoted(uint256 proposalId, address account)\n public\n view\n virtual\n override\n returns (bool)\n {}\n\n // solhint-disable-next-line func-name-mixedcase\n function COUNTING_MODE()\n public\n pure\n virtual\n override\n returns (string memory)\n {}\n\n function _countVote(\n uint256 proposalId,\n address account,\n uint8 support,\n uint256 weight\n ) internal virtual override {}\n\n function _quorumReached(uint256 proposalId)\n internal\n view\n virtual\n override\n returns (bool)\n {}\n\n function _voteSucceeded(uint256 proposalId)\n internal\n view\n virtual\n override\n returns (bool)\n {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Votes.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./draft-ERC20Permit.sol\";\nimport \"../../../utils/math/Math.sol\";\nimport \"../../../governance/utils/IVotes.sol\";\nimport \"../../../utils/math/SafeCast.sol\";\nimport \"../../../utils/cryptography/ECDSA.sol\";\n\n/**\n * @dev Extension of ERC20 to support Compound-like voting and delegation. This version is more generic than Compound's,\n * and supports token supply up to 2^224^ - 1, while COMP is limited to 2^96^ - 1.\n *\n * NOTE: If exact COMP compatibility is required, use the {ERC20VotesComp} variant of this module.\n *\n * This extension keeps a history (checkpoints) of each account's vote power. Vote power can be delegated either\n * by calling the {delegate} function directly, or by providing a signature to be used with {delegateBySig}. Voting\n * power can be queried through the public accessors {getVotes} and {getPastVotes}.\n *\n * By default, token balance does not account for voting power. This makes transfers cheaper. The downside is that it\n * requires users to delegate to themselves in order to activate checkpoints and have their voting power tracked.\n *\n * _Available since v4.2._\n */\nabstract contract ERC20Votes is IVotes, ERC20Permit {\n struct Checkpoint {\n uint32 fromBlock;\n uint224 votes;\n }\n\n bytes32 private constant _DELEGATION_TYPEHASH =\n keccak256(\"Delegation(address delegatee,uint256 nonce,uint256 expiry)\");\n\n mapping(address => address) private _delegates;\n mapping(address => Checkpoint[]) private _checkpoints;\n Checkpoint[] private _totalSupplyCheckpoints;\n\n /**\n * @dev Get the `pos`-th checkpoint for `account`.\n */\n function checkpoints(address account, uint32 pos) public view virtual returns (Checkpoint memory) {\n return _checkpoints[account][pos];\n }\n\n /**\n * @dev Get number of checkpoints for `account`.\n */\n function numCheckpoints(address account) public view virtual returns (uint32) {\n return SafeCast.toUint32(_checkpoints[account].length);\n }\n\n /**\n * @dev Get the address `account` is currently delegating to.\n */\n function delegates(address account) public view virtual override returns (address) {\n return _delegates[account];\n }\n\n /**\n * @dev Gets the current votes balance for `account`\n */\n function getVotes(address account) public view virtual override returns (uint256) {\n uint256 pos = _checkpoints[account].length;\n return pos == 0 ? 0 : _checkpoints[account][pos - 1].votes;\n }\n\n /**\n * @dev Retrieve the number of votes for `account` at the end of `blockNumber`.\n *\n * Requirements:\n *\n * - `blockNumber` must have been already mined\n */\n function getPastVotes(address account, uint256 blockNumber) public view virtual override returns (uint256) {\n require(blockNumber < block.number, \"ERC20Votes: block not yet mined\");\n return _checkpointsLookup(_checkpoints[account], blockNumber);\n }\n\n /**\n * @dev Retrieve the `totalSupply` at the end of `blockNumber`. Note, this value is the sum of all balances.\n * It is but NOT the sum of all the delegated votes!\n *\n * Requirements:\n *\n * - `blockNumber` must have been already mined\n */\n function getPastTotalSupply(uint256 blockNumber) public view virtual override returns (uint256) {\n require(blockNumber < block.number, \"ERC20Votes: block not yet mined\");\n return _checkpointsLookup(_totalSupplyCheckpoints, blockNumber);\n }\n\n /**\n * @dev Lookup a value in a list of (sorted) checkpoints.\n */\n function _checkpointsLookup(Checkpoint[] storage ckpts, uint256 blockNumber) private view returns (uint256) {\n // We run a binary search to look for the earliest checkpoint taken after `blockNumber`.\n //\n // During the loop, the index of the wanted checkpoint remains in the range [low-1, high).\n // With each iteration, either `low` or `high` is moved towards the middle of the range to maintain the invariant.\n // - If the middle checkpoint is after `blockNumber`, we look in [low, mid)\n // - If the middle checkpoint is before or equal to `blockNumber`, we look in [mid+1, high)\n // Once we reach a single value (when low == high), we've found the right checkpoint at the index high-1, if not\n // out of bounds (in which case we're looking too far in the past and the result is 0).\n // Note that if the latest checkpoint available is exactly for `blockNumber`, we end up with an index that is\n // past the end of the array, so we technically don't find a checkpoint after `blockNumber`, but it works out\n // the same.\n uint256 high = ckpts.length;\n uint256 low = 0;\n while (low < high) {\n uint256 mid = Math.average(low, high);\n if (ckpts[mid].fromBlock > blockNumber) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n\n return high == 0 ? 0 : ckpts[high - 1].votes;\n }\n\n /**\n * @dev Delegate votes from the sender to `delegatee`.\n */\n function delegate(address delegatee) public virtual override {\n _delegate(_msgSender(), delegatee);\n }\n\n /**\n * @dev Delegates votes from signer to `delegatee`\n */\n function delegateBySig(\n address delegatee,\n uint256 nonce,\n uint256 expiry,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual override {\n require(block.timestamp <= expiry, \"ERC20Votes: signature expired\");\n address signer = ECDSA.recover(\n _hashTypedDataV4(keccak256(abi.encode(_DELEGATION_TYPEHASH, delegatee, nonce, expiry))),\n v,\n r,\n s\n );\n require(nonce == _useNonce(signer), \"ERC20Votes: invalid nonce\");\n _delegate(signer, delegatee);\n }\n\n /**\n * @dev Maximum token supply. Defaults to `type(uint224).max` (2^224^ - 1).\n */\n function _maxSupply() internal view virtual returns (uint224) {\n return type(uint224).max;\n }\n\n /**\n * @dev Snapshots the totalSupply after it has been increased.\n */\n function _mint(address account, uint256 amount) internal virtual override {\n super._mint(account, amount);\n require(totalSupply() <= _maxSupply(), \"ERC20Votes: total supply risks overflowing votes\");\n\n _writeCheckpoint(_totalSupplyCheckpoints, _add, amount);\n }\n\n /**\n * @dev Snapshots the totalSupply after it has been decreased.\n */\n function _burn(address account, uint256 amount) internal virtual override {\n super._burn(account, amount);\n\n _writeCheckpoint(_totalSupplyCheckpoints, _subtract, amount);\n }\n\n /**\n * @dev Move voting power when tokens are transferred.\n *\n * Emits a {DelegateVotesChanged} event.\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override {\n super._afterTokenTransfer(from, to, amount);\n\n _moveVotingPower(delegates(from), delegates(to), amount);\n }\n\n /**\n * @dev Change delegation for `delegator` to `delegatee`.\n *\n * Emits events {DelegateChanged} and {DelegateVotesChanged}.\n */\n function _delegate(address delegator, address delegatee) internal virtual {\n address currentDelegate = delegates(delegator);\n uint256 delegatorBalance = balanceOf(delegator);\n _delegates[delegator] = delegatee;\n\n emit DelegateChanged(delegator, currentDelegate, delegatee);\n\n _moveVotingPower(currentDelegate, delegatee, delegatorBalance);\n }\n\n function _moveVotingPower(\n address src,\n address dst,\n uint256 amount\n ) private {\n if (src != dst && amount > 0) {\n if (src != address(0)) {\n (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[src], _subtract, amount);\n emit DelegateVotesChanged(src, oldWeight, newWeight);\n }\n\n if (dst != address(0)) {\n (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[dst], _add, amount);\n emit DelegateVotesChanged(dst, oldWeight, newWeight);\n }\n }\n }\n\n function _writeCheckpoint(\n Checkpoint[] storage ckpts,\n function(uint256, uint256) view returns (uint256) op,\n uint256 delta\n ) private returns (uint256 oldWeight, uint256 newWeight) {\n uint256 pos = ckpts.length;\n oldWeight = pos == 0 ? 0 : ckpts[pos - 1].votes;\n newWeight = op(oldWeight, delta);\n\n if (pos > 0 && ckpts[pos - 1].fromBlock == block.number) {\n ckpts[pos - 1].votes = SafeCast.toUint224(newWeight);\n } else {\n ckpts.push(Checkpoint({fromBlock: SafeCast.toUint32(block.number), votes: SafeCast.toUint224(newWeight)}));\n }\n }\n\n function _add(uint256 a, uint256 b) private pure returns (uint256) {\n return a + b;\n }\n\n function _subtract(uint256 a, uint256 b) private pure returns (uint256) {\n return a - b;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-ERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./draft-IERC20Permit.sol\";\nimport \"../ERC20.sol\";\nimport \"../../../utils/cryptography/draft-EIP712.sol\";\nimport \"../../../utils/cryptography/ECDSA.sol\";\nimport \"../../../utils/Counters.sol\";\n\n/**\n * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * _Available since v3.4._\n */\nabstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 {\n using Counters for Counters.Counter;\n\n mapping(address => Counters.Counter) private _nonces;\n\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private immutable _PERMIT_TYPEHASH =\n keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\n\n /**\n * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `\"1\"`.\n *\n * It's a good idea to use the same `name` that is defined as the ERC20 token name.\n */\n constructor(string memory name) EIP712(name, \"1\") {}\n\n /**\n * @dev See {IERC20Permit-permit}.\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual override {\n require(block.timestamp <= deadline, \"ERC20Permit: expired deadline\");\n\n bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));\n\n bytes32 hash = _hashTypedDataV4(structHash);\n\n address signer = ECDSA.recover(hash, v, r, s);\n require(signer == owner, \"ERC20Permit: invalid signature\");\n\n _approve(owner, spender, value);\n }\n\n /**\n * @dev See {IERC20Permit-nonces}.\n */\n function nonces(address owner) public view virtual override returns (uint256) {\n return _nonces[owner].current();\n }\n\n /**\n * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view override returns (bytes32) {\n return _domainSeparatorV4();\n }\n\n /**\n * @dev \"Consume a nonce\": return the current value and increment.\n *\n * _Available since v4.1._\n */\n function _useNonce(address owner) internal virtual returns (uint256 current) {\n Counters.Counter storage nonce = _nonces[owner];\n current = nonce.current();\n nonce.increment();\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, _allowances[owner][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = _allowances[owner][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _balances[to] += amount;\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Spend `amount` form the allowance of `owner` toward `spender`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/utils/Counters.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary Counters {\n struct Counter {\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n // this feature: see https://github.com/ethereum/solidity/issues/4637\n uint256 _value; // default: 0\n }\n\n function current(Counter storage counter) internal view returns (uint256) {\n return counter._value;\n }\n\n function increment(Counter storage counter) internal {\n unchecked {\n counter._value += 1;\n }\n }\n\n function decrement(Counter storage counter) internal {\n uint256 value = counter._value;\n require(value > 0, \"Counter: decrement overflow\");\n unchecked {\n counter._value = value - 1;\n }\n }\n\n function reset(Counter storage counter) internal {\n counter._value = 0;\n }\n}\n" + }, + "contracts/vending/VendingMachine.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\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" + }, + "contracts/test/TestToken.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\npragma solidity 0.8.9;\n\nimport \"@thesis/solidity-contracts/contracts/token/ERC20WithPermit.sol\";\n\ncontract TestToken is ERC20WithPermit {\n constructor() ERC20WithPermit(\"Test Token\", \"TEST\") {}\n}\n" + }, + "contracts/staking/KeepStake.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\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 staking contract in T staking\n/// contract, it fitst needs to resolve the owner. Resolving liquid\n/// KEEP stake owner is easy. Resolving token grant stake owner is\n/// complicated and not possible to do on-chain from a contract external\n/// to KEEP TokenStaking contract. Keep TokenStaking knows the grant ID\n/// 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" + }, + "contracts/staking/ILegacyTokenStaking.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\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" + }, + "contracts/test/IKeepManagedGrant.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\npragma solidity 0.8.9;\n\nimport \"../staking/KeepStake.sol\";\n\ninterface IKeepManagedGrant is IManagedGrant {\n function stake(\n address stakingContract,\n uint256 amount,\n bytes memory extraData\n ) external;\n}\n" + }, + "contracts/staking/TokenStaking.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\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 address application;\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 /// @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(amount > minTStakeAmount, \"Amount is less than minimum\");\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 Refresh Keep stake owner. Can be called only by the old owner.\n /// @dev The staking provider in T staking contract is the legacy KEEP\n /// staking contract operator.\n function refreshKeepStakeOwner(address stakingProvider) external override {\n StakingProviderInfo storage stakingProviderStruct = stakingProviders[\n stakingProvider\n ];\n require(\n stakingProviderStruct.owner == msg.sender,\n \"Caller is not owner\"\n );\n address newOwner = keepStake.resolveOwner(stakingProvider);\n\n emit OwnerRefreshed(\n stakingProvider,\n stakingProviderStruct.owner,\n newOwner\n );\n stakingProviderStruct.owner = newOwner;\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’s 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 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’s 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’s 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 /// Can be called only by the owner or the 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)\n external\n override\n onlyOwnerOrStakingProvider(stakingProvider)\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 onlyOwnerOrStakingProvider(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 address(0)\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 address(0)\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’s authorizer. Overwrites pending\n /// authorization decrease for the given staking provider and\n /// application.\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 {\n StakingProviderInfo storage stakingProviderStruct = stakingProviders[\n stakingProvider\n ];\n require(\n stakingProviderStruct.owner == msg.sender,\n \"Caller is not owner\"\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(\n stakingProvider,\n amountToSlash.toUint96(),\n msg.sender\n )\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 slashing.application\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 address application\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 if (\n application == address(0) ||\n authorizedApplication == application\n ) {\n authorization.authorized -= MathUpgradeable\n .min(fromAmount, slashedAmount)\n .toUint96();\n } else if (fromAmount <= totalStake) {\n continue;\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" + }, + "contracts/staking/IApplication.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\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 /// @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.\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 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" + }, + "contracts/staking/IStaking.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\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’s private\n/// key and should not require any owner’s keys at all. The stake\n/// delegation optimizes the network throughput without compromising the\n/// security of the owners’ 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 Refresh Keep stake owner. Can be called only by the old owner.\n /// @dev The staking provider in T staking contract is the legacy KEEP\n /// staking contract operator.\n function refreshKeepStakeOwner(address stakingProvider) 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’s authorizer. Overwrites pending\n /// authorization decrease for the given staking provider and\n /// application.\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’s 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’s 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 /// Can be called only by the owner or the 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" + }, + "contracts/utils/PercentUtils.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\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" + }, + "contracts/utils/SafeTUpgradeable.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\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" + }, + "@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" + }, + "@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" + }, + "@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" + }, + "@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" + }, + "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\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 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\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" + }, + "contracts/test/ITestKeepTokenStaking.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\npragma solidity 0.8.9;\n\nimport \"../staking/ILegacyTokenStaking.sol\";\n\ninterface ITestKeepTokenStaking is IKeepTokenStaking {\n function authorizeOperatorContract(\n address operator,\n address operatorContract\n ) external;\n\n function commitTopUp(address operator) external;\n\n function undelegate(address operator) external;\n\n function getLocks(address operator)\n external\n view\n returns (address[] memory creators, uint256[] memory expirations);\n}\n" + }, + "contracts/test/IKeepTokenGrant.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\npragma solidity 0.8.9;\n\nimport \"../staking/ILegacyTokenStaking.sol\";\n\ninterface IKeepTokenGrant {\n function stake(\n uint256 id,\n address stakingContract,\n uint256 amount,\n bytes memory extraData\n ) external;\n}\n" + }, + "contracts/test/TestStakingCheckpoints.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\npragma solidity 0.8.9;\n\nimport \"../governance/Checkpoints.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ncontract TestStakingCheckpoints is Checkpoints {\n mapping(address => uint256) public stake;\n\n /// @notice T token contract.\n IERC20 public immutable tToken;\n\n constructor(IERC20 _tToken) {\n tToken = _tToken;\n }\n\n function deposit(uint256 amount) public {\n stake[msg.sender] += amount;\n writeCheckpoint(_checkpoints[msg.sender], add, amount);\n writeCheckpoint(_totalSupplyCheckpoints, add, amount);\n\n tToken.transferFrom(msg.sender, address(this), amount);\n }\n\n function withdraw(uint256 amount) public {\n require(stake[msg.sender] >= amount, \"Not enough stake to withdraw\");\n stake[msg.sender] -= amount;\n writeCheckpoint(_checkpoints[msg.sender], subtract, amount);\n writeCheckpoint(_totalSupplyCheckpoints, subtract, amount);\n\n tToken.transfer(msg.sender, amount);\n }\n\n function delegate(address delegator, address delegatee)\n internal\n virtual\n override\n {}\n}\n" + }, + "contracts/test/IKeepToken.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\npragma solidity 0.8.9;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ninterface IKeepToken is IERC20 {\n function approveAndCall(\n address spender,\n uint256 value,\n bytes memory extraData\n ) external returns (bool success);\n}\n" + }, + "contracts/test/IKeepRegistry.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\npragma solidity 0.8.9;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ninterface IKeepRegistry {\n function approveOperatorContract(address operatorContract) external;\n\n function registryKeeper() external view returns (address);\n}\n" + }, + "contracts/test/KeepRegistryStub.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\npragma solidity 0.8.9;\n\nimport \"./IKeepRegistry.sol\";\n\ncontract KeepRegistryStub is IKeepRegistry {\n address public registryKeeper;\n\n event OperatorContractApproved(address operatorContract);\n\n constructor() public {\n registryKeeper = msg.sender;\n }\n\n function approveOperatorContract(address operatorContract) external {\n emit OperatorContractApproved(operatorContract);\n }\n}\n" + }, + "contracts/test/TestStakerGovernorVotes.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\npragma solidity 0.8.9;\n\nimport \"../governance/StakerGovernorVotes.sol\";\n\ncontract TestStakerGovernorVotes is StakerGovernorVotes {\n constructor(IVotesHistory _tStaking)\n Governor(\"TestStakerGovernor\")\n GovernorParameters(125, 75, 12, 34)\n StakerGovernorVotes(_tStaking)\n {}\n\n function getPastTotalSupply(uint256 blockNumber)\n public\n view\n returns (uint256)\n {\n return _getPastTotalSupply(blockNumber);\n }\n\n function hasVoted(uint256 proposalId, address account)\n public\n view\n virtual\n override\n returns (bool)\n {}\n\n // solhint-disable-next-line func-name-mixedcase\n function COUNTING_MODE()\n public\n pure\n virtual\n override\n returns (string memory)\n {}\n\n function _countVote(\n uint256 proposalId,\n address account,\n uint8 support,\n uint256 weight\n ) internal virtual override {}\n\n function _quorumReached(uint256 proposalId)\n internal\n view\n virtual\n override\n returns (bool)\n {}\n\n function _voteSucceeded(uint256 proposalId)\n internal\n view\n virtual\n override\n returns (bool)\n {}\n}\n" + }, + "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/ProxyAdmin.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./TransparentUpgradeableProxy.sol\";\nimport \"../../access/Ownable.sol\";\n\n/**\n * @dev This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For an\n * explanation of why you would want to use this see the documentation for {TransparentUpgradeableProxy}.\n */\ncontract ProxyAdmin is Ownable {\n /**\n * @dev Returns the current implementation of `proxy`.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function getProxyImplementation(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"implementation()\")) == 0x5c60da1b\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"5c60da1b\");\n require(success);\n return abi.decode(returndata, (address));\n }\n\n /**\n * @dev Returns the current admin of `proxy`.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function getProxyAdmin(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"admin()\")) == 0xf851a440\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"f851a440\");\n require(success);\n return abi.decode(returndata, (address));\n }\n\n /**\n * @dev Changes the admin of `proxy` to `newAdmin`.\n *\n * Requirements:\n *\n * - This contract must be the current admin of `proxy`.\n */\n function changeProxyAdmin(TransparentUpgradeableProxy proxy, address newAdmin) public virtual onlyOwner {\n proxy.changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrades `proxy` to `implementation`. See {TransparentUpgradeableProxy-upgradeTo}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function upgrade(TransparentUpgradeableProxy proxy, address implementation) public virtual onlyOwner {\n proxy.upgradeTo(implementation);\n }\n\n /**\n * @dev Upgrades `proxy` to `implementation` and calls a function on the new implementation. See\n * {TransparentUpgradeableProxy-upgradeToAndCall}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function upgradeAndCall(\n TransparentUpgradeableProxy proxy,\n address implementation,\n bytes memory data\n ) public payable virtual onlyOwner {\n proxy.upgradeToAndCall{value: msg.value}(implementation, data);\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1967/ERC1967Proxy.sol\";\n\n/**\n * @dev This contract implements a proxy that is upgradeable by an admin.\n *\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\n * clashing], which can potentially be used in an attack, this contract uses the\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\n * things that go hand in hand:\n *\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\n * that call matches one of the admin functions exposed by the proxy itself.\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\n * \"admin cannot fallback to proxy target\".\n *\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\n * to sudden errors when trying to call a function from the proxy implementation.\n *\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\n */\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\n /**\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\n */\n constructor(\n address _logic,\n address admin_,\n bytes memory _data\n ) payable ERC1967Proxy(_logic, _data) {\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\"eip1967.proxy.admin\")) - 1));\n _changeAdmin(admin_);\n }\n\n /**\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\n */\n modifier ifAdmin() {\n if (msg.sender == _getAdmin()) {\n _;\n } else {\n _fallback();\n }\n }\n\n /**\n * @dev Returns the current admin.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\n */\n function admin() external ifAdmin returns (address admin_) {\n admin_ = _getAdmin();\n }\n\n /**\n * @dev Returns the current implementation.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\n */\n function implementation() external ifAdmin returns (address implementation_) {\n implementation_ = _implementation();\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\n */\n function changeAdmin(address newAdmin) external virtual ifAdmin {\n _changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\n */\n function upgradeTo(address newImplementation) external ifAdmin {\n _upgradeToAndCall(newImplementation, bytes(\"\"), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\n * proxied contract.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\n */\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\n _upgradeToAndCall(newImplementation, data, true);\n }\n\n /**\n * @dev Returns the current admin.\n */\n function _admin() internal view virtual returns (address) {\n return _getAdmin();\n }\n\n /**\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\n */\n function _beforeFallback() internal virtual override {\n require(msg.sender != _getAdmin(), \"TransparentUpgradeableProxy: admin cannot fallback to proxy target\");\n super._beforeFallback();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Proxy.sol\";\nimport \"./ERC1967Upgrade.sol\";\n\n/**\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\n * implementation address that can be changed. This address is stored in storage in the location specified by\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\n * implementation behind the proxy.\n */\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\n *\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\n */\n constructor(address _logic, bytes memory _data) payable {\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\"eip1967.proxy.implementation\")) - 1));\n _upgradeToAndCall(_logic, _data, false);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function _implementation() internal view virtual override returns (address impl) {\n return ERC1967Upgrade._getImplementation();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n /**\n * @dev Delegates the current call to `implementation`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\n * and {_fallback} should delegate.\n */\n function _implementation() internal view virtual returns (address);\n\n /**\n * @dev Delegates the current call to the address returned by `_implementation()`.\n *\n * This function does not return to its internall call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\n _beforeFallback();\n _delegate(_implementation());\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\n * is empty.\n */\n receive() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\n * call, or as part of the Solidity `fallback` or `receive` functions.\n *\n * If overriden should call `super._beforeFallback()`.\n */\n function _beforeFallback() internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeacon.sol\";\nimport \"../../interfaces/draft-IERC1822.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/StorageSlot.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967Upgrade {\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Emitted when the beacon is upgraded.\n */\n event BeaconUpgraded(address indexed beacon);\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(Address.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n Address.isContract(IBeacon(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts/interfaces/draft-IERC1822.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822Proxiable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n assembly {\n r.slot := slot\n }\n }\n}\n" + }, + "contracts/governance/ProxyAdminWithDeputy.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\npragma solidity 0.8.9;\n\nimport \"./StakerGovernor.sol\";\nimport \"@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol\";\n\n/// @title ProxyAdminWithDeputy\n/// @notice Based on `ProxyAdmin`, an auxiliary contract in OpenZeppelin's\n/// upgradeability approach meant to act as the admin of a\n/// `TransparentUpgradeableProxy`. This variant allows an additional\n/// actor, the \"deputy\", to perform upgrades, which originally can only\n/// be performed by the ProxyAdmin's owner. See OpenZeppelin's\n/// documentation for `TransparentUpgradeableProxy` for more details on\n/// why a ProxyAdmin is recommended.\ncontract ProxyAdminWithDeputy is ProxyAdmin {\n address public deputy;\n event DeputyUpdated(\n address indexed previousDeputy,\n address indexed newDeputy\n );\n\n modifier onlyOwnerOrDeputy() {\n _checkCallerIsOwnerOrDeputy();\n _;\n }\n\n constructor(StakerGovernor dao, address _deputy) {\n address timelock = dao.timelock();\n require(timelock != address(0), \"DAO doesn't have a Timelock\");\n _setDeputy(_deputy);\n _transferOwnership(timelock);\n }\n\n function setDeputy(address newDeputy) external onlyOwner {\n _setDeputy(newDeputy);\n }\n\n /// @notice Upgrades `proxy` to `implementation`. This contract must be the\n /// admin of `proxy`, and the caller must be this contract's owner\n /// or the deputy.\n function upgrade(TransparentUpgradeableProxy proxy, address implementation)\n public\n virtual\n override\n onlyOwnerOrDeputy\n {\n proxy.upgradeTo(implementation);\n }\n\n /// @notice Upgrades `proxy` to `implementation` and calls a function on the\n /// new implementation. This contract must be the admin of `proxy`,\n /// and the caller must be this contract's owner or the deputy.\n function upgradeAndCall(\n TransparentUpgradeableProxy proxy,\n address implementation,\n bytes memory data\n ) public payable virtual override onlyOwnerOrDeputy {\n proxy.upgradeToAndCall{value: msg.value}(implementation, data);\n }\n\n function _setDeputy(address newDeputy) internal {\n address oldDeputy = deputy;\n deputy = newDeputy;\n emit DeputyUpdated(oldDeputy, newDeputy);\n }\n\n function _checkCallerIsOwnerOrDeputy() internal view {\n address caller = _msgSender();\n require(\n owner() == caller || deputy == caller,\n \"Caller is neither the owner nor the deputy\"\n );\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 10 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/deployments/mainnet/solcInputs/ecfd0a8dc1d11e9f659c5fce34a455a2.json b/deployments/mainnet/solcInputs/ecfd0a8dc1d11e9f659c5fce34a455a2.json new file mode 100644 index 00000000..c39e8b03 --- /dev/null +++ b/deployments/mainnet/solcInputs/ecfd0a8dc1d11e9f659c5fce34a455a2.json @@ -0,0 +1,257 @@ +{ + "language": "Solidity", + "sources": { + "contracts/governance/Checkpoints.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\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" + }, + "contracts/governance/IVotesHistory.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\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" + }, + "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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" + }, + "@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" + }, + "contracts/test/TestStakingCheckpoints.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\npragma solidity 0.8.9;\n\nimport \"../governance/Checkpoints.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ncontract TestStakingCheckpoints is Checkpoints {\n mapping(address => uint256) public stake;\n\n /// @notice T token contract.\n IERC20 public immutable tToken;\n\n constructor(IERC20 _tToken) {\n tToken = _tToken;\n }\n\n function deposit(uint256 amount) public {\n stake[msg.sender] += amount;\n writeCheckpoint(_checkpoints[msg.sender], add, amount);\n writeCheckpoint(_totalSupplyCheckpoints, add, amount);\n\n tToken.transferFrom(msg.sender, address(this), amount);\n }\n\n function withdraw(uint256 amount) public {\n require(stake[msg.sender] >= amount, \"Not enough stake to withdraw\");\n stake[msg.sender] -= amount;\n writeCheckpoint(_checkpoints[msg.sender], subtract, amount);\n writeCheckpoint(_totalSupplyCheckpoints, subtract, amount);\n\n tToken.transfer(msg.sender, amount);\n }\n\n function delegate(address delegator, address delegatee)\n internal\n virtual\n override\n {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, 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 `sender` to `recipient` 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 sender,\n address recipient,\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" + }, + "contracts/test/IKeepToken.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\npragma solidity 0.8.9;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ninterface IKeepToken is IERC20 {\n function approveAndCall(\n address spender,\n uint256 value,\n bytes memory extraData\n ) external returns (bool success);\n}\n" + }, + "contracts/test/IKeepRegistry.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\npragma solidity 0.8.9;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ninterface IKeepRegistry {\n function approveOperatorContract(address operatorContract) external;\n\n function registryKeeper() external view returns (address);\n}\n" + }, + "contracts/vending/VendingMachine.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\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" + }, + "@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" + }, + "@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" + }, + "contracts/token/T.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\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" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\n\npragma solidity ^0.8.0;\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 function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 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" + }, + "@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" + }, + "@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" + }, + "@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" + }, + "@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" + }, + "@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" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/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" + }, + "@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" + }, + "@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" + }, + "@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" + }, + "contracts/test/TestTokenholderGovernorVotes.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\npragma solidity 0.8.9;\n\nimport \"../governance/TokenholderGovernorVotes.sol\";\nimport \"../token/T.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol\";\n\ncontract TestTokenholderGovernorVotes is TokenholderGovernorVotes {\n constructor(T _tToken, IVotesHistory _tStaking)\n Governor(\"TestTokenholderGovernor\")\n GovernorParameters(125, 75, 12, 34)\n TokenholderGovernorVotes(_tToken, _tStaking)\n {}\n\n function getPastTotalSupply(uint256 blockNumber)\n public\n view\n returns (uint256)\n {\n return _getPastTotalSupply(blockNumber);\n }\n\n function hasVoted(uint256 proposalId, address account)\n public\n view\n virtual\n override\n returns (bool)\n {}\n\n // solhint-disable-next-line func-name-mixedcase\n function COUNTING_MODE()\n public\n pure\n virtual\n override\n returns (string memory)\n {}\n\n function _countVote(\n uint256 proposalId,\n address account,\n uint8 support,\n uint256 weight\n ) internal virtual override {}\n\n function _quorumReached(uint256 proposalId)\n internal\n view\n virtual\n override\n returns (bool)\n {}\n\n function _voteSucceeded(uint256 proposalId)\n internal\n view\n virtual\n override\n returns (bool)\n {}\n}\n" + }, + "contracts/governance/TokenholderGovernorVotes.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n\npragma solidity 0.8.9;\n\nimport \"./GovernorParameters.sol\";\nimport \"./IVotesHistory.sol\";\n\n/// @title TokenholderGovernorVotes\n/// @notice Tokenholder DAO voting power extraction from both liquid and staked\n/// T token positions, including legacy stakes (NU/KEEP).\nabstract contract TokenholderGovernorVotes is GovernorParameters {\n IVotesHistory public immutable token;\n IVotesHistory public immutable staking;\n\n constructor(IVotesHistory tokenAddress, IVotesHistory tStakingAddress) {\n token = tokenAddress;\n staking = tStakingAddress;\n }\n\n /// @notice Read the voting weight from the snapshot mechanism in the token\n /// and staking contracts. For Tokenholder DAO, there are currently\n /// two voting power sources:\n /// - Liquid T, tracked by the T token contract\n /// - Stakes in the T network, tracked by the T staking contract.\n /// Note that this also tracks legacy stakes (NU/KEEP); legacy\n /// stakes count for tokenholders' voting power, but not for the\n /// total voting power of the Tokenholder DAO\n /// (see {_getPastTotalSupply}).\n /// @param account Tokenholder account in the T network\n /// @param blockNumber The block number to get the vote balance at\n /// @dev See {IGovernor-getVotes}\n function getVotes(address account, uint256 blockNumber)\n public\n view\n virtual\n override\n returns (uint256)\n {\n uint256 liquidVotes = token.getPastVotes(account, blockNumber);\n uint256 stakedVotes = staking.getPastVotes(account, blockNumber);\n return liquidVotes + stakedVotes;\n }\n\n /// @notice Compute the total voting power for Tokenholder DAO. Note how it\n /// only uses the token total supply as source, as native T tokens\n /// that are staked continue existing, but as deposits in the\n /// staking contract. However, legacy stakes can't contribute to the\n /// total voting power as they're already implicitly counted as part\n /// of Vending Machines' liquid balance; hence, we only need to read\n /// total voting power from the token.\n /// @param blockNumber The block number to get the vote power at\n function _getPastTotalSupply(uint256 blockNumber)\n internal\n view\n virtual\n override\n returns (uint256)\n {\n return token.getPastTotalSupply(blockNumber);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Votes.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./draft-ERC20Permit.sol\";\nimport \"../../../utils/math/Math.sol\";\nimport \"../../../utils/math/SafeCast.sol\";\nimport \"../../../utils/cryptography/ECDSA.sol\";\n\n/**\n * @dev Extension of ERC20 to support Compound-like voting and delegation. This version is more generic than Compound's,\n * and supports token supply up to 2^224^ - 1, while COMP is limited to 2^96^ - 1.\n *\n * NOTE: If exact COMP compatibility is required, use the {ERC20VotesComp} variant of this module.\n *\n * This extension keeps a history (checkpoints) of each account's vote power. Vote power can be delegated either\n * by calling the {delegate} function directly, or by providing a signature to be used with {delegateBySig}. Voting\n * power can be queried through the public accessors {getVotes} and {getPastVotes}.\n *\n * By default, token balance does not account for voting power. This makes transfers cheaper. The downside is that it\n * requires users to delegate to themselves in order to activate checkpoints and have their voting power tracked.\n * Enabling self-delegation can easily be done by overriding the {delegates} function. Keep in mind however that this\n * will significantly increase the base gas cost of transfers.\n *\n * _Available since v4.2._\n */\nabstract contract ERC20Votes is ERC20Permit {\n struct Checkpoint {\n uint32 fromBlock;\n uint224 votes;\n }\n\n bytes32 private constant _DELEGATION_TYPEHASH =\n keccak256(\"Delegation(address delegatee,uint256 nonce,uint256 expiry)\");\n\n mapping(address => address) private _delegates;\n mapping(address => Checkpoint[]) private _checkpoints;\n Checkpoint[] private _totalSupplyCheckpoints;\n\n /**\n * @dev Emitted when an account changes their delegate.\n */\n event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);\n\n /**\n * @dev Emitted when a token transfer or delegate change results in changes to an account's voting power.\n */\n event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);\n\n /**\n * @dev Get the `pos`-th checkpoint for `account`.\n */\n function checkpoints(address account, uint32 pos) public view virtual returns (Checkpoint memory) {\n return _checkpoints[account][pos];\n }\n\n /**\n * @dev Get number of checkpoints for `account`.\n */\n function numCheckpoints(address account) public view virtual returns (uint32) {\n return SafeCast.toUint32(_checkpoints[account].length);\n }\n\n /**\n * @dev Get the address `account` is currently delegating to.\n */\n function delegates(address account) public view virtual returns (address) {\n return _delegates[account];\n }\n\n /**\n * @dev Gets the current votes balance for `account`\n */\n function getVotes(address account) public view returns (uint256) {\n uint256 pos = _checkpoints[account].length;\n return pos == 0 ? 0 : _checkpoints[account][pos - 1].votes;\n }\n\n /**\n * @dev Retrieve the number of votes for `account` at the end of `blockNumber`.\n *\n * Requirements:\n *\n * - `blockNumber` must have been already mined\n */\n function getPastVotes(address account, uint256 blockNumber) public view returns (uint256) {\n require(blockNumber < block.number, \"ERC20Votes: block not yet mined\");\n return _checkpointsLookup(_checkpoints[account], blockNumber);\n }\n\n /**\n * @dev Retrieve the `totalSupply` at the end of `blockNumber`. Note, this value is the sum of all balances.\n * It is but NOT the sum of all the delegated votes!\n *\n * Requirements:\n *\n * - `blockNumber` must have been already mined\n */\n function getPastTotalSupply(uint256 blockNumber) public view returns (uint256) {\n require(blockNumber < block.number, \"ERC20Votes: block not yet mined\");\n return _checkpointsLookup(_totalSupplyCheckpoints, blockNumber);\n }\n\n /**\n * @dev Lookup a value in a list of (sorted) checkpoints.\n */\n function _checkpointsLookup(Checkpoint[] storage ckpts, uint256 blockNumber) private view returns (uint256) {\n // We run a binary search to look for the earliest checkpoint taken after `blockNumber`.\n //\n // During the loop, the index of the wanted checkpoint remains in the range [low-1, high).\n // With each iteration, either `low` or `high` is moved towards the middle of the range to maintain the invariant.\n // - If the middle checkpoint is after `blockNumber`, we look in [low, mid)\n // - If the middle checkpoint is before or equal to `blockNumber`, we look in [mid+1, high)\n // Once we reach a single value (when low == high), we've found the right checkpoint at the index high-1, if not\n // out of bounds (in which case we're looking too far in the past and the result is 0).\n // Note that if the latest checkpoint available is exactly for `blockNumber`, we end up with an index that is\n // past the end of the array, so we technically don't find a checkpoint after `blockNumber`, but it works out\n // the same.\n uint256 high = ckpts.length;\n uint256 low = 0;\n while (low < high) {\n uint256 mid = Math.average(low, high);\n if (ckpts[mid].fromBlock > blockNumber) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n\n return high == 0 ? 0 : ckpts[high - 1].votes;\n }\n\n /**\n * @dev Delegate votes from the sender to `delegatee`.\n */\n function delegate(address delegatee) public virtual {\n _delegate(_msgSender(), delegatee);\n }\n\n /**\n * @dev Delegates votes from signer to `delegatee`\n */\n function delegateBySig(\n address delegatee,\n uint256 nonce,\n uint256 expiry,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual {\n require(block.timestamp <= expiry, \"ERC20Votes: signature expired\");\n address signer = ECDSA.recover(\n _hashTypedDataV4(keccak256(abi.encode(_DELEGATION_TYPEHASH, delegatee, nonce, expiry))),\n v,\n r,\n s\n );\n require(nonce == _useNonce(signer), \"ERC20Votes: invalid nonce\");\n _delegate(signer, delegatee);\n }\n\n /**\n * @dev Maximum token supply. Defaults to `type(uint224).max` (2^224^ - 1).\n */\n function _maxSupply() internal view virtual returns (uint224) {\n return type(uint224).max;\n }\n\n /**\n * @dev Snapshots the totalSupply after it has been increased.\n */\n function _mint(address account, uint256 amount) internal virtual override {\n super._mint(account, amount);\n require(totalSupply() <= _maxSupply(), \"ERC20Votes: total supply risks overflowing votes\");\n\n _writeCheckpoint(_totalSupplyCheckpoints, _add, amount);\n }\n\n /**\n * @dev Snapshots the totalSupply after it has been decreased.\n */\n function _burn(address account, uint256 amount) internal virtual override {\n super._burn(account, amount);\n\n _writeCheckpoint(_totalSupplyCheckpoints, _subtract, amount);\n }\n\n /**\n * @dev Move voting power when tokens are transferred.\n *\n * Emits a {DelegateVotesChanged} event.\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override {\n super._afterTokenTransfer(from, to, amount);\n\n _moveVotingPower(delegates(from), delegates(to), amount);\n }\n\n /**\n * @dev Change delegation for `delegator` to `delegatee`.\n *\n * Emits events {DelegateChanged} and {DelegateVotesChanged}.\n */\n function _delegate(address delegator, address delegatee) internal virtual {\n address currentDelegate = delegates(delegator);\n uint256 delegatorBalance = balanceOf(delegator);\n _delegates[delegator] = delegatee;\n\n emit DelegateChanged(delegator, currentDelegate, delegatee);\n\n _moveVotingPower(currentDelegate, delegatee, delegatorBalance);\n }\n\n function _moveVotingPower(\n address src,\n address dst,\n uint256 amount\n ) private {\n if (src != dst && amount > 0) {\n if (src != address(0)) {\n (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[src], _subtract, amount);\n emit DelegateVotesChanged(src, oldWeight, newWeight);\n }\n\n if (dst != address(0)) {\n (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[dst], _add, amount);\n emit DelegateVotesChanged(dst, oldWeight, newWeight);\n }\n }\n }\n\n function _writeCheckpoint(\n Checkpoint[] storage ckpts,\n function(uint256, uint256) view returns (uint256) op,\n uint256 delta\n ) private returns (uint256 oldWeight, uint256 newWeight) {\n uint256 pos = ckpts.length;\n oldWeight = pos == 0 ? 0 : ckpts[pos - 1].votes;\n newWeight = op(oldWeight, delta);\n\n if (pos > 0 && ckpts[pos - 1].fromBlock == block.number) {\n ckpts[pos - 1].votes = SafeCast.toUint224(newWeight);\n } else {\n ckpts.push(Checkpoint({fromBlock: SafeCast.toUint32(block.number), votes: SafeCast.toUint224(newWeight)}));\n }\n }\n\n function _add(uint256 a, uint256 b) private pure returns (uint256) {\n return a + b;\n }\n\n function _subtract(uint256 a, uint256 b) private pure returns (uint256) {\n return a - b;\n }\n}\n" + }, + "contracts/governance/GovernorParameters.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n\npragma solidity 0.8.9;\n\nimport \"@openzeppelin/contracts/governance/Governor.sol\";\n\n/// @title GovernorParameters\n/// @notice Abstract contract to handle governance parameters\n/// @dev Based on `GovernorVotesQuorumFraction`, but without being opinionated\n/// on what's the source of voting power, and extended to handle proposal\n/// thresholds too. See OpenZeppelin's GovernorVotesQuorumFraction,\n/// GovernorVotes and GovernorSettings for reference.\nabstract contract GovernorParameters is Governor {\n uint256 public constant FRACTION_DENOMINATOR = 10000;\n uint256 internal constant AVERAGE_BLOCK_TIME_IN_SECONDS = 13;\n\n uint256 public quorumNumerator;\n uint256 public proposalThresholdNumerator;\n\n uint256 private _votingDelay;\n uint256 private _votingPeriod;\n\n event QuorumNumeratorUpdated(\n uint256 oldQuorumNumerator,\n uint256 newQuorumNumerator\n );\n\n event ProposalThresholdNumeratorUpdated(\n uint256 oldThresholdNumerator,\n uint256 newThresholdNumerator\n );\n\n event VotingDelaySet(uint256 oldVotingDelay, uint256 newVotingDelay);\n event VotingPeriodSet(uint256 oldVotingPeriod, uint256 newVotingPeriod);\n\n constructor(\n uint256 quorumNumeratorValue,\n uint256 proposalNumeratorValue,\n uint256 initialVotingDelay,\n uint256 initialVotingPeriod\n ) {\n _updateQuorumNumerator(quorumNumeratorValue);\n _updateProposalThresholdNumerator(proposalNumeratorValue);\n _setVotingDelay(initialVotingDelay);\n _setVotingPeriod(initialVotingPeriod);\n }\n\n function updateQuorumNumerator(uint256 newQuorumNumerator)\n external\n virtual\n onlyGovernance\n {\n _updateQuorumNumerator(newQuorumNumerator);\n }\n\n function updateProposalThresholdNumerator(uint256 newNumerator)\n external\n virtual\n onlyGovernance\n {\n _updateProposalThresholdNumerator(newNumerator);\n }\n\n /// @notice Update the voting delay. This operation can only be performed\n /// through a governance proposal. Emits a `VotingDelaySet` event.\n function setVotingDelay(uint256 newVotingDelay)\n external\n virtual\n onlyGovernance\n {\n _setVotingDelay(newVotingDelay);\n }\n\n /// @notice Update the voting period. This operation can only be performed\n /// through a governance proposal. Emits a `VotingPeriodSet` event.\n function setVotingPeriod(uint256 newVotingPeriod)\n external\n virtual\n onlyGovernance\n {\n _setVotingPeriod(newVotingPeriod);\n }\n\n /// @notice Compute the required amount of voting power to reach quorum\n /// @param blockNumber The block number to get the quorum at\n function quorum(uint256 blockNumber)\n public\n view\n virtual\n override\n returns (uint256)\n {\n return\n (_getPastTotalSupply(blockNumber) * quorumNumerator) /\n FRACTION_DENOMINATOR;\n }\n\n /// @notice Compute the required amount of voting power to create a proposal\n /// at the last block height\n /// @dev This function is implemented to comply with Governor API but we\n /// we will actually use `proposalThreshold(uint256 blockNumber)`,\n /// as in our DAOs the threshold amount changes according to supply.\n function proposalThreshold()\n public\n view\n virtual\n override\n returns (uint256)\n {\n return proposalThreshold(block.number - 1);\n }\n\n /// @notice Compute the required amount of voting power to create a proposal\n /// @param blockNumber The block number to get the proposal threshold at\n function proposalThreshold(uint256 blockNumber)\n public\n view\n returns (uint256)\n {\n return\n (_getPastTotalSupply(blockNumber) * proposalThresholdNumerator) /\n FRACTION_DENOMINATOR;\n }\n\n function votingDelay() public view virtual override returns (uint256) {\n return _votingDelay;\n }\n\n function votingPeriod() public view virtual override returns (uint256) {\n return _votingPeriod;\n }\n\n function _updateQuorumNumerator(uint256 newQuorumNumerator)\n internal\n virtual\n {\n require(\n newQuorumNumerator <= FRACTION_DENOMINATOR,\n \"quorumNumerator > Denominator\"\n );\n\n uint256 oldQuorumNumerator = quorumNumerator;\n quorumNumerator = newQuorumNumerator;\n\n emit QuorumNumeratorUpdated(oldQuorumNumerator, newQuorumNumerator);\n }\n\n function _updateProposalThresholdNumerator(uint256 proposalNumerator)\n internal\n virtual\n {\n require(\n proposalNumerator <= FRACTION_DENOMINATOR,\n \"proposalNumerator > Denominator\"\n );\n\n uint256 oldNumerator = proposalThresholdNumerator;\n proposalThresholdNumerator = proposalNumerator;\n\n emit ProposalThresholdNumeratorUpdated(oldNumerator, proposalNumerator);\n }\n\n function _setVotingDelay(uint256 newVotingDelay) internal virtual {\n emit VotingDelaySet(_votingDelay, newVotingDelay);\n _votingDelay = newVotingDelay;\n }\n\n function _setVotingPeriod(uint256 newVotingPeriod) internal virtual {\n // voting period must be at least one block long\n require(newVotingPeriod > 0, \"Voting period too low\");\n emit VotingPeriodSet(_votingPeriod, newVotingPeriod);\n _votingPeriod = newVotingPeriod;\n }\n\n /// @notice Compute the past total voting power at a particular block\n /// @param blockNumber The block number to get the vote power at\n // slither-disable-next-line dead-code\n function _getPastTotalSupply(uint256 blockNumber)\n internal\n view\n virtual\n returns (uint256);\n}\n" + }, + "@openzeppelin/contracts/governance/Governor.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (governance/Governor.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/cryptography/ECDSA.sol\";\nimport \"../utils/cryptography/draft-EIP712.sol\";\nimport \"../utils/introspection/ERC165.sol\";\nimport \"../utils/math/SafeCast.sol\";\nimport \"../utils/Address.sol\";\nimport \"../utils/Context.sol\";\nimport \"../utils/Timers.sol\";\nimport \"./IGovernor.sol\";\n\n/**\n * @dev Core of the governance system, designed to be extended though various modules.\n *\n * This contract is abstract and requires several function to be implemented in various modules:\n *\n * - A counting module must implement {quorum}, {_quorumReached}, {_voteSucceeded} and {_countVote}\n * - A voting module must implement {getVotes}\n * - Additionanly, the {votingPeriod} must also be implemented\n *\n * _Available since v4.3._\n */\nabstract contract Governor is Context, ERC165, EIP712, IGovernor {\n using SafeCast for uint256;\n using Timers for Timers.BlockNumber;\n\n bytes32 public constant BALLOT_TYPEHASH = keccak256(\"Ballot(uint256 proposalId,uint8 support)\");\n\n struct ProposalCore {\n Timers.BlockNumber voteStart;\n Timers.BlockNumber voteEnd;\n bool executed;\n bool canceled;\n }\n\n string private _name;\n\n mapping(uint256 => ProposalCore) private _proposals;\n\n /**\n * @dev Restrict access to governor executing address. Some module might override the _executor function to make\n * sure this modifier is consistant with the execution model.\n */\n modifier onlyGovernance() {\n require(_msgSender() == _executor(), \"Governor: onlyGovernance\");\n _;\n }\n\n /**\n * @dev Sets the value for {name} and {version}\n */\n constructor(string memory name_) EIP712(name_, version()) {\n _name = name_;\n }\n\n /**\n * @dev Function to receive ETH that will be handled by the governor (disabled if executor is a third party contract)\n */\n receive() external payable virtual {\n require(_executor() == address(this));\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) {\n return interfaceId == type(IGovernor).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IGovernor-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IGovernor-version}.\n */\n function version() public view virtual override returns (string memory) {\n return \"1\";\n }\n\n /**\n * @dev See {IGovernor-hashProposal}.\n *\n * The proposal id is produced by hashing the RLC encoded `targets` array, the `values` array, the `calldatas` array\n * and the descriptionHash (bytes32 which itself is the keccak256 hash of the description string). This proposal id\n * can be produced from the proposal data which is part of the {ProposalCreated} event. It can even be computed in\n * advance, before the proposal is submitted.\n *\n * Note that the chainId and the governor address are not part of the proposal id computation. Consequently, the\n * same proposal (with same operation and same description) will have the same id if submitted on multiple governors\n * accross multiple networks. This also means that in order to execute the same operation twice (on the same\n * governor) the proposer will have to change the description in order to avoid proposal id conflicts.\n */\n function hashProposal(\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n bytes32 descriptionHash\n ) public pure virtual override returns (uint256) {\n return uint256(keccak256(abi.encode(targets, values, calldatas, descriptionHash)));\n }\n\n /**\n * @dev See {IGovernor-state}.\n */\n function state(uint256 proposalId) public view virtual override returns (ProposalState) {\n ProposalCore memory proposal = _proposals[proposalId];\n\n if (proposal.executed) {\n return ProposalState.Executed;\n } else if (proposal.canceled) {\n return ProposalState.Canceled;\n } else if (proposal.voteStart.getDeadline() >= block.number) {\n return ProposalState.Pending;\n } else if (proposal.voteEnd.getDeadline() >= block.number) {\n return ProposalState.Active;\n } else if (proposal.voteEnd.isExpired()) {\n return\n _quorumReached(proposalId) && _voteSucceeded(proposalId)\n ? ProposalState.Succeeded\n : ProposalState.Defeated;\n } else {\n revert(\"Governor: unknown proposal id\");\n }\n }\n\n /**\n * @dev See {IGovernor-proposalSnapshot}.\n */\n function proposalSnapshot(uint256 proposalId) public view virtual override returns (uint256) {\n return _proposals[proposalId].voteStart.getDeadline();\n }\n\n /**\n * @dev See {IGovernor-proposalDeadline}.\n */\n function proposalDeadline(uint256 proposalId) public view virtual override returns (uint256) {\n return _proposals[proposalId].voteEnd.getDeadline();\n }\n\n /**\n * @dev Part of the Governor Bravo's interface: _\"The number of votes required in order for a voter to become a proposer\"_.\n */\n function proposalThreshold() public view virtual returns (uint256) {\n return 0;\n }\n\n /**\n * @dev Amount of votes already cast passes the threshold limit.\n */\n function _quorumReached(uint256 proposalId) internal view virtual returns (bool);\n\n /**\n * @dev Is the proposal successful or not.\n */\n function _voteSucceeded(uint256 proposalId) internal view virtual returns (bool);\n\n /**\n * @dev Register a vote with a given support and voting weight.\n *\n * Note: Support is generic and can represent various things depending on the voting system used.\n */\n function _countVote(\n uint256 proposalId,\n address account,\n uint8 support,\n uint256 weight\n ) internal virtual;\n\n /**\n * @dev See {IGovernor-propose}.\n */\n function propose(\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n string memory description\n ) public virtual override returns (uint256) {\n require(\n getVotes(msg.sender, block.number - 1) >= proposalThreshold(),\n \"GovernorCompatibilityBravo: proposer votes below proposal threshold\"\n );\n\n uint256 proposalId = hashProposal(targets, values, calldatas, keccak256(bytes(description)));\n\n require(targets.length == values.length, \"Governor: invalid proposal length\");\n require(targets.length == calldatas.length, \"Governor: invalid proposal length\");\n require(targets.length > 0, \"Governor: empty proposal\");\n\n ProposalCore storage proposal = _proposals[proposalId];\n require(proposal.voteStart.isUnset(), \"Governor: proposal already exists\");\n\n uint64 snapshot = block.number.toUint64() + votingDelay().toUint64();\n uint64 deadline = snapshot + votingPeriod().toUint64();\n\n proposal.voteStart.setDeadline(snapshot);\n proposal.voteEnd.setDeadline(deadline);\n\n emit ProposalCreated(\n proposalId,\n _msgSender(),\n targets,\n values,\n new string[](targets.length),\n calldatas,\n snapshot,\n deadline,\n description\n );\n\n return proposalId;\n }\n\n /**\n * @dev See {IGovernor-execute}.\n */\n function execute(\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n bytes32 descriptionHash\n ) public payable virtual override returns (uint256) {\n uint256 proposalId = hashProposal(targets, values, calldatas, descriptionHash);\n\n ProposalState status = state(proposalId);\n require(\n status == ProposalState.Succeeded || status == ProposalState.Queued,\n \"Governor: proposal not successful\"\n );\n _proposals[proposalId].executed = true;\n\n emit ProposalExecuted(proposalId);\n\n _execute(proposalId, targets, values, calldatas, descriptionHash);\n\n return proposalId;\n }\n\n /**\n * @dev Internal execution mechanism. Can be overriden to implement different execution mechanism\n */\n function _execute(\n uint256, /* proposalId */\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n bytes32 /*descriptionHash*/\n ) internal virtual {\n string memory errorMessage = \"Governor: call reverted without message\";\n for (uint256 i = 0; i < targets.length; ++i) {\n (bool success, bytes memory returndata) = targets[i].call{value: values[i]}(calldatas[i]);\n Address.verifyCallResult(success, returndata, errorMessage);\n }\n }\n\n /**\n * @dev Internal cancel mechanism: locks up the proposal timer, preventing it from being re-submitted. Marks it as\n * canceled to allow distinguishing it from executed proposals.\n *\n * Emits a {IGovernor-ProposalCanceled} event.\n */\n function _cancel(\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n bytes32 descriptionHash\n ) internal virtual returns (uint256) {\n uint256 proposalId = hashProposal(targets, values, calldatas, descriptionHash);\n ProposalState status = state(proposalId);\n\n require(\n status != ProposalState.Canceled && status != ProposalState.Expired && status != ProposalState.Executed,\n \"Governor: proposal not active\"\n );\n _proposals[proposalId].canceled = true;\n\n emit ProposalCanceled(proposalId);\n\n return proposalId;\n }\n\n /**\n * @dev See {IGovernor-castVote}.\n */\n function castVote(uint256 proposalId, uint8 support) public virtual override returns (uint256) {\n address voter = _msgSender();\n return _castVote(proposalId, voter, support, \"\");\n }\n\n /**\n * @dev See {IGovernor-castVoteWithReason}.\n */\n function castVoteWithReason(\n uint256 proposalId,\n uint8 support,\n string calldata reason\n ) public virtual override returns (uint256) {\n address voter = _msgSender();\n return _castVote(proposalId, voter, support, reason);\n }\n\n /**\n * @dev See {IGovernor-castVoteBySig}.\n */\n function castVoteBySig(\n uint256 proposalId,\n uint8 support,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual override returns (uint256) {\n address voter = ECDSA.recover(\n _hashTypedDataV4(keccak256(abi.encode(BALLOT_TYPEHASH, proposalId, support))),\n v,\n r,\n s\n );\n return _castVote(proposalId, voter, support, \"\");\n }\n\n /**\n * @dev Internal vote casting mechanism: Check that the vote is pending, that it has not been cast yet, retrieve\n * voting weight using {IGovernor-getVotes} and call the {_countVote} internal function.\n *\n * Emits a {IGovernor-VoteCast} event.\n */\n function _castVote(\n uint256 proposalId,\n address account,\n uint8 support,\n string memory reason\n ) internal virtual returns (uint256) {\n ProposalCore storage proposal = _proposals[proposalId];\n require(state(proposalId) == ProposalState.Active, \"Governor: vote not currently active\");\n\n uint256 weight = getVotes(account, proposal.voteStart.getDeadline());\n _countVote(proposalId, account, support, weight);\n\n emit VoteCast(account, proposalId, support, weight, reason);\n\n return weight;\n }\n\n /**\n * @dev Address through which the governor executes action. Will be overloaded by module that execute actions\n * through another contract such as a timelock.\n */\n function _executor() internal view virtual returns (address) {\n return address(this);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n } else if (error == RecoverError.InvalidSignatureV) {\n revert(\"ECDSA: invalid signature 'v' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n // Check the signature length\n // - case 65: r,s,v signature (standard)\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else if (signature.length == 64) {\n bytes32 r;\n bytes32 vs;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly {\n r := mload(add(signature, 0x20))\n vs := mload(add(signature, 0x40))\n }\n return tryRecover(hash, r, vs);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s;\n uint8 v;\n assembly {\n s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)\n v := add(shr(255, vs), 27)\n }\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n if (v != 27 && v != 28) {\n return (address(0), RecoverError.InvalidSignatureV);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSA.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * _Available since v3.4._\n */\nabstract contract EIP712 {\n /* solhint-disable var-name-mixedcase */\n // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to\n // invalidate the cached domain separator if the chain id changes.\n bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;\n uint256 private immutable _CACHED_CHAIN_ID;\n address private immutable _CACHED_THIS;\n\n bytes32 private immutable _HASHED_NAME;\n bytes32 private immutable _HASHED_VERSION;\n bytes32 private immutable _TYPE_HASH;\n\n /* solhint-enable var-name-mixedcase */\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n constructor(string memory name, string memory version) {\n bytes32 hashedName = keccak256(bytes(name));\n bytes32 hashedVersion = keccak256(bytes(version));\n bytes32 typeHash = keccak256(\n \"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"\n );\n _HASHED_NAME = hashedName;\n _HASHED_VERSION = hashedVersion;\n _CACHED_CHAIN_ID = block.chainid;\n _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);\n _CACHED_THIS = address(this);\n _TYPE_HASH = typeHash;\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {\n return _CACHED_DOMAIN_SEPARATOR;\n } else {\n return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);\n }\n }\n\n function _buildDomainSeparator(\n bytes32 typeHash,\n bytes32 nameHash,\n bytes32 versionHash\n ) private view returns (bytes32) {\n return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Timers.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Timers.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Tooling for timepoints, timers and delays\n */\nlibrary Timers {\n struct Timestamp {\n uint64 _deadline;\n }\n\n function getDeadline(Timestamp memory timer) internal pure returns (uint64) {\n return timer._deadline;\n }\n\n function setDeadline(Timestamp storage timer, uint64 timestamp) internal {\n timer._deadline = timestamp;\n }\n\n function reset(Timestamp storage timer) internal {\n timer._deadline = 0;\n }\n\n function isUnset(Timestamp memory timer) internal pure returns (bool) {\n return timer._deadline == 0;\n }\n\n function isStarted(Timestamp memory timer) internal pure returns (bool) {\n return timer._deadline > 0;\n }\n\n function isPending(Timestamp memory timer) internal view returns (bool) {\n return timer._deadline > block.timestamp;\n }\n\n function isExpired(Timestamp memory timer) internal view returns (bool) {\n return isStarted(timer) && timer._deadline <= block.timestamp;\n }\n\n struct BlockNumber {\n uint64 _deadline;\n }\n\n function getDeadline(BlockNumber memory timer) internal pure returns (uint64) {\n return timer._deadline;\n }\n\n function setDeadline(BlockNumber storage timer, uint64 timestamp) internal {\n timer._deadline = timestamp;\n }\n\n function reset(BlockNumber storage timer) internal {\n timer._deadline = 0;\n }\n\n function isUnset(BlockNumber memory timer) internal pure returns (bool) {\n return timer._deadline == 0;\n }\n\n function isStarted(BlockNumber memory timer) internal pure returns (bool) {\n return timer._deadline > 0;\n }\n\n function isPending(BlockNumber memory timer) internal view returns (bool) {\n return timer._deadline > block.number;\n }\n\n function isExpired(BlockNumber memory timer) internal view returns (bool) {\n return isStarted(timer) && timer._deadline <= block.number;\n }\n}\n" + }, + "@openzeppelin/contracts/governance/IGovernor.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (governance/IGovernor.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Interface of the {Governor} core.\n *\n * _Available since v4.3._\n */\nabstract contract IGovernor is IERC165 {\n enum ProposalState {\n Pending,\n Active,\n Canceled,\n Defeated,\n Succeeded,\n Queued,\n Expired,\n Executed\n }\n\n /**\n * @dev Emitted when a proposal is created.\n */\n event ProposalCreated(\n uint256 proposalId,\n address proposer,\n address[] targets,\n uint256[] values,\n string[] signatures,\n bytes[] calldatas,\n uint256 startBlock,\n uint256 endBlock,\n string description\n );\n\n /**\n * @dev Emitted when a proposal is canceled.\n */\n event ProposalCanceled(uint256 proposalId);\n\n /**\n * @dev Emitted when a proposal is executed.\n */\n event ProposalExecuted(uint256 proposalId);\n\n /**\n * @dev Emitted when a vote is cast.\n *\n * Note: `support` values should be seen as buckets. There interpretation depends on the voting module used.\n */\n event VoteCast(address indexed voter, uint256 proposalId, uint8 support, uint256 weight, string reason);\n\n /**\n * @notice module:core\n * @dev Name of the governor instance (used in building the ERC712 domain separator).\n */\n function name() public view virtual returns (string memory);\n\n /**\n * @notice module:core\n * @dev Version of the governor instance (used in building the ERC712 domain separator). Default: \"1\"\n */\n function version() public view virtual returns (string memory);\n\n /**\n * @notice module:voting\n * @dev A description of the possible `support` values for {castVote} and the way these votes are counted, meant to\n * be consumed by UIs to show correct vote options and interpret the results. The string is a URL-encoded sequence of\n * key-value pairs that each describe one aspect, for example `support=bravo&quorum=for,abstain`.\n *\n * There are 2 standard keys: `support` and `quorum`.\n *\n * - `support=bravo` refers to the vote options 0 = Against, 1 = For, 2 = Abstain, as in `GovernorBravo`.\n * - `quorum=bravo` means that only For votes are counted towards quorum.\n * - `quorum=for,abstain` means that both For and Abstain votes are counted towards quorum.\n *\n * NOTE: The string can be decoded by the standard\n * https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams[`URLSearchParams`]\n * JavaScript class.\n */\n // solhint-disable-next-line func-name-mixedcase\n function COUNTING_MODE() public pure virtual returns (string memory);\n\n /**\n * @notice module:core\n * @dev Hashing function used to (re)build the proposal id from the proposal details..\n */\n function hashProposal(\n address[] calldata targets,\n uint256[] calldata values,\n bytes[] calldata calldatas,\n bytes32 descriptionHash\n ) public pure virtual returns (uint256);\n\n /**\n * @notice module:core\n * @dev Current state of a proposal, following Compound's convention\n */\n function state(uint256 proposalId) public view virtual returns (ProposalState);\n\n /**\n * @notice module:core\n * @dev Block number used to retrieve user's votes and quorum. As per Compound's Comp and OpenZeppelin's\n * ERC20Votes, the snapshot is performed at the end of this block. Hence, voting for this proposal starts at the\n * beginning of the following block.\n */\n function proposalSnapshot(uint256 proposalId) public view virtual returns (uint256);\n\n /**\n * @notice module:core\n * @dev Block number at which votes close. Votes close at the end of this block, so it is possible to cast a vote\n * during this block.\n */\n function proposalDeadline(uint256 proposalId) public view virtual returns (uint256);\n\n /**\n * @notice module:user-config\n * @dev Delay, in number of block, between the proposal is created and the vote starts. This can be increassed to\n * leave time for users to buy voting power, of delegate it, before the voting of a proposal starts.\n */\n function votingDelay() public view virtual returns (uint256);\n\n /**\n * @notice module:user-config\n * @dev Delay, in number of blocks, between the vote start and vote ends.\n *\n * NOTE: The {votingDelay} can delay the start of the vote. This must be considered when setting the voting\n * duration compared to the voting delay.\n */\n function votingPeriod() public view virtual returns (uint256);\n\n /**\n * @notice module:user-config\n * @dev Minimum number of cast voted required for a proposal to be successful.\n *\n * Note: The `blockNumber` parameter corresponds to the snaphot used for counting vote. This allows to scale the\n * quroum depending on values such as the totalSupply of a token at this block (see {ERC20Votes}).\n */\n function quorum(uint256 blockNumber) public view virtual returns (uint256);\n\n /**\n * @notice module:reputation\n * @dev Voting power of an `account` at a specific `blockNumber`.\n *\n * Note: this can be implemented in a number of ways, for example by reading the delegated balance from one (or\n * multiple), {ERC20Votes} tokens.\n */\n function getVotes(address account, uint256 blockNumber) public view virtual returns (uint256);\n\n /**\n * @notice module:voting\n * @dev Returns weither `account` has cast a vote on `proposalId`.\n */\n function hasVoted(uint256 proposalId, address account) public view virtual returns (bool);\n\n /**\n * @dev Create a new proposal. Vote start {IGovernor-votingDelay} blocks after the proposal is created and ends\n * {IGovernor-votingPeriod} blocks after the voting starts.\n *\n * Emits a {ProposalCreated} event.\n */\n function propose(\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n string memory description\n ) public virtual returns (uint256 proposalId);\n\n /**\n * @dev Execute a successful proposal. This requires the quorum to be reached, the vote to be successful, and the\n * deadline to be reached.\n *\n * Emits a {ProposalExecuted} event.\n *\n * Note: some module can modify the requirements for execution, for example by adding an additional timelock.\n */\n function execute(\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n bytes32 descriptionHash\n ) public payable virtual returns (uint256 proposalId);\n\n /**\n * @dev Cast a vote\n *\n * Emits a {VoteCast} event.\n */\n function castVote(uint256 proposalId, uint8 support) public virtual returns (uint256 balance);\n\n /**\n * @dev Cast a with a reason\n *\n * Emits a {VoteCast} event.\n */\n function castVoteWithReason(\n uint256 proposalId,\n uint8 support,\n string calldata reason\n ) public virtual returns (uint256 balance);\n\n /**\n * @dev Cast a vote using the user cryptographic signature.\n *\n * Emits a {VoteCast} event.\n */\n function castVoteBySig(\n uint256 proposalId,\n uint8 support,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual returns (uint256 balance);\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-ERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./draft-IERC20Permit.sol\";\nimport \"../ERC20.sol\";\nimport \"../../../utils/cryptography/draft-EIP712.sol\";\nimport \"../../../utils/cryptography/ECDSA.sol\";\nimport \"../../../utils/Counters.sol\";\n\n/**\n * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * _Available since v3.4._\n */\nabstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 {\n using Counters for Counters.Counter;\n\n mapping(address => Counters.Counter) private _nonces;\n\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private immutable _PERMIT_TYPEHASH =\n keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\n\n /**\n * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `\"1\"`.\n *\n * It's a good idea to use the same `name` that is defined as the ERC20 token name.\n */\n constructor(string memory name) EIP712(name, \"1\") {}\n\n /**\n * @dev See {IERC20Permit-permit}.\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual override {\n require(block.timestamp <= deadline, \"ERC20Permit: expired deadline\");\n\n bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));\n\n bytes32 hash = _hashTypedDataV4(structHash);\n\n address signer = ECDSA.recover(hash, v, r, s);\n require(signer == owner, \"ERC20Permit: invalid signature\");\n\n _approve(owner, spender, value);\n }\n\n /**\n * @dev See {IERC20Permit-nonces}.\n */\n function nonces(address owner) public view virtual override returns (uint256) {\n return _nonces[owner].current();\n }\n\n /**\n * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view override returns (bytes32) {\n return _domainSeparatorV4();\n }\n\n /**\n * @dev \"Consume a nonce\": return the current value and increment.\n *\n * _Available since v4.1._\n */\n function _useNonce(address owner) internal virtual returns (uint256 current) {\n Counters.Counter storage nonce = _nonces[owner];\n current = nonce.current();\n nonce.increment();\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n /**\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" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n require(currentAllowance >= amount, \"ERC20: transfer amount exceeds allowance\");\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n require(senderBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/utils/Counters.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary Counters {\n struct Counter {\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n // this feature: see https://github.com/ethereum/solidity/issues/4637\n uint256 _value; // default: 0\n }\n\n function current(Counter storage counter) internal view returns (uint256) {\n return counter._value;\n }\n\n function increment(Counter storage counter) internal {\n unchecked {\n counter._value += 1;\n }\n }\n\n function decrement(Counter storage counter) internal {\n uint256 value = counter._value;\n require(value > 0, \"Counter: decrement overflow\");\n unchecked {\n counter._value = value - 1;\n }\n }\n\n function reset(Counter storage counter) internal {\n counter._value = 0;\n }\n}\n" + }, + "@openzeppelin/contracts/governance/extensions/GovernorTimelockControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (governance/extensions/GovernorTimelockControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IGovernorTimelock.sol\";\nimport \"../Governor.sol\";\nimport \"../TimelockController.sol\";\n\n/**\n * @dev Extension of {Governor} that binds the execution process to an instance of {TimelockController}. This adds a\n * delay, enforced by the {TimelockController} to all successful proposal (in addition to the voting duration). The\n * {Governor} needs the proposer (an ideally the executor) roles for the {Governor} to work properly.\n *\n * Using this model means the proposal will be operated by the {TimelockController} and not by the {Governor}. Thus,\n * the assets and permissions must be attached to the {TimelockController}. Any asset sent to the {Governor} will be\n * inaccessible.\n *\n * _Available since v4.3._\n */\nabstract contract GovernorTimelockControl is IGovernorTimelock, Governor {\n TimelockController private _timelock;\n mapping(uint256 => bytes32) private _timelockIds;\n\n /**\n * @dev Emitted when the timelock controller used for proposal execution is modified.\n */\n event TimelockChange(address oldTimelock, address newTimelock);\n\n /**\n * @dev Set the timelock.\n */\n constructor(TimelockController timelockAddress) {\n _updateTimelock(timelockAddress);\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, Governor) returns (bool) {\n return interfaceId == type(IGovernorTimelock).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Overriden version of the {Governor-state} function with added support for the `Queued` status.\n */\n function state(uint256 proposalId) public view virtual override(IGovernor, Governor) returns (ProposalState) {\n ProposalState status = super.state(proposalId);\n\n if (status != ProposalState.Succeeded) {\n return status;\n }\n\n // core tracks execution, so we just have to check if successful proposal have been queued.\n bytes32 queueid = _timelockIds[proposalId];\n if (queueid == bytes32(0)) {\n return status;\n } else if (_timelock.isOperationDone(queueid)) {\n return ProposalState.Executed;\n } else {\n return ProposalState.Queued;\n }\n }\n\n /**\n * @dev Public accessor to check the address of the timelock\n */\n function timelock() public view virtual override returns (address) {\n return address(_timelock);\n }\n\n /**\n * @dev Public accessor to check the eta of a queued proposal\n */\n function proposalEta(uint256 proposalId) public view virtual override returns (uint256) {\n uint256 eta = _timelock.getTimestamp(_timelockIds[proposalId]);\n return eta == 1 ? 0 : eta; // _DONE_TIMESTAMP (1) should be replaced with a 0 value\n }\n\n /**\n * @dev Function to queue a proposal to the timelock.\n */\n function queue(\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n bytes32 descriptionHash\n ) public virtual override returns (uint256) {\n uint256 proposalId = hashProposal(targets, values, calldatas, descriptionHash);\n\n require(state(proposalId) == ProposalState.Succeeded, \"Governor: proposal not successful\");\n\n uint256 delay = _timelock.getMinDelay();\n _timelockIds[proposalId] = _timelock.hashOperationBatch(targets, values, calldatas, 0, descriptionHash);\n _timelock.scheduleBatch(targets, values, calldatas, 0, descriptionHash, delay);\n\n emit ProposalQueued(proposalId, block.timestamp + delay);\n\n return proposalId;\n }\n\n /**\n * @dev Overriden execute function that run the already queued proposal through the timelock.\n */\n function _execute(\n uint256, /* proposalId */\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n bytes32 descriptionHash\n ) internal virtual override {\n _timelock.executeBatch{value: msg.value}(targets, values, calldatas, 0, descriptionHash);\n }\n\n /**\n * @dev Overriden version of the {Governor-_cancel} function to cancel the timelocked proposal if it as already\n * been queued.\n */\n function _cancel(\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n bytes32 descriptionHash\n ) internal virtual override returns (uint256) {\n uint256 proposalId = super._cancel(targets, values, calldatas, descriptionHash);\n\n if (_timelockIds[proposalId] != 0) {\n _timelock.cancel(_timelockIds[proposalId]);\n delete _timelockIds[proposalId];\n }\n\n return proposalId;\n }\n\n /**\n * @dev Address through which the governor executes action. In this case, the timelock.\n */\n function _executor() internal view virtual override returns (address) {\n return address(_timelock);\n }\n\n /**\n * @dev Public endpoint to update the underlying timelock instance. Restricted to the timelock itself, so updates\n * must be proposed, scheduled and executed using the {Governor} workflow.\n */\n function updateTimelock(TimelockController newTimelock) external virtual onlyGovernance {\n _updateTimelock(newTimelock);\n }\n\n function _updateTimelock(TimelockController newTimelock) private {\n emit TimelockChange(address(_timelock), address(newTimelock));\n _timelock = newTimelock;\n }\n}\n" + }, + "@openzeppelin/contracts/governance/extensions/IGovernorTimelock.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (governance/extensions/IGovernorTimelock.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IGovernor.sol\";\n\n/**\n * @dev Extension of the {IGovernor} for timelock supporting modules.\n *\n * _Available since v4.3._\n */\nabstract contract IGovernorTimelock is IGovernor {\n event ProposalQueued(uint256 proposalId, uint256 eta);\n\n function timelock() public view virtual returns (address);\n\n function proposalEta(uint256 proposalId) public view virtual returns (uint256);\n\n function queue(\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n bytes32 descriptionHash\n ) public virtual returns (uint256 proposalId);\n}\n" + }, + "@openzeppelin/contracts/governance/TimelockController.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (governance/TimelockController.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../access/AccessControl.sol\";\n\n/**\n * @dev Contract module which acts as a timelocked controller. When set as the\n * owner of an `Ownable` smart contract, it enforces a timelock on all\n * `onlyOwner` maintenance operations. This gives time for users of the\n * controlled contract to exit before a potentially dangerous maintenance\n * operation is applied.\n *\n * By default, this contract is self administered, meaning administration tasks\n * have to go through the timelock process. The proposer (resp executor) role\n * is in charge of proposing (resp executing) operations. A common use case is\n * to position this {TimelockController} as the owner of a smart contract, with\n * a multisig or a DAO as the sole proposer.\n *\n * _Available since v3.3._\n */\ncontract TimelockController is AccessControl {\n bytes32 public constant TIMELOCK_ADMIN_ROLE = keccak256(\"TIMELOCK_ADMIN_ROLE\");\n bytes32 public constant PROPOSER_ROLE = keccak256(\"PROPOSER_ROLE\");\n bytes32 public constant EXECUTOR_ROLE = keccak256(\"EXECUTOR_ROLE\");\n uint256 internal constant _DONE_TIMESTAMP = uint256(1);\n\n mapping(bytes32 => uint256) private _timestamps;\n uint256 private _minDelay;\n\n /**\n * @dev Emitted when a call is scheduled as part of operation `id`.\n */\n event CallScheduled(\n bytes32 indexed id,\n uint256 indexed index,\n address target,\n uint256 value,\n bytes data,\n bytes32 predecessor,\n uint256 delay\n );\n\n /**\n * @dev Emitted when a call is performed as part of operation `id`.\n */\n event CallExecuted(bytes32 indexed id, uint256 indexed index, address target, uint256 value, bytes data);\n\n /**\n * @dev Emitted when operation `id` is cancelled.\n */\n event Cancelled(bytes32 indexed id);\n\n /**\n * @dev Emitted when the minimum delay for future operations is modified.\n */\n event MinDelayChange(uint256 oldDuration, uint256 newDuration);\n\n /**\n * @dev Initializes the contract with a given `minDelay`.\n */\n constructor(\n uint256 minDelay,\n address[] memory proposers,\n address[] memory executors\n ) {\n _setRoleAdmin(TIMELOCK_ADMIN_ROLE, TIMELOCK_ADMIN_ROLE);\n _setRoleAdmin(PROPOSER_ROLE, TIMELOCK_ADMIN_ROLE);\n _setRoleAdmin(EXECUTOR_ROLE, TIMELOCK_ADMIN_ROLE);\n\n // deployer + self administration\n _setupRole(TIMELOCK_ADMIN_ROLE, _msgSender());\n _setupRole(TIMELOCK_ADMIN_ROLE, address(this));\n\n // register proposers\n for (uint256 i = 0; i < proposers.length; ++i) {\n _setupRole(PROPOSER_ROLE, proposers[i]);\n }\n\n // register executors\n for (uint256 i = 0; i < executors.length; ++i) {\n _setupRole(EXECUTOR_ROLE, executors[i]);\n }\n\n _minDelay = minDelay;\n emit MinDelayChange(0, minDelay);\n }\n\n /**\n * @dev Modifier to make a function callable only by a certain role. In\n * addition to checking the sender's role, `address(0)` 's role is also\n * considered. Granting a role to `address(0)` is equivalent to enabling\n * this role for everyone.\n */\n modifier onlyRoleOrOpenRole(bytes32 role) {\n if (!hasRole(role, address(0))) {\n _checkRole(role, _msgSender());\n }\n _;\n }\n\n /**\n * @dev Contract might receive/hold ETH as part of the maintenance process.\n */\n receive() external payable {}\n\n /**\n * @dev Returns whether an id correspond to a registered operation. This\n * includes both Pending, Ready and Done operations.\n */\n function isOperation(bytes32 id) public view virtual returns (bool pending) {\n return getTimestamp(id) > 0;\n }\n\n /**\n * @dev Returns whether an operation is pending or not.\n */\n function isOperationPending(bytes32 id) public view virtual returns (bool pending) {\n return getTimestamp(id) > _DONE_TIMESTAMP;\n }\n\n /**\n * @dev Returns whether an operation is ready or not.\n */\n function isOperationReady(bytes32 id) public view virtual returns (bool ready) {\n uint256 timestamp = getTimestamp(id);\n return timestamp > _DONE_TIMESTAMP && timestamp <= block.timestamp;\n }\n\n /**\n * @dev Returns whether an operation is done or not.\n */\n function isOperationDone(bytes32 id) public view virtual returns (bool done) {\n return getTimestamp(id) == _DONE_TIMESTAMP;\n }\n\n /**\n * @dev Returns the timestamp at with an operation becomes ready (0 for\n * unset operations, 1 for done operations).\n */\n function getTimestamp(bytes32 id) public view virtual returns (uint256 timestamp) {\n return _timestamps[id];\n }\n\n /**\n * @dev Returns the minimum delay for an operation to become valid.\n *\n * This value can be changed by executing an operation that calls `updateDelay`.\n */\n function getMinDelay() public view virtual returns (uint256 duration) {\n return _minDelay;\n }\n\n /**\n * @dev Returns the identifier of an operation containing a single\n * transaction.\n */\n function hashOperation(\n address target,\n uint256 value,\n bytes calldata data,\n bytes32 predecessor,\n bytes32 salt\n ) public pure virtual returns (bytes32 hash) {\n return keccak256(abi.encode(target, value, data, predecessor, salt));\n }\n\n /**\n * @dev Returns the identifier of an operation containing a batch of\n * transactions.\n */\n function hashOperationBatch(\n address[] calldata targets,\n uint256[] calldata values,\n bytes[] calldata datas,\n bytes32 predecessor,\n bytes32 salt\n ) public pure virtual returns (bytes32 hash) {\n return keccak256(abi.encode(targets, values, datas, predecessor, salt));\n }\n\n /**\n * @dev Schedule an operation containing a single transaction.\n *\n * Emits a {CallScheduled} event.\n *\n * Requirements:\n *\n * - the caller must have the 'proposer' role.\n */\n function schedule(\n address target,\n uint256 value,\n bytes calldata data,\n bytes32 predecessor,\n bytes32 salt,\n uint256 delay\n ) public virtual onlyRole(PROPOSER_ROLE) {\n bytes32 id = hashOperation(target, value, data, predecessor, salt);\n _schedule(id, delay);\n emit CallScheduled(id, 0, target, value, data, predecessor, delay);\n }\n\n /**\n * @dev Schedule an operation containing a batch of transactions.\n *\n * Emits one {CallScheduled} event per transaction in the batch.\n *\n * Requirements:\n *\n * - the caller must have the 'proposer' role.\n */\n function scheduleBatch(\n address[] calldata targets,\n uint256[] calldata values,\n bytes[] calldata datas,\n bytes32 predecessor,\n bytes32 salt,\n uint256 delay\n ) public virtual onlyRole(PROPOSER_ROLE) {\n require(targets.length == values.length, \"TimelockController: length mismatch\");\n require(targets.length == datas.length, \"TimelockController: length mismatch\");\n\n bytes32 id = hashOperationBatch(targets, values, datas, predecessor, salt);\n _schedule(id, delay);\n for (uint256 i = 0; i < targets.length; ++i) {\n emit CallScheduled(id, i, targets[i], values[i], datas[i], predecessor, delay);\n }\n }\n\n /**\n * @dev Schedule an operation that is to becomes valid after a given delay.\n */\n function _schedule(bytes32 id, uint256 delay) private {\n require(!isOperation(id), \"TimelockController: operation already scheduled\");\n require(delay >= getMinDelay(), \"TimelockController: insufficient delay\");\n _timestamps[id] = block.timestamp + delay;\n }\n\n /**\n * @dev Cancel an operation.\n *\n * Requirements:\n *\n * - the caller must have the 'proposer' role.\n */\n function cancel(bytes32 id) public virtual onlyRole(PROPOSER_ROLE) {\n require(isOperationPending(id), \"TimelockController: operation cannot be cancelled\");\n delete _timestamps[id];\n\n emit Cancelled(id);\n }\n\n /**\n * @dev Execute an (ready) operation containing a single transaction.\n *\n * Emits a {CallExecuted} event.\n *\n * Requirements:\n *\n * - the caller must have the 'executor' role.\n */\n function execute(\n address target,\n uint256 value,\n bytes calldata data,\n bytes32 predecessor,\n bytes32 salt\n ) public payable virtual onlyRoleOrOpenRole(EXECUTOR_ROLE) {\n bytes32 id = hashOperation(target, value, data, predecessor, salt);\n _beforeCall(id, predecessor);\n _call(id, 0, target, value, data);\n _afterCall(id);\n }\n\n /**\n * @dev Execute an (ready) operation containing a batch of transactions.\n *\n * Emits one {CallExecuted} event per transaction in the batch.\n *\n * Requirements:\n *\n * - the caller must have the 'executor' role.\n */\n function executeBatch(\n address[] calldata targets,\n uint256[] calldata values,\n bytes[] calldata datas,\n bytes32 predecessor,\n bytes32 salt\n ) public payable virtual onlyRoleOrOpenRole(EXECUTOR_ROLE) {\n require(targets.length == values.length, \"TimelockController: length mismatch\");\n require(targets.length == datas.length, \"TimelockController: length mismatch\");\n\n bytes32 id = hashOperationBatch(targets, values, datas, predecessor, salt);\n _beforeCall(id, predecessor);\n for (uint256 i = 0; i < targets.length; ++i) {\n _call(id, i, targets[i], values[i], datas[i]);\n }\n _afterCall(id);\n }\n\n /**\n * @dev Checks before execution of an operation's calls.\n */\n function _beforeCall(bytes32 id, bytes32 predecessor) private view {\n require(isOperationReady(id), \"TimelockController: operation is not ready\");\n require(predecessor == bytes32(0) || isOperationDone(predecessor), \"TimelockController: missing dependency\");\n }\n\n /**\n * @dev Checks after execution of an operation's calls.\n */\n function _afterCall(bytes32 id) private {\n require(isOperationReady(id), \"TimelockController: operation is not ready\");\n _timestamps[id] = _DONE_TIMESTAMP;\n }\n\n /**\n * @dev Execute an operation's call.\n *\n * Emits a {CallExecuted} event.\n */\n function _call(\n bytes32 id,\n uint256 index,\n address target,\n uint256 value,\n bytes calldata data\n ) private {\n (bool success, ) = target.call{value: value}(data);\n require(success, \"TimelockController: underlying transaction reverted\");\n\n emit CallExecuted(id, index, target, value, data);\n }\n\n /**\n * @dev Changes the minimum timelock duration for future operations.\n *\n * Emits a {MinDelayChange} event.\n *\n * Requirements:\n *\n * - the caller must be the timelock itself. This can only be achieved by scheduling and later executing\n * an operation where the timelock is the target and the data is the ABI-encoded call to this function.\n */\n function updateDelay(uint256 newDelay) external virtual {\n require(msg.sender == address(this), \"TimelockController: caller must be timelock\");\n emit MinDelayChange(_minDelay, newDelay);\n _minDelay = newDelay;\n }\n}\n" + }, + "@openzeppelin/contracts/access/AccessControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControl.sol\";\nimport \"../utils/Context.sol\";\nimport \"../utils/Strings.sol\";\nimport \"../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role, _msgSender());\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n Strings.toHexString(uint160(account), 20),\n \" is missing role \",\n Strings.toHexString(uint256(role), 32)\n )\n )\n );\n }\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view override returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n *\n * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\n _grantRole(role, account);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n}\n" + }, + "@openzeppelin/contracts/access/IAccessControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {AccessControl-_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeacon.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/StorageSlot.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967Upgrade {\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallSecure(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n address oldImplementation = _getImplementation();\n\n // Initial upgrade and setup call\n _setImplementation(newImplementation);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(newImplementation, data);\n }\n\n // Perform rollback test if not already in progress\n StorageSlot.BooleanSlot storage rollbackTesting = StorageSlot.getBooleanSlot(_ROLLBACK_SLOT);\n if (!rollbackTesting.value) {\n // Trigger rollback using upgradeTo from the new implementation\n rollbackTesting.value = true;\n Address.functionDelegateCall(\n newImplementation,\n abi.encodeWithSignature(\"upgradeTo(address)\", oldImplementation)\n );\n rollbackTesting.value = false;\n // Check rollback was effective\n require(oldImplementation == _getImplementation(), \"ERC1967Upgrade: upgrade breaks further upgrades\");\n // Finally reset to the new implementation and log the upgrade\n _upgradeTo(newImplementation);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Emitted when the beacon is upgraded.\n */\n event BeaconUpgraded(address indexed beacon);\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(Address.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n Address.isContract(IBeacon(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n assembly {\n r.slot := slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Proxy.sol\";\nimport \"./ERC1967Upgrade.sol\";\n\n/**\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\n * implementation address that can be changed. This address is stored in storage in the location specified by\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\n * implementation behind the proxy.\n */\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\n *\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\n */\n constructor(address _logic, bytes memory _data) payable {\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\"eip1967.proxy.implementation\")) - 1));\n _upgradeToAndCall(_logic, _data, false);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function _implementation() internal view virtual override returns (address impl) {\n return ERC1967Upgrade._getImplementation();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/Proxy.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n /**\n * @dev Delegates the current call to `implementation`.\n *\n * This function does not return to its internall call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\n * and {_fallback} should delegate.\n */\n function _implementation() internal view virtual returns (address);\n\n /**\n * @dev Delegates the current call to the address returned by `_implementation()`.\n *\n * This function does not return to its internall call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\n _beforeFallback();\n _delegate(_implementation());\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\n * is empty.\n */\n receive() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\n * call, or as part of the Solidity `fallback` or `receive` functions.\n *\n * If overriden should call `super._beforeFallback()`.\n */\n function _beforeFallback() internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1967/ERC1967Proxy.sol\";\n\n/**\n * @dev This contract implements a proxy that is upgradeable by an admin.\n *\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\n * clashing], which can potentially be used in an attack, this contract uses the\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\n * things that go hand in hand:\n *\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\n * that call matches one of the admin functions exposed by the proxy itself.\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\n * \"admin cannot fallback to proxy target\".\n *\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\n * to sudden errors when trying to call a function from the proxy implementation.\n *\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\n */\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\n /**\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\n */\n constructor(\n address _logic,\n address admin_,\n bytes memory _data\n ) payable ERC1967Proxy(_logic, _data) {\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\"eip1967.proxy.admin\")) - 1));\n _changeAdmin(admin_);\n }\n\n /**\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\n */\n modifier ifAdmin() {\n if (msg.sender == _getAdmin()) {\n _;\n } else {\n _fallback();\n }\n }\n\n /**\n * @dev Returns the current admin.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\n */\n function admin() external ifAdmin returns (address admin_) {\n admin_ = _getAdmin();\n }\n\n /**\n * @dev Returns the current implementation.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\n */\n function implementation() external ifAdmin returns (address implementation_) {\n implementation_ = _implementation();\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\n */\n function changeAdmin(address newAdmin) external virtual ifAdmin {\n _changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\n */\n function upgradeTo(address newImplementation) external ifAdmin {\n _upgradeToAndCall(newImplementation, bytes(\"\"), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\n * proxied contract.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\n */\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\n _upgradeToAndCall(newImplementation, data, true);\n }\n\n /**\n * @dev Returns the current admin.\n */\n function _admin() internal view virtual returns (address) {\n return _getAdmin();\n }\n\n /**\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\n */\n function _beforeFallback() internal virtual override {\n require(msg.sender != _getAdmin(), \"TransparentUpgradeableProxy: admin cannot fallback to proxy target\");\n super._beforeFallback();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/ProxyAdmin.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./TransparentUpgradeableProxy.sol\";\nimport \"../../access/Ownable.sol\";\n\n/**\n * @dev This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For an\n * explanation of why you would want to use this see the documentation for {TransparentUpgradeableProxy}.\n */\ncontract ProxyAdmin is Ownable {\n /**\n * @dev Returns the current implementation of `proxy`.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function getProxyImplementation(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"implementation()\")) == 0x5c60da1b\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"5c60da1b\");\n require(success);\n return abi.decode(returndata, (address));\n }\n\n /**\n * @dev Returns the current admin of `proxy`.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function getProxyAdmin(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"admin()\")) == 0xf851a440\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"f851a440\");\n require(success);\n return abi.decode(returndata, (address));\n }\n\n /**\n * @dev Changes the admin of `proxy` to `newAdmin`.\n *\n * Requirements:\n *\n * - This contract must be the current admin of `proxy`.\n */\n function changeProxyAdmin(TransparentUpgradeableProxy proxy, address newAdmin) public virtual onlyOwner {\n proxy.changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrades `proxy` to `implementation`. See {TransparentUpgradeableProxy-upgradeTo}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function upgrade(TransparentUpgradeableProxy proxy, address implementation) public virtual onlyOwner {\n proxy.upgradeTo(implementation);\n }\n\n /**\n * @dev Upgrades `proxy` to `implementation` and calls a function on the new implementation. See\n * {TransparentUpgradeableProxy-upgradeToAndCall}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function upgradeAndCall(\n TransparentUpgradeableProxy proxy,\n address implementation,\n bytes memory data\n ) public payable virtual onlyOwner {\n proxy.upgradeToAndCall{value: msg.value}(implementation, data);\n }\n}\n" + }, + "contracts/staking/KeepStake.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\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 staking contract in T staking\n/// contract, it fitst needs to resolve the owner. Resolving liquid\n/// KEEP stake owner is easy. Resolving token grant stake owner is\n/// complicated and not possible to do on-chain from a contract external\n/// to KEEP TokenStaking contract. Keep TokenStaking knows the grant ID\n/// 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" + }, + "contracts/staking/ILegacyTokenStaking.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\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" + }, + "contracts/test/IKeepManagedGrant.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\npragma solidity 0.8.9;\n\nimport \"../staking/KeepStake.sol\";\n\ninterface IKeepManagedGrant is IManagedGrant {\n function stake(\n address stakingContract,\n uint256 amount,\n bytes memory extraData\n ) external;\n}\n" + }, + "contracts/staking/TokenStaking.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\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 address application;\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 /// @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(amount > minTStakeAmount, \"Amount is less than minimum\");\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 Refresh Keep stake owner. Can be called only by the old owner.\n /// @dev The staking provider in T staking contract is the legacy KEEP\n /// staking contract operator.\n function refreshKeepStakeOwner(address stakingProvider) external override {\n StakingProviderInfo storage stakingProviderStruct = stakingProviders[\n stakingProvider\n ];\n require(\n stakingProviderStruct.owner == msg.sender,\n \"Caller is not owner\"\n );\n address newOwner = keepStake.resolveOwner(stakingProvider);\n\n emit OwnerRefreshed(\n stakingProvider,\n stakingProviderStruct.owner,\n newOwner\n );\n stakingProviderStruct.owner = newOwner;\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’s 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 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’s 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’s 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 /// Can be called only by the owner or the 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)\n external\n override\n onlyOwnerOrStakingProvider(stakingProvider)\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 onlyOwnerOrStakingProvider(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 address(0)\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 address(0)\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’s authorizer. Overwrites pending\n /// authorization decrease for the given staking provider and\n /// application.\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 {\n StakingProviderInfo storage stakingProviderStruct = stakingProviders[\n stakingProvider\n ];\n require(\n stakingProviderStruct.owner == msg.sender,\n \"Caller is not owner\"\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(\n stakingProvider,\n amountToSlash.toUint96(),\n msg.sender\n )\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 slashing.application\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 address application\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 if (\n application == address(0) ||\n authorizedApplication == application\n ) {\n authorization.authorized -= MathUpgradeable\n .min(fromAmount, slashedAmount)\n .toUint96();\n } else if (fromAmount <= totalStake) {\n continue;\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" + }, + "contracts/staking/IApplication.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\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 /// @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.\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 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" + }, + "contracts/staking/IStaking.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\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’s private\n/// key and should not require any owner’s keys at all. The stake\n/// delegation optimizes the network throughput without compromising the\n/// security of the owners’ 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 Refresh Keep stake owner. Can be called only by the old owner.\n /// @dev The staking provider in T staking contract is the legacy KEEP\n /// staking contract operator.\n function refreshKeepStakeOwner(address stakingProvider) 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’s authorizer. Overwrites pending\n /// authorization decrease for the given staking provider and\n /// application.\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’s 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’s 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 /// Can be called only by the owner or the 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" + }, + "contracts/utils/PercentUtils.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\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" + }, + "contracts/utils/SafeTUpgradeable.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\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" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 a proxied contract can't have 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" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\n\npragma solidity ^0.8.0;\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 function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 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" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, 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 `sender` to `recipient` 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 sender,\n address recipient,\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" + }, + "@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" + }, + "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\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 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\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" + }, + "contracts/test/ITestKeepTokenStaking.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\npragma solidity 0.8.9;\n\nimport \"../staking/ILegacyTokenStaking.sol\";\n\ninterface ITestKeepTokenStaking is IKeepTokenStaking {\n function authorizeOperatorContract(\n address operator,\n address operatorContract\n ) external;\n\n function commitTopUp(address operator) external;\n\n function undelegate(address operator) external;\n\n function getLocks(address operator)\n external\n view\n returns (address[] memory creators, uint256[] memory expirations);\n}\n" + }, + "contracts/test/IKeepTokenGrant.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\npragma solidity 0.8.9;\n\nimport \"../staking/ILegacyTokenStaking.sol\";\n\ninterface IKeepTokenGrant {\n function stake(\n uint256 id,\n address stakingContract,\n uint256 amount,\n bytes memory extraData\n ) external;\n}\n" + }, + "contracts/test/TestToken.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\npragma solidity 0.8.9;\n\nimport \"@thesis/solidity-contracts/contracts/token/ERC20WithPermit.sol\";\n\ncontract TestToken is ERC20WithPermit {\n constructor() ERC20WithPermit(\"Test Token\", \"TEST\") {}\n}\n" + }, + "contracts/governance/ProxyAdminWithDeputy.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\npragma solidity 0.8.9;\n\nimport \"./StakerGovernor.sol\";\nimport \"@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol\";\n\n/// @title ProxyAdminWithDeputy\n/// @notice Based on `ProxyAdmin`, an auxiliary contract in OpenZeppelin's\n/// upgradeability approach meant to act as the admin of a\n/// `TransparentUpgradeableProxy`. This variant allows an additional\n/// actor, the \"deputy\", to perform upgrades, which originally can only\n/// be performed by the ProxyAdmin's owner. See OpenZeppelin's\n/// documentation for `TransparentUpgradeableProxy` for more details on\n/// why a ProxyAdmin is recommended.\ncontract ProxyAdminWithDeputy is ProxyAdmin {\n address public deputy;\n event DeputyUpdated(\n address indexed previousDeputy,\n address indexed newDeputy\n );\n\n modifier onlyOwnerOrDeputy() {\n _checkCallerIsOwnerOrDeputy();\n _;\n }\n\n constructor(StakerGovernor dao, address _deputy) {\n address timelock = dao.timelock();\n require(timelock != address(0), \"DAO doesn't have a Timelock\");\n _setDeputy(_deputy);\n _transferOwnership(timelock);\n }\n\n function setDeputy(address newDeputy) external onlyOwner {\n _setDeputy(newDeputy);\n }\n\n /// @notice Upgrades `proxy` to `implementation`. This contract must be the\n /// admin of `proxy`, and the caller must be this contract's owner\n /// or the deputy.\n function upgrade(TransparentUpgradeableProxy proxy, address implementation)\n public\n virtual\n override\n onlyOwnerOrDeputy\n {\n proxy.upgradeTo(implementation);\n }\n\n /// @notice Upgrades `proxy` to `implementation` and calls a function on the\n /// new implementation. This contract must be the admin of `proxy`,\n /// and the caller must be this contract's owner or the deputy.\n function upgradeAndCall(\n TransparentUpgradeableProxy proxy,\n address implementation,\n bytes memory data\n ) public payable virtual override onlyOwnerOrDeputy {\n proxy.upgradeToAndCall{value: msg.value}(implementation, data);\n }\n\n function _setDeputy(address newDeputy) internal {\n address oldDeputy = deputy;\n deputy = newDeputy;\n emit DeputyUpdated(oldDeputy, newDeputy);\n }\n\n function _checkCallerIsOwnerOrDeputy() internal view {\n address caller = _msgSender();\n require(\n owner() == caller || deputy == caller,\n \"Caller is neither the owner nor the deputy\"\n );\n }\n}\n" + }, + "contracts/governance/StakerGovernor.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n\npragma solidity 0.8.9;\n\nimport \"./StakerGovernorVotes.sol\";\nimport \"./TokenholderGovernor.sol\";\nimport \"../token/T.sol\";\nimport \"@openzeppelin/contracts/access/AccessControl.sol\";\nimport \"@openzeppelin/contracts/governance/Governor.sol\";\nimport \"@openzeppelin/contracts/governance/extensions/GovernorCountingSimple.sol\";\nimport \"@openzeppelin/contracts/governance/extensions/GovernorVotes.sol\";\nimport \"@openzeppelin/contracts/governance/extensions/GovernorTimelockControl.sol\";\n\ncontract StakerGovernor is\n AccessControl,\n GovernorCountingSimple,\n StakerGovernorVotes,\n GovernorTimelockControl\n{\n uint256 private constant INITIAL_QUORUM_NUMERATOR = 150; // Defined in basis points, i.e., 1.5%\n uint256 private constant INITIAL_PROPOSAL_THRESHOLD_NUMERATOR = 25; // Defined in basis points, i.e., 0.25%\n uint256 private constant INITIAL_VOTING_DELAY =\n 2 days / AVERAGE_BLOCK_TIME_IN_SECONDS;\n uint256 private constant INITIAL_VOTING_PERIOD =\n 10 days / AVERAGE_BLOCK_TIME_IN_SECONDS;\n\n bytes32 public constant VETO_POWER =\n keccak256(\"Power to veto proposals in Threshold's Staker DAO\");\n\n address internal immutable manager;\n\n constructor(\n IVotesHistory _staking,\n TimelockController _timelock,\n TokenholderGovernor tokenholderGovernor,\n address vetoer\n )\n Governor(\"StakerGovernor\")\n GovernorParameters(\n INITIAL_QUORUM_NUMERATOR,\n INITIAL_PROPOSAL_THRESHOLD_NUMERATOR,\n INITIAL_VOTING_DELAY,\n INITIAL_VOTING_PERIOD\n )\n StakerGovernorVotes(_staking)\n GovernorTimelockControl(_timelock)\n {\n require(\n keccak256(bytes(tokenholderGovernor.name())) ==\n keccak256(bytes(\"TokenholderGovernor\")),\n \"Incorrect TokenholderGovernor\"\n );\n manager = tokenholderGovernor.timelock();\n require(manager != address(0), \"No timelock founds\");\n _setupRole(VETO_POWER, vetoer);\n _setupRole(DEFAULT_ADMIN_ROLE, manager);\n }\n\n function cancel(\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n bytes32 descriptionHash\n ) external onlyRole(VETO_POWER) returns (uint256) {\n return _cancel(targets, values, calldatas, descriptionHash);\n }\n\n function propose(\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n string memory description\n ) public override(Governor, IGovernor) returns (uint256) {\n uint256 atLastBlock = block.number - 1;\n require(\n getVotes(msg.sender, atLastBlock) >= proposalThreshold(atLastBlock),\n \"Proposal below threshold\"\n );\n return super.propose(targets, values, calldatas, description);\n }\n\n function quorum(uint256 blockNumber)\n public\n view\n override(IGovernor, GovernorParameters)\n returns (uint256)\n {\n return super.quorum(blockNumber);\n }\n\n function proposalThreshold()\n public\n view\n override(Governor, GovernorParameters)\n returns (uint256)\n {\n return super.proposalThreshold();\n }\n\n function getVotes(address account, uint256 blockNumber)\n public\n view\n override(IGovernor, StakerGovernorVotes)\n returns (uint256)\n {\n return super.getVotes(account, blockNumber);\n }\n\n function state(uint256 proposalId)\n public\n view\n override(Governor, GovernorTimelockControl)\n returns (ProposalState)\n {\n return super.state(proposalId);\n }\n\n function supportsInterface(bytes4 interfaceId)\n public\n view\n override(Governor, GovernorTimelockControl, AccessControl)\n returns (bool)\n {\n return super.supportsInterface(interfaceId);\n }\n\n function _execute(\n uint256 proposalId,\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n bytes32 descriptionHash\n ) internal override(Governor, GovernorTimelockControl) {\n super._execute(proposalId, targets, values, calldatas, descriptionHash);\n }\n\n function _cancel(\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n bytes32 descriptionHash\n ) internal override(Governor, GovernorTimelockControl) returns (uint256) {\n return super._cancel(targets, values, calldatas, descriptionHash);\n }\n\n /// @notice Returns the address of the entity that acts as governance for\n /// this contract.\n /// @dev By default, Governor assumes this is either the Governor contract\n /// itself, or a timelock if there's one configured. We override this\n /// here for the StakerGovernor contract so it's the Tokenholder DAO's\n /// Timelock, which we obtain at constructor time.\n function _executor()\n internal\n view\n override(Governor, GovernorTimelockControl)\n returns (address)\n {\n return manager;\n }\n}\n" + }, + "contracts/governance/StakerGovernorVotes.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n\npragma solidity 0.8.9;\n\nimport \"./GovernorParameters.sol\";\nimport \"./IVotesHistory.sol\";\n\n/// @title StakerGovernorVotes\n/// @notice Staker DAO voting power extraction from staked T positions,\n// including legacy stakes (NU/KEEP).\nabstract contract StakerGovernorVotes is GovernorParameters {\n IVotesHistory public immutable staking;\n\n constructor(IVotesHistory tStakingAddress) {\n staking = tStakingAddress;\n }\n\n /// @notice Read the voting weight from the snapshot mechanism in the T\n /// staking contracts. Note that this also tracks legacy stakes\n /// (NU/KEEP).\n /// @param account Delegate account with T staking voting power\n /// @param blockNumber The block number to get the vote balance at\n /// @dev See {IGovernor-getVotes}\n function getVotes(address account, uint256 blockNumber)\n public\n view\n virtual\n override\n returns (uint256)\n {\n return staking.getPastVotes(account, blockNumber);\n }\n\n /// @notice Compute the total voting power for the Staker DAO.\n /// @param blockNumber The block number to get the voting power at\n function _getPastTotalSupply(uint256 blockNumber)\n internal\n view\n virtual\n override\n returns (uint256)\n {\n return staking.getPastTotalSupply(blockNumber);\n }\n}\n" + }, + "contracts/governance/TokenholderGovernor.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n\npragma solidity 0.8.9;\n\nimport \"./TokenholderGovernorVotes.sol\";\nimport \"../token/T.sol\";\nimport \"@openzeppelin/contracts/access/AccessControl.sol\";\nimport \"@openzeppelin/contracts/governance/Governor.sol\";\nimport \"@openzeppelin/contracts/governance/extensions/GovernorCountingSimple.sol\";\nimport \"@openzeppelin/contracts/governance/extensions/GovernorVotes.sol\";\nimport \"@openzeppelin/contracts/governance/extensions/GovernorTimelockControl.sol\";\n\ncontract TokenholderGovernor is\n AccessControl,\n GovernorCountingSimple,\n TokenholderGovernorVotes,\n GovernorTimelockControl\n{\n uint256 private constant INITIAL_QUORUM_NUMERATOR = 150; // Defined in basis points, i.e., 1.5%\n uint256 private constant INITIAL_PROPOSAL_THRESHOLD_NUMERATOR = 25; // Defined in basis points, i.e., 0.25%\n uint256 private constant INITIAL_VOTING_DELAY =\n 2 days / AVERAGE_BLOCK_TIME_IN_SECONDS;\n uint256 private constant INITIAL_VOTING_PERIOD =\n 10 days / AVERAGE_BLOCK_TIME_IN_SECONDS;\n\n bytes32 public constant VETO_POWER =\n keccak256(\"Power to veto proposals in Threshold's Tokenholder DAO\");\n\n constructor(\n T _token,\n IVotesHistory _staking,\n TimelockController _timelock,\n address vetoer\n )\n Governor(\"TokenholderGovernor\")\n GovernorParameters(\n INITIAL_QUORUM_NUMERATOR,\n INITIAL_PROPOSAL_THRESHOLD_NUMERATOR,\n INITIAL_VOTING_DELAY,\n INITIAL_VOTING_PERIOD\n )\n TokenholderGovernorVotes(_token, _staking)\n GovernorTimelockControl(_timelock)\n {\n _setupRole(VETO_POWER, vetoer);\n _setupRole(DEFAULT_ADMIN_ROLE, address(_timelock));\n }\n\n function cancel(\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n bytes32 descriptionHash\n ) external onlyRole(VETO_POWER) returns (uint256) {\n return _cancel(targets, values, calldatas, descriptionHash);\n }\n\n function propose(\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n string memory description\n ) public override(Governor, IGovernor) returns (uint256) {\n uint256 atLastBlock = block.number - 1;\n require(\n getVotes(msg.sender, atLastBlock) >= proposalThreshold(atLastBlock),\n \"Proposal below threshold\"\n );\n return super.propose(targets, values, calldatas, description);\n }\n\n function quorum(uint256 blockNumber)\n public\n view\n override(IGovernor, GovernorParameters)\n returns (uint256)\n {\n return super.quorum(blockNumber);\n }\n\n function proposalThreshold()\n public\n view\n override(Governor, GovernorParameters)\n returns (uint256)\n {\n return super.proposalThreshold();\n }\n\n function getVotes(address account, uint256 blockNumber)\n public\n view\n override(IGovernor, TokenholderGovernorVotes)\n returns (uint256)\n {\n return super.getVotes(account, blockNumber);\n }\n\n function state(uint256 proposalId)\n public\n view\n override(Governor, GovernorTimelockControl)\n returns (ProposalState)\n {\n return super.state(proposalId);\n }\n\n function supportsInterface(bytes4 interfaceId)\n public\n view\n override(Governor, GovernorTimelockControl, AccessControl)\n returns (bool)\n {\n return super.supportsInterface(interfaceId);\n }\n\n function _execute(\n uint256 proposalId,\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n bytes32 descriptionHash\n ) internal override(Governor, GovernorTimelockControl) {\n super._execute(proposalId, targets, values, calldatas, descriptionHash);\n }\n\n function _cancel(\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n bytes32 descriptionHash\n ) internal override(Governor, GovernorTimelockControl) returns (uint256) {\n return super._cancel(targets, values, calldatas, descriptionHash);\n }\n\n function _executor()\n internal\n view\n override(Governor, GovernorTimelockControl)\n returns (address)\n {\n return super._executor();\n }\n}\n" + }, + "@openzeppelin/contracts/governance/extensions/GovernorCountingSimple.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (governance/extensions/GovernorCountingSimple.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Governor.sol\";\n\n/**\n * @dev Extension of {Governor} for simple, 3 options, vote counting.\n *\n * _Available since v4.3._\n */\nabstract contract GovernorCountingSimple is Governor {\n /**\n * @dev Supported vote types. Matches Governor Bravo ordering.\n */\n enum VoteType {\n Against,\n For,\n Abstain\n }\n\n struct ProposalVote {\n uint256 againstVotes;\n uint256 forVotes;\n uint256 abstainVotes;\n mapping(address => bool) hasVoted;\n }\n\n mapping(uint256 => ProposalVote) private _proposalVotes;\n\n /**\n * @dev See {IGovernor-COUNTING_MODE}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function COUNTING_MODE() public pure virtual override returns (string memory) {\n return \"support=bravo&quorum=for,abstain\";\n }\n\n /**\n * @dev See {IGovernor-hasVoted}.\n */\n function hasVoted(uint256 proposalId, address account) public view virtual override returns (bool) {\n return _proposalVotes[proposalId].hasVoted[account];\n }\n\n /**\n * @dev Accessor to the internal vote counts.\n */\n function proposalVotes(uint256 proposalId)\n public\n view\n virtual\n returns (\n uint256 againstVotes,\n uint256 forVotes,\n uint256 abstainVotes\n )\n {\n ProposalVote storage proposalvote = _proposalVotes[proposalId];\n return (proposalvote.againstVotes, proposalvote.forVotes, proposalvote.abstainVotes);\n }\n\n /**\n * @dev See {Governor-_quorumReached}.\n */\n function _quorumReached(uint256 proposalId) internal view virtual override returns (bool) {\n ProposalVote storage proposalvote = _proposalVotes[proposalId];\n\n return quorum(proposalSnapshot(proposalId)) <= proposalvote.forVotes + proposalvote.abstainVotes;\n }\n\n /**\n * @dev See {Governor-_voteSucceeded}. In this module, the forVotes must be strictly over the againstVotes.\n */\n function _voteSucceeded(uint256 proposalId) internal view virtual override returns (bool) {\n ProposalVote storage proposalvote = _proposalVotes[proposalId];\n\n return proposalvote.forVotes > proposalvote.againstVotes;\n }\n\n /**\n * @dev See {Governor-_countVote}. In this module, the support follows the `VoteType` enum (from Governor Bravo).\n */\n function _countVote(\n uint256 proposalId,\n address account,\n uint8 support,\n uint256 weight\n ) internal virtual override {\n ProposalVote storage proposalvote = _proposalVotes[proposalId];\n\n require(!proposalvote.hasVoted[account], \"GovernorVotingSimple: vote already cast\");\n proposalvote.hasVoted[account] = true;\n\n if (support == uint8(VoteType.Against)) {\n proposalvote.againstVotes += weight;\n } else if (support == uint8(VoteType.For)) {\n proposalvote.forVotes += weight;\n } else if (support == uint8(VoteType.Abstain)) {\n proposalvote.abstainVotes += weight;\n } else {\n revert(\"GovernorVotingSimple: invalid value for enum VoteType\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/governance/extensions/GovernorVotes.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (governance/extensions/GovernorVotes.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Governor.sol\";\nimport \"../../token/ERC20/extensions/ERC20Votes.sol\";\nimport \"../../utils/math/Math.sol\";\n\n/**\n * @dev Extension of {Governor} for voting weight extraction from an {ERC20Votes} token.\n *\n * _Available since v4.3._\n */\nabstract contract GovernorVotes is Governor {\n ERC20Votes public immutable token;\n\n constructor(ERC20Votes tokenAddress) {\n token = tokenAddress;\n }\n\n /**\n * Read the voting weight from the token's built in snapshot mechanism (see {IGovernor-getVotes}).\n */\n function getVotes(address account, uint256 blockNumber) public view virtual override returns (uint256) {\n return token.getPastVotes(account, blockNumber);\n }\n}\n" + }, + "contracts/test/TestGovernorTestSet.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\npragma solidity 0.8.9;\n\nimport \"../governance/GovernorParameters.sol\";\nimport \"../governance/StakerGovernor.sol\";\nimport \"../governance/TokenholderGovernor.sol\";\nimport \"../token/T.sol\";\n\ncontract TestTokenholderGovernorStub {\n string public name = \"TokenholderGovernor\";\n address public timelock = address(0x42);\n}\n\ncontract TestTokenholderGovernorStubV2 {\n string public name = \"TokenholderGovernor\";\n address public timelock;\n\n constructor(address _timelock) {\n timelock = _timelock;\n }\n}\n\ncontract TestStakerGovernor is StakerGovernor {\n constructor(\n IVotesHistory tStaking,\n TokenholderGovernor tokenholderGov,\n address vetoer\n )\n StakerGovernor(\n tStaking,\n TimelockController(payable(0)),\n tokenholderGov,\n vetoer\n )\n {}\n\n function executor() external view returns (address) {\n return _executor();\n }\n}\n\ncontract TestTokenholderGovernor is TokenholderGovernor {\n constructor(\n T _tToken,\n IVotesHistory _tStaking,\n address _vetoer\n )\n TokenholderGovernor(\n _tToken,\n _tStaking,\n TimelockController(payable(0)),\n _vetoer\n )\n {}\n}\n\ncontract TestGovernorParameters is GovernorParameters {\n address internal executor;\n\n constructor(address executorAddress)\n Governor(\"TestGovernorParameters\")\n GovernorParameters(10, 20, 30, 40)\n {\n executor = executorAddress;\n }\n\n function getVotes(address account, uint256 blockNumber)\n public\n view\n virtual\n override\n returns (uint256)\n {}\n\n function getPastTotalSupply(uint256 blockNumber)\n public\n view\n returns (uint256)\n {}\n\n function hasVoted(uint256 proposalId, address account)\n public\n view\n virtual\n override\n returns (bool)\n {}\n\n // solhint-disable-next-line func-name-mixedcase\n function COUNTING_MODE()\n public\n pure\n virtual\n override\n returns (string memory)\n {}\n\n function _countVote(\n uint256 proposalId,\n address account,\n uint8 support,\n uint256 weight\n ) internal virtual override {}\n\n function _quorumReached(uint256 proposalId)\n internal\n view\n virtual\n override\n returns (bool)\n {}\n\n function _voteSucceeded(uint256 proposalId)\n internal\n view\n virtual\n override\n returns (bool)\n {}\n\n function _getPastTotalSupply(uint256 blockNumber)\n internal\n view\n virtual\n override\n returns (uint256)\n {}\n\n function _executor() internal view virtual override returns (address) {\n return executor;\n }\n}\n" + }, + "contracts/test/TestStakerGovernorVotes.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\npragma solidity 0.8.9;\n\nimport \"../governance/StakerGovernorVotes.sol\";\n\ncontract TestStakerGovernorVotes is StakerGovernorVotes {\n constructor(IVotesHistory _tStaking)\n Governor(\"TestStakerGovernor\")\n GovernorParameters(125, 75, 12, 34)\n StakerGovernorVotes(_tStaking)\n {}\n\n function getPastTotalSupply(uint256 blockNumber)\n public\n view\n returns (uint256)\n {\n return _getPastTotalSupply(blockNumber);\n }\n\n function hasVoted(uint256 proposalId, address account)\n public\n view\n virtual\n override\n returns (bool)\n {}\n\n // solhint-disable-next-line func-name-mixedcase\n function COUNTING_MODE()\n public\n pure\n virtual\n override\n returns (string memory)\n {}\n\n function _countVote(\n uint256 proposalId,\n address account,\n uint8 support,\n uint256 weight\n ) internal virtual override {}\n\n function _quorumReached(uint256 proposalId)\n internal\n view\n virtual\n override\n returns (bool)\n {}\n\n function _voteSucceeded(uint256 proposalId)\n internal\n view\n virtual\n override\n returns (bool)\n {}\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 10 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file