diff --git a/packages/hardhat/.openzeppelin/goerli.json b/packages/hardhat/.openzeppelin/goerli.json index 17cc4aa7..2862eba4 100644 --- a/packages/hardhat/.openzeppelin/goerli.json +++ b/packages/hardhat/.openzeppelin/goerli.json @@ -457,7 +457,7 @@ "label": "createDeposit", "offset": 0, "slot": "102", - "type": "t_struct(Deposit)3246_storage", + "type": "t_struct(Deposit)2534_storage", "contract": "QuestFactory", "src": "contracts\\QuestFactory.sol:16" }, @@ -465,7 +465,7 @@ "label": "playDeposit", "offset": 0, "slot": "104", - "type": "t_struct(Deposit)3246_storage", + "type": "t_struct(Deposit)2534_storage", "contract": "QuestFactory", "src": "contracts\\QuestFactory.sol:17" } @@ -491,7 +491,251 @@ "label": "contract IERC20Upgradeable", "numberOfBytes": "20" }, - "t_struct(Deposit)3246_storage": { + "t_struct(Deposit)2534_storage": { + "label": "struct Models.Deposit", + "members": [ + { + "label": "token", + "type": "t_contract(IERC20Upgradeable)378", + "offset": 0, + "slot": "0" + }, + { + "label": "amount", + "type": "t_uint256", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + } + } + }, + "15d09e1816c744d7dd732ea12cbe4a1feac663fedbcaacfa0eeb4fb90aa46134": { + "address": "0xe80ef86aA1C151c6bfc4f90F41dcec1EDB0b5a12", + "txHash": "0xb09c4df25c571070c578d3960ea684210aaa5b6b9b31ab8c6b56b4e68473568c", + "layout": { + "solcVersion": "0.8.2", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:63", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:68" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin\\contracts-upgradeable\\utils\\ContextUpgradeable.sol:36" + }, + { + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin\\contracts-upgradeable\\access\\OwnableUpgradeable.sol:22" + }, + { + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin\\contracts-upgradeable\\access\\OwnableUpgradeable.sol:94" + }, + { + "label": "aragonGovernAddress", + "offset": 0, + "slot": "101", + "type": "t_address", + "contract": "QuestFactory", + "src": "contracts\\QuestFactory.sol:15" + }, + { + "label": "createDeposit", + "offset": 0, + "slot": "102", + "type": "t_struct(Deposit)2546_storage", + "contract": "QuestFactory", + "src": "contracts\\QuestFactory.sol:16" + }, + { + "label": "playDeposit", + "offset": 0, + "slot": "104", + "type": "t_struct(Deposit)2546_storage", + "contract": "QuestFactory", + "src": "contracts\\QuestFactory.sol:17" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(IERC20Upgradeable)378": { + "label": "contract IERC20Upgradeable", + "numberOfBytes": "20" + }, + "t_struct(Deposit)2546_storage": { + "label": "struct Models.Deposit", + "members": [ + { + "label": "token", + "type": "t_contract(IERC20Upgradeable)378", + "offset": 0, + "slot": "0" + }, + { + "label": "amount", + "type": "t_uint256", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + } + } + }, + "e47fe87f5e73b3947c18776f366d3f57f96d6eb7597480f31caccc70f0b7f078": { + "address": "0x0665F2dBE58DdC50FcA848A16A9f39b2C4Ff9d42", + "txHash": "0x8e0a03ad8beeb1f959832f986fe49ee3879d3cf165f15c16af1810cebbac9ee9", + "layout": { + "solcVersion": "0.8.2", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:63", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:68" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin\\contracts-upgradeable\\utils\\ContextUpgradeable.sol:36" + }, + { + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin\\contracts-upgradeable\\access\\OwnableUpgradeable.sol:22" + }, + { + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin\\contracts-upgradeable\\access\\OwnableUpgradeable.sol:94" + }, + { + "label": "aragonGovernAddress", + "offset": 0, + "slot": "101", + "type": "t_address", + "contract": "QuestFactory", + "src": "contracts\\QuestFactory.sol:15" + }, + { + "label": "createDeposit", + "offset": 0, + "slot": "102", + "type": "t_struct(Deposit)2568_storage", + "contract": "QuestFactory", + "src": "contracts\\QuestFactory.sol:16" + }, + { + "label": "playDeposit", + "offset": 0, + "slot": "104", + "type": "t_struct(Deposit)2568_storage", + "contract": "QuestFactory", + "src": "contracts\\QuestFactory.sol:17" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(IERC20Upgradeable)378": { + "label": "contract IERC20Upgradeable", + "numberOfBytes": "20" + }, + "t_struct(Deposit)2568_storage": { "label": "struct Models.Deposit", "members": [ { diff --git a/packages/hardhat/.openzeppelin/unknown-1337.json b/packages/hardhat/.openzeppelin/unknown-1337.json new file mode 100644 index 00000000..4405b332 --- /dev/null +++ b/packages/hardhat/.openzeppelin/unknown-1337.json @@ -0,0 +1,193 @@ +{ + "manifestVersion": "3.2", + "admin": { + "address": "0x6682971dfd150F6d39387238510546143Ad23B72", + "txHash": "0xc8eac278fce54da38c59a4f2edcd48620d9e91a4ce7e60acb6545d69e191d003" + }, + "proxies": [ + { + "address": "0xF6d4Da7AF781E65CFAE3711bbB51eE35C39c2E50", + "txHash": "0x63505cd29f2d93dd5a9eae81cfa520199d2eb2c74d79fe9bc41d68a283b59d95", + "kind": "transparent" + }, + { + "address": "0xCD865862dEF39AC399F235235140e22163a1Eeb7", + "txHash": "0x4c03d2e83f6da5c4435b4f3694ee0e776702b519cbba103378515b7b90341d38", + "kind": "transparent" + }, + { + "address": "0x550F71f90C6769756eF1b515Ced3E1b1f0d3CdFb", + "txHash": "0x3b7a9bfbf36527d6d6194a0a94b5d6b56adf879c48bcc33a6bcf0e3f4bef018c", + "kind": "transparent" + }, + { + "address": "0x797e9a01EC5879CB0d4A13A56346229873d5190C", + "txHash": "0xca54f7666e9eaa0463e333071c38a2f9a937d4b34ec0e1c3a2d29fb2cfb41060", + "kind": "transparent" + }, + { + "address": "0xfc8C6b5e46f6b9585E4182273E5De2c9De941111", + "txHash": "0x74bb482f38372e8e051d80d999564ed2776c588326811c87f53f721f501f162a", + "kind": "transparent" + }, + { + "address": "0x22a24a13165D4092745156c6F323c6B771495A26", + "txHash": "0xb1d9351d43c72e48f1a7ef761367de405d8f1f2b349108e127187bf11161da08", + "kind": "transparent" + }, + { + "address": "0x81242eca3Aba2363e59d44400B859d18b55861f3", + "txHash": "0x29ce3e7a89f6003e9d33f8aaf512e17b39e4fb7d8490542cc12195b66cb1b32e", + "kind": "transparent" + }, + { + "address": "0x7e210dB9B0e52c35626e9aE3E0D8b066fe54251d", + "txHash": "0x6b3ec885287f3a457d1182ac7f6cde534df8ce8b2ee358c161d8ad7393b59610", + "kind": "transparent" + }, + { + "address": "0xaC067E3c12b44322D1eB3496c5d1653bf216A123", + "txHash": "0x3e12ad17f399500d652accab68da876cb396b9177507ebb6a25859943ec9d5ce", + "kind": "transparent" + }, + { + "address": "0x410a36e43e36910cb12F1A9Bd26C0b8EDD9527ae", + "txHash": "0x19a61a2e17ecc9524143c19de5b858b733cbee1246e36fafb097c54f9185dd29", + "kind": "transparent" + }, + { + "address": "0x85D38A78eD9beaF3EAA6F17C2650254b4B20653e", + "txHash": "0x8f1b93753fd4ff1288270f526144ccde1fd898f65e241cbc30360dbb76ea1cca", + "kind": "transparent" + }, + { + "address": "0x12702E15aE26d04b8aA39eb28A3Fd20B736e6432", + "txHash": "0x45d15daa53b1f2f50a7175c1688be281576071732edff3303b3288baf89d4e61", + "kind": "transparent" + } + ], + "impls": { + "435ec29c4ee27b5877c62786f9c20612bfe6658fefda8300ba77eea99a5d107f": { + "address": "0x5cFd319787A79BBd8533F6bfA5240461A9c0A2e1", + "txHash": "0xa128e4ffe2e3a158cd64908f8cee3693a2d8844a5716cea83762a1a8ba96f039", + "layout": { + "solcVersion": "0.8.2", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:63", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:68" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin\\contracts-upgradeable\\utils\\ContextUpgradeable.sol:36" + }, + { + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin\\contracts-upgradeable\\access\\OwnableUpgradeable.sol:22" + }, + { + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin\\contracts-upgradeable\\access\\OwnableUpgradeable.sol:94" + }, + { + "label": "aragonGovernAddress", + "offset": 0, + "slot": "101", + "type": "t_address", + "contract": "QuestFactory", + "src": "contracts\\QuestFactory.sol:39" + }, + { + "label": "createDeposit", + "offset": 0, + "slot": "102", + "type": "t_struct(Deposit)4568_storage", + "contract": "QuestFactory", + "src": "contracts\\QuestFactory.sol:40" + }, + { + "label": "playDeposit", + "offset": 0, + "slot": "104", + "type": "t_struct(Deposit)4568_storage", + "contract": "QuestFactory", + "src": "contracts\\QuestFactory.sol:41" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(IERC20Upgradeable)378": { + "label": "contract IERC20Upgradeable", + "numberOfBytes": "20" + }, + "t_struct(Deposit)4568_storage": { + "label": "struct Models.Deposit", + "members": [ + { + "label": "token", + "type": "t_contract(IERC20Upgradeable)378", + "offset": 0, + "slot": "0" + }, + { + "label": "amount", + "type": "t_uint256", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + } + } + } + } +} diff --git a/packages/hardhat/abi/contracts/Externals/Govern.json b/packages/hardhat/abi/contracts/Externals/Govern.json index 9870b999..1d9f0d9a 100644 --- a/packages/hardhat/abi/contracts/Externals/Govern.json +++ b/packages/hardhat/abi/contracts/Externals/Govern.json @@ -71,9 +71,21 @@ }, { "components": [ - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } ], "indexed": false, "internalType": "struct ERC3000Data.Action[]", @@ -278,11 +290,20 @@ "name": "Withdrawn", "type": "event" }, - { "stateMutability": "nonpayable", "type": "fallback" }, + { + "stateMutability": "nonpayable", + "type": "fallback" + }, { "inputs": [], "name": "ROOT_ROLE", - "outputs": [{ "internalType": "bytes4", "name": "", "type": "bytes4" }], + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], "stateMutability": "view", "type": "function" }, @@ -295,8 +316,16 @@ "name": "op", "type": "uint8" }, - { "internalType": "bytes4", "name": "role", "type": "bytes4" }, - { "internalType": "address", "name": "who", "type": "address" } + { + "internalType": "bytes4", + "name": "role", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "who", + "type": "address" + } ], "internalType": "struct ACLData.BulkItem[]", "name": "items", @@ -310,9 +339,21 @@ }, { "inputs": [ - { "internalType": "address", "name": "_token", "type": "address" }, - { "internalType": "uint256", "name": "_amount", "type": "uint256" }, - { "internalType": "string", "name": "_reference", "type": "string" } + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "string", + "name": "_reference", + "type": "string" + } ], "name": "deposit", "outputs": [], @@ -323,9 +364,21 @@ "inputs": [ { "components": [ - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } ], "internalType": "struct ERC3000Data.Action[]", "name": "actions", @@ -336,18 +389,36 @@ "name": "allowFailuresMap", "type": "bytes32" }, - { "internalType": "bytes32", "name": "memo", "type": "bytes32" } + { + "internalType": "bytes32", + "name": "memo", + "type": "bytes32" + } ], "name": "exec", "outputs": [ - { "internalType": "bytes32", "name": "", "type": "bytes32" }, - { "internalType": "bytes[]", "name": "", "type": "bytes[]" } + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + }, + { + "internalType": "bytes[]", + "name": "", + "type": "bytes[]" + } ], "stateMutability": "nonpayable", "type": "function" }, { - "inputs": [{ "internalType": "bytes4", "name": "_role", "type": "bytes4" }], + "inputs": [ + { + "internalType": "bytes4", + "name": "_role", + "type": "bytes4" + } + ], "name": "freeze", "outputs": [], "stateMutability": "nonpayable", @@ -355,8 +426,16 @@ }, { "inputs": [ - { "internalType": "bytes4", "name": "_role", "type": "bytes4" }, - { "internalType": "address", "name": "_who", "type": "address" } + { + "internalType": "bytes4", + "name": "_role", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "_who", + "type": "address" + } ], "name": "grant", "outputs": [], @@ -365,8 +444,16 @@ }, { "inputs": [ - { "internalType": "bytes4", "name": "_role", "type": "bytes4" }, - { "internalType": "address", "name": "_who", "type": "address" }, + { + "internalType": "bytes4", + "name": "_role", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "_who", + "type": "address" + }, { "internalType": "contract IACLOracle", "name": "_oracle", @@ -379,9 +466,21 @@ "type": "function" }, { - "inputs": [{ "internalType": "string", "name": "", "type": "string" }], + "inputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], "name": "initBlocks", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, @@ -399,27 +498,65 @@ "type": "function" }, { - "inputs": [{ "internalType": "bytes4", "name": "_role", "type": "bytes4" }], + "inputs": [ + { + "internalType": "bytes4", + "name": "_role", + "type": "bytes4" + } + ], "name": "isFrozen", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "bytes32", "name": "_hash", "type": "bytes32" }, - { "internalType": "bytes", "name": "_signature", "type": "bytes" } + { + "internalType": "bytes32", + "name": "_hash", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "_signature", + "type": "bytes" + } ], "name": "isValidSignature", - "outputs": [{ "internalType": "bytes4", "name": "", "type": "bytes4" }], + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "bytes4", "name": "_interfaceId", "type": "bytes4" }, - { "internalType": "bytes4", "name": "_callbackSig", "type": "bytes4" }, - { "internalType": "bytes4", "name": "_magicNumber", "type": "bytes4" } + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + }, + { + "internalType": "bytes4", + "name": "_callbackSig", + "type": "bytes4" + }, + { + "internalType": "bytes4", + "name": "_magicNumber", + "type": "bytes4" + } ], "name": "registerStandardAndCallback", "outputs": [], @@ -428,8 +565,16 @@ }, { "inputs": [ - { "internalType": "bytes4", "name": "_role", "type": "bytes4" }, - { "internalType": "address", "name": "_who", "type": "address" } + { + "internalType": "bytes4", + "name": "_role", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "_who", + "type": "address" + } ], "name": "revoke", "outputs": [], @@ -438,11 +583,25 @@ }, { "inputs": [ - { "internalType": "bytes4", "name": "", "type": "bytes4" }, - { "internalType": "address", "name": "", "type": "address" } + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } ], "name": "roles", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", "type": "function" }, @@ -461,25 +620,58 @@ }, { "inputs": [ - { "internalType": "bytes4", "name": "_interfaceId", "type": "bytes4" } + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } ], "name": "supportsInterface", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "_token", "type": "address" }, - { "internalType": "address", "name": "_from", "type": "address" }, - { "internalType": "address", "name": "_to", "type": "address" }, - { "internalType": "uint256", "name": "_amount", "type": "uint256" }, - { "internalType": "string", "name": "_reference", "type": "string" } + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "string", + "name": "_reference", + "type": "string" + } ], "name": "withdraw", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { "stateMutability": "payable", "type": "receive" } -] + { + "stateMutability": "payable", + "type": "receive" + } +] \ No newline at end of file diff --git a/packages/hardhat/abi/contracts/Externals/GovernQueue.json b/packages/hardhat/abi/contracts/Externals/GovernQueue.json index 03eb685d..813cde75 100644 --- a/packages/hardhat/abi/contracts/Externals/GovernQueue.json +++ b/packages/hardhat/abi/contracts/Externals/GovernQueue.json @@ -1,7 +1,11 @@ [ { "inputs": [ - { "internalType": "address", "name": "_aclRoot", "type": "address" }, + { + "internalType": "address", + "name": "_aclRoot", + "type": "address" + }, { "components": [ { @@ -11,8 +15,16 @@ }, { "components": [ - { "internalType": "address", "name": "token", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } ], "internalType": "struct ERC3000Data.Collateral", "name": "scheduleDeposit", @@ -20,15 +32,31 @@ }, { "components": [ - { "internalType": "address", "name": "token", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } ], "internalType": "struct ERC3000Data.Collateral", "name": "challengeDeposit", "type": "tuple" }, - { "internalType": "address", "name": "resolver", "type": "address" }, - { "internalType": "bytes", "name": "rules", "type": "bytes" }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "bytes", + "name": "rules", + "type": "bytes" + }, { "internalType": "uint256", "name": "maxCalldataSize", @@ -72,8 +100,16 @@ }, { "components": [ - { "internalType": "address", "name": "token", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } ], "indexed": false, "internalType": "struct ERC3000Data.Collateral", @@ -108,8 +144,16 @@ }, { "components": [ - { "internalType": "address", "name": "token", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } ], "internalType": "struct ERC3000Data.Collateral", "name": "scheduleDeposit", @@ -117,15 +161,31 @@ }, { "components": [ - { "internalType": "address", "name": "token", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } ], "internalType": "struct ERC3000Data.Collateral", "name": "challengeDeposit", "type": "tuple" }, - { "internalType": "address", "name": "resolver", "type": "address" }, - { "internalType": "bytes", "name": "rules", "type": "bytes" }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "bytes", + "name": "rules", + "type": "bytes" + }, { "internalType": "uint256", "name": "maxCalldataSize", @@ -291,9 +351,9 @@ }, { "indexed": false, - "internalType": "bool", - "name": "approved", - "type": "bool" + "internalType": "uint256", + "name": "ruling", + "type": "uint256" } ], "name": "Resolved", @@ -360,13 +420,21 @@ }, { "components": [ - { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, { "internalType": "uint256", "name": "executionTime", "type": "uint256" }, - { "internalType": "address", "name": "submitter", "type": "address" }, + { + "internalType": "address", + "name": "submitter", + "type": "address" + }, { "internalType": "contract IERC3000Executor", "name": "executor", @@ -374,9 +442,21 @@ }, { "components": [ - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } ], "internalType": "struct ERC3000Data.Action[]", "name": "actions", @@ -387,8 +467,16 @@ "name": "allowFailuresMap", "type": "bytes32" }, - { "internalType": "bytes", "name": "proof", "type": "bytes" }, - { "internalType": "address", "name": "challenger", "type": "address" } + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + }, + { + "internalType": "address", + "name": "challenger", + "type": "address" + } ], "indexed": false, "internalType": "struct ERC3000Data.Payload", @@ -427,7 +515,13 @@ { "inputs": [], "name": "ROOT_ROLE", - "outputs": [{ "internalType": "bytes4", "name": "", "type": "bytes4" }], + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], "stateMutability": "view", "type": "function" }, @@ -440,8 +534,16 @@ "name": "op", "type": "uint8" }, - { "internalType": "bytes4", "name": "role", "type": "bytes4" }, - { "internalType": "address", "name": "who", "type": "address" } + { + "internalType": "bytes4", + "name": "role", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "who", + "type": "address" + } ], "internalType": "struct ACLData.BulkItem[]", "name": "items", @@ -459,7 +561,11 @@ "components": [ { "components": [ - { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, { "internalType": "uint256", "name": "executionTime", @@ -487,7 +593,11 @@ "name": "value", "type": "uint256" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } ], "internalType": "struct ERC3000Data.Action[]", "name": "actions", @@ -498,7 +608,11 @@ "name": "allowFailuresMap", "type": "bytes32" }, - { "internalType": "bytes", "name": "proof", "type": "bytes" }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + }, { "internalType": "address", "name": "challenger", @@ -555,7 +669,11 @@ "name": "resolver", "type": "address" }, - { "internalType": "bytes", "name": "rules", "type": "bytes" }, + { + "internalType": "bytes", + "name": "rules", + "type": "bytes" + }, { "internalType": "uint256", "name": "maxCalldataSize", @@ -571,26 +689,52 @@ "name": "_container", "type": "tuple" }, - { "internalType": "bytes", "name": "_reason", "type": "bytes" } + { + "internalType": "bytes", + "name": "_reason", + "type": "bytes" + } ], "name": "challenge", "outputs": [ - { "internalType": "uint256", "name": "disputeId", "type": "uint256" } + { + "internalType": "uint256", + "name": "disputeId", + "type": "uint256" + } ], "stateMutability": "nonpayable", "type": "function" }, { - "inputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], "name": "challengerCache", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "configHash", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], "stateMutability": "view", "type": "function" }, @@ -605,8 +749,16 @@ }, { "components": [ - { "internalType": "address", "name": "token", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } ], "internalType": "struct ERC3000Data.Collateral", "name": "scheduleDeposit", @@ -614,15 +766,31 @@ }, { "components": [ - { "internalType": "address", "name": "token", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } ], "internalType": "struct ERC3000Data.Collateral", "name": "challengeDeposit", "type": "tuple" }, - { "internalType": "address", "name": "resolver", "type": "address" }, - { "internalType": "bytes", "name": "rules", "type": "bytes" }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "bytes", + "name": "rules", + "type": "bytes" + }, { "internalType": "uint256", "name": "maxCalldataSize", @@ -635,17 +803,37 @@ } ], "name": "configure", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ - { "internalType": "bytes32", "name": "", "type": "bytes32" }, - { "internalType": "contract IArbitrator", "name": "", "type": "address" } + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + }, + { + "internalType": "contract IArbitrator", + "name": "", + "type": "address" + } ], "name": "disputeItemCache", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, @@ -655,7 +843,11 @@ "components": [ { "components": [ - { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, { "internalType": "uint256", "name": "executionTime", @@ -683,7 +875,11 @@ "name": "value", "type": "uint256" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } ], "internalType": "struct ERC3000Data.Action[]", "name": "actions", @@ -694,7 +890,11 @@ "name": "allowFailuresMap", "type": "bytes32" }, - { "internalType": "bytes", "name": "proof", "type": "bytes" }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + }, { "internalType": "address", "name": "challenger", @@ -751,7 +951,11 @@ "name": "resolver", "type": "address" }, - { "internalType": "bytes", "name": "rules", "type": "bytes" }, + { + "internalType": "bytes", + "name": "rules", + "type": "bytes" + }, { "internalType": "uint256", "name": "maxCalldataSize", @@ -770,14 +974,28 @@ ], "name": "execute", "outputs": [ - { "internalType": "bytes32", "name": "failureMap", "type": "bytes32" }, - { "internalType": "bytes[]", "name": "", "type": "bytes[]" } + { + "internalType": "bytes32", + "name": "failureMap", + "type": "bytes32" + }, + { + "internalType": "bytes[]", + "name": "", + "type": "bytes[]" + } ], "stateMutability": "nonpayable", "type": "function" }, { - "inputs": [{ "internalType": "bytes4", "name": "_role", "type": "bytes4" }], + "inputs": [ + { + "internalType": "bytes4", + "name": "_role", + "type": "bytes4" + } + ], "name": "freeze", "outputs": [], "stateMutability": "nonpayable", @@ -785,8 +1003,16 @@ }, { "inputs": [ - { "internalType": "bytes4", "name": "_role", "type": "bytes4" }, - { "internalType": "address", "name": "_who", "type": "address" } + { + "internalType": "bytes4", + "name": "_role", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "_who", + "type": "address" + } ], "name": "grant", "outputs": [], @@ -795,8 +1021,16 @@ }, { "inputs": [ - { "internalType": "bytes4", "name": "_role", "type": "bytes4" }, - { "internalType": "address", "name": "_who", "type": "address" }, + { + "internalType": "bytes4", + "name": "_role", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "_who", + "type": "address" + }, { "internalType": "contract IACLOracle", "name": "_oracle", @@ -809,15 +1043,31 @@ "type": "function" }, { - "inputs": [{ "internalType": "string", "name": "", "type": "string" }], + "inputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], "name": "initBlocks", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "_aclRoot", "type": "address" }, + { + "internalType": "address", + "name": "_aclRoot", + "type": "address" + }, { "components": [ { @@ -827,8 +1077,16 @@ }, { "components": [ - { "internalType": "address", "name": "token", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } ], "internalType": "struct ERC3000Data.Collateral", "name": "scheduleDeposit", @@ -836,15 +1094,31 @@ }, { "components": [ - { "internalType": "address", "name": "token", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } ], "internalType": "struct ERC3000Data.Collateral", "name": "challengeDeposit", "type": "tuple" }, - { "internalType": "address", "name": "resolver", "type": "address" }, - { "internalType": "bytes", "name": "rules", "type": "bytes" }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "bytes", + "name": "rules", + "type": "bytes" + }, { "internalType": "uint256", "name": "maxCalldataSize", @@ -862,21 +1136,45 @@ "type": "function" }, { - "inputs": [{ "internalType": "bytes4", "name": "_role", "type": "bytes4" }], + "inputs": [ + { + "internalType": "bytes4", + "name": "_role", + "type": "bytes4" + } + ], "name": "isFrozen", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "nonce", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { - "inputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], "name": "queue", "outputs": [ { @@ -894,7 +1192,11 @@ "components": [ { "components": [ - { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, { "internalType": "uint256", "name": "executionTime", @@ -922,7 +1224,11 @@ "name": "value", "type": "uint256" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } ], "internalType": "struct ERC3000Data.Action[]", "name": "actions", @@ -933,7 +1239,11 @@ "name": "allowFailuresMap", "type": "bytes32" }, - { "internalType": "bytes", "name": "proof", "type": "bytes" }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + }, { "internalType": "address", "name": "challenger", @@ -990,7 +1300,11 @@ "name": "resolver", "type": "address" }, - { "internalType": "bytes", "name": "rules", "type": "bytes" }, + { + "internalType": "bytes", + "name": "rules", + "type": "bytes" + }, { "internalType": "uint256", "name": "maxCalldataSize", @@ -1006,20 +1320,40 @@ "name": "_container", "type": "tuple" }, - { "internalType": "uint256", "name": "_disputeId", "type": "uint256" } + { + "internalType": "uint256", + "name": "_disputeId", + "type": "uint256" + } ], "name": "resolve", "outputs": [ - { "internalType": "bytes32", "name": "failureMap", "type": "bytes32" }, - { "internalType": "bytes[]", "name": "", "type": "bytes[]" } + { + "internalType": "bytes32", + "name": "failureMap", + "type": "bytes32" + }, + { + "internalType": "bytes[]", + "name": "", + "type": "bytes[]" + } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ - { "internalType": "bytes4", "name": "_role", "type": "bytes4" }, - { "internalType": "address", "name": "_who", "type": "address" } + { + "internalType": "bytes4", + "name": "_role", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "_who", + "type": "address" + } ], "name": "revoke", "outputs": [], @@ -1028,11 +1362,25 @@ }, { "inputs": [ - { "internalType": "bytes4", "name": "", "type": "bytes4" }, - { "internalType": "address", "name": "", "type": "address" } + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } ], "name": "roles", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", "type": "function" }, @@ -1042,7 +1390,11 @@ "components": [ { "components": [ - { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, { "internalType": "uint256", "name": "executionTime", @@ -1070,7 +1422,11 @@ "name": "value", "type": "uint256" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } ], "internalType": "struct ERC3000Data.Action[]", "name": "actions", @@ -1081,7 +1437,11 @@ "name": "allowFailuresMap", "type": "bytes32" }, - { "internalType": "bytes", "name": "proof", "type": "bytes" }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + }, { "internalType": "address", "name": "challenger", @@ -1138,7 +1498,11 @@ "name": "resolver", "type": "address" }, - { "internalType": "bytes", "name": "rules", "type": "bytes" }, + { + "internalType": "bytes", + "name": "rules", + "type": "bytes" + }, { "internalType": "uint256", "name": "maxCalldataSize", @@ -1157,17 +1521,31 @@ ], "name": "schedule", "outputs": [ - { "internalType": "bytes32", "name": "containerHash", "type": "bytes32" } + { + "internalType": "bytes32", + "name": "containerHash", + "type": "bytes32" + } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ - { "internalType": "bytes4", "name": "_interfaceId", "type": "bytes4" } + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } ], "name": "supportsInterface", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, @@ -1177,7 +1555,11 @@ "components": [ { "components": [ - { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, { "internalType": "uint256", "name": "executionTime", @@ -1205,7 +1587,11 @@ "name": "value", "type": "uint256" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } ], "internalType": "struct ERC3000Data.Action[]", "name": "actions", @@ -1216,7 +1602,11 @@ "name": "allowFailuresMap", "type": "bytes32" }, - { "internalType": "bytes", "name": "proof", "type": "bytes" }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + }, { "internalType": "address", "name": "challenger", @@ -1273,7 +1663,11 @@ "name": "resolver", "type": "address" }, - { "internalType": "bytes", "name": "rules", "type": "bytes" }, + { + "internalType": "bytes", + "name": "rules", + "type": "bytes" + }, { "internalType": "uint256", "name": "maxCalldataSize", @@ -1289,11 +1683,15 @@ "name": "_container", "type": "tuple" }, - { "internalType": "bytes", "name": "_reason", "type": "bytes" } + { + "internalType": "bytes", + "name": "_reason", + "type": "bytes" + } ], "name": "veto", "outputs": [], "stateMutability": "nonpayable", "type": "function" } -] +] \ No newline at end of file diff --git a/packages/hardhat/contracts/Quest.sol b/packages/hardhat/contracts/Quest.sol index e78828a9..dfe25860 100644 --- a/packages/hardhat/contracts/Quest.sol +++ b/packages/hardhat/contracts/Quest.sol @@ -100,8 +100,12 @@ contract Quest is IExecutable { } else { _amount = balance; } + // Claim all but let play deposits of each player if they are same token - if (address(rewardToken) == address(playDeposit.token)) { + if ( + address(rewardToken) == address(playDeposit.token) && + !isWhiteList + ) { (, uint256 result) = _amount.trySub( playDeposit.amount * playerList.length ); @@ -143,8 +147,8 @@ contract Quest is IExecutable { uint256 balance = rewardToken.balanceOf(address(this)); - // Claim all but let the create deposit if they are same token - if (address(rewardToken) == address(playDeposit.token)) { + // Restore all but let the player deposit still locked if they are same token + if (address(rewardToken) == address(playDeposit.token) && !isWhiteList) { (, balance) = balance.trySub( playDeposit.amount * playerList.length ); @@ -201,10 +205,10 @@ contract Quest is IExecutable { /*** * Set the white list of players allowed to play the quest. - * + * * requires sender to be the quest creator * @param _players The list of players allowed to play the quest. - * + * * emit QuestWhiteListChanged with players and timestamp */ function setWhiteList(address[] memory _players) external OnlyCreator { @@ -212,18 +216,23 @@ contract Quest is IExecutable { isWhiteList == true, "ERROR: Can't set the white list to a non-whitelisted contract" ); - - bool playerInList = false; - - for(uint32 i =0;i<_players.length;i++){ - - if(findIndexOfPlayer(_players[i])!=-1){ - playerInList = true; - } + + bool duplicatedPlayers = false; + + for(uint i = 0; i < _players.length; i++) { + address temp = _players[i]; + for(uint j = 0; j < _players.length; j++) { + if((j != i) && (temp == _players[j])) { + duplicatedPlayers = true; + } + } } - require(playerInList == false,"ERROR: One or more players is already in whitelist"); - + require( + duplicatedPlayers == false, + "ERROR: One or more players is already in whitelist" + ); + playerList = _players; emit QuestWhiteListChanged(_players, block.timestamp); } diff --git a/packages/hardhat/contracts/mocks/OwnableCelesteMock.sol b/packages/hardhat/contracts/mocks/OwnableCelesteMock.sol index 2b3c5673..a7db05a1 100644 --- a/packages/hardhat/contracts/mocks/OwnableCelesteMock.sol +++ b/packages/hardhat/contracts/mocks/OwnableCelesteMock.sol @@ -1,10 +1,3 @@ -/** - *Submitted for verification at Etherscan.io on 2022-01-07 - */ - -// Brought from https://github.com/aragon/aragonOS/blob/v4.3.0/contracts/lib/token/GovernERC20.sol -// Adapted to use pragma ^0.5.8 and satisfy our linter rules - pragma solidity ^0.5.8; /** @@ -63,6 +56,7 @@ interface IArbitrator { * @param _evidence Data submitted for the evidence related to the dispute */ function submitEvidence( + IArbitrable _subject, uint256 _disputeId, address _submitter, bytes calldata _evidence @@ -72,7 +66,10 @@ interface IArbitrator { * @dev Close the evidence period of a dispute * @param _disputeId Identification number of the dispute to close its evidence submitting period */ - function closeEvidencePeriod(uint256 _disputeId) external; + function closeEvidencePeriod( + IArbitrable _subject, + uint256 _disputeId + ) external; /** * @notice Rule dispute #`_disputeId` if ready @@ -82,7 +79,7 @@ interface IArbitrator { */ function rule( uint256 _disputeId - ) external returns (address subject, uint256 ruling); + ) external returns (IArbitrable subject, uint256 ruling); /** * @dev Tell the dispute fees information to create a dispute @@ -202,6 +199,20 @@ library SafeGovernERC20 { } } +contract IArbitrable { + /** + * @dev Emitted when an IArbitrable instance's dispute is ruled by an IArbitrator + * @param arbitrator IArbitrator instance ruling the dispute + * @param disputeId Identification number of the dispute being ruled by the arbitrator + * @param ruling Ruling given by the arbitrator + */ + event Ruled( + IArbitrator indexed arbitrator, + uint256 indexed disputeId, + uint256 ruling + ); +} + // File: contracts/ownable-celeste/OwnableCeleste.sol pragma solidity ^0.5.8; @@ -226,29 +237,178 @@ contract OwnableCeleste is IArbitrator { } struct Dispute { - address subject; + IArbitrable subject; State state; } + enum DisputeState { + PreDraft, + Adjudicating, + Ruled + } + + enum AdjudicationState { + Invalid, + Committing, + Revealing, + Appealing, + ConfirmingAppeal, + Ended + } + + /** + * @dev Ensure a dispute exists + * @param _disputeId Identification number of the dispute to be ensured + */ + modifier disputeExists(uint256 _disputeId) { + require(_disputeId <= currentId, "DM_DISPUTE_DOES_NOT_EXIST"); + _; + } + GovernERC20 public feeToken; uint256 public feeAmount; uint256 public currentId; address public owner; + // Last ensured term id + uint64 private termId; mapping(uint256 => Dispute) public disputes; + address feesUpdater; modifier onlyOwner() { require(msg.sender == owner, "ERR:NOT_OWNER"); _; } + // Events + event Heartbeat(uint64 previousTermId, uint64 currentTermId); + event StartTimeDelayed(uint64 previousStartTime, uint64 currentStartTime); + + event DisputeStateChanged( + uint256 indexed disputeId, + DisputeState indexed state + ); + event EvidenceSubmitted( + uint256 indexed disputeId, + address indexed submitter, + bytes evidence + ); + event EvidencePeriodClosed( + uint256 indexed disputeId, + uint64 indexed termId + ); + event NewDispute( + uint256 indexed disputeId, + IArbitrable indexed subject, + uint64 indexed draftTermId, + uint64 jurorsNumber, + bytes metadata + ); + event JurorDrafted( + uint256 indexed disputeId, + uint256 indexed roundId, + address indexed juror + ); + event RulingAppealed( + uint256 indexed disputeId, + uint256 indexed roundId, + uint8 ruling + ); + event RulingAppealConfirmed( + uint256 indexed disputeId, + uint256 indexed roundId, + uint64 indexed draftTermId, + uint256 jurorsNumber + ); + event RulingComputed(uint256 indexed disputeId, uint8 indexed ruling); + event PenaltiesSettled( + uint256 indexed disputeId, + uint256 indexed roundId, + uint256 collectedTokens + ); + event RewardSettled( + uint256 indexed disputeId, + uint256 indexed roundId, + address juror, + uint256 tokens, + uint256 fees + ); + event AppealDepositSettled( + uint256 indexed disputeId, + uint256 indexed roundId + ); + event MaxJurorsPerDraftBatchChanged( + uint64 previousMaxJurorsPerDraftBatch, + uint64 currentMaxJurorsPerDraftBatch + ); + constructor(GovernERC20 _feeToken, uint256 _feeAmount) public { owner = msg.sender; feeToken = _feeToken; feeAmount = _feeAmount; } - function setOwner(address _owner) public onlyOwner { - owner = _owner; + /** + * @dev Draft jurors for the next round of a dispute + * @param _disputeId Identification number of the dispute to be drafted + */ + function draft(uint256 _disputeId) external disputeExists(_disputeId) { + emit JurorDrafted(_disputeId, 0, address(this)); + emit DisputeStateChanged(_disputeId, DisputeState.Adjudicating); + } + + /** + * @notice Transition up to `_maxRequestedTransitions` terms + * @param _maxRequestedTransitions Max number of term transitions allowed by the sender + * @return Identification number of the term ID after executing the heartbeat transitions + */ + function heartbeat( + uint64 _maxRequestedTransitions + ) external returns (uint64) { + uint64 previousTermId = termId; + uint64 currentTermId = previousTermId + _maxRequestedTransitions; + termId = currentTermId; + emit Heartbeat(previousTermId, currentTermId); + return termId; + } + + /** + * @notice Delay the Court start time to `_newFirstTermStartTime` + * @param _newFirstTermStartTime New timestamp in seconds when the court will open + */ + function delayStartTime(uint64 _newFirstTermStartTime) public { + emit StartTimeDelayed(0, _newFirstTermStartTime); + } + + /** + * @notice Close the evidence period of dispute #`_disputeId` + * @param _subject IArbitrable instance requesting to close the evidence submission period + * @param _disputeId Identification number of the dispute to close its evidence submitting period + */ + function closeEvidencePeriod( + IArbitrable _subject, + uint256 _disputeId + ) external { + Dispute storage dispute = disputes[_disputeId]; + require(dispute.subject == _subject, "DM_SUBJECT_NOT_DISPUTE_SUBJECT"); + emit EvidencePeriodClosed(_disputeId, 0); + } + + /** + * @notice Submit evidence for a dispute #`_disputeId` + * @param _subject Arbitrable instance submitting the dispute + * @param _disputeId Identification number of the dispute receiving new evidence + * @param _submitter Address of the account submitting the evidence + * @param _evidence Data submitted for the evidence of the dispute + */ + function submitEvidence( + uint256 _disputeId, + address _submitter, + bytes calldata _evidence + ) external disputeExists(_disputeId) { + IArbitrable _subject = IArbitrable(msg.sender); + Dispute storage dispute = disputes[_disputeId]; + require(dispute.subject == _subject, "DM_SUBJECT_NOT_DISPUTE_SUBJECT"); + emit EvidenceSubmitted(_disputeId, _submitter, _evidence); } /** @@ -262,16 +422,23 @@ contract OwnableCeleste is IArbitrator { bytes calldata _metadata ) external returns (uint256) { uint256 disputeId = currentId; - disputes[disputeId] = Dispute(msg.sender, State.DISPUTED); + disputes[disputeId] = Dispute(IArbitrable(msg.sender), State.DISPUTED); currentId++; require( feeToken.safeTransferFrom(msg.sender, address(this), feeAmount), "ERR:DEPOSIT_FAILED" ); + + emit NewDispute(disputeId, IArbitrable(msg.sender), 0, 3, _metadata); + return disputeId; } + function setOwner(address _owner) public onlyOwner { + owner = _owner; + } + function decideDispute( uint256 _disputeId, State _state @@ -287,24 +454,6 @@ contract OwnableCeleste is IArbitrator { dispute.state = _state; } - /** - * @dev Submit evidence for a dispute - * @param _disputeId Id of the dispute in the Protocol - * @param _submitter Address of the account submitting the evidence - * @param _evidence Data submitted for the evidence related to the dispute - */ - function submitEvidence( - uint256 _disputeId, - address _submitter, - bytes calldata _evidence - ) external {} - - /** - * @dev Close the evidence period of a dispute - * @param _disputeId Identification number of the dispute to close its evidence submitting period - */ - function closeEvidencePeriod(uint256 _disputeId) external {} - /** * @notice Rule dispute #`_disputeId` if ready * @param _disputeId Identification number of the dispute to be ruled @@ -313,7 +462,7 @@ contract OwnableCeleste is IArbitrator { */ function rule( uint256 _disputeId - ) external returns (address subject, uint256 ruling) { + ) external returns (IArbitrable subject, uint256 ruling) { Dispute storage dispute = disputes[_disputeId]; if (dispute.state == State.DISPUTES_RULING_CHALLENGER) { @@ -347,14 +496,9 @@ contract OwnableCeleste is IArbitrator { function computeRuling( uint256 _disputeId - ) external view returns (address subject, State finalRuling) { + ) external returns (IArbitrable subject, State finalRuling) { Dispute storage dispute = disputes[_disputeId]; subject = dispute.subject; finalRuling = dispute.state; } - - function setFee(address _feeToken, uint256 _feeAmount) external onlyOwner { - feeAmount = _feeAmount; - feeToken = GovernERC20(_feeToken); - } } diff --git a/packages/hardhat/coverage.json b/packages/hardhat/coverage.json index 704f191c..257494e6 100644 --- a/packages/hardhat/coverage.json +++ b/packages/hardhat/coverage.json @@ -1 +1 @@ -{"contracts\\libraries\\Deposit.sol":{"l":{"24":45,"25":43,"36":45,"38":45,"42":45,"47":43,"58":61,"59":61},"path":"C:\\Projects\\quests\\packages\\hardhat\\contracts\\libraries\\Deposit.sol","s":{"1":45,"2":43,"3":45,"4":45,"5":45,"6":43,"7":61,"8":61},"b":{"1":[45,0],"2":[43,2],"3":[61,0]},"f":{"1":45,"2":45,"3":61},"fnMap":{"1":{"name":"collectFrom","line":19,"loc":{"start":{"line":19,"column":4},"end":{"line":26,"column":4}}},"2":{"name":"collectFrom","line":33,"loc":{"start":{"line":33,"column":4},"end":{"line":53,"column":4}}},"3":{"name":"releaseTo","line":55,"loc":{"start":{"line":55,"column":4},"end":{"line":61,"column":4}}}},"statementMap":{"1":{"start":{"line":24,"column":8},"end":{"line":24,"column":38}},"2":{"start":{"line":25,"column":8},"end":{"line":25,"column":34}},"3":{"start":{"line":36,"column":8},"end":{"line":36,"column":1126}},"4":{"start":{"line":38,"column":12},"end":{"line":38,"column":1207}},"5":{"start":{"line":42,"column":12},"end":{"line":42,"column":1339}},"6":{"start":{"line":47,"column":12},"end":{"line":47,"column":1478}},"7":{"start":{"line":58,"column":8},"end":{"line":58,"column":1744}},"8":{"start":{"line":59,"column":12},"end":{"line":59,"column":66}}},"branchMap":{"1":{"line":36,"type":"if","locations":[{"start":{"line":36,"column":8},"end":{"line":36,"column":8}},{"start":{"line":36,"column":8},"end":{"line":36,"column":8}}]},"2":{"line":42,"type":"if","locations":[{"start":{"line":42,"column":12},"end":{"line":42,"column":12}},{"start":{"line":42,"column":12},"end":{"line":42,"column":12}}]},"3":{"line":58,"type":"if","locations":[{"start":{"line":58,"column":8},"end":{"line":58,"column":8}},{"start":{"line":58,"column":8},"end":{"line":58,"column":8}}]}}},"contracts\\libraries\\IExecutable.sol":{"l":{},"path":"C:\\Projects\\quests\\packages\\hardhat\\contracts\\libraries\\IExecutable.sol","s":{},"b":{},"f":{},"fnMap":{},"statementMap":{},"branchMap":{}},"contracts\\libraries\\Models.sol":{"l":{},"path":"C:\\Projects\\quests\\packages\\hardhat\\contracts\\libraries\\Models.sol","s":{},"b":{},"f":{},"fnMap":{},"statementMap":{},"branchMap":{}},"contracts\\Quest.sol":{"l":{"38":4,"42":4,"52":99,"56":98,"57":98,"58":98,"59":98,"60":98,"61":98,"62":98,"63":98,"64":98,"66":98,"67":98,"68":98,"90":22,"91":21,"93":20,"95":20,"97":12,"98":6,"99":6,"101":6,"104":12,"105":6,"108":6,"112":20,"113":7,"114":7,"120":19,"121":19,"124":18,"126":18,"136":16,"139":15,"140":12,"141":12,"144":15,"147":15,"148":3,"153":15,"163":5,"180":45,"184":44,"188":43,"192":42,"193":41,"194":41,"196":40,"198":39,"199":39,"211":4,"215":3,"216":3,"229":9,"233":8,"237":7,"238":7,"241":6,"243":6,"245":6,"246":6,"253":6,"259":53,"260":18,"261":10,"264":43},"path":"C:\\Projects\\quests\\packages\\hardhat\\contracts\\Quest.sol","s":{"1":4,"2":99,"3":22,"4":21,"5":20,"6":20,"7":12,"8":6,"9":12,"10":6,"11":20,"12":7,"13":7,"14":19,"15":19,"16":18,"17":18,"18":16,"19":15,"20":12,"21":15,"22":15,"23":15,"24":5,"25":45,"26":44,"27":43,"28":42,"29":41,"30":41,"31":40,"32":39,"33":39,"34":4,"35":3,"36":9,"37":8,"38":7,"39":7,"40":6,"41":6,"42":6,"43":6,"44":53,"45":18,"46":10,"47":43},"b":{"1":[4,0],"2":[98,1],"3":[21,1],"4":[20,1],"5":[12,8],"6":[6,6],"7":[6,6],"8":[7,13],"9":[6,1],"10":[19,0],"11":[15,1],"12":[12,3],"13":[3,12],"14":[44,1],"15":[43,1],"16":[22,21],"17":[42,1],"18":[39,3],"19":[41,1],"20":[40,1],"21":[4,0],"22":[3,1],"23":[8,1],"24":[7,1],"25":[3,4],"26":[6,1],"27":[10,8]},"f":{"1":4,"2":99,"3":22,"4":16,"5":5,"6":45,"7":4,"8":9,"9":6,"10":53},"fnMap":{"1":{"name":"OnlyCreator","line":37,"loc":{"start":{"line":37,"column":4},"end":{"line":43,"column":4}}},"2":{"name":"constructor","line":45,"loc":{"start":{"line":45,"column":4},"end":{"line":69,"column":4}}},"3":{"name":"claim","line":84,"loc":{"start":{"line":84,"column":4},"end":{"line":127,"column":4}}},"4":{"name":"recoverFundsAndDeposit","line":135,"loc":{"start":{"line":135,"column":4},"end":{"line":154,"column":4}}},"5":{"name":"canExecute","line":160,"loc":{"start":{"line":160,"column":4},"end":{"line":164,"column":4}}},"6":{"name":"play","line":179,"loc":{"start":{"line":179,"column":4},"end":{"line":200,"column":4}}},"7":{"name":"setWhiteList","line":210,"loc":{"start":{"line":210,"column":4},"end":{"line":217,"column":4}}},"8":{"name":"unplay","line":228,"loc":{"start":{"line":228,"column":4},"end":{"line":247,"column":4}}},"9":{"name":"getPlayers","line":252,"loc":{"start":{"line":252,"column":4},"end":{"line":254,"column":4}}},"10":{"name":"findIndexOfPlayer","line":258,"loc":{"start":{"line":258,"column":4},"end":{"line":265,"column":4}}}},"statementMap":{"1":{"start":{"line":38,"column":8},"end":{"line":38,"column":1464}},"2":{"start":{"line":52,"column":8},"end":{"line":52,"column":1848}},"3":{"start":{"line":90,"column":8},"end":{"line":90,"column":77}},"4":{"start":{"line":91,"column":8},"end":{"line":91,"column":59}},"5":{"start":{"line":93,"column":8},"end":{"line":93,"column":62}},"6":{"start":{"line":95,"column":8},"end":{"line":95,"column":3386}},"7":{"start":{"line":97,"column":12},"end":{"line":97,"column":3496}},"8":{"start":{"line":98,"column":16},"end":{"line":98,"column":73}},"9":{"start":{"line":104,"column":12},"end":{"line":104,"column":3839}},"10":{"start":{"line":105,"column":16},"end":{"line":105,"column":3919}},"11":{"start":{"line":112,"column":8},"end":{"line":112,"column":4099}},"12":{"start":{"line":113,"column":12},"end":{"line":113,"column":56}},"13":{"start":{"line":114,"column":12},"end":{"line":114,"column":4235}},"14":{"start":{"line":120,"column":8},"end":{"line":120,"column":4386}},"15":{"start":{"line":121,"column":12},"end":{"line":121,"column":53}},"16":{"start":{"line":124,"column":8},"end":{"line":124,"column":61}},"17":{"start":{"line":126,"column":8},"end":{"line":126,"column":54}},"18":{"start":{"line":136,"column":8},"end":{"line":136,"column":67}},"19":{"start":{"line":139,"column":8},"end":{"line":139,"column":4983}},"20":{"start":{"line":140,"column":12},"end":{"line":140,"column":48}},"21":{"start":{"line":144,"column":8},"end":{"line":144,"column":62}},"22":{"start":{"line":147,"column":8},"end":{"line":147,"column":5273}},"23":{"start":{"line":153,"column":8},"end":{"line":153,"column":62}},"24":{"start":{"line":163,"column":8},"end":{"line":163,"column":48}},"25":{"start":{"line":180,"column":8},"end":{"line":180,"column":6369}},"26":{"start":{"line":184,"column":8},"end":{"line":184,"column":6505}},"27":{"start":{"line":188,"column":8},"end":{"line":188,"column":6653}},"28":{"start":{"line":192,"column":8},"end":{"line":192,"column":68}},"29":{"start":{"line":193,"column":8},"end":{"line":193,"column":55}},"30":{"start":{"line":194,"column":8},"end":{"line":194,"column":65}},"31":{"start":{"line":196,"column":8},"end":{"line":196,"column":57}},"32":{"start":{"line":198,"column":8},"end":{"line":198,"column":31}},"33":{"start":{"line":199,"column":8},"end":{"line":199,"column":50}},"34":{"start":{"line":211,"column":8},"end":{"line":211,"column":7510}},"35":{"start":{"line":216,"column":8},"end":{"line":216,"column":61}},"36":{"start":{"line":229,"column":8},"end":{"line":229,"column":8121}},"37":{"start":{"line":233,"column":8},"end":{"line":233,"column":8241}},"38":{"start":{"line":237,"column":8},"end":{"line":237,"column":55}},"39":{"start":{"line":238,"column":8},"end":{"line":238,"column":62}},"40":{"start":{"line":243,"column":8},"end":{"line":243,"column":23}},"41":{"start":{"line":245,"column":8},"end":{"line":245,"column":37}},"42":{"start":{"line":246,"column":8},"end":{"line":246,"column":52}},"43":{"start":{"line":253,"column":8},"end":{"line":253,"column":25}},"44":{"start":{"line":259,"column":8},"end":{"line":259,"column":9176}},"45":{"start":{"line":260,"column":12},"end":{"line":260,"column":9243}},"46":{"start":{"line":261,"column":16},"end":{"line":261,"column":32}},"47":{"start":{"line":264,"column":8},"end":{"line":264,"column":17}}},"branchMap":{"1":{"line":38,"type":"if","locations":[{"start":{"line":38,"column":8},"end":{"line":38,"column":8}},{"start":{"line":38,"column":8},"end":{"line":38,"column":8}}]},"2":{"line":52,"type":"if","locations":[{"start":{"line":52,"column":8},"end":{"line":52,"column":8}},{"start":{"line":52,"column":8},"end":{"line":52,"column":8}}]},"3":{"line":90,"type":"if","locations":[{"start":{"line":90,"column":8},"end":{"line":90,"column":8}},{"start":{"line":90,"column":8},"end":{"line":90,"column":8}}]},"4":{"line":91,"type":"if","locations":[{"start":{"line":91,"column":8},"end":{"line":91,"column":8}},{"start":{"line":91,"column":8},"end":{"line":91,"column":8}}]},"5":{"line":95,"type":"if","locations":[{"start":{"line":95,"column":8},"end":{"line":95,"column":8}},{"start":{"line":95,"column":8},"end":{"line":95,"column":8}}]},"6":{"line":97,"type":"if","locations":[{"start":{"line":97,"column":12},"end":{"line":97,"column":12}},{"start":{"line":97,"column":12},"end":{"line":97,"column":12}}]},"7":{"line":104,"type":"if","locations":[{"start":{"line":104,"column":12},"end":{"line":104,"column":12}},{"start":{"line":104,"column":12},"end":{"line":104,"column":12}}]},"8":{"line":112,"type":"if","locations":[{"start":{"line":112,"column":8},"end":{"line":112,"column":8}},{"start":{"line":112,"column":8},"end":{"line":112,"column":8}}]},"9":{"line":114,"type":"if","locations":[{"start":{"line":114,"column":12},"end":{"line":114,"column":12}},{"start":{"line":114,"column":12},"end":{"line":114,"column":12}}]},"10":{"line":120,"type":"if","locations":[{"start":{"line":120,"column":8},"end":{"line":120,"column":8}},{"start":{"line":120,"column":8},"end":{"line":120,"column":8}}]},"11":{"line":136,"type":"if","locations":[{"start":{"line":136,"column":8},"end":{"line":136,"column":8}},{"start":{"line":136,"column":8},"end":{"line":136,"column":8}}]},"12":{"line":139,"type":"if","locations":[{"start":{"line":139,"column":8},"end":{"line":139,"column":8}},{"start":{"line":139,"column":8},"end":{"line":139,"column":8}}]},"13":{"line":147,"type":"if","locations":[{"start":{"line":147,"column":8},"end":{"line":147,"column":8}},{"start":{"line":147,"column":8},"end":{"line":147,"column":8}}]},"14":{"line":180,"type":"if","locations":[{"start":{"line":180,"column":8},"end":{"line":180,"column":8}},{"start":{"line":180,"column":8},"end":{"line":180,"column":8}}]},"15":{"line":184,"type":"if","locations":[{"start":{"line":184,"column":8},"end":{"line":184,"column":8}},{"start":{"line":184,"column":8},"end":{"line":184,"column":8}}]},"16":{"line":185,"type":"cond-expr","locations":[{"start":{"line":185,"column":12},"end":{"line":185,"column":32}},{"start":{"line":185,"column":37},"end":{"line":185,"column":62}}]},"17":{"line":188,"type":"if","locations":[{"start":{"line":188,"column":8},"end":{"line":188,"column":8}},{"start":{"line":188,"column":8},"end":{"line":188,"column":8}}]},"18":{"line":189,"type":"cond-expr","locations":[{"start":{"line":189,"column":12},"end":{"line":189,"column":26}},{"start":{"line":189,"column":31},"end":{"line":189,"column":60}}]},"19":{"line":192,"type":"if","locations":[{"start":{"line":192,"column":8},"end":{"line":192,"column":8}},{"start":{"line":192,"column":8},"end":{"line":192,"column":8}}]},"20":{"line":194,"type":"if","locations":[{"start":{"line":194,"column":8},"end":{"line":194,"column":8}},{"start":{"line":194,"column":8},"end":{"line":194,"column":8}}]},"21":{"line":210,"type":"if","locations":[{"start":{"line":210,"column":62},"end":{"line":210,"column":62}},{"start":{"line":210,"column":62},"end":{"line":210,"column":62}}]},"22":{"line":211,"type":"if","locations":[{"start":{"line":211,"column":8},"end":{"line":211,"column":8}},{"start":{"line":211,"column":8},"end":{"line":211,"column":8}}]},"23":{"line":229,"type":"if","locations":[{"start":{"line":229,"column":8},"end":{"line":229,"column":8}},{"start":{"line":229,"column":8},"end":{"line":229,"column":8}}]},"24":{"line":233,"type":"if","locations":[{"start":{"line":233,"column":8},"end":{"line":233,"column":8}},{"start":{"line":233,"column":8},"end":{"line":233,"column":8}}]},"25":{"line":234,"type":"cond-expr","locations":[{"start":{"line":234,"column":12},"end":{"line":234,"column":32}},{"start":{"line":234,"column":37},"end":{"line":234,"column":62}}]},"26":{"line":238,"type":"if","locations":[{"start":{"line":238,"column":8},"end":{"line":238,"column":8}},{"start":{"line":238,"column":8},"end":{"line":238,"column":8}}]},"27":{"line":260,"type":"if","locations":[{"start":{"line":260,"column":12},"end":{"line":260,"column":12}},{"start":{"line":260,"column":12},"end":{"line":260,"column":12}}]}}},"contracts\\QuestFactory.sol":{"l":{"45":3,"49":36,"50":36,"63":14,"64":14,"77":14,"78":14,"102":5,"119":5,"121":4,"136":4,"147":1},"path":"C:\\Projects\\quests\\packages\\hardhat\\contracts\\QuestFactory.sol","s":{"1":3,"2":36,"3":14,"4":14,"5":5,"6":5,"7":4,"8":4},"b":{"1":[36,0],"2":[14,1],"3":[14,1],"4":[1,1]},"f":{"1":3,"2":36,"3":14,"4":14,"5":5,"6":1},"fnMap":{"1":{"name":"constructor","line":44,"loc":{"start":{"line":44,"column":4},"end":{"line":46,"column":4}}},"2":{"name":"initialize","line":48,"loc":{"start":{"line":48,"column":4},"end":{"line":51,"column":4}}},"3":{"name":"setCreateDeposit","line":62,"loc":{"start":{"line":59,"column":4},"end":{"line":65,"column":4}}},"4":{"name":"setPlayDeposit","line":76,"loc":{"start":{"line":73,"column":4},"end":{"line":79,"column":4}}},"5":{"name":"createQuest","line":93,"loc":{"start":{"line":93,"column":4},"end":{"line":137,"column":4}}},"6":{"name":"setAragonGovernAddress","line":146,"loc":{"start":{"line":144,"column":4},"end":{"line":148,"column":4}}}},"statementMap":{"1":{"start":{"line":45,"column":8},"end":{"line":45,"column":29}},"2":{"start":{"line":49,"column":8},"end":{"line":49,"column":23}},"3":{"start":{"line":64,"column":8},"end":{"line":64,"column":74}},"4":{"start":{"line":78,"column":8},"end":{"line":78,"column":72}},"5":{"start":{"line":102,"column":8},"end":{"line":102,"column":3329}},"6":{"start":{"line":119,"column":8},"end":{"line":119,"column":60}},"7":{"start":{"line":121,"column":8},"end":{"line":121,"column":3983}},"8":{"start":{"line":136,"column":8},"end":{"line":136,"column":29}}},"branchMap":{"1":{"line":48,"type":"if","locations":[{"start":{"line":48,"column":61},"end":{"line":48,"column":61}},{"start":{"line":48,"column":61},"end":{"line":48,"column":61}}]},"2":{"line":62,"type":"if","locations":[{"start":{"line":62,"column":13},"end":{"line":62,"column":13}},{"start":{"line":62,"column":13},"end":{"line":62,"column":13}}]},"3":{"line":76,"type":"if","locations":[{"start":{"line":76,"column":13},"end":{"line":76,"column":13}},{"start":{"line":76,"column":13},"end":{"line":76,"column":13}}]},"4":{"line":146,"type":"if","locations":[{"start":{"line":146,"column":15},"end":{"line":146,"column":15}},{"start":{"line":146,"column":15},"end":{"line":146,"column":15}}]}}}} \ No newline at end of file +{"contracts\\libraries\\Deposit.sol":{"l":{"24":45,"25":43,"36":45,"38":45,"42":45,"47":43,"58":64,"59":64},"path":"C:\\Projects\\quests\\packages\\hardhat\\contracts\\libraries\\Deposit.sol","s":{"1":45,"2":43,"3":45,"4":45,"5":45,"6":43,"7":64,"8":64},"b":{"1":[45,0],"2":[43,2],"3":[64,0]},"f":{"1":45,"2":45,"3":64},"fnMap":{"1":{"name":"collectFrom","line":19,"loc":{"start":{"line":19,"column":4},"end":{"line":26,"column":4}}},"2":{"name":"collectFrom","line":33,"loc":{"start":{"line":33,"column":4},"end":{"line":53,"column":4}}},"3":{"name":"releaseTo","line":55,"loc":{"start":{"line":55,"column":4},"end":{"line":61,"column":4}}}},"statementMap":{"1":{"start":{"line":24,"column":8},"end":{"line":24,"column":38}},"2":{"start":{"line":25,"column":8},"end":{"line":25,"column":34}},"3":{"start":{"line":36,"column":8},"end":{"line":36,"column":1126}},"4":{"start":{"line":38,"column":12},"end":{"line":38,"column":1207}},"5":{"start":{"line":42,"column":12},"end":{"line":42,"column":1339}},"6":{"start":{"line":47,"column":12},"end":{"line":47,"column":1478}},"7":{"start":{"line":58,"column":8},"end":{"line":58,"column":1744}},"8":{"start":{"line":59,"column":12},"end":{"line":59,"column":66}}},"branchMap":{"1":{"line":36,"type":"if","locations":[{"start":{"line":36,"column":8},"end":{"line":36,"column":8}},{"start":{"line":36,"column":8},"end":{"line":36,"column":8}}]},"2":{"line":42,"type":"if","locations":[{"start":{"line":42,"column":12},"end":{"line":42,"column":12}},{"start":{"line":42,"column":12},"end":{"line":42,"column":12}}]},"3":{"line":58,"type":"if","locations":[{"start":{"line":58,"column":8},"end":{"line":58,"column":8}},{"start":{"line":58,"column":8},"end":{"line":58,"column":8}}]}}},"contracts\\libraries\\IExecutable.sol":{"l":{},"path":"C:\\Projects\\quests\\packages\\hardhat\\contracts\\libraries\\IExecutable.sol","s":{},"b":{},"f":{},"fnMap":{},"statementMap":{},"branchMap":{}},"contracts\\libraries\\Models.sol":{"l":{},"path":"C:\\Projects\\quests\\packages\\hardhat\\contracts\\libraries\\Models.sol","s":{},"b":{},"f":{},"fnMap":{},"statementMap":{},"branchMap":{}},"contracts\\Quest.sol":{"l":{"38":11,"42":11,"52":108,"56":107,"57":107,"58":107,"59":107,"60":107,"61":107,"62":107,"63":107,"64":107,"66":107,"67":107,"68":107,"90":25,"91":24,"93":23,"95":23,"97":15,"98":9,"99":9,"101":6,"105":15,"109":6,"112":6,"116":23,"117":10,"118":10,"124":22,"125":22,"128":21,"130":21,"140":19,"143":18,"144":15,"145":15,"148":18,"151":18,"152":3,"157":18,"167":5,"184":45,"188":44,"192":43,"196":42,"197":41,"198":41,"200":40,"202":39,"203":39,"215":11,"220":10,"222":10,"223":19,"224":1,"228":10,"233":9,"234":9,"247":9,"251":8,"255":7,"256":7,"259":6,"261":6,"263":6,"264":6,"271":6,"277":72,"278":19,"279":11,"282":61},"path":"C:\\Projects\\quests\\packages\\hardhat\\contracts\\Quest.sol","s":{"1":11,"2":108,"3":25,"4":24,"5":23,"6":23,"7":15,"8":9,"9":15,"10":6,"11":23,"12":10,"13":10,"14":22,"15":22,"16":21,"17":21,"18":19,"19":18,"20":15,"21":18,"22":18,"23":18,"24":5,"25":45,"26":44,"27":43,"28":42,"29":41,"30":41,"31":40,"32":39,"33":39,"34":11,"35":10,"36":10,"37":19,"38":10,"39":9,"40":9,"41":8,"42":7,"43":7,"44":6,"45":6,"46":6,"47":6,"48":72,"49":19,"50":11,"51":61},"b":{"1":[11,0],"2":[107,1],"3":[24,1],"4":[23,1],"5":[15,8],"6":[9,6],"7":[6,9],"8":[10,13],"9":[9,1],"10":[22,0],"11":[18,1],"12":[15,3],"13":[3,15],"14":[44,1],"15":[43,1],"16":[22,21],"17":[42,1],"18":[39,3],"19":[41,1],"20":[40,1],"21":[11,0],"22":[10,1],"23":[1,18],"24":[9,1],"25":[8,1],"26":[7,1],"27":[3,4],"28":[6,1],"29":[11,8]},"f":{"1":11,"2":108,"3":25,"4":19,"5":5,"6":45,"7":11,"8":9,"9":6,"10":72},"fnMap":{"1":{"name":"OnlyCreator","line":37,"loc":{"start":{"line":37,"column":4},"end":{"line":43,"column":4}}},"2":{"name":"constructor","line":45,"loc":{"start":{"line":45,"column":4},"end":{"line":69,"column":4}}},"3":{"name":"claim","line":84,"loc":{"start":{"line":84,"column":4},"end":{"line":131,"column":4}}},"4":{"name":"recoverFundsAndDeposit","line":139,"loc":{"start":{"line":139,"column":4},"end":{"line":158,"column":4}}},"5":{"name":"canExecute","line":164,"loc":{"start":{"line":164,"column":4},"end":{"line":168,"column":4}}},"6":{"name":"play","line":183,"loc":{"start":{"line":183,"column":4},"end":{"line":204,"column":4}}},"7":{"name":"setWhiteList","line":214,"loc":{"start":{"line":214,"column":4},"end":{"line":235,"column":4}}},"8":{"name":"unplay","line":246,"loc":{"start":{"line":246,"column":4},"end":{"line":265,"column":4}}},"9":{"name":"getPlayers","line":270,"loc":{"start":{"line":270,"column":4},"end":{"line":272,"column":4}}},"10":{"name":"findIndexOfPlayer","line":276,"loc":{"start":{"line":276,"column":4},"end":{"line":283,"column":4}}}},"statementMap":{"1":{"start":{"line":38,"column":8},"end":{"line":38,"column":1464}},"2":{"start":{"line":52,"column":8},"end":{"line":52,"column":1848}},"3":{"start":{"line":90,"column":8},"end":{"line":90,"column":77}},"4":{"start":{"line":91,"column":8},"end":{"line":91,"column":59}},"5":{"start":{"line":93,"column":8},"end":{"line":93,"column":62}},"6":{"start":{"line":95,"column":8},"end":{"line":95,"column":3386}},"7":{"start":{"line":97,"column":12},"end":{"line":97,"column":3496}},"8":{"start":{"line":98,"column":16},"end":{"line":98,"column":73}},"9":{"start":{"line":105,"column":12},"end":{"line":105,"column":3841}},"10":{"start":{"line":109,"column":16},"end":{"line":109,"column":3986}},"11":{"start":{"line":116,"column":8},"end":{"line":116,"column":4166}},"12":{"start":{"line":117,"column":12},"end":{"line":117,"column":56}},"13":{"start":{"line":118,"column":12},"end":{"line":118,"column":4302}},"14":{"start":{"line":124,"column":8},"end":{"line":124,"column":4453}},"15":{"start":{"line":125,"column":12},"end":{"line":125,"column":53}},"16":{"start":{"line":128,"column":8},"end":{"line":128,"column":61}},"17":{"start":{"line":130,"column":8},"end":{"line":130,"column":54}},"18":{"start":{"line":140,"column":8},"end":{"line":140,"column":67}},"19":{"start":{"line":143,"column":8},"end":{"line":143,"column":5050}},"20":{"start":{"line":144,"column":12},"end":{"line":144,"column":48}},"21":{"start":{"line":148,"column":8},"end":{"line":148,"column":62}},"22":{"start":{"line":151,"column":8},"end":{"line":151,"column":5355}},"23":{"start":{"line":157,"column":8},"end":{"line":157,"column":62}},"24":{"start":{"line":167,"column":8},"end":{"line":167,"column":48}},"25":{"start":{"line":184,"column":8},"end":{"line":184,"column":6467}},"26":{"start":{"line":188,"column":8},"end":{"line":188,"column":6603}},"27":{"start":{"line":192,"column":8},"end":{"line":192,"column":6751}},"28":{"start":{"line":196,"column":8},"end":{"line":196,"column":68}},"29":{"start":{"line":197,"column":8},"end":{"line":197,"column":55}},"30":{"start":{"line":198,"column":8},"end":{"line":198,"column":65}},"31":{"start":{"line":200,"column":8},"end":{"line":200,"column":57}},"32":{"start":{"line":202,"column":8},"end":{"line":202,"column":31}},"33":{"start":{"line":203,"column":8},"end":{"line":203,"column":50}},"34":{"start":{"line":215,"column":8},"end":{"line":215,"column":7606}},"35":{"start":{"line":220,"column":8},"end":{"line":220,"column":33}},"36":{"start":{"line":222,"column":8},"end":{"line":222,"column":7787}},"37":{"start":{"line":223,"column":12},"end":{"line":223,"column":7851}},"38":{"start":{"line":228,"column":8},"end":{"line":228,"column":7966}},"39":{"start":{"line":234,"column":8},"end":{"line":234,"column":61}},"40":{"start":{"line":247,"column":8},"end":{"line":247,"column":8570}},"41":{"start":{"line":251,"column":8},"end":{"line":251,"column":8690}},"42":{"start":{"line":255,"column":8},"end":{"line":255,"column":55}},"43":{"start":{"line":256,"column":8},"end":{"line":256,"column":62}},"44":{"start":{"line":261,"column":8},"end":{"line":261,"column":23}},"45":{"start":{"line":263,"column":8},"end":{"line":263,"column":37}},"46":{"start":{"line":264,"column":8},"end":{"line":264,"column":52}},"47":{"start":{"line":271,"column":8},"end":{"line":271,"column":25}},"48":{"start":{"line":277,"column":8},"end":{"line":277,"column":9625}},"49":{"start":{"line":278,"column":12},"end":{"line":278,"column":9692}},"50":{"start":{"line":279,"column":16},"end":{"line":279,"column":32}},"51":{"start":{"line":282,"column":8},"end":{"line":282,"column":17}}},"branchMap":{"1":{"line":38,"type":"if","locations":[{"start":{"line":38,"column":8},"end":{"line":38,"column":8}},{"start":{"line":38,"column":8},"end":{"line":38,"column":8}}]},"2":{"line":52,"type":"if","locations":[{"start":{"line":52,"column":8},"end":{"line":52,"column":8}},{"start":{"line":52,"column":8},"end":{"line":52,"column":8}}]},"3":{"line":90,"type":"if","locations":[{"start":{"line":90,"column":8},"end":{"line":90,"column":8}},{"start":{"line":90,"column":8},"end":{"line":90,"column":8}}]},"4":{"line":91,"type":"if","locations":[{"start":{"line":91,"column":8},"end":{"line":91,"column":8}},{"start":{"line":91,"column":8},"end":{"line":91,"column":8}}]},"5":{"line":95,"type":"if","locations":[{"start":{"line":95,"column":8},"end":{"line":95,"column":8}},{"start":{"line":95,"column":8},"end":{"line":95,"column":8}}]},"6":{"line":97,"type":"if","locations":[{"start":{"line":97,"column":12},"end":{"line":97,"column":12}},{"start":{"line":97,"column":12},"end":{"line":97,"column":12}}]},"7":{"line":105,"type":"if","locations":[{"start":{"line":105,"column":12},"end":{"line":105,"column":12}},{"start":{"line":105,"column":12},"end":{"line":105,"column":12}}]},"8":{"line":116,"type":"if","locations":[{"start":{"line":116,"column":8},"end":{"line":116,"column":8}},{"start":{"line":116,"column":8},"end":{"line":116,"column":8}}]},"9":{"line":118,"type":"if","locations":[{"start":{"line":118,"column":12},"end":{"line":118,"column":12}},{"start":{"line":118,"column":12},"end":{"line":118,"column":12}}]},"10":{"line":124,"type":"if","locations":[{"start":{"line":124,"column":8},"end":{"line":124,"column":8}},{"start":{"line":124,"column":8},"end":{"line":124,"column":8}}]},"11":{"line":140,"type":"if","locations":[{"start":{"line":140,"column":8},"end":{"line":140,"column":8}},{"start":{"line":140,"column":8},"end":{"line":140,"column":8}}]},"12":{"line":143,"type":"if","locations":[{"start":{"line":143,"column":8},"end":{"line":143,"column":8}},{"start":{"line":143,"column":8},"end":{"line":143,"column":8}}]},"13":{"line":151,"type":"if","locations":[{"start":{"line":151,"column":8},"end":{"line":151,"column":8}},{"start":{"line":151,"column":8},"end":{"line":151,"column":8}}]},"14":{"line":184,"type":"if","locations":[{"start":{"line":184,"column":8},"end":{"line":184,"column":8}},{"start":{"line":184,"column":8},"end":{"line":184,"column":8}}]},"15":{"line":188,"type":"if","locations":[{"start":{"line":188,"column":8},"end":{"line":188,"column":8}},{"start":{"line":188,"column":8},"end":{"line":188,"column":8}}]},"16":{"line":189,"type":"cond-expr","locations":[{"start":{"line":189,"column":12},"end":{"line":189,"column":32}},{"start":{"line":189,"column":37},"end":{"line":189,"column":62}}]},"17":{"line":192,"type":"if","locations":[{"start":{"line":192,"column":8},"end":{"line":192,"column":8}},{"start":{"line":192,"column":8},"end":{"line":192,"column":8}}]},"18":{"line":193,"type":"cond-expr","locations":[{"start":{"line":193,"column":12},"end":{"line":193,"column":26}},{"start":{"line":193,"column":31},"end":{"line":193,"column":60}}]},"19":{"line":196,"type":"if","locations":[{"start":{"line":196,"column":8},"end":{"line":196,"column":8}},{"start":{"line":196,"column":8},"end":{"line":196,"column":8}}]},"20":{"line":198,"type":"if","locations":[{"start":{"line":198,"column":8},"end":{"line":198,"column":8}},{"start":{"line":198,"column":8},"end":{"line":198,"column":8}}]},"21":{"line":214,"type":"if","locations":[{"start":{"line":214,"column":62},"end":{"line":214,"column":62}},{"start":{"line":214,"column":62},"end":{"line":214,"column":62}}]},"22":{"line":215,"type":"if","locations":[{"start":{"line":215,"column":8},"end":{"line":215,"column":8}},{"start":{"line":215,"column":8},"end":{"line":215,"column":8}}]},"23":{"line":223,"type":"if","locations":[{"start":{"line":223,"column":12},"end":{"line":223,"column":12}},{"start":{"line":223,"column":12},"end":{"line":223,"column":12}}]},"24":{"line":228,"type":"if","locations":[{"start":{"line":228,"column":8},"end":{"line":228,"column":8}},{"start":{"line":228,"column":8},"end":{"line":228,"column":8}}]},"25":{"line":247,"type":"if","locations":[{"start":{"line":247,"column":8},"end":{"line":247,"column":8}},{"start":{"line":247,"column":8},"end":{"line":247,"column":8}}]},"26":{"line":251,"type":"if","locations":[{"start":{"line":251,"column":8},"end":{"line":251,"column":8}},{"start":{"line":251,"column":8},"end":{"line":251,"column":8}}]},"27":{"line":252,"type":"cond-expr","locations":[{"start":{"line":252,"column":12},"end":{"line":252,"column":32}},{"start":{"line":252,"column":37},"end":{"line":252,"column":62}}]},"28":{"line":256,"type":"if","locations":[{"start":{"line":256,"column":8},"end":{"line":256,"column":8}},{"start":{"line":256,"column":8},"end":{"line":256,"column":8}}]},"29":{"line":278,"type":"if","locations":[{"start":{"line":278,"column":12},"end":{"line":278,"column":12}},{"start":{"line":278,"column":12},"end":{"line":278,"column":12}}]}}},"contracts\\QuestFactory.sol":{"l":{"45":3,"49":36,"50":36,"63":14,"64":14,"77":14,"78":14,"102":5,"119":5,"121":4,"136":4,"147":1},"path":"C:\\Projects\\quests\\packages\\hardhat\\contracts\\QuestFactory.sol","s":{"1":3,"2":36,"3":14,"4":14,"5":5,"6":5,"7":4,"8":4},"b":{"1":[36,0],"2":[14,1],"3":[14,1],"4":[1,1]},"f":{"1":3,"2":36,"3":14,"4":14,"5":5,"6":1},"fnMap":{"1":{"name":"constructor","line":44,"loc":{"start":{"line":44,"column":4},"end":{"line":46,"column":4}}},"2":{"name":"initialize","line":48,"loc":{"start":{"line":48,"column":4},"end":{"line":51,"column":4}}},"3":{"name":"setCreateDeposit","line":62,"loc":{"start":{"line":59,"column":4},"end":{"line":65,"column":4}}},"4":{"name":"setPlayDeposit","line":76,"loc":{"start":{"line":73,"column":4},"end":{"line":79,"column":4}}},"5":{"name":"createQuest","line":93,"loc":{"start":{"line":93,"column":4},"end":{"line":137,"column":4}}},"6":{"name":"setAragonGovernAddress","line":146,"loc":{"start":{"line":144,"column":4},"end":{"line":148,"column":4}}}},"statementMap":{"1":{"start":{"line":45,"column":8},"end":{"line":45,"column":29}},"2":{"start":{"line":49,"column":8},"end":{"line":49,"column":23}},"3":{"start":{"line":64,"column":8},"end":{"line":64,"column":74}},"4":{"start":{"line":78,"column":8},"end":{"line":78,"column":72}},"5":{"start":{"line":102,"column":8},"end":{"line":102,"column":3329}},"6":{"start":{"line":119,"column":8},"end":{"line":119,"column":60}},"7":{"start":{"line":121,"column":8},"end":{"line":121,"column":3983}},"8":{"start":{"line":136,"column":8},"end":{"line":136,"column":29}}},"branchMap":{"1":{"line":48,"type":"if","locations":[{"start":{"line":48,"column":61},"end":{"line":48,"column":61}},{"start":{"line":48,"column":61},"end":{"line":48,"column":61}}]},"2":{"line":62,"type":"if","locations":[{"start":{"line":62,"column":13},"end":{"line":62,"column":13}},{"start":{"line":62,"column":13},"end":{"line":62,"column":13}}]},"3":{"line":76,"type":"if","locations":[{"start":{"line":76,"column":13},"end":{"line":76,"column":13}},{"start":{"line":76,"column":13},"end":{"line":76,"column":13}}]},"4":{"line":146,"type":"if","locations":[{"start":{"line":146,"column":15},"end":{"line":146,"column":15}},{"start":{"line":146,"column":15},"end":{"line":146,"column":15}}]}}}} \ No newline at end of file diff --git a/packages/hardhat/default-config.json b/packages/hardhat/default-config.json index a05e1d79..c42f8b40 100644 --- a/packages/hardhat/default-config.json +++ b/packages/hardhat/default-config.json @@ -66,7 +66,7 @@ "ChallengeFee": { "goerli": { "token": "0x2d467a24095B262787f58ce97d9B130ce7232B57", - "amount": 0.05 + "amount": 0.2 }, "localhost": { "token": "0x0000000000000000000000000000000000000000", @@ -83,6 +83,6 @@ }, "CelesteResolver": { "xdai": "0x44E4fCFed14E1285c9e0F6eae77D5fDd0F196f85", - "goerli": "0xCDD144eac3dD79667a1cAADFDc4Edaa75D0Eb81f" + "goerli": "0xb802fBfb9e880fa0C57443F5ff12239101Eb90f3" } } \ No newline at end of file diff --git a/packages/hardhat/deploy/deploy-quest.ts b/packages/hardhat/deploy/deploy-quest.ts index 7a10a1bc..b48cc3eb 100644 --- a/packages/hardhat/deploy/deploy-quest.ts +++ b/packages/hardhat/deploy/deploy-quest.ts @@ -1,64 +1,46 @@ import { HardhatRuntimeEnvironment } from "hardhat/types"; import exportContractResult from "../scripts/export-contract-result"; +export const questConstructorArguments = [ + "ASDF", + "0x00", + { + token: "0x6e7c3BC98bee14302AA2A98B4c5C86b13eB4b6Cd", + amount: "100000000000000000", + }, + { + token: "0x6e7c3BC98bee14302AA2A98B4c5C86b13eB4b6Cd", + amount: "100000000000000000", + }, + { + questCreator: "0xdf456B614fE9FF1C7c0B380330Da29C96d40FB02", + maxPlayers: 0, + rewardToken: "0xdf456B614fE9FF1C7c0B380330Da29C96d40FB02", + expireTime: 1700122574, + aragonGovernAddress: "0x6e7c3BC98bee14302AA2A98B4c5C86b13eB4b6Cd", + fundsRecoveryAddress: "0xdf456B614fE9FF1C7c0B380330Da29C96d40FB02", + isWhiteList: false, + }, +]; + // Not actually used but so verification using etherscan-verify will verify the quest contract export default async ({ getNamedAccounts, deployments, network, run, - ethers, }: HardhatRuntimeEnvironment) => { const { deploy } = deployments; const { deployer } = await getNamedAccounts(); - const constructorArguments = [ - "ASDF", - "0x00", - { - token: "0x6e7c3BC98bee14302AA2A98B4c5C86b13eB4b6Cd", - amount: "100000000000000000", - }, - { - token: "0x6e7c3BC98bee14302AA2A98B4c5C86b13eB4b6Cd", - amount: "100000000000000000", - }, - { - questCreator: "0xdf456B614fE9FF1C7c0B380330Da29C96d40FB02", - maxPlayers: 0, - rewardToken: "0xdf456B614fE9FF1C7c0B380330Da29C96d40FB02", - expireTime: 1700122574, - aragonGovernAddress: "0x6e7c3BC98bee14302AA2A98B4c5C86b13eB4b6Cd", - fundsRecoveryAddress: "0xdf456B614fE9FF1C7c0B380330Da29C96d40FB02", - isWhiteList: false, - }, - ]; - const balance = await ethers.provider.getBalance(deployer); + const deployResult = await deploy("Quest", { from: deployer, - args: constructorArguments, + args: questConstructorArguments, log: true, // gasLimit: 30000000, }); - console.log({ constructorArguments }); - - try { - console.log("Verifying Quest..."); - await new Promise((res, rej) => { - setTimeout( - () => - run("verify:verify", { - address: deployResult.address, - constructorArguments, - }) - .then(res) - .catch(rej), - 30000 - ); // Wait for contract to be deployed - }); - } catch (error) { - console.error("Failed when verifying the Quest contract", error); - } + console.log({ questConstructorArguments }); exportContractResult(network, "Quest", { address: deployResult.address, diff --git a/packages/hardhat/deploy/deploy-quest_factory.ts b/packages/hardhat/deploy/deploy-quest_factory.ts index c399b45a..ebcf97d4 100644 --- a/packages/hardhat/deploy/deploy-quest_factory.ts +++ b/packages/hardhat/deploy/deploy-quest_factory.ts @@ -2,6 +2,7 @@ import { HardhatRuntimeEnvironment } from "hardhat/types"; import "@nomiclabs/hardhat-etherscan"; import defaultConfig from "../default-config.json"; import exportContractResult from "../scripts/export-contract-result"; +import { verifyContractWithRetry } from "../scripts/verify-contract"; export const buildQuestFactoryConstructorArguments = async ({ getNamedAccounts, @@ -10,11 +11,11 @@ export const buildQuestFactoryConstructorArguments = async ({ ethers, }) => { const { govern, owner } = await getNamedAccounts(); - const createDeposit = args + const createDeposit = args.createDepositToken ? { token: args.createDepositToken, amount: args.createDepositAmount } : defaultConfig.CreateQuestDeposit[network.name]; console.log(network.name); - const playDeposit = args + const playDeposit = args.playDepositToken ? { token: args.playDepositToken, amount: args.playDepositAmount } : defaultConfig.PlayQuestDeposit[network.name]; const constructorArguments = [ @@ -58,29 +59,18 @@ export default async ( deployResult.deployed(); await ethers.getContractAt("QuestFactory", deployResult.address); - try { - console.log("Verifying QuestFactory..."); - await new Promise((res, rej) => { - setTimeout( - () => - run("verify:verify", { - address: deployResult.address, - constructorArguments: [], - }) - .then(res) - .catch(rej), - 30000 - ); // Wait for contract to be deployed - }); - } catch (error) { - console.error("Failed when verifying the QuestFactory contract", error); - } - exportContractResult(network, "QuestFactory", { address: deployResult.address, abi: abi, }); + await verifyContractWithRetry( + "QuestFactory", + run, + deployResult.address, + [] // Proxy doens't have constructor arguments + ); + return deployResult; }; export const tags = ["QuestFactory"]; diff --git a/packages/hardhat/deployments/goerli/Govern.json b/packages/hardhat/deployments/goerli/Govern.json index a9d6333d..7f1eb1a5 100644 --- a/packages/hardhat/deployments/goerli/Govern.json +++ b/packages/hardhat/deployments/goerli/Govern.json @@ -1,5 +1,5 @@ { - "address": "0x7281807631714071425C2efE38917C9e1A7D1aA4", + "address": "0x92249E8504F4fb690d5a4287af726F441Ac6F1D2", "abi": [ { "inputs": [ @@ -73,9 +73,21 @@ }, { "components": [ - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } ], "indexed": false, "internalType": "struct ERC3000Data.Action[]", @@ -280,11 +292,20 @@ "name": "Withdrawn", "type": "event" }, - { "stateMutability": "nonpayable", "type": "fallback" }, + { + "stateMutability": "nonpayable", + "type": "fallback" + }, { "inputs": [], "name": "ROOT_ROLE", - "outputs": [{ "internalType": "bytes4", "name": "", "type": "bytes4" }], + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], "stateMutability": "view", "type": "function" }, @@ -297,8 +318,16 @@ "name": "op", "type": "uint8" }, - { "internalType": "bytes4", "name": "role", "type": "bytes4" }, - { "internalType": "address", "name": "who", "type": "address" } + { + "internalType": "bytes4", + "name": "role", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "who", + "type": "address" + } ], "internalType": "struct ACLData.BulkItem[]", "name": "items", @@ -312,9 +341,21 @@ }, { "inputs": [ - { "internalType": "address", "name": "_token", "type": "address" }, - { "internalType": "uint256", "name": "_amount", "type": "uint256" }, - { "internalType": "string", "name": "_reference", "type": "string" } + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "string", + "name": "_reference", + "type": "string" + } ], "name": "deposit", "outputs": [], @@ -325,9 +366,21 @@ "inputs": [ { "components": [ - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } ], "internalType": "struct ERC3000Data.Action[]", "name": "actions", @@ -338,19 +391,35 @@ "name": "allowFailuresMap", "type": "bytes32" }, - { "internalType": "bytes32", "name": "memo", "type": "bytes32" } + { + "internalType": "bytes32", + "name": "memo", + "type": "bytes32" + } ], "name": "exec", "outputs": [ - { "internalType": "bytes32", "name": "", "type": "bytes32" }, - { "internalType": "bytes[]", "name": "", "type": "bytes[]" } + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + }, + { + "internalType": "bytes[]", + "name": "", + "type": "bytes[]" + } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ - { "internalType": "bytes4", "name": "_role", "type": "bytes4" } + { + "internalType": "bytes4", + "name": "_role", + "type": "bytes4" + } ], "name": "freeze", "outputs": [], @@ -359,8 +428,16 @@ }, { "inputs": [ - { "internalType": "bytes4", "name": "_role", "type": "bytes4" }, - { "internalType": "address", "name": "_who", "type": "address" } + { + "internalType": "bytes4", + "name": "_role", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "_who", + "type": "address" + } ], "name": "grant", "outputs": [], @@ -369,8 +446,16 @@ }, { "inputs": [ - { "internalType": "bytes4", "name": "_role", "type": "bytes4" }, - { "internalType": "address", "name": "_who", "type": "address" }, + { + "internalType": "bytes4", + "name": "_role", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "_who", + "type": "address" + }, { "internalType": "contract IACLOracle", "name": "_oracle", @@ -383,9 +468,21 @@ "type": "function" }, { - "inputs": [{ "internalType": "string", "name": "", "type": "string" }], + "inputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], "name": "initBlocks", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, @@ -404,28 +501,64 @@ }, { "inputs": [ - { "internalType": "bytes4", "name": "_role", "type": "bytes4" } + { + "internalType": "bytes4", + "name": "_role", + "type": "bytes4" + } ], "name": "isFrozen", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "bytes32", "name": "_hash", "type": "bytes32" }, - { "internalType": "bytes", "name": "_signature", "type": "bytes" } + { + "internalType": "bytes32", + "name": "_hash", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "_signature", + "type": "bytes" + } ], "name": "isValidSignature", - "outputs": [{ "internalType": "bytes4", "name": "", "type": "bytes4" }], + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "bytes4", "name": "_interfaceId", "type": "bytes4" }, - { "internalType": "bytes4", "name": "_callbackSig", "type": "bytes4" }, - { "internalType": "bytes4", "name": "_magicNumber", "type": "bytes4" } + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + }, + { + "internalType": "bytes4", + "name": "_callbackSig", + "type": "bytes4" + }, + { + "internalType": "bytes4", + "name": "_magicNumber", + "type": "bytes4" + } ], "name": "registerStandardAndCallback", "outputs": [], @@ -434,8 +567,16 @@ }, { "inputs": [ - { "internalType": "bytes4", "name": "_role", "type": "bytes4" }, - { "internalType": "address", "name": "_who", "type": "address" } + { + "internalType": "bytes4", + "name": "_role", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "_who", + "type": "address" + } ], "name": "revoke", "outputs": [], @@ -444,11 +585,25 @@ }, { "inputs": [ - { "internalType": "bytes4", "name": "", "type": "bytes4" }, - { "internalType": "address", "name": "", "type": "address" } + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } ], "name": "roles", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", "type": "function" }, @@ -467,26 +622,59 @@ }, { "inputs": [ - { "internalType": "bytes4", "name": "_interfaceId", "type": "bytes4" } + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } ], "name": "supportsInterface", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "_token", "type": "address" }, - { "internalType": "address", "name": "_from", "type": "address" }, - { "internalType": "address", "name": "_to", "type": "address" }, - { "internalType": "uint256", "name": "_amount", "type": "uint256" }, - { "internalType": "string", "name": "_reference", "type": "string" } + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "string", + "name": "_reference", + "type": "string" + } ], "name": "withdraw", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { "stateMutability": "payable", "type": "receive" } + { + "stateMutability": "payable", + "type": "receive" + } ] -} +} \ No newline at end of file diff --git a/packages/hardhat/deployments/goerli/GovernQueue.json b/packages/hardhat/deployments/goerli/GovernQueue.json index 697fe56f..443c7872 100644 --- a/packages/hardhat/deployments/goerli/GovernQueue.json +++ b/packages/hardhat/deployments/goerli/GovernQueue.json @@ -1,9 +1,13 @@ { - "address": "0xc73BCDc0FF18Fb903FCd34de4BFfE37BE66b4E8f", + "address": "0xce38877414ffd60c1a1e20ddb1d52fa5840d9ca6", "abi": [ { "inputs": [ - { "internalType": "address", "name": "_aclRoot", "type": "address" }, + { + "internalType": "address", + "name": "_aclRoot", + "type": "address" + }, { "components": [ { @@ -50,7 +54,11 @@ "name": "resolver", "type": "address" }, - { "internalType": "bytes", "name": "rules", "type": "bytes" }, + { + "internalType": "bytes", + "name": "rules", + "type": "bytes" + }, { "internalType": "uint256", "name": "maxCalldataSize", @@ -94,8 +102,16 @@ }, { "components": [ - { "internalType": "address", "name": "token", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } ], "indexed": false, "internalType": "struct ERC3000Data.Collateral", @@ -167,7 +183,11 @@ "name": "resolver", "type": "address" }, - { "internalType": "bytes", "name": "rules", "type": "bytes" }, + { + "internalType": "bytes", + "name": "rules", + "type": "bytes" + }, { "internalType": "uint256", "name": "maxCalldataSize", @@ -333,9 +353,9 @@ }, { "indexed": false, - "internalType": "bool", - "name": "approved", - "type": "bool" + "internalType": "uint256", + "name": "ruling", + "type": "uint256" } ], "name": "Resolved", @@ -402,7 +422,11 @@ }, { "components": [ - { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, { "internalType": "uint256", "name": "executionTime", @@ -420,13 +444,21 @@ }, { "components": [ - { "internalType": "address", "name": "to", "type": "address" }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } ], "internalType": "struct ERC3000Data.Action[]", "name": "actions", @@ -437,7 +469,11 @@ "name": "allowFailuresMap", "type": "bytes32" }, - { "internalType": "bytes", "name": "proof", "type": "bytes" }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + }, { "internalType": "address", "name": "challenger", @@ -481,7 +517,13 @@ { "inputs": [], "name": "ROOT_ROLE", - "outputs": [{ "internalType": "bytes4", "name": "", "type": "bytes4" }], + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], "stateMutability": "view", "type": "function" }, @@ -494,8 +536,16 @@ "name": "op", "type": "uint8" }, - { "internalType": "bytes4", "name": "role", "type": "bytes4" }, - { "internalType": "address", "name": "who", "type": "address" } + { + "internalType": "bytes4", + "name": "role", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "who", + "type": "address" + } ], "internalType": "struct ACLData.BulkItem[]", "name": "items", @@ -545,7 +595,11 @@ "name": "value", "type": "uint256" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } ], "internalType": "struct ERC3000Data.Action[]", "name": "actions", @@ -556,7 +610,11 @@ "name": "allowFailuresMap", "type": "bytes32" }, - { "internalType": "bytes", "name": "proof", "type": "bytes" }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + }, { "internalType": "address", "name": "challenger", @@ -613,7 +671,11 @@ "name": "resolver", "type": "address" }, - { "internalType": "bytes", "name": "rules", "type": "bytes" }, + { + "internalType": "bytes", + "name": "rules", + "type": "bytes" + }, { "internalType": "uint256", "name": "maxCalldataSize", @@ -629,26 +691,52 @@ "name": "_container", "type": "tuple" }, - { "internalType": "bytes", "name": "_reason", "type": "bytes" } + { + "internalType": "bytes", + "name": "_reason", + "type": "bytes" + } ], "name": "challenge", "outputs": [ - { "internalType": "uint256", "name": "disputeId", "type": "uint256" } + { + "internalType": "uint256", + "name": "disputeId", + "type": "uint256" + } ], "stateMutability": "nonpayable", "type": "function" }, { - "inputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], "name": "challengerCache", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "configHash", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], "stateMutability": "view", "type": "function" }, @@ -700,7 +788,11 @@ "name": "resolver", "type": "address" }, - { "internalType": "bytes", "name": "rules", "type": "bytes" }, + { + "internalType": "bytes", + "name": "rules", + "type": "bytes" + }, { "internalType": "uint256", "name": "maxCalldataSize", @@ -713,13 +805,23 @@ } ], "name": "configure", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ - { "internalType": "bytes32", "name": "", "type": "bytes32" }, + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + }, { "internalType": "contract IArbitrator", "name": "", @@ -727,7 +829,13 @@ } ], "name": "disputeItemCache", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, @@ -769,7 +877,11 @@ "name": "value", "type": "uint256" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } ], "internalType": "struct ERC3000Data.Action[]", "name": "actions", @@ -780,7 +892,11 @@ "name": "allowFailuresMap", "type": "bytes32" }, - { "internalType": "bytes", "name": "proof", "type": "bytes" }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + }, { "internalType": "address", "name": "challenger", @@ -837,7 +953,11 @@ "name": "resolver", "type": "address" }, - { "internalType": "bytes", "name": "rules", "type": "bytes" }, + { + "internalType": "bytes", + "name": "rules", + "type": "bytes" + }, { "internalType": "uint256", "name": "maxCalldataSize", @@ -856,15 +976,27 @@ ], "name": "execute", "outputs": [ - { "internalType": "bytes32", "name": "failureMap", "type": "bytes32" }, - { "internalType": "bytes[]", "name": "", "type": "bytes[]" } + { + "internalType": "bytes32", + "name": "failureMap", + "type": "bytes32" + }, + { + "internalType": "bytes[]", + "name": "", + "type": "bytes[]" + } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ - { "internalType": "bytes4", "name": "_role", "type": "bytes4" } + { + "internalType": "bytes4", + "name": "_role", + "type": "bytes4" + } ], "name": "freeze", "outputs": [], @@ -873,8 +1005,16 @@ }, { "inputs": [ - { "internalType": "bytes4", "name": "_role", "type": "bytes4" }, - { "internalType": "address", "name": "_who", "type": "address" } + { + "internalType": "bytes4", + "name": "_role", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "_who", + "type": "address" + } ], "name": "grant", "outputs": [], @@ -883,8 +1023,16 @@ }, { "inputs": [ - { "internalType": "bytes4", "name": "_role", "type": "bytes4" }, - { "internalType": "address", "name": "_who", "type": "address" }, + { + "internalType": "bytes4", + "name": "_role", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "_who", + "type": "address" + }, { "internalType": "contract IACLOracle", "name": "_oracle", @@ -897,15 +1045,31 @@ "type": "function" }, { - "inputs": [{ "internalType": "string", "name": "", "type": "string" }], + "inputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], "name": "initBlocks", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "_aclRoot", "type": "address" }, + { + "internalType": "address", + "name": "_aclRoot", + "type": "address" + }, { "components": [ { @@ -952,7 +1116,11 @@ "name": "resolver", "type": "address" }, - { "internalType": "bytes", "name": "rules", "type": "bytes" }, + { + "internalType": "bytes", + "name": "rules", + "type": "bytes" + }, { "internalType": "uint256", "name": "maxCalldataSize", @@ -971,22 +1139,44 @@ }, { "inputs": [ - { "internalType": "bytes4", "name": "_role", "type": "bytes4" } + { + "internalType": "bytes4", + "name": "_role", + "type": "bytes4" + } ], "name": "isFrozen", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "nonce", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { - "inputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], "name": "queue", "outputs": [ { @@ -1036,7 +1226,11 @@ "name": "value", "type": "uint256" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } ], "internalType": "struct ERC3000Data.Action[]", "name": "actions", @@ -1047,7 +1241,11 @@ "name": "allowFailuresMap", "type": "bytes32" }, - { "internalType": "bytes", "name": "proof", "type": "bytes" }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + }, { "internalType": "address", "name": "challenger", @@ -1104,7 +1302,11 @@ "name": "resolver", "type": "address" }, - { "internalType": "bytes", "name": "rules", "type": "bytes" }, + { + "internalType": "bytes", + "name": "rules", + "type": "bytes" + }, { "internalType": "uint256", "name": "maxCalldataSize", @@ -1120,20 +1322,40 @@ "name": "_container", "type": "tuple" }, - { "internalType": "uint256", "name": "_disputeId", "type": "uint256" } + { + "internalType": "uint256", + "name": "_disputeId", + "type": "uint256" + } ], "name": "resolve", "outputs": [ - { "internalType": "bytes32", "name": "failureMap", "type": "bytes32" }, - { "internalType": "bytes[]", "name": "", "type": "bytes[]" } + { + "internalType": "bytes32", + "name": "failureMap", + "type": "bytes32" + }, + { + "internalType": "bytes[]", + "name": "", + "type": "bytes[]" + } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ - { "internalType": "bytes4", "name": "_role", "type": "bytes4" }, - { "internalType": "address", "name": "_who", "type": "address" } + { + "internalType": "bytes4", + "name": "_role", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "_who", + "type": "address" + } ], "name": "revoke", "outputs": [], @@ -1142,11 +1364,25 @@ }, { "inputs": [ - { "internalType": "bytes4", "name": "", "type": "bytes4" }, - { "internalType": "address", "name": "", "type": "address" } + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } ], "name": "roles", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", "type": "function" }, @@ -1188,7 +1424,11 @@ "name": "value", "type": "uint256" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } ], "internalType": "struct ERC3000Data.Action[]", "name": "actions", @@ -1199,7 +1439,11 @@ "name": "allowFailuresMap", "type": "bytes32" }, - { "internalType": "bytes", "name": "proof", "type": "bytes" }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + }, { "internalType": "address", "name": "challenger", @@ -1256,7 +1500,11 @@ "name": "resolver", "type": "address" }, - { "internalType": "bytes", "name": "rules", "type": "bytes" }, + { + "internalType": "bytes", + "name": "rules", + "type": "bytes" + }, { "internalType": "uint256", "name": "maxCalldataSize", @@ -1286,10 +1534,20 @@ }, { "inputs": [ - { "internalType": "bytes4", "name": "_interfaceId", "type": "bytes4" } + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } ], "name": "supportsInterface", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, @@ -1331,7 +1589,11 @@ "name": "value", "type": "uint256" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } ], "internalType": "struct ERC3000Data.Action[]", "name": "actions", @@ -1342,7 +1604,11 @@ "name": "allowFailuresMap", "type": "bytes32" }, - { "internalType": "bytes", "name": "proof", "type": "bytes" }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + }, { "internalType": "address", "name": "challenger", @@ -1399,7 +1665,11 @@ "name": "resolver", "type": "address" }, - { "internalType": "bytes", "name": "rules", "type": "bytes" }, + { + "internalType": "bytes", + "name": "rules", + "type": "bytes" + }, { "internalType": "uint256", "name": "maxCalldataSize", @@ -1415,7 +1685,11 @@ "name": "_container", "type": "tuple" }, - { "internalType": "bytes", "name": "_reason", "type": "bytes" } + { + "internalType": "bytes", + "name": "_reason", + "type": "bytes" + } ], "name": "veto", "outputs": [], @@ -1423,4 +1697,4 @@ "type": "function" } ] -} +} \ No newline at end of file diff --git a/packages/hardhat/deployments/goerli/OwnableCeleste.json b/packages/hardhat/deployments/goerli/OwnableCeleste.json index b127ec9b..1bfce28b 100644 --- a/packages/hardhat/deployments/goerli/OwnableCeleste.json +++ b/packages/hardhat/deployments/goerli/OwnableCeleste.json @@ -1,38 +1,31 @@ { - "address": "0xA7e288C5251d82597956d06c8558FB48D4fA6Cc2", + "address": "0xb802fBfb9e880fa0C57443F5ff12239101Eb90f3", "abi": [ - { - "constant": true, - "inputs": [], - "name": "getCurrentTermId", - "outputs": [{ "name": "", "type": "uint64" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, - "inputs": [{ "name": "_owner", "type": "address" }], + "inputs": [ + { + "name": "_owner", + "type": "address" + } + ], "name": "setOwner", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "getVoting", - "outputs": [{ "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ - { "name": "_disputeId", "type": "uint256" }, - { "name": "_state", "type": "uint8" } + { + "name": "_disputeId", + "type": "uint256" + }, + { + "name": "_finalRuling", + "type": "uint8" + } ], "name": "decideDispute", "outputs": [], @@ -42,101 +35,45 @@ }, { "constant": true, - "inputs": [], - "name": "getTermDuration", - "outputs": [{ "name": "", "type": "uint64" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getTreasury", - "outputs": [{ "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getSubscriptions", - "outputs": [{ "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getFundsGovernor", - "outputs": [{ "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getModulesGovernor", - "outputs": [{ "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "name": "_newFeesUpdater", "type": "address" }], - "name": "changeFeesUpdater", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, "inputs": [ - { "name": "_id", "type": "bytes32" }, - { "name": "_addr", "type": "address" } + { + "name": "", + "type": "uint256" + } ], - "name": "setModule", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "name": "", "type": "uint256" }], "name": "disputes", "outputs": [ - { "name": "subject", "type": "address" }, - { "name": "state", "type": "uint8" } + { + "name": "subject", + "type": "address" + }, + { + "name": "possibleRuling", + "type": "uint8" + }, + { + "name": "finalRuling", + "type": "uint8" + }, + { + "name": "state", + "type": "uint8" + } ], "payable": false, "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { "name": "_subject", "type": "address" }, - { "name": "_disputeId", "type": "uint256" }, - { "name": "_submitter", "type": "address" }, - { "name": "_evidence", "type": "bytes" } - ], - "name": "submitEvidence", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], "name": "feeToken", - "outputs": [{ "name": "", "type": "address" }], + "outputs": [ + { + "name": "", + "type": "address" + } + ], "payable": false, "stateMutability": "view", "type": "function" @@ -145,23 +82,24 @@ "constant": true, "inputs": [], "name": "feeAmount", - "outputs": [{ "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getBrightIdRegister", - "outputs": [{ "name": "", "type": "address" }], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, - "inputs": [{ "name": "_disputeId", "type": "uint256" }], + "inputs": [ + { + "name": "_disputeId", + "type": "uint256" + } + ], "name": "draft", "outputs": [], "payable": false, @@ -173,81 +111,54 @@ "inputs": [], "name": "getDisputeFees", "outputs": [ - { "name": "", "type": "address" }, - { "name": "", "type": "address" }, - { "name": "", "type": "uint256" } + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "uint256" + } ], "payable": false, "stateMutability": "view", "type": "function" }, - { - "constant": true, - "inputs": [{ "name": "_id", "type": "bytes32" }], - "name": "getModule", - "outputs": [{ "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, - "inputs": [], - "name": "ejectModulesGovernor", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "owner", - "outputs": [{ "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "name": "_newFundsGovernor", "type": "address" }], - "name": "changeFundsGovernor", + "inputs": [ + { + "name": "_disputeId", + "type": "uint256" + }, + { + "name": "_submitter", + "type": "address" + }, + { + "name": "_evidence", + "type": "bytes" + } + ], + "name": "submitEvidence", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "getJurorsRegistry", - "outputs": [{ "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getConfigGovernor", - "outputs": [{ "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "name": "_maxRequestedTransitions", "type": "uint64" }], - "name": "heartbeat", - "outputs": [{ "name": "", "type": "uint64" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, - "inputs": [{ "name": "_termDuration", "type": "uint64" }], - "name": "setTermDuration", + "inputs": [ + { + "name": "_disputeId", + "type": "uint256" + } + ], + "name": "closeEvidencePeriod", "outputs": [], "payable": false, "stateMutability": "nonpayable", @@ -256,82 +167,31 @@ { "constant": true, "inputs": [], - "name": "getFeesUpdater", - "outputs": [{ "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "name": "_disputeId", "type": "uint256" }], - "name": "computeRuling", + "name": "owner", "outputs": [ - { "name": "subject", "type": "address" }, - { "name": "finalRuling", "type": "uint8" } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "name": "_possibleRulings", "type": "uint256" }, - { "name": "_metadata", "type": "bytes" } + { + "name": "", + "type": "address" + } ], - "name": "createDispute", - "outputs": [{ "name": "", "type": "uint256" }], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [ - { "name": "_subject", "type": "address" }, - { "name": "_disputeId", "type": "uint256" } + { + "name": "_maxRequestedTransitions", + "type": "uint64" + } ], - "name": "closeEvidencePeriod", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "ejectFundsGovernor", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "name": "_newModulesGovernor", "type": "address" }], - "name": "changeModulesGovernor", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "name": "_newConfigGovernor", "type": "address" }], - "name": "changeConfigGovernor", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "name": "_disputeId", "type": "uint256" }], - "name": "rule", + "name": "heartbeat", "outputs": [ - { "name": "subject", "type": "address" }, - { "name": "ruling", "type": "uint256" } + { + "name": "", + "type": "uint64" + } ], "payable": false, "stateMutability": "nonpayable", @@ -341,23 +201,11 @@ "constant": true, "inputs": [], "name": "getDisputeManager", - "outputs": [{ "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "name": "_termId", "type": "uint64" }], - "name": "getConfig", "outputs": [ - { "name": "_feeToken", "type": "address" }, - { "name": "fees", "type": "uint256[3]" }, - { "name": "maxRulingOptions", "type": "uint8" }, - { "name": "roundParams", "type": "uint64[9]" }, - { "name": "pcts", "type": "uint16[2]" }, - { "name": "appealCollateralParams", "type": "uint256[2]" }, - { "name": "jurorsParams", "type": "uint256[4]" } + { + "name": "", + "type": "address" + } ], "payable": false, "stateMutability": "view", @@ -367,14 +215,24 @@ "constant": true, "inputs": [], "name": "currentId", - "outputs": [{ "name": "", "type": "uint256" }], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, - "inputs": [{ "name": "_newFirstTermStartTime", "type": "uint64" }], + "inputs": [ + { + "name": "_newFirstTermStartTime", + "type": "uint64" + } + ], "name": "delayStartTime", "outputs": [], "payable": false, @@ -383,22 +241,68 @@ }, { "constant": true, - "inputs": [{ "name": "_termId", "type": "uint64" }], - "name": "getTerm", + "inputs": [ + { + "name": "_disputeId", + "type": "uint256" + } + ], + "name": "getDispute", "outputs": [ - { "name": "startTime", "type": "uint64" }, - { "name": "randomnessBN", "type": "uint64" }, - { "name": "randomness", "type": "bytes32" }, - { "name": "celesteTokenTotalSupply", "type": "uint256" } + { + "name": "subject", + "type": "address" + }, + { + "name": "possibleRulings", + "type": "uint8" + }, + { + "name": "state", + "type": "uint8" + }, + { + "name": "finalRuling", + "type": "uint8" + } ], "payable": false, "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "name": "_possibleRulings", + "type": "uint8" + }, + { + "name": "_metadata", + "type": "bytes" + } + ], + "name": "createDispute", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ - { "name": "_feeToken", "type": "address" }, - { "name": "_feeAmount", "type": "uint256" } + { + "name": "_feeToken", + "type": "address" + }, + { + "name": "_feeAmount", + "type": "uint256" + } ], "payable": false, "stateMutability": "nonpayable", @@ -407,8 +311,16 @@ { "anonymous": false, "inputs": [ - { "indexed": false, "name": "previousTermId", "type": "uint64" }, - { "indexed": false, "name": "currentTermId", "type": "uint64" } + { + "indexed": false, + "name": "previousTermId", + "type": "uint64" + }, + { + "indexed": false, + "name": "currentTermId", + "type": "uint64" + } ], "name": "Heartbeat", "type": "event" @@ -416,8 +328,16 @@ { "anonymous": false, "inputs": [ - { "indexed": false, "name": "previousStartTime", "type": "uint64" }, - { "indexed": false, "name": "currentStartTime", "type": "uint64" } + { + "indexed": false, + "name": "previousStartTime", + "type": "uint64" + }, + { + "indexed": false, + "name": "currentStartTime", + "type": "uint64" + } ], "name": "StartTimeDelayed", "type": "event" @@ -425,8 +345,16 @@ { "anonymous": false, "inputs": [ - { "indexed": true, "name": "disputeId", "type": "uint256" }, - { "indexed": true, "name": "state", "type": "uint8" } + { + "indexed": true, + "name": "disputeId", + "type": "uint256" + }, + { + "indexed": true, + "name": "state", + "type": "uint8" + } ], "name": "DisputeStateChanged", "type": "event" @@ -434,9 +362,21 @@ { "anonymous": false, "inputs": [ - { "indexed": true, "name": "disputeId", "type": "uint256" }, - { "indexed": true, "name": "submitter", "type": "address" }, - { "indexed": false, "name": "evidence", "type": "bytes" } + { + "indexed": true, + "name": "disputeId", + "type": "uint256" + }, + { + "indexed": true, + "name": "submitter", + "type": "address" + }, + { + "indexed": false, + "name": "evidence", + "type": "bytes" + } ], "name": "EvidenceSubmitted", "type": "event" @@ -444,8 +384,16 @@ { "anonymous": false, "inputs": [ - { "indexed": true, "name": "disputeId", "type": "uint256" }, - { "indexed": true, "name": "termId", "type": "uint64" } + { + "indexed": true, + "name": "disputeId", + "type": "uint256" + }, + { + "indexed": true, + "name": "termId", + "type": "uint64" + } ], "name": "EvidencePeriodClosed", "type": "event" @@ -453,11 +401,31 @@ { "anonymous": false, "inputs": [ - { "indexed": true, "name": "disputeId", "type": "uint256" }, - { "indexed": true, "name": "subject", "type": "address" }, - { "indexed": true, "name": "draftTermId", "type": "uint64" }, - { "indexed": false, "name": "jurorsNumber", "type": "uint64" }, - { "indexed": false, "name": "metadata", "type": "bytes" } + { + "indexed": true, + "name": "disputeId", + "type": "uint256" + }, + { + "indexed": true, + "name": "subject", + "type": "address" + }, + { + "indexed": true, + "name": "draftTermId", + "type": "uint64" + }, + { + "indexed": false, + "name": "jurorsNumber", + "type": "uint64" + }, + { + "indexed": false, + "name": "metadata", + "type": "bytes" + } ], "name": "NewDispute", "type": "event" @@ -465,9 +433,21 @@ { "anonymous": false, "inputs": [ - { "indexed": true, "name": "disputeId", "type": "uint256" }, - { "indexed": true, "name": "roundId", "type": "uint256" }, - { "indexed": true, "name": "juror", "type": "address" } + { + "indexed": true, + "name": "disputeId", + "type": "uint256" + }, + { + "indexed": true, + "name": "roundId", + "type": "uint256" + }, + { + "indexed": true, + "name": "juror", + "type": "address" + } ], "name": "JurorDrafted", "type": "event" @@ -475,9 +455,21 @@ { "anonymous": false, "inputs": [ - { "indexed": true, "name": "disputeId", "type": "uint256" }, - { "indexed": true, "name": "roundId", "type": "uint256" }, - { "indexed": false, "name": "ruling", "type": "uint8" } + { + "indexed": true, + "name": "disputeId", + "type": "uint256" + }, + { + "indexed": true, + "name": "roundId", + "type": "uint256" + }, + { + "indexed": false, + "name": "ruling", + "type": "uint8" + } ], "name": "RulingAppealed", "type": "event" @@ -485,10 +477,26 @@ { "anonymous": false, "inputs": [ - { "indexed": true, "name": "disputeId", "type": "uint256" }, - { "indexed": true, "name": "roundId", "type": "uint256" }, - { "indexed": true, "name": "draftTermId", "type": "uint64" }, - { "indexed": false, "name": "jurorsNumber", "type": "uint256" } + { + "indexed": true, + "name": "disputeId", + "type": "uint256" + }, + { + "indexed": true, + "name": "roundId", + "type": "uint256" + }, + { + "indexed": true, + "name": "draftTermId", + "type": "uint64" + }, + { + "indexed": false, + "name": "jurorsNumber", + "type": "uint256" + } ], "name": "RulingAppealConfirmed", "type": "event" @@ -496,8 +504,16 @@ { "anonymous": false, "inputs": [ - { "indexed": true, "name": "disputeId", "type": "uint256" }, - { "indexed": true, "name": "ruling", "type": "uint8" } + { + "indexed": true, + "name": "disputeId", + "type": "uint256" + }, + { + "indexed": true, + "name": "ruling", + "type": "uint8" + } ], "name": "RulingComputed", "type": "event" @@ -505,9 +521,21 @@ { "anonymous": false, "inputs": [ - { "indexed": true, "name": "disputeId", "type": "uint256" }, - { "indexed": true, "name": "roundId", "type": "uint256" }, - { "indexed": false, "name": "collectedTokens", "type": "uint256" } + { + "indexed": true, + "name": "disputeId", + "type": "uint256" + }, + { + "indexed": true, + "name": "roundId", + "type": "uint256" + }, + { + "indexed": false, + "name": "collectedTokens", + "type": "uint256" + } ], "name": "PenaltiesSettled", "type": "event" @@ -515,11 +543,31 @@ { "anonymous": false, "inputs": [ - { "indexed": true, "name": "disputeId", "type": "uint256" }, - { "indexed": true, "name": "roundId", "type": "uint256" }, - { "indexed": false, "name": "juror", "type": "address" }, - { "indexed": false, "name": "tokens", "type": "uint256" }, - { "indexed": false, "name": "fees", "type": "uint256" } + { + "indexed": true, + "name": "disputeId", + "type": "uint256" + }, + { + "indexed": true, + "name": "roundId", + "type": "uint256" + }, + { + "indexed": false, + "name": "juror", + "type": "address" + }, + { + "indexed": false, + "name": "tokens", + "type": "uint256" + }, + { + "indexed": false, + "name": "fees", + "type": "uint256" + } ], "name": "RewardSettled", "type": "event" @@ -527,8 +575,16 @@ { "anonymous": false, "inputs": [ - { "indexed": true, "name": "disputeId", "type": "uint256" }, - { "indexed": true, "name": "roundId", "type": "uint256" } + { + "indexed": true, + "name": "disputeId", + "type": "uint256" + }, + { + "indexed": true, + "name": "roundId", + "type": "uint256" + } ], "name": "AppealDepositSettled", "type": "event" @@ -549,52 +605,10 @@ ], "name": "MaxJurorsPerDraftBatchChanged", "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "name": "id", "type": "bytes32" }, - { "indexed": false, "name": "addr", "type": "address" } - ], - "name": "ModuleSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "name": "previousGovernor", "type": "address" }, - { "indexed": false, "name": "currentGovernor", "type": "address" } - ], - "name": "FundsGovernorChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "name": "previousGovernor", "type": "address" }, - { "indexed": false, "name": "currentGovernor", "type": "address" } - ], - "name": "ConfigGovernorChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "name": "previousFeesUpdater", "type": "address" }, - { "indexed": false, "name": "currentFeesUpdater", "type": "address" } - ], - "name": "FeesUpdaterChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "name": "previousGovernor", "type": "address" }, - { "indexed": false, "name": "currentGovernor", "type": "address" } - ], - "name": "ModulesGovernorChanged", - "type": "event" } ], - "args": ["0x2d467a24095B262787f58ce97d9B130ce7232B57", "10000000000000000000"] -} + "args": [ + "0x2d467a24095B262787f58ce97d9B130ce7232B57", + "10000000000000000000" + ] +} \ No newline at end of file diff --git a/packages/hardhat/deployments/goerli/Quest.json b/packages/hardhat/deployments/goerli/Quest.json index cc0377b0..d795d1a6 100644 --- a/packages/hardhat/deployments/goerli/Quest.json +++ b/packages/hardhat/deployments/goerli/Quest.json @@ -1 +1 @@ -{"address":"0xD0699B582ec12E37602EcC16Fb4d9F2DeEE0DD2F","abi":[{"inputs":[{"internalType":"string","name":"_questTitle","type":"string"},{"internalType":"bytes","name":"_questDetailsRef","type":"bytes"},{"components":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct Models.Deposit","name":"_createDeposit","type":"tuple"},{"components":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct Models.Deposit","name":"_playDeposit","type":"tuple"},{"components":[{"internalType":"address","name":"questCreator","type":"address"},{"internalType":"uint32","name":"maxPlayers","type":"uint32"},{"internalType":"contract IERC20Upgradeable","name":"rewardToken","type":"address"},{"internalType":"uint256","name":"expireTime","type":"uint256"},{"internalType":"address","name":"aragonGovernAddress","type":"address"},{"internalType":"address payable","name":"fundsRecoveryAddress","type":"address"},{"internalType":"bool","name":"isWhiteList","type":"bool"}],"internalType":"struct Models.QuestParam","name":"_questParam","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"evidence","type":"bytes"},{"indexed":false,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"QuestClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"QuestPlayed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"QuestUnplayed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"whiteListPlayers","type":"address[]"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"QuestWhiteListChanged","type":"event"},{"inputs":[],"name":"aragonGovernAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"executer","type":"address"}],"name":"canExecute","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_evidence","type":"bytes"},{"internalType":"address","name":"_player","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bool","name":"_claimAll","type":"bool"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"claims","outputs":[{"internalType":"bytes","name":"evidence","type":"bytes"},{"internalType":"address","name":"player","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"createDeposit","outputs":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"expireTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fundsRecoveryAddress","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPlayers","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isCreateDepositReleased","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isWhiteList","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPlayers","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_player","type":"address"}],"name":"play","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"playDeposit","outputs":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"questCreator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"questDetailsRef","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"questTitle","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"recoverFundsAndDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract IERC20Upgradeable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_players","type":"address[]"}],"name":"setWhiteList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_player","type":"address"}],"name":"unplay","outputs":[],"stateMutability":"nonpayable","type":"function"}]} \ No newline at end of file +{"address":"0xc794b83C2c7bb7aAcBe042da15f41c61837D0F6a","abi":[{"inputs":[{"internalType":"string","name":"_questTitle","type":"string"},{"internalType":"bytes","name":"_questDetailsRef","type":"bytes"},{"components":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct Models.Deposit","name":"_createDeposit","type":"tuple"},{"components":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct Models.Deposit","name":"_playDeposit","type":"tuple"},{"components":[{"internalType":"address","name":"questCreator","type":"address"},{"internalType":"uint32","name":"maxPlayers","type":"uint32"},{"internalType":"contract IERC20Upgradeable","name":"rewardToken","type":"address"},{"internalType":"uint256","name":"expireTime","type":"uint256"},{"internalType":"address","name":"aragonGovernAddress","type":"address"},{"internalType":"address payable","name":"fundsRecoveryAddress","type":"address"},{"internalType":"bool","name":"isWhiteList","type":"bool"}],"internalType":"struct Models.QuestParam","name":"_questParam","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"evidence","type":"bytes"},{"indexed":false,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"QuestClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"QuestPlayed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"QuestUnplayed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"whiteListPlayers","type":"address[]"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"QuestWhiteListChanged","type":"event"},{"inputs":[],"name":"aragonGovernAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"executer","type":"address"}],"name":"canExecute","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_evidence","type":"bytes"},{"internalType":"address","name":"_player","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bool","name":"_claimAll","type":"bool"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"claims","outputs":[{"internalType":"bytes","name":"evidence","type":"bytes"},{"internalType":"address","name":"player","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"createDeposit","outputs":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"expireTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fundsRecoveryAddress","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPlayers","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isCreateDepositReleased","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isWhiteList","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPlayers","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_player","type":"address"}],"name":"play","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"playDeposit","outputs":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"questCreator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"questDetailsRef","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"questTitle","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"recoverFundsAndDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract IERC20Upgradeable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_players","type":"address[]"}],"name":"setWhiteList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_player","type":"address"}],"name":"unplay","outputs":[],"stateMutability":"nonpayable","type":"function"}]} \ No newline at end of file diff --git a/packages/hardhat/deployments/goerli/QuestFactory.json b/packages/hardhat/deployments/goerli/QuestFactory.json index 88fc4001..27fecbce 100644 --- a/packages/hardhat/deployments/goerli/QuestFactory.json +++ b/packages/hardhat/deployments/goerli/QuestFactory.json @@ -1 +1 @@ -{"address":"0x05301D6787430d26bb0D6430Bd98a59B955a27D0","abi":[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"CreateDepositChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PlayDepositChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"questAddress","type":"address"},{"indexed":false,"internalType":"string","name":"questTitle","type":"string"},{"indexed":false,"internalType":"bytes","name":"questDetailsRef","type":"bytes"},{"indexed":false,"internalType":"address","name":"rewardTokenAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"expireTime","type":"uint256"},{"indexed":false,"internalType":"address","name":"fundsRecoveryAddress","type":"address"},{"components":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"indexed":false,"internalType":"struct Models.Deposit","name":"createDeposit","type":"tuple"},{"components":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"indexed":false,"internalType":"struct Models.Deposit","name":"playDeposit","type":"tuple"},{"indexed":false,"internalType":"address","name":"creator","type":"address"},{"indexed":false,"internalType":"uint32","name":"maxPlayers","type":"uint32"},{"indexed":false,"internalType":"bool","name":"isWhiteList","type":"bool"},{"indexed":false,"internalType":"uint256","name":"version","type":"uint256"}],"name":"QuestCreated","type":"event"},{"inputs":[],"name":"aragonGovernAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"createDeposit","outputs":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_questTitle","type":"string"},{"internalType":"bytes","name":"_questDetailsRef","type":"bytes"},{"internalType":"contract IERC20Upgradeable","name":"_rewardToken","type":"address"},{"internalType":"uint256","name":"_expireTime","type":"uint256"},{"internalType":"address payable","name":"_fundsRecoveryAddress","type":"address"},{"internalType":"uint32","name":"_maxPlayers","type":"uint32"},{"internalType":"bool","name":"_isWhiteList","type":"bool"}],"name":"createQuest","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_aragonGovernAddress","type":"address"},{"internalType":"contract IERC20Upgradeable","name":"_createDepositToken","type":"address"},{"internalType":"uint256","name":"_createDepositAmount","type":"uint256"},{"internalType":"contract IERC20Upgradeable","name":"_playDepositToken","type":"address"},{"internalType":"uint256","name":"_playDepositAmount","type":"uint256"},{"internalType":"address","name":"_initialOwner","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"playDeposit","outputs":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_aragonGovernAddress","type":"address"}],"name":"setAragonGovernAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"setCreateDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"setPlayDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]} \ No newline at end of file +{"address":"0x05301D6787430d26bb0D6430Bd98a59B955a27D0","abi":[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"CreateDepositChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PlayDepositChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"questAddress","type":"address"},{"indexed":false,"internalType":"string","name":"questTitle","type":"string"},{"indexed":false,"internalType":"bytes","name":"questDetailsRef","type":"bytes"},{"indexed":false,"internalType":"address","name":"rewardTokenAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"expireTime","type":"uint256"},{"indexed":false,"internalType":"address","name":"fundsRecoveryAddress","type":"address"},{"components":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"indexed":false,"internalType":"struct Models.Deposit","name":"createDeposit","type":"tuple"},{"components":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"indexed":false,"internalType":"struct Models.Deposit","name":"playDeposit","type":"tuple"},{"indexed":false,"internalType":"address","name":"creator","type":"address"},{"indexed":false,"internalType":"uint32","name":"maxPlayers","type":"uint32"},{"indexed":false,"internalType":"bool","name":"isWhiteList","type":"bool"},{"indexed":false,"internalType":"uint256","name":"version","type":"uint256"}],"name":"QuestCreated","type":"event"},{"inputs":[],"name":"aragonGovernAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"createDeposit","outputs":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_questTitle","type":"string"},{"internalType":"bytes","name":"_questDetailsRef","type":"bytes"},{"internalType":"contract IERC20Upgradeable","name":"_rewardToken","type":"address"},{"internalType":"uint256","name":"_expireTime","type":"uint256"},{"internalType":"address payable","name":"_fundsRecoveryAddress","type":"address"},{"internalType":"uint32","name":"_maxPlayers","type":"uint32"},{"internalType":"bool","name":"_isWhiteList","type":"bool"}],"name":"createQuest","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_aragonGovernAddress","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"playDeposit","outputs":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_aragonGovernAddress","type":"address"}],"name":"setAragonGovernAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"setCreateDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"setPlayDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]} \ No newline at end of file diff --git a/packages/hardhat/deployments/goerli/solcInputs/50a18826e7492a602ffecf93cceefc5c.json b/packages/hardhat/deployments/goerli/solcInputs/50a18826e7492a602ffecf93cceefc5c.json new file mode 100644 index 00000000..791497aa --- /dev/null +++ b/packages/hardhat/deployments/goerli/solcInputs/50a18826e7492a602ffecf93cceefc5c.json @@ -0,0 +1,71 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized != type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20Upgradeable token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20PermitUpgradeable token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts/utils/math/SafeMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n return a - b;\n }\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a / b;\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n }\n}\n" + }, + "contracts/libraries/Deposit.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\n// Solidity: Package Default Dependencies Directory = \"node_modules\"\r\n\r\npragma solidity ^0.8.2;\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"./Models.sol\";\r\n\r\nlibrary DepositLib {\r\n using SafeERC20Upgradeable for IERC20Upgradeable;\r\n\r\n /*\r\n * Collect deposit from signer and send it to _to address.\r\n * @param _token The deposit token.\r\n * @param _amount The deposit amount.\r\n * @param _to The address where the deposit should be transfered.\r\n */\r\n function collectFrom(\r\n Models.Deposit memory _collateral,\r\n address _from,\r\n address _to\r\n ) internal {\r\n collectFrom(_collateral, _from);\r\n releaseTo(_collateral, _to);\r\n }\r\n\r\n /*\r\n * Collect deposit from signer\r\n * @param _token The deposit token.\r\n * @param _amount The deposit amount.\r\n */\r\n function collectFrom(Models.Deposit memory _collateral, address _from)\r\n internal\r\n {\r\n if (_collateral.amount > 0) {\r\n // Verify allowance\r\n uint256 allowance = _collateral.token.allowance(\r\n _from,\r\n address(this)\r\n );\r\n require(\r\n allowance >= _collateral.amount,\r\n \"ERROR : Deposit bad allowance\"\r\n );\r\n\r\n _collateral.token.safeTransferFrom(\r\n _from,\r\n address(this),\r\n _collateral.amount\r\n );\r\n }\r\n }\r\n\r\n function releaseTo(Models.Deposit memory _collateral, address _to)\r\n internal\r\n {\r\n if (_collateral.amount > 0) {\r\n _collateral.token.safeTransfer(_to, _collateral.amount);\r\n }\r\n }\r\n}\r\n" + }, + "contracts/libraries/IExecutable.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\n\r\ninterface IExecutable {\r\n function canExecute(address executer) external returns (bool);\r\n}\r\n" + }, + "contracts/libraries/Models.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\n\r\nlibrary Models {\r\n struct Deposit {\r\n IERC20Upgradeable token;\r\n uint256 amount;\r\n }\r\n struct Claim {\r\n bytes evidence;\r\n address player;\r\n uint256 amount;\r\n }\r\n struct QuestParam {\r\n address questCreator;\r\n uint32 maxPlayers;\r\n IERC20Upgradeable rewardToken;\r\n uint256 expireTime;\r\n address aragonGovernAddress;\r\n address payable fundsRecoveryAddress;\r\n bool isWhiteList;\r\n }\r\n}\r\n" + }, + "contracts/Quest.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\";\r\nimport \"./libraries/Deposit.sol\";\r\nimport \"./libraries/Models.sol\";\r\nimport \"./libraries/IExecutable.sol\";\r\n\r\ncontract Quest is IExecutable {\r\n using SafeMath for uint256;\r\n using SafeERC20Upgradeable for IERC20Upgradeable;\r\n using DepositLib for Models.Deposit;\r\n\r\n // Quest payload\r\n address public questCreator;\r\n string public questTitle;\r\n bytes public questDetailsRef;\r\n IERC20Upgradeable public rewardToken;\r\n uint256 public expireTime;\r\n address public aragonGovernAddress;\r\n address payable public fundsRecoveryAddress;\r\n uint32 public maxPlayers; // 0 for unlimited players\r\n bool public isWhiteList;\r\n Models.Claim[] public claims;\r\n Models.Deposit public createDeposit;\r\n Models.Deposit public playDeposit;\r\n bool public isCreateDepositReleased;\r\n\r\n address[] private playerList;\r\n\r\n event QuestClaimed(bytes evidence, address player, uint256 amount);\r\n event QuestPlayed(address player, uint256 timestamp);\r\n event QuestUnplayed(address player, uint256 timestamp);\r\n event QuestWhiteListChanged(address[] whiteListPlayers, uint256 timestamp);\r\n modifier OnlyCreator() {\r\n require(\r\n msg.sender == questCreator,\r\n \"Only creator can call this function\"\r\n );\r\n _;\r\n }\r\n\r\n constructor(\r\n string memory _questTitle,\r\n bytes memory _questDetailsRef,\r\n Models.Deposit memory _createDeposit,\r\n Models.Deposit memory _playDeposit,\r\n Models.QuestParam memory _questParam\r\n ) {\r\n require(\r\n !(_questParam.isWhiteList && _questParam.maxPlayers > 0),\r\n \"ERROR: Can't create a whiteListed quest with max players greater than 0 (infinity)\"\r\n );\r\n questTitle = _questTitle;\r\n questDetailsRef = _questDetailsRef;\r\n rewardToken = _questParam.rewardToken;\r\n expireTime = _questParam.expireTime;\r\n aragonGovernAddress = _questParam.aragonGovernAddress;\r\n fundsRecoveryAddress = _questParam.fundsRecoveryAddress;\r\n questCreator = _questParam.questCreator;\r\n createDeposit = _createDeposit;\r\n playDeposit = _playDeposit;\r\n\r\n isCreateDepositReleased = false;\r\n maxPlayers = _questParam.maxPlayers;\r\n isWhiteList = _questParam.isWhiteList;\r\n }\r\n\r\n /*\r\n * Claim a quest reward.\r\n *\r\n * @param _evidence Evidence of the claim.\r\n * @param _player Player address.\r\n * @param _amount Amount of the reward.\r\n *\r\n * requires sender to be aragonGovernAddress\r\n * requires evidence to not be empty\r\n * requires claim amount to not exceed available deposit when same token\r\n *\r\n * emit QuestClaimed\r\n */\r\n function claim(\r\n bytes memory _evidence,\r\n address _player,\r\n uint256 _amount,\r\n bool _claimAll\r\n ) external {\r\n require(msg.sender == aragonGovernAddress, \"ERROR: Sender not govern\");\r\n require(_evidence.length != 0, \"ERROR: No evidence\");\r\n\r\n uint256 balance = rewardToken.balanceOf(address(this));\r\n\r\n if (_claimAll) {\r\n // Claim all but let the create deposit if they are same token\r\n if (address(rewardToken) == address(createDeposit.token)) {\r\n (, uint256 result) = balance.trySub(createDeposit.amount);\r\n _amount = result;\r\n } else {\r\n _amount = balance;\r\n }\r\n\r\n // Claim all but let play deposits of each player if they are same token\r\n if (\r\n address(rewardToken) == address(playDeposit.token) &&\r\n !isWhiteList\r\n ) {\r\n (, uint256 result) = _amount.trySub(\r\n playDeposit.amount * playerList.length\r\n );\r\n _amount = result;\r\n }\r\n }\r\n\r\n if (address(rewardToken) == address(createDeposit.token)) {\r\n (, uint256 result) = balance.trySub(_amount);\r\n require(\r\n result >= createDeposit.amount,\r\n \"ERROR: Should not exceed allowed bounty\"\r\n );\r\n }\r\n\r\n if (_amount > 0) {\r\n rewardToken.safeTransfer(_player, _amount);\r\n }\r\n\r\n claims.push(Models.Claim(_evidence, _player, _amount));\r\n\r\n emit QuestClaimed(_evidence, _player, _amount);\r\n }\r\n\r\n /*\r\n * Release create deposit to creator and send unused funds to fundsRecoveryAddress.\r\n * requires quests to have expired\r\n *\r\n * requires quest to be expired\r\n */\r\n function recoverFundsAndDeposit() external {\r\n require(block.timestamp >= expireTime, \"ERROR: Not expired\");\r\n\r\n // Restore deposit if not already released\r\n if (!isCreateDepositReleased) {\r\n createDeposit.releaseTo(questCreator);\r\n isCreateDepositReleased = true;\r\n }\r\n\r\n uint256 balance = rewardToken.balanceOf(address(this));\r\n\r\n // Restore all but let the player deposit still locked if they are same token\r\n if (address(rewardToken) == address(playDeposit.token) && !isWhiteList) {\r\n (, balance) = balance.trySub(\r\n playDeposit.amount * playerList.length\r\n );\r\n }\r\n\r\n rewardToken.safeTransfer(fundsRecoveryAddress, balance);\r\n }\r\n\r\n /**\r\n * Verify given executer can execute this quest.\r\n * @param executer The player to verify\r\n */\r\n function canExecute(\r\n address executer\r\n ) external view override returns (bool) {\r\n return findIndexOfPlayer(executer) != -1;\r\n }\r\n\r\n /**\r\n * Register a player to the quest. (sender could be the player or quest creator)\r\n *\r\n * @param _player Player address.\r\n *\r\n * requires sender to be the quest creator or the player\r\n * requires sender to put a deposit (if its creator, deposit will be released to player)\r\n * requires player list is not full\r\n * requires quest is not expired\r\n * requires player is not already registered\r\n *\r\n * emit QuestPlayed with player and timestamp\r\n */\r\n function play(address _player) external {\r\n require(\r\n isWhiteList == false,\r\n \"ERROR: Can't self register and play a whitelisted Quest\"\r\n );\r\n require(\r\n msg.sender == _player || msg.sender == questCreator,\r\n \"ERROR: Sender not player nor creator\"\r\n );\r\n require(\r\n maxPlayers == 0 || playerList.length < maxPlayers,\r\n \"ERROR: Max players reached\"\r\n );\r\n require(block.timestamp < expireTime, \"ERROR: Quest expired\");\r\n int256 playerIndex = findIndexOfPlayer(_player);\r\n require(playerIndex == -1, \"ERROR: Player already exists\");\r\n\r\n playDeposit.collectFrom(msg.sender, address(this));\r\n\r\n playerList.push(_player);\r\n emit QuestPlayed(_player, block.timestamp);\r\n }\r\n\r\n /***\r\n * Set the white list of players allowed to play the quest.\r\n *\r\n * requires sender to be the quest creator\r\n * @param _players The list of players allowed to play the quest.\r\n *\r\n * emit QuestWhiteListChanged with players and timestamp\r\n */\r\n function setWhiteList(address[] memory _players) external OnlyCreator {\r\n require(\r\n isWhiteList == true,\r\n \"ERROR: Can't set the white list to a non-whitelisted contract\"\r\n );\r\n\r\n bool duplicatedPlayers = false;\r\n\r\n for(uint i = 0; i < _players.length; i++) {\r\n address temp = _players[i];\r\n for(uint j = 0; j < _players.length; j++) {\r\n if((j != i) && (temp == _players[j])) {\r\n duplicatedPlayers = true;\r\n }\r\n }\r\n }\r\n\r\n require(\r\n duplicatedPlayers == false,\r\n \"ERROR: One or more players is already in whitelist\"\r\n );\r\n\r\n playerList = _players;\r\n emit QuestWhiteListChanged(_players, block.timestamp);\r\n }\r\n\r\n /**\r\n * Unregister a player from the quest. (sender could be the player or quest creator)\r\n * @param _player Player address.\r\n *\r\n * requires sender to be the quest creator or the player\r\n * requires player is registered\r\n *\r\n * emit QuestUnplayed with player and timestamp\r\n */\r\n function unplay(address _player) external {\r\n require(\r\n isWhiteList == false,\r\n \"ERROR: can't unplay a whitelisted quest\"\r\n );\r\n require(\r\n msg.sender == _player || msg.sender == questCreator,\r\n \"ERROR: Sender not player nor creator\"\r\n );\r\n int256 playerIndex = findIndexOfPlayer(_player);\r\n require(playerIndex != -1, \"ERROR: player not in list\");\r\n\r\n // We put the last player in the place of the player to remove\r\n playerList[uint256(playerIndex)] = playerList[playerList.length - 1];\r\n // And then we can remove the last element to have the actual lenght updated\r\n playerList.pop();\r\n\r\n playDeposit.releaseTo(_player);\r\n emit QuestUnplayed(_player, block.timestamp);\r\n }\r\n\r\n /**\r\n Simply return the player list as the entire array\r\n */\r\n function getPlayers() external view returns (address[] memory) {\r\n return playerList;\r\n }\r\n\r\n // Private functions\r\n\r\n function findIndexOfPlayer(address _player) private view returns (int256) {\r\n for (uint256 i = 0; i < playerList.length; i++) {\r\n if (playerList[i] == _player) {\r\n return int256(i);\r\n }\r\n }\r\n return -1;\r\n }\r\n}\r\n" + }, + "contracts/QuestFactory.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\r\nimport \"./libraries/Deposit.sol\";\r\nimport \"./libraries/Models.sol\";\r\nimport \"./Quest.sol\";\r\n\r\ncontract QuestFactory is OwnableUpgradeable {\r\n using DepositLib for Models.Deposit;\r\n\r\n address public aragonGovernAddress;\r\n Models.Deposit public createDeposit;\r\n Models.Deposit public playDeposit;\r\n uint256 public constant version = 3;\r\n\r\n event QuestCreated(\r\n address questAddress,\r\n string questTitle,\r\n bytes questDetailsRef,\r\n address rewardTokenAddress,\r\n uint256 expireTime,\r\n address fundsRecoveryAddress,\r\n Models.Deposit createDeposit,\r\n Models.Deposit playDeposit,\r\n address creator,\r\n uint32 maxPlayers,\r\n bool isWhiteList,\r\n uint256 version\r\n );\r\n\r\n event CreateDepositChanged(\r\n uint256 timestamp,\r\n address token,\r\n uint256 amount\r\n );\r\n\r\n event PlayDepositChanged(uint256 timestamp, address token, uint256 amount);\r\n\r\n /// @custom:oz-upgrades-unsafe-allow constructor\r\n constructor() {\r\n _disableInitializers();\r\n }\r\n\r\n function initialize(address _aragonGovernAddress) public initializer {\r\n __Ownable_init();\r\n aragonGovernAddress = _aragonGovernAddress;\r\n }\r\n\r\n /*\r\n * @dev Set the deposit token and amount.\r\n * @param _depositToken The deposit token.\r\n * @param _depositAmount The deposit amount.\r\n * emit CreateDepositChanged\r\n */\r\n function setCreateDeposit(\r\n IERC20Upgradeable token,\r\n uint256 amount\r\n ) public onlyOwner {\r\n createDeposit = Models.Deposit(token, amount);\r\n emit CreateDepositChanged(block.timestamp, address(token), amount);\r\n }\r\n\r\n /*\r\n * @dev Set the play deposit token and amount.\r\n * @param _depositToken The deposit token.\r\n * @param _depositAmount The deposit amount.\r\n * emit PlayDepositChanged\r\n */\r\n function setPlayDeposit(\r\n IERC20Upgradeable token,\r\n uint256 amount\r\n ) public onlyOwner {\r\n playDeposit = Models.Deposit(token, amount);\r\n emit PlayDepositChanged(block.timestamp, address(token), amount);\r\n }\r\n\r\n /*\r\n * Collect deposit, deploy a new Quest with given info contract\r\n * and transfer deposit to new Quest.\r\n * @param _title Quest title.\r\n * @param _details Quest details.\r\n * @param _rewardTokenAddress Reward token address.\r\n * @param _expireTime Expire time.\r\n * @param _fundsRecoveryAddress Funds recovery address.\r\n * requires deposit allowance\r\n * returns Quest address.\r\n * emits QuestCreated\r\n */\r\n function createQuest(\r\n string memory _questTitle,\r\n bytes memory _questDetailsRef,\r\n IERC20Upgradeable _rewardToken,\r\n uint256 _expireTime,\r\n address payable _fundsRecoveryAddress,\r\n uint32 _maxPlayers,\r\n bool _isWhiteList\r\n ) external returns (address) {\r\n Quest quest = new Quest(\r\n _questTitle,\r\n _questDetailsRef,\r\n Models.Deposit(createDeposit.token, createDeposit.amount),\r\n Models.Deposit(playDeposit.token, playDeposit.amount),\r\n Models.QuestParam(\r\n msg.sender,\r\n _maxPlayers,\r\n _rewardToken,\r\n _expireTime,\r\n aragonGovernAddress,\r\n _fundsRecoveryAddress,\r\n _isWhiteList\r\n )\r\n );\r\n\r\n // Collect deposit from quest creator and send it to quest\r\n createDeposit.collectFrom(msg.sender, address(quest));\r\n\r\n emit QuestCreated(\r\n address(quest),\r\n _questTitle,\r\n _questDetailsRef,\r\n address(_rewardToken),\r\n _expireTime,\r\n _fundsRecoveryAddress,\r\n createDeposit,\r\n playDeposit,\r\n msg.sender,\r\n _maxPlayers,\r\n _isWhiteList,\r\n version\r\n );\r\n\r\n return address(quest);\r\n }\r\n\r\n /**\r\n * @dev Be able to change it after deploy so we can deploy\r\n * a new GovernQueue but keep the same QuestFactory\r\n * @param _aragonGovernAddress The aragonGovernAddress.\r\n */\r\n function setAragonGovernAddress(\r\n address _aragonGovernAddress\r\n ) external onlyOwner {\r\n aragonGovernAddress = _aragonGovernAddress;\r\n }\r\n}\r\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 20000 + }, + "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/packages/hardhat/deployments/goerli/solcInputs/6e8338cf1c4754b2c5cce55ee1ef71c3.json b/packages/hardhat/deployments/goerli/solcInputs/6e8338cf1c4754b2c5cce55ee1ef71c3.json new file mode 100644 index 00000000..fb0c8427 --- /dev/null +++ b/packages/hardhat/deployments/goerli/solcInputs/6e8338cf1c4754b2c5cce55ee1ef71c3.json @@ -0,0 +1,87 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized != type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20Upgradeable token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20PermitUpgradeable token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(address from, address to, uint256 amount) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(address owner, address spender, uint256 amount) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/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/math/SafeMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n return a - b;\n }\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a / b;\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n }\n}\n" + }, + "contracts/libraries/Deposit.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\n// Solidity: Package Default Dependencies Directory = \"node_modules\"\r\n\r\npragma solidity ^0.8.2;\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"./Models.sol\";\r\n\r\nlibrary DepositLib {\r\n using SafeERC20Upgradeable for IERC20Upgradeable;\r\n\r\n /*\r\n * Collect deposit from signer and send it to _to address.\r\n * @param _token The deposit token.\r\n * @param _amount The deposit amount.\r\n * @param _to The address where the deposit should be transfered.\r\n */\r\n function collectFrom(\r\n Models.Deposit memory _collateral,\r\n address _from,\r\n address _to\r\n ) internal {\r\n collectFrom(_collateral, _from);\r\n releaseTo(_collateral, _to);\r\n }\r\n\r\n /*\r\n * Collect deposit from signer\r\n * @param _token The deposit token.\r\n * @param _amount The deposit amount.\r\n */\r\n function collectFrom(Models.Deposit memory _collateral, address _from)\r\n internal\r\n {\r\n if (_collateral.amount > 0) {\r\n // Verify allowance\r\n uint256 allowance = _collateral.token.allowance(\r\n _from,\r\n address(this)\r\n );\r\n require(\r\n allowance >= _collateral.amount,\r\n \"ERROR : Deposit bad allowance\"\r\n );\r\n\r\n _collateral.token.safeTransferFrom(\r\n _from,\r\n address(this),\r\n _collateral.amount\r\n );\r\n }\r\n }\r\n\r\n function releaseTo(Models.Deposit memory _collateral, address _to)\r\n internal\r\n {\r\n if (_collateral.amount > 0) {\r\n _collateral.token.safeTransfer(_to, _collateral.amount);\r\n }\r\n }\r\n}\r\n" + }, + "contracts/libraries/IExecutable.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\n\r\ninterface IExecutable {\r\n function canExecute(address executer) external returns (bool);\r\n}\r\n" + }, + "contracts/libraries/Models.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\n\r\nlibrary Models {\r\n struct Deposit {\r\n IERC20Upgradeable token;\r\n uint256 amount;\r\n }\r\n struct Claim {\r\n bytes evidence;\r\n address player;\r\n uint256 amount;\r\n }\r\n struct QuestParam {\r\n address questCreator;\r\n uint32 maxPlayers;\r\n IERC20Upgradeable rewardToken;\r\n uint256 expireTime;\r\n address aragonGovernAddress;\r\n address payable fundsRecoveryAddress;\r\n bool isWhiteList;\r\n }\r\n}\r\n" + }, + "contracts/mocks/TokenMock.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.0;\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\r\n\r\n// Example class - a mock class using delivering from ERC20\r\ncontract TokenMock is ERC20 {\r\n constructor(string memory name, string memory symbol)\r\n payable\r\n ERC20(name, symbol)\r\n {}\r\n\r\n function mint(address owner, uint256 initialBalance) external {\r\n _mint(owner, initialBalance);\r\n }\r\n}\r\n" + }, + "contracts/Quest.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\";\r\nimport \"./libraries/Deposit.sol\";\r\nimport \"./libraries/Models.sol\";\r\nimport \"./libraries/IExecutable.sol\";\r\n\r\ncontract Quest is IExecutable {\r\n using SafeMath for uint256;\r\n using SafeERC20Upgradeable for IERC20Upgradeable;\r\n using DepositLib for Models.Deposit;\r\n\r\n // Quest payload\r\n address public questCreator;\r\n string public questTitle;\r\n bytes public questDetailsRef;\r\n IERC20Upgradeable public rewardToken;\r\n uint256 public expireTime;\r\n address public aragonGovernAddress;\r\n address payable public fundsRecoveryAddress;\r\n uint32 public maxPlayers; // 0 for unlimited players\r\n bool public isWhiteList;\r\n Models.Claim[] public claims;\r\n Models.Deposit public createDeposit;\r\n Models.Deposit public playDeposit;\r\n bool public isCreateDepositReleased;\r\n\r\n address[] private playerList;\r\n\r\n event QuestClaimed(bytes evidence, address player, uint256 amount);\r\n event QuestPlayed(address player, uint256 timestamp);\r\n event QuestUnplayed(address player, uint256 timestamp);\r\n event QuestWhiteListChanged(address[] whiteListPlayers, uint256 timestamp);\r\n modifier OnlyCreator() {\r\n require(\r\n msg.sender == questCreator,\r\n \"Only creator can call this function\"\r\n );\r\n _;\r\n }\r\n\r\n constructor(\r\n string memory _questTitle,\r\n bytes memory _questDetailsRef,\r\n Models.Deposit memory _createDeposit,\r\n Models.Deposit memory _playDeposit,\r\n Models.QuestParam memory _questParam\r\n ) {\r\n require(\r\n !(_questParam.isWhiteList && _questParam.maxPlayers > 0),\r\n \"ERROR: Can't create a whiteListed quest with max players greater than 0 (infinity)\"\r\n );\r\n questTitle = _questTitle;\r\n questDetailsRef = _questDetailsRef;\r\n rewardToken = _questParam.rewardToken;\r\n expireTime = _questParam.expireTime;\r\n aragonGovernAddress = _questParam.aragonGovernAddress;\r\n fundsRecoveryAddress = _questParam.fundsRecoveryAddress;\r\n questCreator = _questParam.questCreator;\r\n createDeposit = _createDeposit;\r\n playDeposit = _playDeposit;\r\n\r\n isCreateDepositReleased = false;\r\n maxPlayers = _questParam.maxPlayers;\r\n isWhiteList = _questParam.isWhiteList;\r\n }\r\n\r\n /*\r\n * Claim a quest reward.\r\n *\r\n * @param _evidence Evidence of the claim.\r\n * @param _player Player address.\r\n * @param _amount Amount of the reward.\r\n *\r\n * requires sender to be aragonGovernAddress\r\n * requires evidence to not be empty\r\n * requires claim amount to not exceed available deposit when same token\r\n *\r\n * emit QuestClaimed\r\n */\r\n function claim(\r\n bytes memory _evidence,\r\n address _player,\r\n uint256 _amount,\r\n bool _claimAll\r\n ) external {\r\n require(msg.sender == aragonGovernAddress, \"ERROR: Sender not govern\");\r\n require(_evidence.length != 0, \"ERROR: No evidence\");\r\n\r\n uint256 balance = rewardToken.balanceOf(address(this));\r\n\r\n if (_claimAll) {\r\n // Claim all but let the create deposit if they are same token\r\n if (address(rewardToken) == address(createDeposit.token)) {\r\n (, uint256 result) = balance.trySub(createDeposit.amount);\r\n _amount = result;\r\n } else {\r\n _amount = balance;\r\n }\r\n\r\n // Claim all but let play deposits of each player if they are same token\r\n if (\r\n address(rewardToken) == address(playDeposit.token) &&\r\n !isWhiteList\r\n ) {\r\n (, uint256 result) = _amount.trySub(\r\n playDeposit.amount * playerList.length\r\n );\r\n _amount = result;\r\n }\r\n }\r\n\r\n if (address(rewardToken) == address(createDeposit.token)) {\r\n (, uint256 result) = balance.trySub(_amount);\r\n require(\r\n result >= createDeposit.amount,\r\n \"ERROR: Should not exceed allowed bounty\"\r\n );\r\n }\r\n\r\n if (_amount > 0) {\r\n rewardToken.safeTransfer(_player, _amount);\r\n }\r\n\r\n claims.push(Models.Claim(_evidence, _player, _amount));\r\n\r\n emit QuestClaimed(_evidence, _player, _amount);\r\n }\r\n\r\n /*\r\n * Release create deposit to creator and send unused funds to fundsRecoveryAddress.\r\n * requires quests to have expired\r\n *\r\n * requires quest to be expired\r\n */\r\n function recoverFundsAndDeposit() external {\r\n require(block.timestamp >= expireTime, \"ERROR: Not expired\");\r\n\r\n // Restore deposit if not already released\r\n if (!isCreateDepositReleased) {\r\n createDeposit.releaseTo(questCreator);\r\n isCreateDepositReleased = true;\r\n }\r\n\r\n uint256 balance = rewardToken.balanceOf(address(this));\r\n\r\n // Restore all but let the player deposit still locked if they are same token\r\n if (address(rewardToken) == address(playDeposit.token) && !isWhiteList) {\r\n (, balance) = balance.trySub(\r\n playDeposit.amount * playerList.length\r\n );\r\n }\r\n\r\n rewardToken.safeTransfer(fundsRecoveryAddress, balance);\r\n }\r\n\r\n /**\r\n * Verify given executer can execute this quest.\r\n * @param executer The player to verify\r\n */\r\n function canExecute(\r\n address executer\r\n ) external view override returns (bool) {\r\n return findIndexOfPlayer(executer) != -1;\r\n }\r\n\r\n /**\r\n * Register a player to the quest. (sender could be the player or quest creator)\r\n *\r\n * @param _player Player address.\r\n *\r\n * requires sender to be the quest creator or the player\r\n * requires sender to put a deposit (if its creator, deposit will be released to player)\r\n * requires player list is not full\r\n * requires quest is not expired\r\n * requires player is not already registered\r\n *\r\n * emit QuestPlayed with player and timestamp\r\n */\r\n function play(address _player) external {\r\n require(\r\n isWhiteList == false,\r\n \"ERROR: Can't self register and play a whitelisted Quest\"\r\n );\r\n require(\r\n msg.sender == _player || msg.sender == questCreator,\r\n \"ERROR: Sender not player nor creator\"\r\n );\r\n require(\r\n maxPlayers == 0 || playerList.length < maxPlayers,\r\n \"ERROR: Max players reached\"\r\n );\r\n require(block.timestamp < expireTime, \"ERROR: Quest expired\");\r\n int256 playerIndex = findIndexOfPlayer(_player);\r\n require(playerIndex == -1, \"ERROR: Player already exists\");\r\n\r\n playDeposit.collectFrom(msg.sender, address(this));\r\n\r\n playerList.push(_player);\r\n emit QuestPlayed(_player, block.timestamp);\r\n }\r\n\r\n /***\r\n * Set the white list of players allowed to play the quest.\r\n *\r\n * requires sender to be the quest creator\r\n * @param _players The list of players allowed to play the quest.\r\n *\r\n * emit QuestWhiteListChanged with players and timestamp\r\n */\r\n function setWhiteList(address[] memory _players) external OnlyCreator {\r\n require(\r\n isWhiteList == true,\r\n \"ERROR: Can't set the white list to a non-whitelisted contract\"\r\n );\r\n\r\n bool playerInList = false;\r\n\r\n for (uint32 i = 0; i < _players.length; i++) {\r\n if (findIndexOfPlayer(_players[i]) != -1) {\r\n playerInList = true;\r\n }\r\n }\r\n\r\n require(\r\n playerInList == false,\r\n \"ERROR: One or more players is already in whitelist\"\r\n );\r\n\r\n playerList = _players;\r\n emit QuestWhiteListChanged(_players, block.timestamp);\r\n }\r\n\r\n /**\r\n * Unregister a player from the quest. (sender could be the player or quest creator)\r\n * @param _player Player address.\r\n *\r\n * requires sender to be the quest creator or the player\r\n * requires player is registered\r\n *\r\n * emit QuestUnplayed with player and timestamp\r\n */\r\n function unplay(address _player) external {\r\n require(\r\n isWhiteList == false,\r\n \"ERROR: can't unplay a whitelisted quest\"\r\n );\r\n require(\r\n msg.sender == _player || msg.sender == questCreator,\r\n \"ERROR: Sender not player nor creator\"\r\n );\r\n int256 playerIndex = findIndexOfPlayer(_player);\r\n require(playerIndex != -1, \"ERROR: player not in list\");\r\n\r\n // We put the last player in the place of the player to remove\r\n playerList[uint256(playerIndex)] = playerList[playerList.length - 1];\r\n // And then we can remove the last element to have the actual lenght updated\r\n playerList.pop();\r\n\r\n playDeposit.releaseTo(_player);\r\n emit QuestUnplayed(_player, block.timestamp);\r\n }\r\n\r\n /**\r\n Simply return the player list as the entire array\r\n */\r\n function getPlayers() external view returns (address[] memory) {\r\n return playerList;\r\n }\r\n\r\n // Private functions\r\n\r\n function findIndexOfPlayer(address _player) private view returns (int256) {\r\n for (uint256 i = 0; i < playerList.length; i++) {\r\n if (playerList[i] == _player) {\r\n return int256(i);\r\n }\r\n }\r\n return -1;\r\n }\r\n}\r\n" + }, + "contracts/QuestFactory.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\r\nimport \"./libraries/Deposit.sol\";\r\nimport \"./libraries/Models.sol\";\r\nimport \"./Quest.sol\";\r\n\r\ncontract QuestFactory is OwnableUpgradeable {\r\n using DepositLib for Models.Deposit;\r\n\r\n address public aragonGovernAddress;\r\n Models.Deposit public createDeposit;\r\n Models.Deposit public playDeposit;\r\n uint256 public constant version = 3;\r\n\r\n event QuestCreated(\r\n address questAddress,\r\n string questTitle,\r\n bytes questDetailsRef,\r\n address rewardTokenAddress,\r\n uint256 expireTime,\r\n address fundsRecoveryAddress,\r\n Models.Deposit createDeposit,\r\n Models.Deposit playDeposit,\r\n address creator,\r\n uint32 maxPlayers,\r\n bool isWhiteList,\r\n uint256 version\r\n );\r\n\r\n event CreateDepositChanged(\r\n uint256 timestamp,\r\n address token,\r\n uint256 amount\r\n );\r\n\r\n event PlayDepositChanged(uint256 timestamp, address token, uint256 amount);\r\n\r\n /// @custom:oz-upgrades-unsafe-allow constructor\r\n constructor() {\r\n _disableInitializers();\r\n }\r\n\r\n function initialize(address _aragonGovernAddress) public initializer {\r\n __Ownable_init();\r\n aragonGovernAddress = _aragonGovernAddress;\r\n }\r\n\r\n /*\r\n * @dev Set the deposit token and amount.\r\n * @param _depositToken The deposit token.\r\n * @param _depositAmount The deposit amount.\r\n * emit CreateDepositChanged\r\n */\r\n function setCreateDeposit(\r\n IERC20Upgradeable token,\r\n uint256 amount\r\n ) public onlyOwner {\r\n createDeposit = Models.Deposit(token, amount);\r\n emit CreateDepositChanged(block.timestamp, address(token), amount);\r\n }\r\n\r\n /*\r\n * @dev Set the play deposit token and amount.\r\n * @param _depositToken The deposit token.\r\n * @param _depositAmount The deposit amount.\r\n * emit PlayDepositChanged\r\n */\r\n function setPlayDeposit(\r\n IERC20Upgradeable token,\r\n uint256 amount\r\n ) public onlyOwner {\r\n playDeposit = Models.Deposit(token, amount);\r\n emit PlayDepositChanged(block.timestamp, address(token), amount);\r\n }\r\n\r\n /*\r\n * Collect deposit, deploy a new Quest with given info contract\r\n * and transfer deposit to new Quest.\r\n * @param _title Quest title.\r\n * @param _details Quest details.\r\n * @param _rewardTokenAddress Reward token address.\r\n * @param _expireTime Expire time.\r\n * @param _fundsRecoveryAddress Funds recovery address.\r\n * requires deposit allowance\r\n * returns Quest address.\r\n * emits QuestCreated\r\n */\r\n function createQuest(\r\n string memory _questTitle,\r\n bytes memory _questDetailsRef,\r\n IERC20Upgradeable _rewardToken,\r\n uint256 _expireTime,\r\n address payable _fundsRecoveryAddress,\r\n uint32 _maxPlayers,\r\n bool _isWhiteList\r\n ) external returns (address) {\r\n Quest quest = new Quest(\r\n _questTitle,\r\n _questDetailsRef,\r\n Models.Deposit(createDeposit.token, createDeposit.amount),\r\n Models.Deposit(playDeposit.token, playDeposit.amount),\r\n Models.QuestParam(\r\n msg.sender,\r\n _maxPlayers,\r\n _rewardToken,\r\n _expireTime,\r\n aragonGovernAddress,\r\n _fundsRecoveryAddress,\r\n _isWhiteList\r\n )\r\n );\r\n\r\n // Collect deposit from quest creator and send it to quest\r\n createDeposit.collectFrom(msg.sender, address(quest));\r\n\r\n emit QuestCreated(\r\n address(quest),\r\n _questTitle,\r\n _questDetailsRef,\r\n address(_rewardToken),\r\n _expireTime,\r\n _fundsRecoveryAddress,\r\n createDeposit,\r\n playDeposit,\r\n msg.sender,\r\n _maxPlayers,\r\n _isWhiteList,\r\n version\r\n );\r\n\r\n return address(quest);\r\n }\r\n\r\n /**\r\n * @dev Be able to change it after deploy so we can deploy\r\n * a new GovernQueue but keep the same QuestFactory\r\n * @param _aragonGovernAddress The aragonGovernAddress.\r\n */\r\n function setAragonGovernAddress(\r\n address _aragonGovernAddress\r\n ) external onlyOwner {\r\n aragonGovernAddress = _aragonGovernAddress;\r\n }\r\n}\r\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 20000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + }, + "libraries": {} + } +} \ No newline at end of file diff --git a/packages/hardhat/deployments/goerli/solcInputs/7790a97eeede749331715ebec1706882.json b/packages/hardhat/deployments/goerli/solcInputs/7790a97eeede749331715ebec1706882.json new file mode 100644 index 00000000..a5b7a544 --- /dev/null +++ b/packages/hardhat/deployments/goerli/solcInputs/7790a97eeede749331715ebec1706882.json @@ -0,0 +1,86 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized != type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20Upgradeable token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20PermitUpgradeable token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(address from, address to, uint256 amount) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(address owner, address spender, uint256 amount) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/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/math/SafeMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n return a - b;\n }\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a / b;\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n }\n}\n" + }, + "contracts/libraries/Deposit.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\n// Solidity: Package Default Dependencies Directory = \"node_modules\"\r\n\r\npragma solidity ^0.8.2;\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"./Models.sol\";\r\n\r\nlibrary DepositLib {\r\n using SafeERC20Upgradeable for IERC20Upgradeable;\r\n\r\n /*\r\n * Collect deposit from signer and send it to _to address.\r\n * @param _token The deposit token.\r\n * @param _amount The deposit amount.\r\n * @param _to The address where the deposit should be transfered.\r\n */\r\n function collectFrom(\r\n Models.Deposit memory _collateral,\r\n address _from,\r\n address _to\r\n ) internal {\r\n collectFrom(_collateral, _from);\r\n releaseTo(_collateral, _to);\r\n }\r\n\r\n /*\r\n * Collect deposit from signer\r\n * @param _token The deposit token.\r\n * @param _amount The deposit amount.\r\n */\r\n function collectFrom(Models.Deposit memory _collateral, address _from)\r\n internal\r\n {\r\n if (_collateral.amount > 0) {\r\n // Verify allowance\r\n uint256 allowance = _collateral.token.allowance(\r\n _from,\r\n address(this)\r\n );\r\n require(\r\n allowance >= _collateral.amount,\r\n \"ERROR : Deposit bad allowance\"\r\n );\r\n\r\n _collateral.token.safeTransferFrom(\r\n _from,\r\n address(this),\r\n _collateral.amount\r\n );\r\n }\r\n }\r\n\r\n function releaseTo(Models.Deposit memory _collateral, address _to)\r\n internal\r\n {\r\n if (_collateral.amount > 0) {\r\n _collateral.token.safeTransfer(_to, _collateral.amount);\r\n }\r\n }\r\n}\r\n" + }, + "contracts/libraries/IExecutable.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\n\r\ninterface IExecutable {\r\n function canExecute(address executer) external returns (bool);\r\n}\r\n" + }, + "contracts/libraries/Models.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\n\r\nlibrary Models {\r\n struct Deposit {\r\n IERC20Upgradeable token;\r\n uint256 amount;\r\n }\r\n struct Claim {\r\n bytes evidence;\r\n address player;\r\n uint256 amount;\r\n }\r\n struct QuestParam {\r\n address questCreator;\r\n uint32 maxPlayers;\r\n IERC20Upgradeable rewardToken;\r\n uint256 expireTime;\r\n address aragonGovernAddress;\r\n address payable fundsRecoveryAddress;\r\n bool isWhiteList;\r\n }\r\n}\r\n" + }, + "contracts/mocks/TokenMock.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.0;\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\r\n\r\n// Example class - a mock class using delivering from ERC20\r\ncontract TokenMock is ERC20 {\r\n constructor(string memory name, string memory symbol)\r\n payable\r\n ERC20(name, symbol)\r\n {}\r\n\r\n function mint(address owner, uint256 initialBalance) external {\r\n _mint(owner, initialBalance);\r\n }\r\n}\r\n" + }, + "contracts/Quest.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\";\r\nimport \"./libraries/Deposit.sol\";\r\nimport \"./libraries/Models.sol\";\r\nimport \"./libraries/IExecutable.sol\";\r\n\r\ncontract Quest is IExecutable {\r\n using SafeMath for uint256;\r\n using SafeERC20Upgradeable for IERC20Upgradeable;\r\n using DepositLib for Models.Deposit;\r\n\r\n // Quest payload\r\n address public questCreator;\r\n string public questTitle;\r\n bytes public questDetailsRef;\r\n IERC20Upgradeable public rewardToken;\r\n uint256 public expireTime;\r\n address public aragonGovernAddress;\r\n address payable public fundsRecoveryAddress;\r\n uint32 public maxPlayers; // 0 for unlimited players\r\n bool public isWhiteList;\r\n Models.Claim[] public claims;\r\n Models.Deposit public createDeposit;\r\n Models.Deposit public playDeposit;\r\n bool public isCreateDepositReleased;\r\n\r\n address[] private playerList;\r\n\r\n event QuestClaimed(bytes evidence, address player, uint256 amount);\r\n event QuestPlayed(address player, uint256 timestamp);\r\n event QuestUnplayed(address player, uint256 timestamp);\r\n event QuestWhiteListChanged(address[] whiteListPlayers, uint256 timestamp);\r\n modifier OnlyCreator() {\r\n require(\r\n msg.sender == questCreator,\r\n \"Only creator can call this function\"\r\n );\r\n _;\r\n }\r\n\r\n constructor(\r\n string memory _questTitle,\r\n bytes memory _questDetailsRef,\r\n Models.Deposit memory _createDeposit,\r\n Models.Deposit memory _playDeposit,\r\n Models.QuestParam memory _questParam\r\n ) {\r\n require(\r\n !(_questParam.isWhiteList && _questParam.maxPlayers > 0),\r\n \"ERROR: Can't create a whiteListed quest with max players greater than 0 (infinity)\"\r\n );\r\n questTitle = _questTitle;\r\n questDetailsRef = _questDetailsRef;\r\n rewardToken = _questParam.rewardToken;\r\n expireTime = _questParam.expireTime;\r\n aragonGovernAddress = _questParam.aragonGovernAddress;\r\n fundsRecoveryAddress = _questParam.fundsRecoveryAddress;\r\n questCreator = _questParam.questCreator;\r\n createDeposit = _createDeposit;\r\n playDeposit = _playDeposit;\r\n\r\n isCreateDepositReleased = false;\r\n maxPlayers = _questParam.maxPlayers;\r\n isWhiteList = _questParam.isWhiteList;\r\n }\r\n\r\n /*\r\n * Claim a quest reward.\r\n *\r\n * @param _evidence Evidence of the claim.\r\n * @param _player Player address.\r\n * @param _amount Amount of the reward.\r\n *\r\n * requires sender to be aragonGovernAddress\r\n * requires evidence to not be empty\r\n * requires claim amount to not exceed available deposit when same token\r\n *\r\n * emit QuestClaimed\r\n */\r\n function claim(\r\n bytes memory _evidence,\r\n address _player,\r\n uint256 _amount,\r\n bool _claimAll\r\n ) external {\r\n require(msg.sender == aragonGovernAddress, \"ERROR: Sender not govern\");\r\n require(_evidence.length != 0, \"ERROR: No evidence\");\r\n\r\n uint256 balance = rewardToken.balanceOf(address(this));\r\n\r\n if (_claimAll) {\r\n // Claim all but let the create deposit if they are same token\r\n if (address(rewardToken) == address(createDeposit.token)) {\r\n (, uint256 result) = balance.trySub(createDeposit.amount);\r\n _amount = result;\r\n } else {\r\n _amount = balance;\r\n }\r\n\r\n // Claim all but let play deposits of each player if they are same token\r\n if (\r\n address(rewardToken) == address(playDeposit.token) &&\r\n !isWhiteList\r\n ) {\r\n (, uint256 result) = _amount.trySub(\r\n playDeposit.amount * playerList.length\r\n );\r\n _amount = result;\r\n }\r\n }\r\n\r\n if (address(rewardToken) == address(createDeposit.token)) {\r\n (, uint256 result) = balance.trySub(_amount);\r\n require(\r\n result >= createDeposit.amount,\r\n \"ERROR: Should not exceed allowed bounty\"\r\n );\r\n }\r\n\r\n if (_amount > 0) {\r\n rewardToken.safeTransfer(_player, _amount);\r\n }\r\n\r\n claims.push(Models.Claim(_evidence, _player, _amount));\r\n\r\n emit QuestClaimed(_evidence, _player, _amount);\r\n }\r\n\r\n /*\r\n * Release create deposit to creator and send unused funds to fundsRecoveryAddress.\r\n * requires quests to have expired\r\n *\r\n * requires quest to be expired\r\n */\r\n function recoverFundsAndDeposit() external {\r\n require(block.timestamp >= expireTime, \"ERROR: Not expired\");\r\n\r\n // Restore deposit if not already released\r\n if (!isCreateDepositReleased) {\r\n createDeposit.releaseTo(questCreator);\r\n isCreateDepositReleased = true;\r\n }\r\n\r\n uint256 balance = rewardToken.balanceOf(address(this));\r\n\r\n // Restore all but let the player deposit still locked if they are same token\r\n if (address(rewardToken) == address(playDeposit.token) && !isWhiteList) {\r\n (, balance) = balance.trySub(\r\n playDeposit.amount * playerList.length\r\n );\r\n }\r\n\r\n rewardToken.safeTransfer(fundsRecoveryAddress, balance);\r\n }\r\n\r\n /**\r\n * Verify given executer can execute this quest.\r\n * @param executer The player to verify\r\n */\r\n function canExecute(\r\n address executer\r\n ) external view override returns (bool) {\r\n return findIndexOfPlayer(executer) != -1;\r\n }\r\n\r\n /**\r\n * Register a player to the quest. (sender could be the player or quest creator)\r\n *\r\n * @param _player Player address.\r\n *\r\n * requires sender to be the quest creator or the player\r\n * requires sender to put a deposit (if its creator, deposit will be released to player)\r\n * requires player list is not full\r\n * requires quest is not expired\r\n * requires player is not already registered\r\n *\r\n * emit QuestPlayed with player and timestamp\r\n */\r\n function play(address _player) external {\r\n require(\r\n isWhiteList == false,\r\n \"ERROR: Can't self register and play a whitelisted Quest\"\r\n );\r\n require(\r\n msg.sender == _player || msg.sender == questCreator,\r\n \"ERROR: Sender not player nor creator\"\r\n );\r\n require(\r\n maxPlayers == 0 || playerList.length < maxPlayers,\r\n \"ERROR: Max players reached\"\r\n );\r\n require(block.timestamp < expireTime, \"ERROR: Quest expired\");\r\n int256 playerIndex = findIndexOfPlayer(_player);\r\n require(playerIndex == -1, \"ERROR: Player already exists\");\r\n\r\n playDeposit.collectFrom(msg.sender, address(this));\r\n\r\n playerList.push(_player);\r\n emit QuestPlayed(_player, block.timestamp);\r\n }\r\n\r\n /***\r\n * Set the white list of players allowed to play the quest.\r\n *\r\n * requires sender to be the quest creator\r\n * @param _players The list of players allowed to play the quest.\r\n *\r\n * emit QuestWhiteListChanged with players and timestamp\r\n */\r\n function setWhiteList(address[] memory _players) external OnlyCreator {\r\n require(\r\n isWhiteList == true,\r\n \"ERROR: Can't set the white list to a non-whitelisted contract\"\r\n );\r\n\r\n bool playerInList = false;\r\n\r\n for (uint32 i = 0; i < _players.length; i++) {\r\n if (findIndexOfPlayer(_players[i]) != -1) {\r\n playerInList = true;\r\n }\r\n }\r\n\r\n require(\r\n playerInList == false,\r\n \"ERROR: One or more players is already in whitelist\"\r\n );\r\n\r\n playerList = _players;\r\n emit QuestWhiteListChanged(_players, block.timestamp);\r\n }\r\n\r\n /**\r\n * Unregister a player from the quest. (sender could be the player or quest creator)\r\n * @param _player Player address.\r\n *\r\n * requires sender to be the quest creator or the player\r\n * requires player is registered\r\n *\r\n * emit QuestUnplayed with player and timestamp\r\n */\r\n function unplay(address _player) external {\r\n require(\r\n isWhiteList == false,\r\n \"ERROR: can't unplay a whitelisted quest\"\r\n );\r\n require(\r\n msg.sender == _player || msg.sender == questCreator,\r\n \"ERROR: Sender not player nor creator\"\r\n );\r\n int256 playerIndex = findIndexOfPlayer(_player);\r\n require(playerIndex != -1, \"ERROR: player not in list\");\r\n\r\n // We put the last player in the place of the player to remove\r\n playerList[uint256(playerIndex)] = playerList[playerList.length - 1];\r\n // And then we can remove the last element to have the actual lenght updated\r\n playerList.pop();\r\n\r\n playDeposit.releaseTo(_player);\r\n emit QuestUnplayed(_player, block.timestamp);\r\n }\r\n\r\n /**\r\n Simply return the player list as the entire array\r\n */\r\n function getPlayers() external view returns (address[] memory) {\r\n return playerList;\r\n }\r\n\r\n // Private functions\r\n\r\n function findIndexOfPlayer(address _player) private view returns (int256) {\r\n for (uint256 i = 0; i < playerList.length; i++) {\r\n if (playerList[i] == _player) {\r\n return int256(i);\r\n }\r\n }\r\n return -1;\r\n }\r\n}\r\n" + }, + "contracts/QuestFactory.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\r\nimport \"./libraries/Deposit.sol\";\r\nimport \"./libraries/Models.sol\";\r\nimport \"./Quest.sol\";\r\n\r\ncontract QuestFactory is OwnableUpgradeable {\r\n using DepositLib for Models.Deposit;\r\n\r\n address public aragonGovernAddress;\r\n Models.Deposit public createDeposit;\r\n Models.Deposit public playDeposit;\r\n uint256 public constant version = 3;\r\n\r\n event QuestCreated(\r\n address questAddress,\r\n string questTitle,\r\n bytes questDetailsRef,\r\n address rewardTokenAddress,\r\n uint256 expireTime,\r\n address fundsRecoveryAddress,\r\n Models.Deposit createDeposit,\r\n Models.Deposit playDeposit,\r\n address creator,\r\n uint32 maxPlayers,\r\n bool isWhiteList,\r\n uint256 version\r\n );\r\n\r\n event CreateDepositChanged(\r\n uint256 timestamp,\r\n address token,\r\n uint256 amount\r\n );\r\n\r\n event PlayDepositChanged(uint256 timestamp, address token, uint256 amount);\r\n\r\n /// @custom:oz-upgrades-unsafe-allow constructor\r\n constructor() {\r\n _disableInitializers();\r\n }\r\n\r\n function initialize(address _aragonGovernAddress) public initializer {\r\n __Ownable_init();\r\n aragonGovernAddress = _aragonGovernAddress;\r\n }\r\n\r\n /*\r\n * @dev Set the deposit token and amount.\r\n * @param _depositToken The deposit token.\r\n * @param _depositAmount The deposit amount.\r\n * emit CreateDepositChanged\r\n */\r\n function setCreateDeposit(\r\n IERC20Upgradeable token,\r\n uint256 amount\r\n ) public onlyOwner {\r\n createDeposit = Models.Deposit(token, amount);\r\n emit CreateDepositChanged(block.timestamp, address(token), amount);\r\n }\r\n\r\n /*\r\n * @dev Set the play deposit token and amount.\r\n * @param _depositToken The deposit token.\r\n * @param _depositAmount The deposit amount.\r\n * emit PlayDepositChanged\r\n */\r\n function setPlayDeposit(\r\n IERC20Upgradeable token,\r\n uint256 amount\r\n ) public onlyOwner {\r\n playDeposit = Models.Deposit(token, amount);\r\n emit PlayDepositChanged(block.timestamp, address(token), amount);\r\n }\r\n\r\n /*\r\n * Collect deposit, deploy a new Quest with given info contract\r\n * and transfer deposit to new Quest.\r\n * @param _title Quest title.\r\n * @param _details Quest details.\r\n * @param _rewardTokenAddress Reward token address.\r\n * @param _expireTime Expire time.\r\n * @param _fundsRecoveryAddress Funds recovery address.\r\n * requires deposit allowance\r\n * returns Quest address.\r\n * emits QuestCreated\r\n */\r\n function createQuest(\r\n string memory _questTitle,\r\n bytes memory _questDetailsRef,\r\n IERC20Upgradeable _rewardToken,\r\n uint256 _expireTime,\r\n address payable _fundsRecoveryAddress,\r\n uint32 _maxPlayers,\r\n bool _isWhiteList\r\n ) external returns (address) {\r\n Quest quest = new Quest(\r\n _questTitle,\r\n _questDetailsRef,\r\n Models.Deposit(createDeposit.token, createDeposit.amount),\r\n Models.Deposit(playDeposit.token, playDeposit.amount),\r\n Models.QuestParam(\r\n msg.sender,\r\n _maxPlayers,\r\n _rewardToken,\r\n _expireTime,\r\n aragonGovernAddress,\r\n _fundsRecoveryAddress,\r\n _isWhiteList\r\n )\r\n );\r\n\r\n // Collect deposit from quest creator and send it to quest\r\n createDeposit.collectFrom(msg.sender, address(quest));\r\n\r\n emit QuestCreated(\r\n address(quest),\r\n _questTitle,\r\n _questDetailsRef,\r\n address(_rewardToken),\r\n _expireTime,\r\n _fundsRecoveryAddress,\r\n createDeposit,\r\n playDeposit,\r\n msg.sender,\r\n _maxPlayers,\r\n _isWhiteList,\r\n version\r\n );\r\n\r\n return address(quest);\r\n }\r\n\r\n /**\r\n * @dev Be able to change it after deploy so we can deploy\r\n * a new GovernQueue but keep the same QuestFactory\r\n * @param _aragonGovernAddress The aragonGovernAddress.\r\n */\r\n function setAragonGovernAddress(\r\n address _aragonGovernAddress\r\n ) external onlyOwner {\r\n aragonGovernAddress = _aragonGovernAddress;\r\n }\r\n}\r\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 20000 + }, + "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/packages/hardhat/deployments/goerli/solcInputs/95fb67f99076a1d067d3226060286d32.json b/packages/hardhat/deployments/goerli/solcInputs/95fb67f99076a1d067d3226060286d32.json new file mode 100644 index 00000000..fc6e133c --- /dev/null +++ b/packages/hardhat/deployments/goerli/solcInputs/95fb67f99076a1d067d3226060286d32.json @@ -0,0 +1,86 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized != type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20Upgradeable token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20PermitUpgradeable token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(address from, address to, uint256 amount) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(address owner, address spender, uint256 amount) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/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/math/SafeMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n return a - b;\n }\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a / b;\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n }\n}\n" + }, + "contracts/libraries/Deposit.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\n// Solidity: Package Default Dependencies Directory = \"node_modules\"\r\n\r\npragma solidity ^0.8.2;\nfunction c_9cc2e7a8(bytes8 c__9cc2e7a8) pure {}\nfunction c_true9cc2e7a8(bytes8 c__9cc2e7a8) pure returns (bool){ return true; }\nfunction c_false9cc2e7a8(bytes8 c__9cc2e7a8) pure returns (bool){ return false; }\n\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"./Models.sol\";\r\n\r\nlibrary DepositLib {\nfunction c_86fb8751(bytes8 c__86fb8751) internal pure {}\nfunction c_true86fb8751(bytes8 c__86fb8751) internal pure returns (bool){ return true; }\nfunction c_false86fb8751(bytes8 c__86fb8751) internal pure returns (bool){ return false; }\n\r\n using SafeERC20Upgradeable for IERC20Upgradeable;\r\n\r\n /*\r\n * Collect deposit from signer and send it to _to address.\r\n * @param _token The deposit token.\r\n * @param _amount The deposit amount.\r\n * @param _to The address where the deposit should be transfered.\r\n */\r\n function collectFrom(\r\n Models.Deposit memory _collateral,\r\n address _from,\r\n address _to\r\n ) internal {c_86fb8751(0xeba890abd5c6a759); /* function */ \n\r\nc_86fb8751(0xb04facfefe209ca9); /* line */ \n c_86fb8751(0x9fd82d3b198ff42e); /* statement */ \ncollectFrom(_collateral, _from);\r\nc_86fb8751(0x28c2e03e97b66c5d); /* line */ \n c_86fb8751(0xa102dcd4441caad7); /* statement */ \nreleaseTo(_collateral, _to);\r\n }\r\n\r\n /*\r\n * Collect deposit from signer\r\n * @param _token The deposit token.\r\n * @param _amount The deposit amount.\r\n */\r\n function collectFrom(Models.Deposit memory _collateral, address _from)\r\n internal\r\n {c_86fb8751(0x2e54ea59257511eb); /* function */ \n\r\nc_86fb8751(0x4e8e40e3fe690b99); /* line */ \n c_86fb8751(0x374794e13b4eef95); /* statement */ \nif (_collateral.amount > 0) {c_86fb8751(0xfd0e615dde5b41a4); /* branch */ \n\r\n // Verify allowance\r\nc_86fb8751(0xdb66974502781d8f); /* line */ \n c_86fb8751(0x080d93e154980c1b); /* statement */ \nuint256 allowance = _collateral.token.allowance(\r\n _from,\r\n address(this)\r\n );\r\nc_86fb8751(0x7dda1ed0663e65f4); /* line */ \n c_86fb8751(0x4a61ff67c4f4e6eb); /* requirePre */ \nc_86fb8751(0x5a19dc5b13ed4fff); /* statement */ \nrequire(\r\n allowance >= _collateral.amount,\r\n \"ERROR : Deposit bad allowance\"\r\n );c_86fb8751(0x90b84030d937b50e); /* requirePost */ \n\r\n\r\nc_86fb8751(0x4fc2048aa3c7cf70); /* line */ \n c_86fb8751(0x52cc92bf23aa099a); /* statement */ \n_collateral.token.safeTransferFrom(\r\n _from,\r\n address(this),\r\n _collateral.amount\r\n );\r\n }else { c_86fb8751(0xeab61c20b6146987); /* branch */ \n}\r\n }\r\n\r\n function releaseTo(Models.Deposit memory _collateral, address _to)\r\n internal\r\n {c_86fb8751(0x0c0ebada067a59b5); /* function */ \n\r\nc_86fb8751(0x51979652a99cd56a); /* line */ \n c_86fb8751(0xe795a2e8985d3628); /* statement */ \nif (_collateral.amount > 0) {c_86fb8751(0x32f390c8aa674226); /* branch */ \n\r\nc_86fb8751(0x434f21563c81b9cb); /* line */ \n c_86fb8751(0xbcd3ed1b2dea21fb); /* statement */ \n_collateral.token.safeTransfer(_to, _collateral.amount);\r\n }else { c_86fb8751(0x0a1e82b479f54f47); /* branch */ \n}\r\n }\r\n}\r\n" + }, + "contracts/libraries/IExecutable.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\nfunction c_f10db837(bytes8 c__f10db837) pure {}\nfunction c_truef10db837(bytes8 c__f10db837) pure returns (bool){ return true; }\nfunction c_falsef10db837(bytes8 c__f10db837) pure returns (bool){ return false; }\n\r\n\r\ninterface IExecutable {\r\n function canExecute(address executer) external returns (bool);\r\n}\r\n" + }, + "contracts/libraries/Models.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\nfunction c_b7e3ad2e(bytes8 c__b7e3ad2e) pure {}\nfunction c_trueb7e3ad2e(bytes8 c__b7e3ad2e) pure returns (bool){ return true; }\nfunction c_falseb7e3ad2e(bytes8 c__b7e3ad2e) pure returns (bool){ return false; }\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\n\r\nlibrary Models {\nfunction c_a9dfceef(bytes8 c__a9dfceef) internal pure {}\nfunction c_truea9dfceef(bytes8 c__a9dfceef) internal pure returns (bool){ return true; }\nfunction c_falsea9dfceef(bytes8 c__a9dfceef) internal pure returns (bool){ return false; }\n\r\n struct Deposit {\r\n IERC20Upgradeable token;\r\n uint256 amount;\r\n }\r\n struct Claim {\r\n bytes evidence;\r\n address player;\r\n uint256 amount;\r\n }\r\n struct QuestParam {\r\n address questCreator;\r\n uint32 maxPlayers;\r\n IERC20Upgradeable rewardToken;\r\n uint256 expireTime;\r\n address aragonGovernAddress;\r\n address payable fundsRecoveryAddress;\r\n bool isWhiteList;\r\n }\r\n}\r\n" + }, + "contracts/mocks/TokenMock.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.0;\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\r\n\r\n// Example class - a mock class using delivering from ERC20\r\ncontract TokenMock is ERC20 {\r\n constructor(string memory name, string memory symbol)\r\n payable\r\n ERC20(name, symbol)\r\n {}\r\n\r\n function mint(address owner, uint256 initialBalance) external {\r\n _mint(owner, initialBalance);\r\n }\r\n}\r\n" + }, + "contracts/Quest.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\nfunction c_16df0459(bytes8 c__16df0459) pure {}\nfunction c_true16df0459(bytes8 c__16df0459) pure returns (bool){ return true; }\nfunction c_false16df0459(bytes8 c__16df0459) pure returns (bool){ return false; }\n\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\";\r\nimport \"./libraries/Deposit.sol\";\r\nimport \"./libraries/Models.sol\";\r\nimport \"./libraries/IExecutable.sol\";\r\n\r\ncontract Quest is IExecutable {\nfunction c_28c23fc5(bytes8 c__28c23fc5) internal pure {}\nfunction c_true28c23fc5(bytes8 c__28c23fc5) internal pure returns (bool){ return true; }\nfunction c_false28c23fc5(bytes8 c__28c23fc5) internal pure returns (bool){ return false; }\nmodifier c_mode76ec6a3{ c_28c23fc5(0x8c65dde638976eaf); /* modifier-post */ \n _; }\nmodifier c_modea7514a5{ c_28c23fc5(0xa93087ecaf33eca2); /* modifier-pre */ \n _; }\n\r\n using SafeMath for uint256;\r\n using SafeERC20Upgradeable for IERC20Upgradeable;\r\n using DepositLib for Models.Deposit;\r\n\r\n // Quest payload\r\n address public questCreator;\r\n string public questTitle;\r\n bytes public questDetailsRef;\r\n IERC20Upgradeable public rewardToken;\r\n uint256 public expireTime;\r\n address public aragonGovernAddress;\r\n address payable public fundsRecoveryAddress;\r\n uint32 public maxPlayers; // 0 for unlimited players\r\n bool public isWhiteList;\r\n Models.Claim[] public claims;\r\n Models.Deposit public createDeposit;\r\n Models.Deposit public playDeposit;\r\n bool public isCreateDepositReleased;\r\n\r\n address[] private playerList;\r\n\r\n event QuestClaimed(bytes evidence, address player, uint256 amount);\r\n event QuestPlayed(address player, uint256 timestamp);\r\n event QuestUnplayed(address player, uint256 timestamp);\r\n event QuestWhiteListChanged(address[] whiteListPlayers, uint256 timestamp);\r\n modifier OnlyCreator() {c_28c23fc5(0x6b1d65e9e23a3b08); /* function */ \n\r\nc_28c23fc5(0x7ca364bfeb14a8e4); /* line */ \n c_28c23fc5(0xafefb6249adc44f3); /* requirePre */ \nc_28c23fc5(0x2cb158ab646063f7); /* statement */ \nrequire(\r\n msg.sender == questCreator,\r\n \"Only creator can call this function\"\r\n );c_28c23fc5(0xd2a9945ec04b6cfb); /* requirePost */ \n\r\nc_28c23fc5(0x3427505522bb139d); /* line */ \n _;\r\n }\r\n\r\n constructor(\r\n string memory _questTitle,\r\n bytes memory _questDetailsRef,\r\n Models.Deposit memory _createDeposit,\r\n Models.Deposit memory _playDeposit,\r\n Models.QuestParam memory _questParam\r\n ) {c_28c23fc5(0x201f57e7739507dc); /* function */ \n\r\nc_28c23fc5(0x605bc5c59115c3c8); /* line */ \n c_28c23fc5(0x3bc9686f22e00565); /* requirePre */ \nc_28c23fc5(0x257e7503e984bb0a); /* statement */ \nrequire(\r\n !(_questParam.isWhiteList && _questParam.maxPlayers > 0),\r\n \"ERROR: Can't create a whiteListed quest with max players greater than 0 (infinity)\"\r\n );c_28c23fc5(0xfcb65ef0df269e55); /* requirePost */ \n\r\nc_28c23fc5(0xb442a7e02b870baa); /* line */ \n questTitle = _questTitle;\r\nc_28c23fc5(0x21462740e67d3598); /* line */ \n questDetailsRef = _questDetailsRef;\r\nc_28c23fc5(0xe8912bdb315dfb61); /* line */ \n rewardToken = _questParam.rewardToken;\r\nc_28c23fc5(0xa7b5220eef006e07); /* line */ \n expireTime = _questParam.expireTime;\r\nc_28c23fc5(0x7c239f3b69a5f8ff); /* line */ \n aragonGovernAddress = _questParam.aragonGovernAddress;\r\nc_28c23fc5(0x69ee8ffa5327919f); /* line */ \n fundsRecoveryAddress = _questParam.fundsRecoveryAddress;\r\nc_28c23fc5(0x929a3003443ca31f); /* line */ \n questCreator = _questParam.questCreator;\r\nc_28c23fc5(0x2e514711a332c80b); /* line */ \n createDeposit = _createDeposit;\r\nc_28c23fc5(0xb26df9290b66dfc3); /* line */ \n playDeposit = _playDeposit;\r\n\r\nc_28c23fc5(0x197ba710974c32e5); /* line */ \n isCreateDepositReleased = false;\r\nc_28c23fc5(0xb744e394bd41e2ab); /* line */ \n maxPlayers = _questParam.maxPlayers;\r\nc_28c23fc5(0xa6a29ec8b26b5673); /* line */ \n isWhiteList = _questParam.isWhiteList;\r\n }\r\n\r\n /*\r\n * Claim a quest reward.\r\n *\r\n * @param _evidence Evidence of the claim.\r\n * @param _player Player address.\r\n * @param _amount Amount of the reward.\r\n *\r\n * requires sender to be aragonGovernAddress\r\n * requires evidence to not be empty\r\n * requires claim amount to not exceed available deposit when same token\r\n *\r\n * emit QuestClaimed\r\n */\r\n function claim(\r\n bytes memory _evidence,\r\n address _player,\r\n uint256 _amount,\r\n bool _claimAll\r\n ) external {c_28c23fc5(0x9f8e462f82fd6bf0); /* function */ \n\r\nc_28c23fc5(0xf6ecb2b671bd1efe); /* line */ \n c_28c23fc5(0x9588db56ab918bba); /* requirePre */ \nc_28c23fc5(0x0620ecc1e9d32a90); /* statement */ \nrequire(msg.sender == aragonGovernAddress, \"ERROR: Sender not govern\");c_28c23fc5(0xcdda0a4feb60c6f3); /* requirePost */ \n\r\nc_28c23fc5(0x1da179ab82c8ba26); /* line */ \n c_28c23fc5(0x5637603bbcfb8145); /* requirePre */ \nc_28c23fc5(0xe6e4479a6d99dc49); /* statement */ \nrequire(_evidence.length != 0, \"ERROR: No evidence\");c_28c23fc5(0x84e2da4d8de94605); /* requirePost */ \n\r\n\r\nc_28c23fc5(0xe313d5dbed0597b4); /* line */ \n c_28c23fc5(0x06f1b57692317621); /* statement */ \nuint256 balance = rewardToken.balanceOf(address(this));\r\n\r\nc_28c23fc5(0x6e695fbaaa697bd7); /* line */ \n c_28c23fc5(0x90f51837984cf8b9); /* statement */ \nif (_claimAll) {c_28c23fc5(0x6ef330ba4f59d473); /* branch */ \n\r\n // Claim all but let the create deposit if they are same token\r\nc_28c23fc5(0x0a012faffaff72dc); /* line */ \n c_28c23fc5(0x728066e634af75dd); /* statement */ \nif (address(rewardToken) == address(createDeposit.token)) {c_28c23fc5(0x3ab2f862350730f0); /* branch */ \n\r\nc_28c23fc5(0x15b00d4aa53d509e); /* line */ \n c_28c23fc5(0x22b46e930f32ab45); /* statement */ \n(, uint256 result) = balance.trySub(createDeposit.amount);\r\nc_28c23fc5(0xa6b10536649fd966); /* line */ \n _amount = result;\r\n } else {c_28c23fc5(0x3cb13ebb8b3de3e7); /* branch */ \n\r\nc_28c23fc5(0xfdd6371a77b5adf4); /* line */ \n _amount = balance;\r\n }\r\n\r\n // Claim all but let play deposits of each player if they are same token\r\nc_28c23fc5(0x6dbceaa93a8c8739); /* line */ \n c_28c23fc5(0xf76090ffd46db8f3); /* statement */ \nif (\r\n address(rewardToken) == address(playDeposit.token) &&\r\n !isWhiteList\r\n ) {c_28c23fc5(0xd4152bf5e1329c9a); /* branch */ \n\r\nc_28c23fc5(0xe8eba4cc47bbb555); /* line */ \n c_28c23fc5(0x50586c2ec75d39fb); /* statement */ \n(, uint256 result) = _amount.trySub(\r\n playDeposit.amount * playerList.length\r\n );\r\nc_28c23fc5(0xfa8c9a0ca7ca8ac2); /* line */ \n _amount = result;\r\n }else { c_28c23fc5(0x888ff90e9c79c861); /* branch */ \n}\r\n }else { c_28c23fc5(0x5aa7a3f3feaeadd3); /* branch */ \n}\r\n\r\nc_28c23fc5(0x9cf430f60bab3f1a); /* line */ \n c_28c23fc5(0x99a6589436abea89); /* statement */ \nif (address(rewardToken) == address(createDeposit.token)) {c_28c23fc5(0x54b4ab17973d3222); /* branch */ \n\r\nc_28c23fc5(0xbb372447a92d737e); /* line */ \n c_28c23fc5(0x22453c249b596ba3); /* statement */ \n(, uint256 result) = balance.trySub(_amount);\r\nc_28c23fc5(0x284ccd79b24eaf7b); /* line */ \n c_28c23fc5(0x4ef0a128517675ba); /* requirePre */ \nc_28c23fc5(0x13ce5940a025e8d1); /* statement */ \nrequire(\r\n result >= createDeposit.amount,\r\n \"ERROR: Should not exceed allowed bounty\"\r\n );c_28c23fc5(0xea4fac06254b8a1e); /* requirePost */ \n\r\n }else { c_28c23fc5(0x206332479c6c1e73); /* branch */ \n}\r\n\r\nc_28c23fc5(0x4b1e9e5c8f6cd15f); /* line */ \n c_28c23fc5(0xad1de8c827a7837f); /* statement */ \nif (_amount > 0) {c_28c23fc5(0xac248d58f87fe5f0); /* branch */ \n\r\nc_28c23fc5(0x6a6e169c03b28733); /* line */ \n c_28c23fc5(0x2be9a176d42bc00d); /* statement */ \nrewardToken.safeTransfer(_player, _amount);\r\n }else { c_28c23fc5(0xad4b254d8b8f9cdc); /* branch */ \n}\r\n\r\nc_28c23fc5(0x511e913024485636); /* line */ \n c_28c23fc5(0x85ecf86c8d7035d0); /* statement */ \nclaims.push(Models.Claim(_evidence, _player, _amount));\r\n\r\nc_28c23fc5(0x8814d876ff183ed9); /* line */ \n c_28c23fc5(0x23c7f0e23d910870); /* statement */ \nemit QuestClaimed(_evidence, _player, _amount);\r\n }\r\n\r\n /*\r\n * Release create deposit to creator and send unused funds to fundsRecoveryAddress.\r\n * requires quests to have expired\r\n *\r\n * requires quest to be expired\r\n */\r\n function recoverFundsAndDeposit() external {c_28c23fc5(0x49ee317a00bfd3ae); /* function */ \n\r\nc_28c23fc5(0x1e5f42ffbf0057dc); /* line */ \n c_28c23fc5(0xe0101bb9a08ce9c6); /* requirePre */ \nc_28c23fc5(0xced2c7ab168a85de); /* statement */ \nrequire(block.timestamp >= expireTime, \"ERROR: Not expired\");c_28c23fc5(0x16e2349da65aed19); /* requirePost */ \n\r\n\r\n // Restore deposit if not already released\r\nc_28c23fc5(0xe873bf55a422f100); /* line */ \n c_28c23fc5(0xc67bb315447bbce0); /* statement */ \nif (!isCreateDepositReleased) {c_28c23fc5(0x4192327b8bcf1e81); /* branch */ \n\r\nc_28c23fc5(0x78e9ae643c139ad7); /* line */ \n c_28c23fc5(0x9b585cfe66dff3ac); /* statement */ \ncreateDeposit.releaseTo(questCreator);\r\nc_28c23fc5(0x5868bcc870def648); /* line */ \n isCreateDepositReleased = true;\r\n }else { c_28c23fc5(0x8fe05a4f2812a431); /* branch */ \n}\r\n\r\nc_28c23fc5(0x242fd74ceb27e63f); /* line */ \n c_28c23fc5(0x26b2d608d44c887a); /* statement */ \nuint256 balance = rewardToken.balanceOf(address(this));\r\n\r\n // Restore all but let the player deposit still locked if they are same token\r\nc_28c23fc5(0x7938f75bc1c00291); /* line */ \n c_28c23fc5(0x38f79bf577616b7a); /* statement */ \nif (address(rewardToken) == address(playDeposit.token) && !isWhiteList) {c_28c23fc5(0x833d3d7320f0701d); /* branch */ \n\r\nc_28c23fc5(0x2547b108dfb5682a); /* line */ \n (, balance) = balance.trySub(\r\n playDeposit.amount * playerList.length\r\n );\r\n }else { c_28c23fc5(0x03659150f0865c75); /* branch */ \n}\r\n\r\nc_28c23fc5(0x96b5699448e959e0); /* line */ \n c_28c23fc5(0xd6536ad812e0c4e7); /* statement */ \nrewardToken.safeTransfer(fundsRecoveryAddress, balance);\r\n }\r\n\r\n /**\r\n * Verify given executer can execute this quest.\r\n * @param executer The player to verify\r\n */\r\n function canExecute(\r\n address executer\r\n ) external view override returns (bool) {c_28c23fc5(0xb3965c9a4fb2fae1); /* function */ \n\r\nc_28c23fc5(0x87d26b6b15e008cb); /* line */ \n c_28c23fc5(0x02e06a24254cdc68); /* statement */ \nreturn findIndexOfPlayer(executer) != -1;\r\n }\r\n\r\n /**\r\n * Register a player to the quest. (sender could be the player or quest creator)\r\n *\r\n * @param _player Player address.\r\n *\r\n * requires sender to be the quest creator or the player\r\n * requires sender to put a deposit (if its creator, deposit will be released to player)\r\n * requires player list is not full\r\n * requires quest is not expired\r\n * requires player is not already registered\r\n *\r\n * emit QuestPlayed with player and timestamp\r\n */\r\n function play(address _player) external {c_28c23fc5(0xbdd8913a081625f8); /* function */ \n\r\nc_28c23fc5(0xca820ce9be9d1c1a); /* line */ \n c_28c23fc5(0x20412470be5617f1); /* requirePre */ \nc_28c23fc5(0xaf9ff70a195c9066); /* statement */ \nrequire(\r\n isWhiteList == false,\r\n \"ERROR: Can't self register and play a whitelisted Quest\"\r\n );c_28c23fc5(0xa33f16a47597eeb4); /* requirePost */ \n\r\nc_28c23fc5(0xf1ad32bfd8362e3f); /* line */ \n c_28c23fc5(0x9f744bcdd4ca559f); /* requirePre */ \nc_28c23fc5(0x4328584f75b21155); /* statement */ \nrequire(\r\n (msg.sender == _player && c_true28c23fc5(0xa3c63b90fd69ac72)) || (msg.sender == questCreator && c_true28c23fc5(0xdb414657d0100b1e)),\r\n \"ERROR: Sender not player nor creator\"\r\n );c_28c23fc5(0xe9bef6653e501c70); /* requirePost */ \n\r\nc_28c23fc5(0xc289ccc3dab4f402); /* line */ \n c_28c23fc5(0xd57895a4422d2f5a); /* requirePre */ \nc_28c23fc5(0x03c884caede3dd89); /* statement */ \nrequire(\r\n (maxPlayers == 0 && c_true28c23fc5(0x62ed42ce61d240be)) || (playerList.length < maxPlayers && c_true28c23fc5(0x7140c0c8d19bd94c)),\r\n \"ERROR: Max players reached\"\r\n );c_28c23fc5(0xa6a66235cefcbd0e); /* requirePost */ \n\r\nc_28c23fc5(0xf94c071a0fcac21e); /* line */ \n c_28c23fc5(0x6e447be0494f14fe); /* requirePre */ \nc_28c23fc5(0xd517f4d84787ab1a); /* statement */ \nrequire(block.timestamp < expireTime, \"ERROR: Quest expired\");c_28c23fc5(0x563be2a60d97c327); /* requirePost */ \n\r\nc_28c23fc5(0x318577897d4e252d); /* line */ \n c_28c23fc5(0xe8dee74784c1f5b7); /* statement */ \nint256 playerIndex = findIndexOfPlayer(_player);\r\nc_28c23fc5(0xe6b9964cb272c922); /* line */ \n c_28c23fc5(0x9d2c316ff5f3a9b9); /* requirePre */ \nc_28c23fc5(0xc83e06932aa2ccdb); /* statement */ \nrequire(playerIndex == -1, \"ERROR: Player already exists\");c_28c23fc5(0x4d3d961f8aec5784); /* requirePost */ \n\r\n\r\nc_28c23fc5(0x63da1ef308d7bbef); /* line */ \n c_28c23fc5(0x0800b5a00353d8f0); /* statement */ \nplayDeposit.collectFrom(msg.sender, address(this));\r\n\r\nc_28c23fc5(0x409fb108bd7ff3fe); /* line */ \n c_28c23fc5(0xb0c51f8fdf205e84); /* statement */ \nplayerList.push(_player);\r\nc_28c23fc5(0x1f9160fda101764f); /* line */ \n c_28c23fc5(0xe4382a9823c40ac2); /* statement */ \nemit QuestPlayed(_player, block.timestamp);\r\n }\r\n\r\n /***\r\n * Set the white list of players allowed to play the quest.\r\n *\r\n * requires sender to be the quest creator\r\n * @param _players The list of players allowed to play the quest.\r\n *\r\n * emit QuestWhiteListChanged with players and timestamp\r\n */\r\n function setWhiteList(address[] memory _players) external c_modea7514a5 OnlyCreator c_mode76ec6a3 {c_28c23fc5(0x35581ede4eba5c14); /* function */ \n\r\nc_28c23fc5(0xe6fd9d84698aeb73); /* line */ \n c_28c23fc5(0xffdbb62b7795341c); /* requirePre */ \nc_28c23fc5(0x8411e44fd8b88ca3); /* statement */ \nrequire(\r\n isWhiteList == true,\r\n \"ERROR: Can't set the white list to a non-whitelisted contract\"\r\n );c_28c23fc5(0x1accdf3ebde97917); /* requirePost */ \n\r\n\r\nc_28c23fc5(0x8c3a03c67001fdd3); /* line */ \n c_28c23fc5(0x3d28b8b5edd6235e); /* statement */ \nbool playerInList = false;\r\n\r\nc_28c23fc5(0xc374ff4a280dbf35); /* line */ \n c_28c23fc5(0xefff330a40df0bf2); /* statement */ \nfor (uint32 i = 0; i < _players.length; i++) {\r\nc_28c23fc5(0xd0203a72a7608457); /* line */ \n c_28c23fc5(0xda9eb66dc3d82b0b); /* statement */ \nif (findIndexOfPlayer(_players[i]) != -1) {c_28c23fc5(0x9359447a6c9eaa38); /* branch */ \n\r\nc_28c23fc5(0x6ed5d26b8cdf11c3); /* line */ \n playerInList = true;\r\n }else { c_28c23fc5(0x32d5bee520552a85); /* branch */ \n}\r\n }\r\n\r\nc_28c23fc5(0xa0f9e2c19ced7424); /* line */ \n c_28c23fc5(0x5ec4fd4020272a7f); /* requirePre */ \nc_28c23fc5(0x96589a48cfdfc9ee); /* statement */ \nrequire(\r\n playerInList == false,\r\n \"ERROR: One or more players is already in whitelist\"\r\n );c_28c23fc5(0x2a4f6cf2038ebf9b); /* requirePost */ \n\r\n\r\nc_28c23fc5(0x96cc6a408a9940d3); /* line */ \n playerList = _players;\r\nc_28c23fc5(0xd4e1a3635fdbc856); /* line */ \n c_28c23fc5(0xb5a2c344d7c31f94); /* statement */ \nemit QuestWhiteListChanged(_players, block.timestamp);\r\n }\r\n\r\n /**\r\n * Unregister a player from the quest. (sender could be the player or quest creator)\r\n * @param _player Player address.\r\n *\r\n * requires sender to be the quest creator or the player\r\n * requires player is registered\r\n *\r\n * emit QuestUnplayed with player and timestamp\r\n */\r\n function unplay(address _player) external {c_28c23fc5(0x32efddbbd1f87bb5); /* function */ \n\r\nc_28c23fc5(0xd9c931de784e200c); /* line */ \n c_28c23fc5(0x4d6d5bd7811ccda1); /* requirePre */ \nc_28c23fc5(0x49e5a4c773555eab); /* statement */ \nrequire(\r\n isWhiteList == false,\r\n \"ERROR: can't unplay a whitelisted quest\"\r\n );c_28c23fc5(0xebbfef2a04fe78a3); /* requirePost */ \n\r\nc_28c23fc5(0xbe90eb0ac3298e7c); /* line */ \n c_28c23fc5(0x71f725ce80907b35); /* requirePre */ \nc_28c23fc5(0x7cb135e2d9386f05); /* statement */ \nrequire(\r\n (msg.sender == _player && c_true28c23fc5(0x48f2625fb17a6428)) || (msg.sender == questCreator && c_true28c23fc5(0xfc77a832c8602883)),\r\n \"ERROR: Sender not player nor creator\"\r\n );c_28c23fc5(0x9a5d0901e9258638); /* requirePost */ \n\r\nc_28c23fc5(0x20c5db7312fea82c); /* line */ \n c_28c23fc5(0xa8c6c695dc9ddad4); /* statement */ \nint256 playerIndex = findIndexOfPlayer(_player);\r\nc_28c23fc5(0xe4e40d0375be2837); /* line */ \n c_28c23fc5(0x429f355e31530f7f); /* requirePre */ \nc_28c23fc5(0xbe76644ceca6017c); /* statement */ \nrequire(playerIndex != -1, \"ERROR: player not in list\");c_28c23fc5(0xc60fd9636a7ef873); /* requirePost */ \n\r\n\r\n // We put the last player in the place of the player to remove\r\nc_28c23fc5(0x44a6a408a2be2998); /* line */ \n playerList[uint256(playerIndex)] = playerList[playerList.length - 1];\r\n // And then we can remove the last element to have the actual lenght updated\r\nc_28c23fc5(0xc9bfe374997edbae); /* line */ \n c_28c23fc5(0x6f7fc1215b156a51); /* statement */ \nplayerList.pop();\r\n\r\nc_28c23fc5(0xb44331a05f3b0b4e); /* line */ \n c_28c23fc5(0xd00e531781d8ad3f); /* statement */ \nplayDeposit.releaseTo(_player);\r\nc_28c23fc5(0x552817a91899ecf0); /* line */ \n c_28c23fc5(0x94770ed3857a2c3f); /* statement */ \nemit QuestUnplayed(_player, block.timestamp);\r\n }\r\n\r\n /**\r\n Simply return the player list as the entire array\r\n */\r\n function getPlayers() external view returns (address[] memory) {c_28c23fc5(0x3ea543d729fcaabe); /* function */ \n\r\nc_28c23fc5(0xedcb6c1726fc943b); /* line */ \n c_28c23fc5(0x86417e35d96aec82); /* statement */ \nreturn playerList;\r\n }\r\n\r\n // Private functions\r\n\r\n function findIndexOfPlayer(address _player) private view returns (int256) {c_28c23fc5(0x5f2983638d9fc6d5); /* function */ \n\r\nc_28c23fc5(0x55f8452fb4531fe9); /* line */ \n c_28c23fc5(0xb84d1092f4520419); /* statement */ \nfor (uint256 i = 0; i < playerList.length; i++) {\r\nc_28c23fc5(0xca719689d18bf056); /* line */ \n c_28c23fc5(0x659f8e998dc9c1de); /* statement */ \nif (playerList[i] == _player) {c_28c23fc5(0xa05ea05bd5822e16); /* branch */ \n\r\nc_28c23fc5(0x51108c97d793da70); /* line */ \n c_28c23fc5(0x1bb7c9a3a27e26fe); /* statement */ \nreturn int256(i);\r\n }else { c_28c23fc5(0x2bd813f0c0b24269); /* branch */ \n}\r\n }\r\nc_28c23fc5(0x5a3af027ee4d61e9); /* line */ \n c_28c23fc5(0x64bcd8e112a86bf0); /* statement */ \nreturn -1;\r\n }\r\n}\r\n" + }, + "contracts/QuestFactory.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\nfunction c_e3a31c36(bytes8 c__e3a31c36) pure {}\nfunction c_truee3a31c36(bytes8 c__e3a31c36) pure returns (bool){ return true; }\nfunction c_falsee3a31c36(bytes8 c__e3a31c36) pure returns (bool){ return false; }\n\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\r\nimport \"./libraries/Deposit.sol\";\r\nimport \"./libraries/Models.sol\";\r\nimport \"./Quest.sol\";\r\n\r\ncontract QuestFactory is OwnableUpgradeable {\nfunction c_e9fd5542(bytes8 c__e9fd5542) internal pure {}\nfunction c_truee9fd5542(bytes8 c__e9fd5542) internal pure returns (bool){ return true; }\nfunction c_falsee9fd5542(bytes8 c__e9fd5542) internal pure returns (bool){ return false; }\nmodifier c_mod0fa3af38{ c_e9fd5542(0x475cc8a2e7603358); /* modifier-post */ \n _; }\nmodifier c_moddbfdc9ea{ c_e9fd5542(0x4575e17f48255aa2); /* modifier-pre */ \n _; }\nmodifier c_modf6e58f55{ c_e9fd5542(0xde96ed4adae896a1); /* modifier-post */ \n _; }\nmodifier c_mode207a5ba{ c_e9fd5542(0xdbe8c5008ec69876); /* modifier-pre */ \n _; }\nmodifier c_mod15ababcd{ c_e9fd5542(0x9c21a3e69c60caef); /* modifier-post */ \n _; }\nmodifier c_mod0f4a45f4{ c_e9fd5542(0x2a1fdc3dd75731c2); /* modifier-pre */ \n _; }\nmodifier c_moda9254c49{ c_e9fd5542(0x0ed4afce8f7d26f6); /* modifier-post */ \n _; }\nmodifier c_mod58268d1f{ c_e9fd5542(0x928a2ce7112aa1eb); /* modifier-pre */ \n _; }\n\r\n using DepositLib for Models.Deposit;\r\n\r\n address public aragonGovernAddress;\r\n Models.Deposit public createDeposit;\r\n Models.Deposit public playDeposit;\r\n uint256 public constant version = 3;\r\n\r\n event QuestCreated(\r\n address questAddress,\r\n string questTitle,\r\n bytes questDetailsRef,\r\n address rewardTokenAddress,\r\n uint256 expireTime,\r\n address fundsRecoveryAddress,\r\n Models.Deposit createDeposit,\r\n Models.Deposit playDeposit,\r\n address creator,\r\n uint32 maxPlayers,\r\n bool isWhiteList,\r\n uint256 version\r\n );\r\n\r\n event CreateDepositChanged(\r\n uint256 timestamp,\r\n address token,\r\n uint256 amount\r\n );\r\n\r\n event PlayDepositChanged(uint256 timestamp, address token, uint256 amount);\r\n\r\n /// @custom:oz-upgrades-unsafe-allow constructor\r\n constructor() {c_e9fd5542(0xc41321543fca567f); /* function */ \n\r\nc_e9fd5542(0xae4593923c8dff5b); /* line */ \n c_e9fd5542(0x4f8063a3e5971acd); /* statement */ \n_disableInitializers();\r\n }\r\n\r\n function initialize(address _aragonGovernAddress) public c_mod58268d1f initializer c_moda9254c49 {c_e9fd5542(0x028dcf568bedd010); /* function */ \n\r\nc_e9fd5542(0xcbf0976884739d05); /* line */ \n c_e9fd5542(0x36c5c42fee8a09a5); /* statement */ \n__Ownable_init();\r\nc_e9fd5542(0xd3636fe4d8887b36); /* line */ \n aragonGovernAddress = _aragonGovernAddress;\r\n }\r\n\r\n /*\r\n * @dev Set the deposit token and amount.\r\n * @param _depositToken The deposit token.\r\n * @param _depositAmount The deposit amount.\r\n * emit CreateDepositChanged\r\n */\r\n function setCreateDeposit(\r\n IERC20Upgradeable token,\r\n uint256 amount\r\n ) public c_mod0f4a45f4 onlyOwner c_mod15ababcd {c_e9fd5542(0xe4fd2fe5aed7eb85); /* function */ \n\r\nc_e9fd5542(0xe61bb216294da3e4); /* line */ \n createDeposit = Models.Deposit(token, amount);\r\nc_e9fd5542(0x784fbecdae736a66); /* line */ \n c_e9fd5542(0x3c4f82d0637c303b); /* statement */ \nemit CreateDepositChanged(block.timestamp, address(token), amount);\r\n }\r\n\r\n /*\r\n * @dev Set the play deposit token and amount.\r\n * @param _depositToken The deposit token.\r\n * @param _depositAmount The deposit amount.\r\n * emit PlayDepositChanged\r\n */\r\n function setPlayDeposit(\r\n IERC20Upgradeable token,\r\n uint256 amount\r\n ) public c_mode207a5ba onlyOwner c_modf6e58f55 {c_e9fd5542(0x154a2d89523cea73); /* function */ \n\r\nc_e9fd5542(0xa65d9775d82b3aee); /* line */ \n playDeposit = Models.Deposit(token, amount);\r\nc_e9fd5542(0x0ce16bb9af0cbe37); /* line */ \n c_e9fd5542(0x061c272b4a82d9e2); /* statement */ \nemit PlayDepositChanged(block.timestamp, address(token), amount);\r\n }\r\n\r\n /*\r\n * Collect deposit, deploy a new Quest with given info contract\r\n * and transfer deposit to new Quest.\r\n * @param _title Quest title.\r\n * @param _details Quest details.\r\n * @param _rewardTokenAddress Reward token address.\r\n * @param _expireTime Expire time.\r\n * @param _fundsRecoveryAddress Funds recovery address.\r\n * requires deposit allowance\r\n * returns Quest address.\r\n * emits QuestCreated\r\n */\r\n function createQuest(\r\n string memory _questTitle,\r\n bytes memory _questDetailsRef,\r\n IERC20Upgradeable _rewardToken,\r\n uint256 _expireTime,\r\n address payable _fundsRecoveryAddress,\r\n uint32 _maxPlayers,\r\n bool _isWhiteList\r\n ) external returns (address) {c_e9fd5542(0xcdbb18a4e6124712); /* function */ \n\r\nc_e9fd5542(0xd031221065f5e8fd); /* line */ \n c_e9fd5542(0x8b32665e7f31fb8d); /* statement */ \nQuest quest = new Quest(\r\n _questTitle,\r\n _questDetailsRef,\r\n Models.Deposit(createDeposit.token, createDeposit.amount),\r\n Models.Deposit(playDeposit.token, playDeposit.amount),\r\n Models.QuestParam(\r\n msg.sender,\r\n _maxPlayers,\r\n _rewardToken,\r\n _expireTime,\r\n aragonGovernAddress,\r\n _fundsRecoveryAddress,\r\n _isWhiteList\r\n )\r\n );\r\n\r\n // Collect deposit from quest creator and send it to quest\r\nc_e9fd5542(0xb1760f26ace5cbf6); /* line */ \n c_e9fd5542(0xbf4459b76d855a95); /* statement */ \ncreateDeposit.collectFrom(msg.sender, address(quest));\r\n\r\nc_e9fd5542(0x18cbb442aab95296); /* line */ \n c_e9fd5542(0xee634f1c6750501d); /* statement */ \nemit QuestCreated(\r\n address(quest),\r\n _questTitle,\r\n _questDetailsRef,\r\n address(_rewardToken),\r\n _expireTime,\r\n _fundsRecoveryAddress,\r\n createDeposit,\r\n playDeposit,\r\n msg.sender,\r\n _maxPlayers,\r\n _isWhiteList,\r\n version\r\n );\r\n\r\nc_e9fd5542(0x616cfac99824e646); /* line */ \n c_e9fd5542(0xdf6e6627dae96fb1); /* statement */ \nreturn address(quest);\r\n }\r\n\r\n /**\r\n * @dev Be able to change it after deploy so we can deploy\r\n * a new GovernQueue but keep the same QuestFactory\r\n * @param _aragonGovernAddress The aragonGovernAddress.\r\n */\r\n function setAragonGovernAddress(\r\n address _aragonGovernAddress\r\n ) external c_moddbfdc9ea onlyOwner c_mod0fa3af38 {c_e9fd5542(0x8369cb1f24452ae2); /* function */ \n\r\nc_e9fd5542(0xefeb67ec9005f1a1); /* line */ \n aragonGovernAddress = _aragonGovernAddress;\r\n }\r\n}\r\n" + } + }, + "settings": { + "optimizer": { + "enabled": false, + "runs": 20000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": false + } + } +} \ No newline at end of file diff --git a/packages/hardhat/hardhat.config.ts b/packages/hardhat/hardhat.config.ts index f0e3da85..630c01a3 100644 --- a/packages/hardhat/hardhat.config.ts +++ b/packages/hardhat/hardhat.config.ts @@ -12,7 +12,7 @@ import "solidity-coverage"; import { task, HardhatUserConfig, types } from "hardhat/config"; import { HttpNetworkUserConfig } from "hardhat/types"; import { resolve } from "path"; -import deployQuest from "./deploy/deploy-quest"; +import deployQuest, { questConstructorArguments } from "./deploy/deploy-quest"; import deployGovernQueue, { generateQueueConfig, } from "./scripts/deploy-govern_queue"; @@ -25,6 +25,7 @@ import GovernAbi from "./abi/contracts/Externals/Govern.json"; import GovernQueueAbi from "./abi/contracts/Externals/GovernQueue.json"; import CelesteMockGoerli from "./deployments/goerli/OwnableCeleste.json"; import upgradeQuestFactory from "./scripts/upgrade-quest-factory"; +import { verifyContractWithRetry } from "./scripts/verify-contract"; dotenvConfig({ path: resolve( @@ -806,15 +807,30 @@ task("newQuestFactory:gnosis") ) .setAction(async (args, hre) => { console.log("Starting by deploying the Quest template..."); - await hre.run("newQuest"); + const questDeployResult = await hre.run("newQuest"); console.log("Deploying proxy upgrade for QuestFactory..."); - const address = await upgradeQuestFactory(hre, args); + const questFactoryDeployResult = await upgradeQuestFactory(hre, args); console.log( "Deployed proxy upgrade for QuestFactory (" + hre.network.name + "):", - address + questFactoryDeployResult.address ); + + Promise.all([ + verifyContractWithRetry( + "Quest", + hre.run, + questDeployResult.address, + questDeployResult.args + ), + verifyContractWithRetry( + "QuestFactory", + hre.run, + questFactoryDeployResult.address, + questFactoryDeployResult.args + ), + ]); }); task("newQuestFactory:goerli") @@ -826,15 +842,30 @@ task("newQuestFactory:goerli") ) .setAction(async (args, hre) => { console.log("Starting by deploying the Quest template..."); - await hre.run("newQuest", hre); + const questDeployResult = await hre.run("newQuest", hre); console.log("Deploying proxy upgrade for QuestFactory..."); - const address = await upgradeQuestFactory(hre, args); + const questFactoryDeployResult = await upgradeQuestFactory(hre, args); console.log( "Deployed proxy upgrade for QuestFactory (" + hre.network.name + "):", - address + questFactoryDeployResult.address ); + + await Promise.all([ + verifyContractWithRetry( + "Quest", + hre.run, + questDeployResult.address, + questDeployResult.args + ), + verifyContractWithRetry( + "QuestFactory", + hre.run, + questFactoryDeployResult.address, + questFactoryDeployResult.args + ), + ]); }); task("newQuest") @@ -845,6 +876,7 @@ task("newQuest") "Deployed quest template (" + hre.network.name + "):", deployResult.address ); + return deployResult; }); async function deployAll( @@ -1130,32 +1162,26 @@ task("deployCeleste:goerli") } ); -task( - "verify-quests-contracts", - "Verify contracts with etherscan api" -).setAction(async (_args, { run, network }) => { - const questFactoryDeploy = require(`./deployments/${network.name.toLowerCase()}/QuestFactory.json`); - const questDeploy = require(`./deployments/${network.name.toLowerCase()}/Quest.json`); - console.log("Quest", { - address: questDeploy.address, - constructorArguments: questDeploy.args, - }); - try { - await run("verify:verify", { - address: questFactoryDeploy.address, - constructorArguments: questFactoryDeploy.args, - }); - } catch (error) { - console.error("Failed when verifying QuestFactory contract", error); - } - try { - await run("verify:verify", { - address: questDeploy.address, - constructorArguments: questDeploy.args, - }); - } catch (error) { - console.error("Failed when verifying Quest contract", error); +task("verify-contracts", "Verify contracts with etherscan api").setAction( + async (_args, { run, network }) => { + const questFactoryDeploy = require(`./deployments/${network.name.toLowerCase()}/QuestFactory.json`); + const questDeploy = require(`./deployments/${network.name.toLowerCase()}/Quest.json`); + + await Promise.all([ + verifyContractWithRetry( + "Quest", + run, + questDeploy.address, + questConstructorArguments + ), + verifyContractWithRetry( + "QuestFactory", + run, + questFactoryDeploy.address, + [] // Proxy contract has no constructor + ), + ]); } -}); +); module.exports = hardhatConfig; diff --git a/packages/hardhat/package.json b/packages/hardhat/package.json index e700575c..79041f2b 100644 --- a/packages/hardhat/package.json +++ b/packages/hardhat/package.json @@ -15,7 +15,7 @@ "@openzeppelin/contracts": "^4.9.2", "@openzeppelin/contracts-upgradeable": "^4.9.3", "@openzeppelin/hardhat-upgrades": "^1.0.0", - "@tenderly/hardhat-tenderly": "1.0.10", + "@tenderly/hardhat-tenderly": "^1.7.7", "@typechain/ethers-v5": "^5.0.0", "@types/chai": "^4.2.21", "@types/mocha": "^9.0.0", @@ -80,8 +80,8 @@ "send": "hardhat send", "generate": "hardhat generate", "account": "hardhat account", - "verify:rinkeby": "hardhat verify-quests-contracts --network rinkeby", - "verify:goerli": "hardhat verify-quests-contracts --network goerli", + "verify:rinkeby": "hardhat verify-contracts --network rinkeby", + "verify:goerli": "hardhat verify-contracts --network goerli", "ci": "yarn install --pure-lockfile --immutable --skip-builds" } } diff --git a/packages/hardhat/scripts/deploy-govern_queue.ts b/packages/hardhat/scripts/deploy-govern_queue.ts index 126c483c..9d4a4bfa 100644 --- a/packages/hardhat/scripts/deploy-govern_queue.ts +++ b/packages/hardhat/scripts/deploy-govern_queue.ts @@ -66,7 +66,6 @@ export default async function deployGovernQueue( }), ethers.constants.HashZero, { - // from:"0x91B0d67D3F47A30FBEeB159E67209Ad6cb2cE22E", gasPrice: "110000000", gasLimit: "10000000", } diff --git a/packages/hardhat/scripts/upgrade-quest-factory.ts b/packages/hardhat/scripts/upgrade-quest-factory.ts index d1ec909a..e2523421 100644 --- a/packages/hardhat/scripts/upgrade-quest-factory.ts +++ b/packages/hardhat/scripts/upgrade-quest-factory.ts @@ -1,6 +1,7 @@ import { HardhatRuntimeEnvironment } from "hardhat/types"; import { buildQuestFactoryConstructorArguments } from "../deploy/deploy-quest_factory"; import exportContractResult from "../scripts/export-contract-result"; +import { verifyContractWithRetry } from "../scripts/verify-contract"; export default async function upgradeQuestFactory( { @@ -16,50 +17,26 @@ export default async function upgradeQuestFactory( createDepositAmount: number; playDepositToken: string; playDepositAmount: number; + newProxy: boolean; } ) { const QuestFactoryProxy = require(`../deployments/${network.name}/QuestFactory.json`); const abi = require(`../artifacts/contracts/QuestFactory.sol/QuestFactory.json`).abi; - const constructorArguments = buildQuestFactoryConstructorArguments({ - getNamedAccounts, - args, - network, - ethers, - }); + const { govern } = await getNamedAccounts(); const contractFactory = await ethers.getContractFactory("QuestFactory"); const newContractUpgrade = await upgrades.upgradeProxy( QuestFactoryProxy.address, contractFactory ); - newContractUpgrade.deployed(); - - console.log({ constructorArguments }); - - try { - console.log("Verifying QuestFactory..."); - await new Promise((res, rej) => { - setTimeout( - () => - run("verify:verify", { - address: newContractUpgrade.address, - constructorArguments: [], - }) - .then(res) - .catch(rej), - 30000 - ); // Wait for contract to be deployed - }); - } catch (error) { - console.error("Failed when verifying the Quest contract", error); - } + await newContractUpgrade.deployed(); exportContractResult(network, "QuestFactory", { address: QuestFactoryProxy.address, abi: abi, }); - return newContractUpgrade.address; + return { address: newContractUpgrade.address, args: [] }; } diff --git a/packages/hardhat/scripts/verify-contract.ts b/packages/hardhat/scripts/verify-contract.ts new file mode 100644 index 00000000..0768b75e --- /dev/null +++ b/packages/hardhat/scripts/verify-contract.ts @@ -0,0 +1,41 @@ +import { HardhatRuntimeEnvironment } from "hardhat/types"; + +export const verifyContractWithRetry = ( + name: string, + run: HardhatRuntimeEnvironment["run"], + address: string, + constructorArguments: any[], + triesRemaining = 2 +) => + new Promise((resolve, reject) => { + if (triesRemaining === 2) { + console.log(`Verifying ${name}...`); + } else if (triesRemaining === 1) { + reject(`Failed to verify ${name}. No more tries remaining.`); + } + setTimeout( + () => + run("verify:verify", { + address: address, + constructorArguments: constructorArguments, + }) + .then(resolve) + .catch((error) => { + console.error( + `Failed when verifying the ${name} contract, retrying (${triesRemaining--} more tries)`, + error + ); + + verifyContractWithRetry( + name, + run, + address, + constructorArguments, + triesRemaining + ) + .then(resolve) + .catch(reject); + }), + 30000 + ); + }); diff --git a/packages/hardhat/test/Quest.test.ts b/packages/hardhat/test/Quest.test.ts index b71611e6..d01b20f0 100644 --- a/packages/hardhat/test/Quest.test.ts +++ b/packages/hardhat/test/Quest.test.ts @@ -189,10 +189,54 @@ describe("[Contract] Quest", function () { ); expect(await sameToken.balanceOf(other.address)).to.eq(questFunds); }); + + describe("WHEN quest is whitelist only", () => { + it("SHOULDn't keep players deposits", async () => { + // Arrange + const sameToken = rewardToken; + const quest = await deployQuest( + "fakeTitle", + "0x", + sameToken, + network.name === "hardhat" ? epochNow + 60 * 5 : epoch0, // expired in 5 min + govern.address, + other.address, + questFunds, + createDepositToken, + depositAmount, + sameToken, + depositAmount, + creator, + undefined, + true + ); + + if (network.name === "hardhat") { + await quest.connect(creator).setWhiteList([player.address]); + + // Set next block timestamp to 10 minutes later (quest will be expired) + await time.setNextBlockTimestamp(epochNow + 60 * 11); + } else { + console.warn( + "Non hardhat network, skipping not supported fast foward" + ); + } + + // Act + await quest.recoverFundsAndDeposit(); + + // Assert + expect(await sameToken.balanceOf(quest.address)).to.eq(0); // no deposit remains even if still have players + expect(await createDepositToken.balanceOf(creator.address)).to.eq( + depositAmount + ); + expect(await sameToken.balanceOf(other.address)).to.eq(questFunds); + }); + }); }); describe("claim()", function () { - describe("questFund is 1000", function () { + describe("WHEN questFund is 1000", function () { const questFunds = fromNumber(1000); it("SHOULD transfer amount to player", async function () { @@ -511,6 +555,49 @@ describe("[Contract] Quest", function () { depositAmount.mul(3) // 1 create and 2 player deposits ); }); + + describe("WHEN quest is whitelist only AND player claims all", () => { + it("SHOULDn't let player deposit if same token", async () => { + // Arrange + const sameToken = rewardToken; + const quest = await deployQuest( + "fakeTitle", + "0x", + sameToken, + epochNow + 3600, // 1 hour from now + govern.address, + creator.address, + fromNumber(1), + sameToken, + depositAmount, + sameToken, + depositAmount, + creator, + undefined, + true + ); + await sameToken + .connect(creator) + .mint(creator.address, fromNumber(1000)); + await sameToken + .connect(creator) + .approve(quest.address, depositAmount.mul(2)); + + await quest + .connect(creator) + .setWhiteList([player.address, other.address]); // Add 2 player + + // Act + await quest + .connect(govern) + .claim(hashToBytes("evidence1"), player.address, 0, true); + + // Assert + expect(await rewardToken.balanceOf(quest.address)).to.eq( + depositAmount.mul(1) // 1 create and no players deposits + ); + }); + }); }); describe("play()", () => { @@ -733,6 +820,7 @@ describe("[Contract] Quest", function () { // Assert await expect(act()).to.be.revertedWith("ERROR: Player already exists"); }); + it("SHOULD revert if it's a whitelisted quest", async () => { // Arrange const quest = await deployQuest( @@ -901,6 +989,7 @@ describe("[Contract] Quest", function () { // Assert await expect(act()).to.be.revertedWith("ERROR: player not in list"); }); + it("SHOULD revert WHEN quest is whitelisted", async () => { // Arrange const quest = await deployQuest( @@ -936,6 +1025,7 @@ describe("[Contract] Quest", function () { ); }); }); + describe("constructor()", () => { it("SHOULD revert if max players greater than 0 and isWhiteList", async () => { //Arrange @@ -965,6 +1055,7 @@ describe("[Contract] Quest", function () { ); }); }); + describe("setWhiteList()", () => { it("SHOULD set the player list to the one in the parameters", async () => { //Arrange @@ -981,14 +1072,14 @@ describe("[Contract] Quest", function () { playDepositToken, depositAmount, creator, - 0, + undefined, true ); //Act const act = () => quest.connect(creator).setWhiteList([player.address, other.address]); //Assert - await expect(act()).to.emit(quest, "QuestWhiteListChanged"); + await expect(act()).to.emit(quest, "QuestWhiteListChanged"); expect(await quest.getPlayers()).to.deep.eq([ player.address, other.address, @@ -996,7 +1087,8 @@ describe("[Contract] Quest", function () { expect(await quest.canExecute(player.address)).to.eq(true); expect(await quest.canExecute(other.address)).to.eq(true); }); - it("SHOULD revert if one or more players is already in list", async () => { + + it("SHOULD revert if duplicated address in given list", async () => { //Arrange const quest = await deployQuest( "fakeTitle", @@ -1011,18 +1103,20 @@ describe("[Contract] Quest", function () { playDepositToken, depositAmount, creator, - 0, + undefined, true ); + //Act - await quest.connect(creator).setWhiteList([player.address, other.address]); - const act = async () => - await quest.connect(creator).setWhiteList([player.address]); + const act = () => + quest.connect(creator).setWhiteList([player.address, player.address]); + //Assert await expect(act()).to.be.revertedWith( - "ERROR: One or more players is already in whitelist" - ); + "ERROR: One or more players is already in whitelist" + ); }); + it("SHOULD revert if it's not a whitelisted quest", async () => { //Arrange const quest = await deployQuest( @@ -1038,15 +1132,15 @@ describe("[Contract] Quest", function () { playDepositToken, depositAmount, creator, - 0, + undefined, false ); //Act const act = () => quest.connect(creator).setWhiteList([player.address, other.address]); - + //Assert - await expect(act()).to.be.revertedWith( + await expect(act()).to.be.revertedWith( "ERROR: Can't set the white list to a non-whitelisted contract" ); }); diff --git a/packages/hardhat/typechain/factories/OwnableCeleste__factory.ts b/packages/hardhat/typechain/factories/OwnableCeleste__factory.ts index f9bc4bc1..bf4e594c 100644 --- a/packages/hardhat/typechain/factories/OwnableCeleste__factory.ts +++ b/packages/hardhat/typechain/factories/OwnableCeleste__factory.ts @@ -334,4 +334,4 @@ const _abi = [ ]; const _bytecode = - "0x608060405234801561001057600080fd5b506040516040806111bf8339810180604052604081101561003057600080fd5b81019080805190602001909291908051906020019092919050505033600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508060018190555050506110db806100e46000396000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c80637e9adccf11610097578063db18af6c11610066578063db18af6c1461051d578063db9bee4614610592578063e00dd161146105dc578063e55156b5146105fa576100f5565b80637e9adccf1461038b5780638da5cb5b146103b9578063bd881e5314610403578063c13517e114610486576100f5565b8063647846a5116100d3578063647846a5146101fc57806369e15404146102465780637b751b9e146102645780637cb57c64146102e8576100f5565b806313af4035146100fa5780631da213f21461013e578063564a565d14610179575b600080fd5b61013c6004803603602081101561011057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610648565b005b6101776004803603604081101561015457600080fd5b8101908080359060200190929190803560ff16906020019092919050505061074f565b005b6101a56004803603602081101561018f57600080fd5b81019080803590602001909291905050506109a0565b604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018260048111156101e757fe5b60ff1681526020019250505060405180910390f35b6102046109f1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61024e610a16565b6040518082815260200191505060405180910390f35b61026c610a1c565b604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390f35b610389600480360360608110156102fe57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561034557600080fd5b82018360208201111561035757600080fd5b8035906020019184600183028401116401000000008311171561037957600080fd5b9091929391929390505050610a52565b005b6103b7600480360360208110156103a157600080fd5b8101908080359060200190929190505050610a58565b005b6103c1610a5b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61042f6004803603602081101561041957600080fd5b8101908080359060200190929190505050610a81565b604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182600481111561047157fe5b60ff1681526020019250505060405180910390f35b6105076004803603604081101561049c57600080fd5b8101908080359060200190929190803590602001906401000000008111156104c357600080fd5b8201836020820111156104d557600080fd5b803590602001918460018302840111640100000000831117156104f757600080fd5b9091929391929390505050610adc565b6040518082815260200191505060405180910390f35b6105496004803603602081101561053357600080fd5b8101908080359060200190929190505050610c80565b604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390f35b61059a610e2f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105e4610e37565b6040518082815260200191505060405180910390f35b6106466004803603604081101561061057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e3d565b005b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461070b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f4552523a4e4f545f4f574e45520000000000000000000000000000000000000081525060200191505060405180910390fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610812576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f4552523a4e4f545f4f574e45520000000000000000000000000000000000000081525060200191505060405180910390fd5b6000600481111561081f57fe5b81600481111561082b57fe5b1415801561085057506001600481111561084157fe5b81600481111561084d57fe5b14155b6108c2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f4552523a4f5554434f4d455f4e4f545f41535349474e41424c4500000000000081525060200191505060405180910390fd5b6000600460008481526020019081526020016000209050600160048111156108e657fe5b8160000160149054906101000a900460ff16600481111561090357fe5b14610976576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f4552523a4e4f545f44495350555445440000000000000000000000000000000081525060200191505060405180910390fd5b818160000160146101000a81548160ff0219169083600481111561099657fe5b0217905550505050565b60046020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060000160149054906101000a900460ff16905082565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60015481565b6000806000306000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600154925092509250909192565b50505050565b50565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060006004600085815260200190815260200160002090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1692508060000160149054906101000a900460ff16915050915091565b600080600254905060405180604001604052803373ffffffffffffffffffffffffffffffffffffffff16815260200160016004811115610b1857fe5b8152506004600083815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a81548160ff02191690836004811115610b9957fe5b0217905550905050600260008154809291906001019190505550610c0333306001546000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f4b909392919063ffffffff16565b610c75576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f4552523a4445504f5349545f4641494c4544000000000000000000000000000081525060200191505060405180910390fd5b809150509392505050565b600080600060046000858152602001908152602001600020905060036004811115610ca757fe5b8160000160149054906101000a900460ff166004811115610cc457fe5b1415610cfb578060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660039250925050610e2a565b600480811115610d0757fe5b8160000160149054906101000a900460ff166004811115610d2457fe5b1415610d5b578060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660049250925050610e2a565b60026004811115610d6857fe5b8160000160149054906101000a900460ff166004811115610d8557fe5b1415610dbc578060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660009250925050610e2a565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f554e45585045435445445f53544154450000000000000000000000000000000081525060200191505060405180910390fd5b915091565b600030905090565b60025481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f00576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f4552523a4e4f545f4f574e45520000000000000000000000000000000000000081525060200191505060405180910390fd5b80600181905550816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b600060608573ffffffffffffffffffffffffffffffffffffffff166323b872dd905060e01b858585604051602401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050611052868261105d565b915050949350505050565b6000806040516020818551602087016000895af160008111156110a3573d600081146110905760208114611099576110a1565b600193506110a1565b600183511493505b505b5050809150509291505056fea165627a7a72305820ad526ae7aa1ab8e65a1ec5cf369673b6a337ae20ff8df8363900beea6b1185150029"; + "0x608060405234801561001057600080fd5b506040516040806111bf8339810180604052604081101561003057600080fd5b81019080805190602001909291908051906020019092919050505033600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508060018190555050506110db806100e46000396000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c80637e9adccf11610097578063db18af6c11610066578063db18af6c1461051d578063db9bee4614610592578063e00dd161146105dc578063e55156b5146105fa576100f5565b80637e9adccf1461038b5780638da5cb5b146103b9578063bd881e5314610403578063c13517e114610486576100f5565b8063647846a5116100d3578063647846a5146101fc57806369e15404146102465780637b751b9e146102645780637cb57c64146102e8576100f5565b806313af4035146100fa5780631da213f21461013e578063564a565d14610179575b600080fd5b61013c6004803603602081101561011057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610648565b005b6101776004803603604081101561015457600080fd5b8101908080359060200190929190803560ff16906020019092919050505061074f565b005b6101a56004803603602081101561018f57600080fd5b81019080803590602001909291905050506109a0565b604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018260048111156101e757fe5b60ff1681526020019250505060405180910390f35b6102046109f1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61024e610a16565b6040518082815260200191505060405180910390f35b61026c610a1c565b604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390f35b610389600480360360608110156102fe57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561034557600080fd5b82018360208201111561035757600080fd5b8035906020019184600183028401116401000000008311171561037957600080fd5b9091929391929390505050610a52565b005b6103b7600480360360208110156103a157600080fd5b8101908080359060200190929190505050610a58565b005b6103c1610a5b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61042f6004803603602081101561041957600080fd5b8101908080359060200190929190505050610a81565b604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182600481111561047157fe5b60ff1681526020019250505060405180910390f35b6105076004803603604081101561049c57600080fd5b8101908080359060200190929190803590602001906401000000008111156104c357600080fd5b8201836020820111156104d557600080fd5b803590602001918460018302840111640100000000831117156104f757600080fd5b9091929391929390505050610adc565b6040518082815260200191505060405180910390f35b6105496004803603602081101561053357600080fd5b8101908080359060200190929190505050610c80565b604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390f35b61059a610e2f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105e4610e37565b6040518082815260200191505060405180910390f35b6106466004803603604081101561061057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e3d565b005b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461070b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f4552523a4e4f545f4f574e45520000000000000000000000000000000000000081525060200191505060405180910390fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610812576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f4552523a4e4f545f4f574e45520000000000000000000000000000000000000081525060200191505060405180910390fd5b6000600481111561081f57fe5b81600481111561082b57fe5b1415801561085057506001600481111561084157fe5b81600481111561084d57fe5b14155b6108c2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f4552523a4f5554434f4d455f4e4f545f41535349474e41424c4500000000000081525060200191505060405180910390fd5b6000600460008481526020019081526020016000209050600160048111156108e657fe5b8160000160149054906101000a900460ff16600481111561090357fe5b14610976576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f4552523a4e4f545f44495350555445440000000000000000000000000000000081525060200191505060405180910390fd5b818160000160146101000a81548160ff0219169083600481111561099657fe5b0217905550505050565b60046020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060000160149054906101000a900460ff16905082565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60015481565b6000806000306000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600154925092509250909192565b50505050565b50565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060006004600085815260200190815260200160002090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1692508060000160149054906101000a900460ff16915050915091565b600080600254905060405180604001604052803373ffffffffffffffffffffffffffffffffffffffff16815260200160016004811115610b1857fe5b8152506004600083815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a81548160ff02191690836004811115610b9957fe5b0217905550905050600260008154809291906001019190505550610c0333306001546000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f4b909392919063ffffffff16565b610c75576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f4552523a4445504f5349545f4641494c4544000000000000000000000000000081525060200191505060405180910390fd5b809150509392505050565b600080600060046000858152602001908152602001600020905060036004811115610ca757fe5b8160000160149054906101000a900460ff166004811115610cc457fe5b1415610cfb578060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660039250925050610e2a565b600480811115610d0757fe5b8160000160149054906101000a900460ff166004811115610d2457fe5b1415610d5b578060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660049250925050610e2a565b60026004811115610d6857fe5b8160000160149054906101000a900460ff166004811115610d8557fe5b1415610dbc578060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660009250925050610e2a565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f554e45585045435445445f53544154450000000000000000000000000000000081525060200191505060405180910390fd5b915091565b600030905090565b60025481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f00576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f4552523a4e4f545f4f574e45520000000000000000000000000000000000000081525060200191505060405180910390fd5b80600181905550816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b600060608573ffffffffffffffffffffffffffffffffffffffff166323b872dd905060e01b858585604051602401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050611052868261105d565b915050949350505050565b6000806040516020818551602087016000895af160008111156110a3573d600081146110905760208114611099576110a1565b600193506110a1565b600183511493505b505b5050809150509291505056fea165627a7a72305820bd4a295db9bcaba2a85d13d7982dc2f3a1586e33fa938dd46dc0ba2833ca42570029"; diff --git a/packages/hardhat/typechain/factories/QuestFactory__factory.ts b/packages/hardhat/typechain/factories/QuestFactory__factory.ts index 538301ea..51bb00d1 100644 --- a/packages/hardhat/typechain/factories/QuestFactory__factory.ts +++ b/packages/hardhat/typechain/factories/QuestFactory__factory.ts @@ -433,4 +433,4 @@ const _abi = [ ]; const _bytecode = - "0x608060405234801561001057600080fd5b5061001961001e565b6100dd565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff908116146100db576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b614076806100ec6000396000f3fe60806040523480156200001157600080fd5b5060043610620000e75760003560e01c8063b0a87ac1116200008d578063d03ffefb1162000063578063d03ffefb1462000223578063edeecdd31462000248578063f2fde38b146200025f57620000e7565b8063b0a87ac114620001d4578063b628a33f14620001f5578063c4d66de8146200020c57620000e7565b80638c43b41111620000c35780638c43b411146200012b5780638c53c9bd14620001425780638da5cb5b146200019457620000e7565b8062732e3014620000ec57806354fd4d501462000105578063715018a61462000121575b600080fd5b62000103620000fd366004620011a4565b62000276565b005b6200010e600381565b6040519081526020015b60405180910390f35b62000103620002c7565b620001036200013c366004620011e2565b620002df565b606854606954620001679173ffffffffffffffffffffffffffffffffffffffff169082565b6040805173ffffffffffffffffffffffffffffffffffffffff909316835260208301919091520162000118565b60335473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200162000118565b606554620001ae9073ffffffffffffffffffffffffffffffffffffffff1681565b620001ae6200020636600462001210565b62000384565b620001036200021d366004620011a4565b620004ef565b606654606754620001679173ffffffffffffffffffffffffffffffffffffffff169082565b6200010362000259366004620011e2565b620006d5565b6200010362000270366004620011a4565b62000773565b6200028062000830565b606580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b620002d162000830565b620002dd6000620008b3565b565b620002e962000830565b60408051808201825273ffffffffffffffffffffffffffffffffffffffff84168082526020918201849052606880547fffffffffffffffffffffffff0000000000000000000000000000000000000000168217905560698490558251428152918201529081018290527f013c800b1a136f9798a25e471501a7b824156d1e9cba8439821c5a41adf2fb89906060015b60405180910390a15050565b60408051808201825260665473ffffffffffffffffffffffffffffffffffffffff9081168252606754602080840191909152835180850185526068548316815260695481830152845160e08101865233815263ffffffff88169281019290925289831682860152606082018990526065548316608083015291871660a082015284151560c0820152925160009384938c938c93919290916200042690620010a3565b6200043695949392919062001468565b604051809103906000f08015801562000453573d6000803e3d6000fd5b506040805180820190915260665473ffffffffffffffffffffffffffffffffffffffff1681526067546020820152909150620004919033836200092a565b7f2d0b32d809449b38bb442a046b092f68efaf9d4bef7678947afd25048117f187818a8a8a8a8a60666068338d8d6003604051620004db9c9b9a9998979695949392919062001366565b60405180910390a198975050505050505050565b600054610100900460ff1615808015620005105750600054600160ff909116105b80620005355750620005223062000947565b15801562000535575060005460ff166001145b620005c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156200062657600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b6200063062000967565b606580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790558015620006d157600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200162000378565b5050565b620006df62000830565b60408051808201825273ffffffffffffffffffffffffffffffffffffffff84168082526020918201849052606680547fffffffffffffffffffffffff0000000000000000000000000000000000000000168217905560678490558251428152918201529081018290527f35c5e8a6f8bed2c61a2eb1996d117b1b96192314c0d4ca7cd96360f2509200799060600162000378565b6200077d62000830565b73ffffffffffffffffffffffffffffffffffffffff811662000822576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401620005be565b6200082d81620008b3565b50565b60335473ffffffffffffffffffffffffffffffffffffffff163314620002dd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401620005be565b6033805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b62000936838362000a0a565b62000942838262000b63565b505050565b73ffffffffffffffffffffffffffffffffffffffff81163b15155b919050565b600054610100900460ff1662000a00576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401620005be565b620002dd62000b9b565b602082015115620006d15781516040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8381166004830152306024830152600092169063dd62ed3e9060440160206040518083038186803b15801562000a8757600080fd5b505afa15801562000a9c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000ac29190620012e3565b9050826020015181101562000b34576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4552524f52203a204465706f7369742062616420616c6c6f77616e63650000006044820152606401620005be565b60208301518351620009429173ffffffffffffffffffffffffffffffffffffffff909116908490309062000c3f565b602082015115620006d15760208201518251620006d19173ffffffffffffffffffffffffffffffffffffffff90911690839062000d23565b600054610100900460ff1662000c34576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401620005be565b620002dd33620008b3565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905262000d1d9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915262000d7b565b50505050565b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052620009429084907fa9059cbb000000000000000000000000000000000000000000000000000000009060640162000c9a565b600062000ddf826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1662000e919092919063ffffffff16565b905080516000148062000e0357508080602001905181019062000e039190620011c3565b62000942576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401620005be565b606062000ea2848460008562000eaa565b949350505050565b60608247101562000f3e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401620005be565b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405162000f69919062001348565b60006040518083038185875af1925050503d806000811462000fa8576040519150601f19603f3d011682016040523d82523d6000602084013e62000fad565b606091505b509150915062000fc08783838762000fcb565b979650505050505050565b60608315620010565782516200104e5762000fe68562000947565b6200104e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401620005be565b508162000ea2565b62000ea283838151156200106d5781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005be919062001453565b612a2e806200161383390190565b600067ffffffffffffffff80841115620010cf57620010cf620015b1565b604051601f85017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908282118183101715620011185762001118620015b1565b816040528093508581528686860111156200113257600080fd5b858560208301376000602087830101525050509392505050565b80356200096281620015e0565b8035620009628162001603565b600082601f83011262001177578081fd5b6200118883833560208501620010b1565b9392505050565b803563ffffffff811681146200096257600080fd5b600060208284031215620011b6578081fd5b81356200118881620015e0565b600060208284031215620011d5578081fd5b8151620011888162001603565b60008060408385031215620011f5578081fd5b82356200120281620015e0565b946020939093013593505050565b600080600080600080600060e0888a0312156200122b578283fd5b873567ffffffffffffffff8082111562001243578485fd5b818a0191508a601f83011262001257578485fd5b620012688b833560208501620010b1565b985060208a01359150808211156200127e578485fd5b506200128d8a828b0162001166565b9650506200129e604089016200114c565b945060608801359350620012b5608089016200114c565b9250620012c560a089016200118f565b9150620012d560c0890162001159565b905092959891949750929550565b600060208284031215620012f5578081fd5b5051919050565b600081518084526200131681602086016020860162001582565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600082516200135c81846020870162001582565b9190910192915050565b600073ffffffffffffffffffffffffffffffffffffffff808f1683526101c060208401526200139a6101c084018f620012fc565b8381036040850152620013ae818f620012fc565b925050808c1660608401528a6080840152808a1660a0840152620013f660c084018a805473ffffffffffffffffffffffffffffffffffffffff16825260010154602090910152565b875473ffffffffffffffffffffffffffffffffffffffff166101008401526001909701546101208301529590941661014085015263ffffffff9290921661016084015215156101808301526101a090910152979650505050505050565b600060208252620011886020830184620012fc565b60006101a08083526200147e81840189620012fc565b90508281036020840152620014948188620012fc565b865173ffffffffffffffffffffffffffffffffffffffff166040850152602087015160608501529150620014c59050565b835173ffffffffffffffffffffffffffffffffffffffff166080830152602084015160a0830152825173ffffffffffffffffffffffffffffffffffffffff90811660c0840152602084015163ffffffff1660e084015260408401518116610100840152606084015161012084015260808401511661014083015260a08301516200156861016084018273ffffffffffffffffffffffffffffffffffffffff169052565b5060c0830151801515610180840152509695505050505050565b60005b838110156200159f57818101518382015260200162001585565b8381111562000d1d5750506000910152565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff811681146200082d57600080fd5b80151581146200082d57600080fdfe60806040523480156200001157600080fd5b5060405162002a2e38038062002a2e833981016040819052620000349162000423565b8060c0015180156200005057506000816020015163ffffffff16115b15620000e35760405162461bcd60e51b815260206004820152605260248201527f4552524f523a2043616e27742063726561746520612077686974654c6973746560448201527f642071756573742077697468206d617820706c61796572732067726561746572606482015271207468616e20302028696e66696e6974792960701b608482015260a40160405180910390fd5b8451620000f8906001906020880190620001f1565b5083516200010e906002906020870190620001f1565b506040810151600380546001600160a01b03199081166001600160a01b03938416179091556060830151600455608083015160058054831691841691909117905560a083015160068054855160008054861691871691909117905587516008805486169187169190911790556020978801516009558651600a8054861691871691909117905595870151600b55600c805460ff191690559584015160c0909401519490911691161763ffffffff60a01b1916600160a01b63ffffffff909216919091021760ff60c01b1916600160c01b9115159190910217905550620005909050565b828054620001ff9062000524565b90600052602060002090601f0160209004810192826200022357600085556200026e565b82601f106200023e57805160ff19168380011785556200026e565b828001600101855582156200026e579182015b828111156200026e57825182559160200191906001019062000251565b506200027c92915062000280565b5090565b5b808211156200027c576000815560010162000281565b60006001600160401b03831115620002b357620002b362000561565b6020620002c9601f8501601f19168201620004f1565b9150838252848484011115620002de57600080fd5b60005b84811015620002fc57838101518382018301528101620002e1565b848111156200030e5760008286850101525b50509392505050565b8051620003248162000577565b919050565b805180151581146200032457600080fd5b6000604082840312156200034c578081fd5b620003586040620004f1565b90508151620003678162000577565b808252506020820151602082015292915050565b600060e082840312156200038d578081fd5b6200039960e0620004f1565b90508151620003a88162000577565b8152602082015163ffffffff81168114620003c257600080fd5b6020820152620003d56040830162000317565b604082015260608201516060820152620003f26080830162000317565b60808201526200040560a0830162000317565b60a08201526200041860c0830162000329565b60c082015292915050565b60008060008060006101a086880312156200043c578081fd5b85516001600160401b038082111562000453578283fd5b818801915088601f83011262000467578283fd5b620004788983516020850162000297565b965060208801519150808211156200048e578283fd5b508601601f81018813620004a0578182fd5b620004b18882516020840162000297565b945050620004c387604088016200033a565b9250620004d487608088016200033a565b9150620004e58760c088016200037b565b90509295509295909350565b604051601f8201601f191681016001600160401b03811182821017156200051c576200051c62000561565b604052919050565b6002810460018216806200053957607f821691505b602082108114156200055b57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146200058d57600080fd5b50565b61248e80620005a06000396000f3fe608060405234801561001057600080fd5b506004361061016c5760003560e01c80638b5b9ccc116100cd578063d03ffefb11610081578063e492814f11610066578063e492814f146103ab578063f294cf38146103be578063f7c618c1146103c65761016c565b8063d03ffefb14610372578063e0c23423146103965761016c565b8063a888c2cd116100b2578063a888c2cd1461031d578063b0a87ac11461033f578063b434151c1461035f5761016c565b80638b5b9ccc146102b85780638c53c9bd146102cd5761016c565b8063579ca2c911610124578063775b9c1311610109578063775b9c13146102725780637ceae3101461028557806385c99e2b146102a55761016c565b8063579ca2c9146102255780636c3a4cce1461022d5761016c565b8063310a1ee311610155578063310a1ee3146101c457806348d6cb53146101db5780634c2412a2146101e85761016c565b8063151dfb06146101715780632f17b18214610186575b600080fd5b61018461017f366004611f3f565b6103e6565b005b6006546101af907801000000000000000000000000000000000000000000000000900460ff1681565b60405190151581526020015b60405180910390f35b6101cd60045481565b6040519081526020016101bb565b600c546101af9060ff1681565b6006546102109074010000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff90911681526020016101bb565b610184610807565b60005461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101bb565b610184610280366004611f60565b6109fb565b60065461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b6101af6102b3366004611f3f565b610cc8565b6102c0610cfe565b6040516101bb91906121e9565b600a54600b546102f19173ffffffffffffffffffffffffffffffffffffffff169082565b6040805173ffffffffffffffffffffffffffffffffffffffff90931683526020830191909152016101bb565b61033061032b366004612103565b610d6d565b6040516101bb93929190612231565b60055461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b61018461036d36600461202a565b610e46565b6008546009546102f19173ffffffffffffffffffffffffffffffffffffffff169082565b61039e611274565b6040516101bb919061221e565b6101846103b9366004611f3f565b611302565b61039e61170d565b60035461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b6006547801000000000000000000000000000000000000000000000000900460ff161561049a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f4552524f523a2063616e277420756e706c617920612077686974656c6973746560448201527f642071756573740000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff821614806104d5575060005473ffffffffffffffffffffffffffffffffffffffff1633145b610560576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f4552524f523a2053656e646572206e6f7420706c61796572206e6f722063726560448201527f61746f72000000000000000000000000000000000000000000000000000000006064820152608401610491565b600061056b8261171a565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14156105f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4552524f523a20706c61796572206e6f7420696e206c697374000000000000006044820152606401610491565b600d8054610607906001906122f8565b8154811061063e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260209091200154600d805473ffffffffffffffffffffffffffffffffffffffff909216918390811061069e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d80548061071e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b600082815260209081902082017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905590910190915560408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b54918101919091526107b490836117e2565b6040805173ffffffffffffffffffffffffffffffffffffffff841681524260208201527fc4a67a0877d477de99d765a3d9f48abfbe6181dff4727d68c3cb60715555417591015b60405180910390a15050565b600454421015610873576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4552524f523a204e6f74206578706972656400000000000000000000000000006044820152606401610491565b600c5460ff166108e5576000546040805180820190915260085473ffffffffffffffffffffffffffffffffffffffff908116825260095460208301526108b992166117e2565b600c80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b15801561094f57600080fd5b505afa158015610963573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610987919061211b565b600a5460035491925073ffffffffffffffffffffffffffffffffffffffff918216911614156109ce57600d54600b546109ca916109c3916122bb565b829061181b565b9150505b6006546003546109f89173ffffffffffffffffffffffffffffffffffffffff918216911683611841565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610aa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f4f6e6c792063726561746f722063616e2063616c6c20746869732066756e637460448201527f696f6e00000000000000000000000000000000000000000000000000000000006064820152608401610491565b6006547801000000000000000000000000000000000000000000000000900460ff161515600114610b55576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603d60248201527f4552524f523a2043616e27742073657420746865207768697465206c6973742060448201527f746f2061206e6f6e2d77686974656c697374656420636f6e74726163740000006064820152608401610491565b6000805b82518163ffffffff161015610bf457610bb7838263ffffffff1681518110610baa577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015161171a565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610be257600191505b80610bec816123c8565b915050610b59565b508015610c83576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4552524f523a204f6e65206f72206d6f726520706c617965727320697320616c60448201527f726561647920696e2077686974656c69737400000000000000000000000000006064820152608401610491565b8151610c9690600d906020850190611dfd565b507fb1565d66d9899787abe67ac307850cf339a24f69de2bf7ffa4179e0eaeb939b082426040516107fb9291906121fc565b6000610cd38261171a565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff141590505b919050565b6060600d805480602002602001604051908101604052809291908181526020018280548015610d6357602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610d38575b5050505050905090565b60078181548110610d7d57600080fd5b9060005260206000209060030201600091509050806000018054610da09061233b565b80601f0160208091040260200160405190810160405280929190818152602001828054610dcc9061233b565b8015610e195780601f10610dee57610100808354040283529160200191610e19565b820191906000526020600020905b815481529060010190602001808311610dfc57829003601f168201915b505050506001830154600290930154919273ffffffffffffffffffffffffffffffffffffffff1691905083565b60055473ffffffffffffffffffffffffffffffffffffffff163314610ec7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4552524f523a2053656e646572206e6f7420676f7665726e00000000000000006044820152606401610491565b8351610f2f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4552524f523a204e6f2065766964656e636500000000000000000000000000006044820152606401610491565b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b158015610f9957600080fd5b505afa158015610fad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fd1919061211b565b905081156110675760085460035473ffffffffffffffffffffffffffffffffffffffff9081169116141561101a5760095460009061101090839061181b565b945061101e915050565b8092505b600a5460035473ffffffffffffffffffffffffffffffffffffffff9081169116141561106757600d54600b546000916110629161105b91906122bb565b859061181b565b945050505b60085460035473ffffffffffffffffffffffffffffffffffffffff90811691161415611133576000611099828561181b565b915050600860010154811015611131576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f4552524f523a2053686f756c64206e6f742065786365656420616c6c6f77656460448201527f20626f756e7479000000000000000000000000000000000000000000000000006064820152608401610491565b505b821561115d5760035461115d9073ffffffffffffffffffffffffffffffffffffffff168585611841565b6040805160608101825286815273ffffffffffffffffffffffffffffffffffffffff86166020808301919091529181018590526007805460018101825560009190915281518051929360039092027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68801926111db9284920190611e87565b5060208201516001820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091179055604091820151600290910155517fa1c3b325aa2c115e4b244062eba2515bc5585ae5b41556be8fef399ae9fde11b9061126590879087908790612231565b60405180910390a15050505050565b600280546112819061233b565b80601f01602080910402602001604051908101604052809291908181526020018280546112ad9061233b565b80156112fa5780601f106112cf576101008083540402835291602001916112fa565b820191906000526020600020905b8154815290600101906020018083116112dd57829003601f168201915b505050505081565b6006547801000000000000000000000000000000000000000000000000900460ff16156113b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603760248201527f4552524f523a2043616e27742073656c6620726567697374657220616e64207060448201527f6c617920612077686974656c69737465642051756573740000000000000000006064820152608401610491565b3373ffffffffffffffffffffffffffffffffffffffff821614806113ec575060005473ffffffffffffffffffffffffffffffffffffffff1633145b611477576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f4552524f523a2053656e646572206e6f7420706c61796572206e6f722063726560448201527f61746f72000000000000000000000000000000000000000000000000000000006064820152608401610491565b60065474010000000000000000000000000000000000000000900463ffffffff1615806114c65750600654600d547401000000000000000000000000000000000000000090910463ffffffff16115b61152c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f4552524f523a204d617820706c617965727320726561636865640000000000006044820152606401610491565b6004544210611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4552524f523a20517565737420657870697265640000000000000000000000006044820152606401610491565b60006115a28261171a565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1461162d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4552524f523a20506c6179657220616c726561647920657869737473000000006044820152606401610491565b60408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b54602082015261166590333061191a565b600d80546001810182556000919091527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb50180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8416908117909155604080519182524260208301527f35ec60f951b4abc8b287ab5148caf98524052482927d42e86a720cc71b8a76a191016107fb565b600180546112819061233b565b6000805b600d548110156117ba578273ffffffffffffffffffffffffffffffffffffffff16600d8281548110611779577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614156117a8579050610cf9565b806117b28161238f565b91505061171e565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92915050565b60208201511561181757602082015182516118179173ffffffffffffffffffffffffffffffffffffffff909116908390611841565b5050565b600080838311156118315750600090508061183a565b50600190508183035b9250929050565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526119159084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261192e565b505050565b6119248383611a3d565b61191583826117e2565b6000611990826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611b8d9092919063ffffffff16565b90508051600014806119b15750808060200190518101906119b1919061200e565b611915576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610491565b6020820151156118175781516040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8381166004830152306024830152600092169063dd62ed3e9060440160206040518083038186803b158015611ab857600080fd5b505afa158015611acc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611af0919061211b565b90508260200151811015611b60576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4552524f52203a204465706f7369742062616420616c6c6f77616e63650000006044820152606401610491565b602083015183516119159173ffffffffffffffffffffffffffffffffffffffff9091169084903090611ba4565b6060611b9c8484600085611c08565b949350505050565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052611c029085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401611893565b50505050565b606082471015611c9a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610491565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051611cc391906121cd565b60006040518083038185875af1925050503d8060008114611d00576040519150601f19603f3d011682016040523d82523d6000602084013e611d05565b606091505b5091509150611d1687838387611d21565b979650505050505050565b60608315611db4578251611dad5773ffffffffffffffffffffffffffffffffffffffff85163b611dad576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610491565b5081611b9c565b611b9c8383815115611dc95781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610491919061221e565b828054828255906000526020600020908101928215611e77579160200282015b82811115611e7757825182547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909116178255602090920191600190910190611e1d565b50611e83929150611efb565b5090565b828054611e939061233b565b90600052602060002090601f016020900481019282611eb55760008555611e77565b82601f10611ece57805160ff1916838001178555611e77565b82800160010185558215611e77579182015b82811115611e77578251825591602001919060010190611ee0565b5b80821115611e835760008155600101611efc565b803573ffffffffffffffffffffffffffffffffffffffff81168114610cf957600080fd5b8035610cf98161244a565b600060208284031215611f50578081fd5b611f5982611f10565b9392505050565b60006020808385031215611f72578182fd5b823567ffffffffffffffff80821115611f89578384fd5b818501915085601f830112611f9c578384fd5b813581811115611fae57611fae61241b565b8381029150611fbe84830161226c565b8181528481019084860184860187018a1015611fd8578788fd5b8795505b8386101561200157611fed81611f10565b835260019590950194918601918601611fdc565b5098975050505050505050565b60006020828403121561201f578081fd5b8151611f598161244a565b6000806000806080858703121561203f578283fd5b843567ffffffffffffffff80821115612056578485fd5b818701915087601f830112612069578485fd5b813560208282111561207d5761207d61241b565b6120ad817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8501160161226c565b925081835289818386010111156120c2578687fd5b8181850182850137868183850101528297506120df818a01611f10565b965050505050604085013591506120f860608601611f34565b905092959194509250565b600060208284031215612114578081fd5b5035919050565b60006020828403121561212c578081fd5b5051919050565b6000815180845260208085019450808401835b8381101561217857815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101612146565b509495945050505050565b6000815180845261219b81602086016020860161230f565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600082516121df81846020870161230f565b9190910192915050565b600060208252611f596020830184612133565b60006040825261220f6040830185612133565b90508260208301529392505050565b600060208252611f596020830184612183565b6000606082526122446060830186612183565b73ffffffffffffffffffffffffffffffffffffffff9490941660208301525060400152919050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156122b3576122b361241b565b604052919050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156122f3576122f36123ec565b500290565b60008282101561230a5761230a6123ec565b500390565b60005b8381101561232a578181015183820152602001612312565b83811115611c025750506000910152565b60028104600182168061234f57607f821691505b60208210811415612389577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156123c1576123c16123ec565b5060010190565b600063ffffffff808316818114156123e2576123e26123ec565b6001019392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b80151581146109f857600080fdfea26469706673582212201d95e7743bcb101068cc9a865b5573cbcd2079b13e70e82b4992d89773670e1c64736f6c63430008020033a2646970667358221220cafd3128d67a577592a54666fe90eb14cbffaab5a5d7020a86280d4fe134225964736f6c63430008020033"; + "0x608060405234801561001057600080fd5b5061001961001e565b6100dd565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff908116146100db576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b614113806100ec6000396000f3fe60806040523480156200001157600080fd5b5060043610620000e75760003560e01c8063b0a87ac1116200008d578063d03ffefb1162000063578063d03ffefb1462000223578063edeecdd31462000248578063f2fde38b146200025f57620000e7565b8063b0a87ac114620001d4578063b628a33f14620001f5578063c4d66de8146200020c57620000e7565b80638c43b41111620000c35780638c43b411146200012b5780638c53c9bd14620001425780638da5cb5b146200019457620000e7565b8062732e3014620000ec57806354fd4d501462000105578063715018a61462000121575b600080fd5b62000103620000fd366004620011a4565b62000276565b005b6200010e600381565b6040519081526020015b60405180910390f35b62000103620002c7565b620001036200013c366004620011e2565b620002df565b606854606954620001679173ffffffffffffffffffffffffffffffffffffffff169082565b6040805173ffffffffffffffffffffffffffffffffffffffff909316835260208301919091520162000118565b60335473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200162000118565b606554620001ae9073ffffffffffffffffffffffffffffffffffffffff1681565b620001ae6200020636600462001210565b62000384565b620001036200021d366004620011a4565b620004ef565b606654606754620001679173ffffffffffffffffffffffffffffffffffffffff169082565b6200010362000259366004620011e2565b620006d5565b6200010362000270366004620011a4565b62000773565b6200028062000830565b606580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b620002d162000830565b620002dd6000620008b3565b565b620002e962000830565b60408051808201825273ffffffffffffffffffffffffffffffffffffffff84168082526020918201849052606880547fffffffffffffffffffffffff0000000000000000000000000000000000000000168217905560698490558251428152918201529081018290527f013c800b1a136f9798a25e471501a7b824156d1e9cba8439821c5a41adf2fb89906060015b60405180910390a15050565b60408051808201825260665473ffffffffffffffffffffffffffffffffffffffff9081168252606754602080840191909152835180850185526068548316815260695481830152845160e08101865233815263ffffffff88169281019290925289831682860152606082018990526065548316608083015291871660a082015284151560c0820152925160009384938c938c93919290916200042690620010a3565b6200043695949392919062001468565b604051809103906000f08015801562000453573d6000803e3d6000fd5b506040805180820190915260665473ffffffffffffffffffffffffffffffffffffffff1681526067546020820152909150620004919033836200092a565b7f2d0b32d809449b38bb442a046b092f68efaf9d4bef7678947afd25048117f187818a8a8a8a8a60666068338d8d6003604051620004db9c9b9a9998979695949392919062001366565b60405180910390a198975050505050505050565b600054610100900460ff1615808015620005105750600054600160ff909116105b80620005355750620005223062000947565b15801562000535575060005460ff166001145b620005c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156200062657600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b6200063062000967565b606580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790558015620006d157600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200162000378565b5050565b620006df62000830565b60408051808201825273ffffffffffffffffffffffffffffffffffffffff84168082526020918201849052606680547fffffffffffffffffffffffff0000000000000000000000000000000000000000168217905560678490558251428152918201529081018290527f35c5e8a6f8bed2c61a2eb1996d117b1b96192314c0d4ca7cd96360f2509200799060600162000378565b6200077d62000830565b73ffffffffffffffffffffffffffffffffffffffff811662000822576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401620005be565b6200082d81620008b3565b50565b60335473ffffffffffffffffffffffffffffffffffffffff163314620002dd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401620005be565b6033805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b62000936838362000a0a565b62000942838262000b63565b505050565b73ffffffffffffffffffffffffffffffffffffffff81163b15155b919050565b600054610100900460ff1662000a00576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401620005be565b620002dd62000b9b565b602082015115620006d15781516040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8381166004830152306024830152600092169063dd62ed3e9060440160206040518083038186803b15801562000a8757600080fd5b505afa15801562000a9c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000ac29190620012e3565b9050826020015181101562000b34576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4552524f52203a204465706f7369742062616420616c6c6f77616e63650000006044820152606401620005be565b60208301518351620009429173ffffffffffffffffffffffffffffffffffffffff909116908490309062000c3f565b602082015115620006d15760208201518251620006d19173ffffffffffffffffffffffffffffffffffffffff90911690839062000d23565b600054610100900460ff1662000c34576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401620005be565b620002dd33620008b3565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905262000d1d9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915262000d7b565b50505050565b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052620009429084907fa9059cbb000000000000000000000000000000000000000000000000000000009060640162000c9a565b600062000ddf826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1662000e919092919063ffffffff16565b905080516000148062000e0357508080602001905181019062000e039190620011c3565b62000942576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401620005be565b606062000ea2848460008562000eaa565b949350505050565b60608247101562000f3e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401620005be565b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405162000f69919062001348565b60006040518083038185875af1925050503d806000811462000fa8576040519150601f19603f3d011682016040523d82523d6000602084013e62000fad565b606091505b509150915062000fc08783838762000fcb565b979650505050505050565b60608315620010565782516200104e5762000fe68562000947565b6200104e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401620005be565b508162000ea2565b62000ea283838151156200106d5781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005be919062001453565b612acb806200161383390190565b600067ffffffffffffffff80841115620010cf57620010cf620015b1565b604051601f85017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908282118183101715620011185762001118620015b1565b816040528093508581528686860111156200113257600080fd5b858560208301376000602087830101525050509392505050565b80356200096281620015e0565b8035620009628162001603565b600082601f83011262001177578081fd5b6200118883833560208501620010b1565b9392505050565b803563ffffffff811681146200096257600080fd5b600060208284031215620011b6578081fd5b81356200118881620015e0565b600060208284031215620011d5578081fd5b8151620011888162001603565b60008060408385031215620011f5578081fd5b82356200120281620015e0565b946020939093013593505050565b600080600080600080600060e0888a0312156200122b578283fd5b873567ffffffffffffffff8082111562001243578485fd5b818a0191508a601f83011262001257578485fd5b620012688b833560208501620010b1565b985060208a01359150808211156200127e578485fd5b506200128d8a828b0162001166565b9650506200129e604089016200114c565b945060608801359350620012b5608089016200114c565b9250620012c560a089016200118f565b9150620012d560c0890162001159565b905092959891949750929550565b600060208284031215620012f5578081fd5b5051919050565b600081518084526200131681602086016020860162001582565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600082516200135c81846020870162001582565b9190910192915050565b600073ffffffffffffffffffffffffffffffffffffffff808f1683526101c060208401526200139a6101c084018f620012fc565b8381036040850152620013ae818f620012fc565b925050808c1660608401528a6080840152808a1660a0840152620013f660c084018a805473ffffffffffffffffffffffffffffffffffffffff16825260010154602090910152565b875473ffffffffffffffffffffffffffffffffffffffff166101008401526001909701546101208301529590941661014085015263ffffffff9290921661016084015215156101808301526101a090910152979650505050505050565b600060208252620011886020830184620012fc565b60006101a08083526200147e81840189620012fc565b90508281036020840152620014948188620012fc565b865173ffffffffffffffffffffffffffffffffffffffff166040850152602087015160608501529150620014c59050565b835173ffffffffffffffffffffffffffffffffffffffff166080830152602084015160a0830152825173ffffffffffffffffffffffffffffffffffffffff90811660c0840152602084015163ffffffff1660e084015260408401518116610100840152606084015161012084015260808401511661014083015260a08301516200156861016084018273ffffffffffffffffffffffffffffffffffffffff169052565b5060c0830151801515610180840152509695505050505050565b60005b838110156200159f57818101518382015260200162001585565b8381111562000d1d5750506000910152565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff811681146200082d57600080fd5b80151581146200082d57600080fdfe60806040523480156200001157600080fd5b5060405162002acb38038062002acb833981016040819052620000349162000423565b8060c0015180156200005057506000816020015163ffffffff16115b15620000e35760405162461bcd60e51b815260206004820152605260248201527f4552524f523a2043616e27742063726561746520612077686974654c6973746560448201527f642071756573742077697468206d617820706c61796572732067726561746572606482015271207468616e20302028696e66696e6974792960701b608482015260a40160405180910390fd5b8451620000f8906001906020880190620001f1565b5083516200010e906002906020870190620001f1565b506040810151600380546001600160a01b03199081166001600160a01b03938416179091556060830151600455608083015160058054831691841691909117905560a083015160068054855160008054861691871691909117905587516008805486169187169190911790556020978801516009558651600a8054861691871691909117905595870151600b55600c805460ff191690559584015160c0909401519490911691161763ffffffff60a01b1916600160a01b63ffffffff909216919091021760ff60c01b1916600160c01b9115159190910217905550620005909050565b828054620001ff9062000524565b90600052602060002090601f0160209004810192826200022357600085556200026e565b82601f106200023e57805160ff19168380011785556200026e565b828001600101855582156200026e579182015b828111156200026e57825182559160200191906001019062000251565b506200027c92915062000280565b5090565b5b808211156200027c576000815560010162000281565b60006001600160401b03831115620002b357620002b362000561565b6020620002c9601f8501601f19168201620004f1565b9150838252848484011115620002de57600080fd5b60005b84811015620002fc57838101518382018301528101620002e1565b848111156200030e5760008286850101525b50509392505050565b8051620003248162000577565b919050565b805180151581146200032457600080fd5b6000604082840312156200034c578081fd5b620003586040620004f1565b90508151620003678162000577565b808252506020820151602082015292915050565b600060e082840312156200038d578081fd5b6200039960e0620004f1565b90508151620003a88162000577565b8152602082015163ffffffff81168114620003c257600080fd5b6020820152620003d56040830162000317565b604082015260608201516060820152620003f26080830162000317565b60808201526200040560a0830162000317565b60a08201526200041860c0830162000329565b60c082015292915050565b60008060008060006101a086880312156200043c578081fd5b85516001600160401b038082111562000453578283fd5b818801915088601f83011262000467578283fd5b620004788983516020850162000297565b965060208801519150808211156200048e578283fd5b508601601f81018813620004a0578182fd5b620004b18882516020840162000297565b945050620004c387604088016200033a565b9250620004d487608088016200033a565b9150620004e58760c088016200037b565b90509295509295909350565b604051601f8201601f191681016001600160401b03811182821017156200051c576200051c62000561565b604052919050565b6002810460018216806200053957607f821691505b602082108114156200055b57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146200058d57600080fd5b50565b61252b80620005a06000396000f3fe608060405234801561001057600080fd5b506004361061016c5760003560e01c80638b5b9ccc116100cd578063d03ffefb11610081578063e492814f11610066578063e492814f146103ab578063f294cf38146103be578063f7c618c1146103c65761016c565b8063d03ffefb14610372578063e0c23423146103965761016c565b8063a888c2cd116100b2578063a888c2cd1461031d578063b0a87ac11461033f578063b434151c1461035f5761016c565b80638b5b9ccc146102b85780638c53c9bd146102cd5761016c565b8063579ca2c911610124578063775b9c1311610109578063775b9c13146102725780637ceae3101461028557806385c99e2b146102a55761016c565b8063579ca2c9146102255780636c3a4cce1461022d5761016c565b8063310a1ee311610155578063310a1ee3146101c457806348d6cb53146101db5780634c2412a2146101e85761016c565b8063151dfb06146101715780632f17b18214610186575b600080fd5b61018461017f366004612000565b6103e6565b005b6006546101af907801000000000000000000000000000000000000000000000000900460ff1681565b60405190151581526020015b60405180910390f35b6101cd60045481565b6040519081526020016101bb565b600c546101af9060ff1681565b6006546102109074010000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff90911681526020016101bb565b610184610807565b60005461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101bb565b610184610280366004612021565b610a26565b60065461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b6101af6102b3366004612000565b610d5e565b6102c0610d94565b6040516101bb91906122aa565b600a54600b546102f19173ffffffffffffffffffffffffffffffffffffffff169082565b6040805173ffffffffffffffffffffffffffffffffffffffff90931683526020830191909152016101bb565b61033061032b3660046121c4565b610e03565b6040516101bb939291906122f2565b60055461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b61018461036d3660046120eb565b610edc565b6008546009546102f19173ffffffffffffffffffffffffffffffffffffffff169082565b61039e611335565b6040516101bb91906122df565b6101846103b9366004612000565b6113c3565b61039e6117ce565b60035461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b6006547801000000000000000000000000000000000000000000000000900460ff161561049a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f4552524f523a2063616e277420756e706c617920612077686974656c6973746560448201527f642071756573740000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff821614806104d5575060005473ffffffffffffffffffffffffffffffffffffffff1633145b610560576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f4552524f523a2053656e646572206e6f7420706c61796572206e6f722063726560448201527f61746f72000000000000000000000000000000000000000000000000000000006064820152608401610491565b600061056b826117db565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14156105f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4552524f523a20706c61796572206e6f7420696e206c697374000000000000006044820152606401610491565b600d8054610607906001906123b9565b8154811061063e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260209091200154600d805473ffffffffffffffffffffffffffffffffffffffff909216918390811061069e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d80548061071e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b600082815260209081902082017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905590910190915560408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b54918101919091526107b490836118a3565b6040805173ffffffffffffffffffffffffffffffffffffffff841681524260208201527fc4a67a0877d477de99d765a3d9f48abfbe6181dff4727d68c3cb60715555417591015b60405180910390a15050565b600454421015610873576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4552524f523a204e6f74206578706972656400000000000000000000000000006044820152606401610491565b600c5460ff166108e5576000546040805180820190915260085473ffffffffffffffffffffffffffffffffffffffff908116825260095460208301526108b992166118a3565b600c80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b15801561094f57600080fd5b505afa158015610963573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098791906121dc565b600a5460035491925073ffffffffffffffffffffffffffffffffffffffff91821691161480156109d657506006547801000000000000000000000000000000000000000000000000900460ff16155b156109f957600d54600b546109f5916109ee9161237c565b82906118dc565b9150505b600654600354610a239173ffffffffffffffffffffffffffffffffffffffff918216911683611902565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610acd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f4f6e6c792063726561746f722063616e2063616c6c20746869732066756e637460448201527f696f6e00000000000000000000000000000000000000000000000000000000006064820152608401610491565b6006547801000000000000000000000000000000000000000000000000900460ff161515600114610b80576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603d60248201527f4552524f523a2043616e27742073657420746865207768697465206c6973742060448201527f746f2061206e6f6e2d77686974656c697374656420636f6e74726163740000006064820152608401610491565b6000805b8251811015610c8a576000838281518110610bc8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151905060005b8451811015610c7557828114158015610c595750848181518110610c22577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15610c6357600193505b80610c6d81612450565b915050610bd5565b50508080610c8290612450565b915050610b84565b508015610d19576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4552524f523a204f6e65206f72206d6f726520706c617965727320697320616c60448201527f726561647920696e2077686974656c69737400000000000000000000000000006064820152608401610491565b8151610d2c90600d906020850190611ebe565b507fb1565d66d9899787abe67ac307850cf339a24f69de2bf7ffa4179e0eaeb939b082426040516107fb9291906122bd565b6000610d69826117db565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff141590505b919050565b6060600d805480602002602001604051908101604052809291908181526020018280548015610df957602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610dce575b5050505050905090565b60078181548110610e1357600080fd5b9060005260206000209060030201600091509050806000018054610e36906123fc565b80601f0160208091040260200160405190810160405280929190818152602001828054610e62906123fc565b8015610eaf5780601f10610e8457610100808354040283529160200191610eaf565b820191906000526020600020905b815481529060010190602001808311610e9257829003601f168201915b505050506001830154600290930154919273ffffffffffffffffffffffffffffffffffffffff1691905083565b60055473ffffffffffffffffffffffffffffffffffffffff163314610f5d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4552524f523a2053656e646572206e6f7420676f7665726e00000000000000006044820152606401610491565b8351610fc5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4552524f523a204e6f2065766964656e636500000000000000000000000000006044820152606401610491565b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b15801561102f57600080fd5b505afa158015611043573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106791906121dc565b905081156111285760085460035473ffffffffffffffffffffffffffffffffffffffff908116911614156110b0576009546000906110a69083906118dc565b94506110b4915050565b8092505b600a5460035473ffffffffffffffffffffffffffffffffffffffff908116911614801561110057506006547801000000000000000000000000000000000000000000000000900460ff16155b1561112857600d54600b546000916111239161111c919061237c565b85906118dc565b945050505b60085460035473ffffffffffffffffffffffffffffffffffffffff908116911614156111f457600061115a82856118dc565b9150506008600101548110156111f2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f4552524f523a2053686f756c64206e6f742065786365656420616c6c6f77656460448201527f20626f756e7479000000000000000000000000000000000000000000000000006064820152608401610491565b505b821561121e5760035461121e9073ffffffffffffffffffffffffffffffffffffffff168585611902565b6040805160608101825286815273ffffffffffffffffffffffffffffffffffffffff86166020808301919091529181018590526007805460018101825560009190915281518051929360039092027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c688019261129c9284920190611f48565b5060208201516001820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091179055604091820151600290910155517fa1c3b325aa2c115e4b244062eba2515bc5585ae5b41556be8fef399ae9fde11b90611326908790879087906122f2565b60405180910390a15050505050565b60028054611342906123fc565b80601f016020809104026020016040519081016040528092919081815260200182805461136e906123fc565b80156113bb5780601f10611390576101008083540402835291602001916113bb565b820191906000526020600020905b81548152906001019060200180831161139e57829003601f168201915b505050505081565b6006547801000000000000000000000000000000000000000000000000900460ff1615611472576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603760248201527f4552524f523a2043616e27742073656c6620726567697374657220616e64207060448201527f6c617920612077686974656c69737465642051756573740000000000000000006064820152608401610491565b3373ffffffffffffffffffffffffffffffffffffffff821614806114ad575060005473ffffffffffffffffffffffffffffffffffffffff1633145b611538576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f4552524f523a2053656e646572206e6f7420706c61796572206e6f722063726560448201527f61746f72000000000000000000000000000000000000000000000000000000006064820152608401610491565b60065474010000000000000000000000000000000000000000900463ffffffff1615806115875750600654600d547401000000000000000000000000000000000000000090910463ffffffff16115b6115ed576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f4552524f523a204d617820706c617965727320726561636865640000000000006044820152606401610491565b6004544210611658576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4552524f523a20517565737420657870697265640000000000000000000000006044820152606401610491565b6000611663826117db565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff146116ee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4552524f523a20506c6179657220616c726561647920657869737473000000006044820152606401610491565b60408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b5460208201526117269033306119db565b600d80546001810182556000919091527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb50180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8416908117909155604080519182524260208301527f35ec60f951b4abc8b287ab5148caf98524052482927d42e86a720cc71b8a76a191016107fb565b60018054611342906123fc565b6000805b600d5481101561187b578273ffffffffffffffffffffffffffffffffffffffff16600d828154811061183a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff161415611869579050610d8f565b8061187381612450565b9150506117df565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92915050565b6020820151156118d857602082015182516118d89173ffffffffffffffffffffffffffffffffffffffff909116908390611902565b5050565b600080838311156118f2575060009050806118fb565b50600190508183035b9250929050565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526119d69084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526119ef565b505050565b6119e58383611afe565b6119d683826118a3565b6000611a51826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611c4e9092919063ffffffff16565b9050805160001480611a72575080806020019051810190611a7291906120cf565b6119d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610491565b6020820151156118d85781516040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8381166004830152306024830152600092169063dd62ed3e9060440160206040518083038186803b158015611b7957600080fd5b505afa158015611b8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bb191906121dc565b90508260200151811015611c21576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4552524f52203a204465706f7369742062616420616c6c6f77616e63650000006044820152606401610491565b602083015183516119d69173ffffffffffffffffffffffffffffffffffffffff9091169084903090611c65565b6060611c5d8484600085611cc9565b949350505050565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052611cc39085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401611954565b50505050565b606082471015611d5b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610491565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051611d84919061228e565b60006040518083038185875af1925050503d8060008114611dc1576040519150601f19603f3d011682016040523d82523d6000602084013e611dc6565b606091505b5091509150611dd787838387611de2565b979650505050505050565b60608315611e75578251611e6e5773ffffffffffffffffffffffffffffffffffffffff85163b611e6e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610491565b5081611c5d565b611c5d8383815115611e8a5781518083602001fd5b806040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161049191906122df565b828054828255906000526020600020908101928215611f38579160200282015b82811115611f3857825182547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909116178255602090920191600190910190611ede565b50611f44929150611fbc565b5090565b828054611f54906123fc565b90600052602060002090601f016020900481019282611f765760008555611f38565b82601f10611f8f57805160ff1916838001178555611f38565b82800160010185558215611f38579182015b82811115611f38578251825591602001919060010190611fa1565b5b80821115611f445760008155600101611fbd565b803573ffffffffffffffffffffffffffffffffffffffff81168114610d8f57600080fd5b8035610d8f816124e7565b600060208284031215612011578081fd5b61201a82611fd1565b9392505050565b60006020808385031215612033578182fd5b823567ffffffffffffffff8082111561204a578384fd5b818501915085601f83011261205d578384fd5b81358181111561206f5761206f6124b8565b838102915061207f84830161232d565b8181528481019084860184860187018a1015612099578788fd5b8795505b838610156120c2576120ae81611fd1565b83526001959095019491860191860161209d565b5098975050505050505050565b6000602082840312156120e0578081fd5b815161201a816124e7565b60008060008060808587031215612100578283fd5b843567ffffffffffffffff80821115612117578485fd5b818701915087601f83011261212a578485fd5b813560208282111561213e5761213e6124b8565b61216e817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8501160161232d565b92508183528981838601011115612183578687fd5b8181850182850137868183850101528297506121a0818a01611fd1565b965050505050604085013591506121b960608601611ff5565b905092959194509250565b6000602082840312156121d5578081fd5b5035919050565b6000602082840312156121ed578081fd5b5051919050565b6000815180845260208085019450808401835b8381101561223957815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101612207565b509495945050505050565b6000815180845261225c8160208601602086016123d0565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600082516122a08184602087016123d0565b9190910192915050565b60006020825261201a60208301846121f4565b6000604082526122d060408301856121f4565b90508260208301529392505050565b60006020825261201a6020830184612244565b6000606082526123056060830186612244565b73ffffffffffffffffffffffffffffffffffffffff9490941660208301525060400152919050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715612374576123746124b8565b604052919050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156123b4576123b4612489565b500290565b6000828210156123cb576123cb612489565b500390565b60005b838110156123eb5781810151838201526020016123d3565b83811115611cc35750506000910152565b60028104600182168061241057607f821691505b6020821081141561244a577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561248257612482612489565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b8015158114610a2357600080fdfea26469706673582212204eb3f233eed5fefb3d1f4c5541d3001cc0d8a4109bd90cca624a823385b379a164736f6c63430008020033a264697066735822122065292a639cb7d9e637fadfaa78b9d48f3864d8799ed4214556f82c758298f47564736f6c63430008020033"; diff --git a/packages/hardhat/typechain/factories/Quest__factory.ts b/packages/hardhat/typechain/factories/Quest__factory.ts index 9f04ee40..6d40a425 100644 --- a/packages/hardhat/typechain/factories/Quest__factory.ts +++ b/packages/hardhat/typechain/factories/Quest__factory.ts @@ -553,4 +553,4 @@ const _abi = [ ]; const _bytecode = - "0x60806040523480156200001157600080fd5b5060405162002a2e38038062002a2e833981016040819052620000349162000423565b8060c0015180156200005057506000816020015163ffffffff16115b15620000e35760405162461bcd60e51b815260206004820152605260248201527f4552524f523a2043616e27742063726561746520612077686974654c6973746560448201527f642071756573742077697468206d617820706c61796572732067726561746572606482015271207468616e20302028696e66696e6974792960701b608482015260a40160405180910390fd5b8451620000f8906001906020880190620001f1565b5083516200010e906002906020870190620001f1565b506040810151600380546001600160a01b03199081166001600160a01b03938416179091556060830151600455608083015160058054831691841691909117905560a083015160068054855160008054861691871691909117905587516008805486169187169190911790556020978801516009558651600a8054861691871691909117905595870151600b55600c805460ff191690559584015160c0909401519490911691161763ffffffff60a01b1916600160a01b63ffffffff909216919091021760ff60c01b1916600160c01b9115159190910217905550620005909050565b828054620001ff9062000524565b90600052602060002090601f0160209004810192826200022357600085556200026e565b82601f106200023e57805160ff19168380011785556200026e565b828001600101855582156200026e579182015b828111156200026e57825182559160200191906001019062000251565b506200027c92915062000280565b5090565b5b808211156200027c576000815560010162000281565b60006001600160401b03831115620002b357620002b362000561565b6020620002c9601f8501601f19168201620004f1565b9150838252848484011115620002de57600080fd5b60005b84811015620002fc57838101518382018301528101620002e1565b848111156200030e5760008286850101525b50509392505050565b8051620003248162000577565b919050565b805180151581146200032457600080fd5b6000604082840312156200034c578081fd5b620003586040620004f1565b90508151620003678162000577565b808252506020820151602082015292915050565b600060e082840312156200038d578081fd5b6200039960e0620004f1565b90508151620003a88162000577565b8152602082015163ffffffff81168114620003c257600080fd5b6020820152620003d56040830162000317565b604082015260608201516060820152620003f26080830162000317565b60808201526200040560a0830162000317565b60a08201526200041860c0830162000329565b60c082015292915050565b60008060008060006101a086880312156200043c578081fd5b85516001600160401b038082111562000453578283fd5b818801915088601f83011262000467578283fd5b620004788983516020850162000297565b965060208801519150808211156200048e578283fd5b508601601f81018813620004a0578182fd5b620004b18882516020840162000297565b945050620004c387604088016200033a565b9250620004d487608088016200033a565b9150620004e58760c088016200037b565b90509295509295909350565b604051601f8201601f191681016001600160401b03811182821017156200051c576200051c62000561565b604052919050565b6002810460018216806200053957607f821691505b602082108114156200055b57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146200058d57600080fd5b50565b61248e80620005a06000396000f3fe608060405234801561001057600080fd5b506004361061016c5760003560e01c80638b5b9ccc116100cd578063d03ffefb11610081578063e492814f11610066578063e492814f146103ab578063f294cf38146103be578063f7c618c1146103c65761016c565b8063d03ffefb14610372578063e0c23423146103965761016c565b8063a888c2cd116100b2578063a888c2cd1461031d578063b0a87ac11461033f578063b434151c1461035f5761016c565b80638b5b9ccc146102b85780638c53c9bd146102cd5761016c565b8063579ca2c911610124578063775b9c1311610109578063775b9c13146102725780637ceae3101461028557806385c99e2b146102a55761016c565b8063579ca2c9146102255780636c3a4cce1461022d5761016c565b8063310a1ee311610155578063310a1ee3146101c457806348d6cb53146101db5780634c2412a2146101e85761016c565b8063151dfb06146101715780632f17b18214610186575b600080fd5b61018461017f366004611f3f565b6103e6565b005b6006546101af907801000000000000000000000000000000000000000000000000900460ff1681565b60405190151581526020015b60405180910390f35b6101cd60045481565b6040519081526020016101bb565b600c546101af9060ff1681565b6006546102109074010000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff90911681526020016101bb565b610184610807565b60005461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101bb565b610184610280366004611f60565b6109fb565b60065461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b6101af6102b3366004611f3f565b610cc8565b6102c0610cfe565b6040516101bb91906121e9565b600a54600b546102f19173ffffffffffffffffffffffffffffffffffffffff169082565b6040805173ffffffffffffffffffffffffffffffffffffffff90931683526020830191909152016101bb565b61033061032b366004612103565b610d6d565b6040516101bb93929190612231565b60055461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b61018461036d36600461202a565b610e46565b6008546009546102f19173ffffffffffffffffffffffffffffffffffffffff169082565b61039e611274565b6040516101bb919061221e565b6101846103b9366004611f3f565b611302565b61039e61170d565b60035461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b6006547801000000000000000000000000000000000000000000000000900460ff161561049a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f4552524f523a2063616e277420756e706c617920612077686974656c6973746560448201527f642071756573740000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff821614806104d5575060005473ffffffffffffffffffffffffffffffffffffffff1633145b610560576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f4552524f523a2053656e646572206e6f7420706c61796572206e6f722063726560448201527f61746f72000000000000000000000000000000000000000000000000000000006064820152608401610491565b600061056b8261171a565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14156105f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4552524f523a20706c61796572206e6f7420696e206c697374000000000000006044820152606401610491565b600d8054610607906001906122f8565b8154811061063e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260209091200154600d805473ffffffffffffffffffffffffffffffffffffffff909216918390811061069e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d80548061071e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b600082815260209081902082017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905590910190915560408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b54918101919091526107b490836117e2565b6040805173ffffffffffffffffffffffffffffffffffffffff841681524260208201527fc4a67a0877d477de99d765a3d9f48abfbe6181dff4727d68c3cb60715555417591015b60405180910390a15050565b600454421015610873576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4552524f523a204e6f74206578706972656400000000000000000000000000006044820152606401610491565b600c5460ff166108e5576000546040805180820190915260085473ffffffffffffffffffffffffffffffffffffffff908116825260095460208301526108b992166117e2565b600c80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b15801561094f57600080fd5b505afa158015610963573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610987919061211b565b600a5460035491925073ffffffffffffffffffffffffffffffffffffffff918216911614156109ce57600d54600b546109ca916109c3916122bb565b829061181b565b9150505b6006546003546109f89173ffffffffffffffffffffffffffffffffffffffff918216911683611841565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610aa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f4f6e6c792063726561746f722063616e2063616c6c20746869732066756e637460448201527f696f6e00000000000000000000000000000000000000000000000000000000006064820152608401610491565b6006547801000000000000000000000000000000000000000000000000900460ff161515600114610b55576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603d60248201527f4552524f523a2043616e27742073657420746865207768697465206c6973742060448201527f746f2061206e6f6e2d77686974656c697374656420636f6e74726163740000006064820152608401610491565b6000805b82518163ffffffff161015610bf457610bb7838263ffffffff1681518110610baa577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015161171a565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610be257600191505b80610bec816123c8565b915050610b59565b508015610c83576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4552524f523a204f6e65206f72206d6f726520706c617965727320697320616c60448201527f726561647920696e2077686974656c69737400000000000000000000000000006064820152608401610491565b8151610c9690600d906020850190611dfd565b507fb1565d66d9899787abe67ac307850cf339a24f69de2bf7ffa4179e0eaeb939b082426040516107fb9291906121fc565b6000610cd38261171a565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff141590505b919050565b6060600d805480602002602001604051908101604052809291908181526020018280548015610d6357602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610d38575b5050505050905090565b60078181548110610d7d57600080fd5b9060005260206000209060030201600091509050806000018054610da09061233b565b80601f0160208091040260200160405190810160405280929190818152602001828054610dcc9061233b565b8015610e195780601f10610dee57610100808354040283529160200191610e19565b820191906000526020600020905b815481529060010190602001808311610dfc57829003601f168201915b505050506001830154600290930154919273ffffffffffffffffffffffffffffffffffffffff1691905083565b60055473ffffffffffffffffffffffffffffffffffffffff163314610ec7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4552524f523a2053656e646572206e6f7420676f7665726e00000000000000006044820152606401610491565b8351610f2f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4552524f523a204e6f2065766964656e636500000000000000000000000000006044820152606401610491565b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b158015610f9957600080fd5b505afa158015610fad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fd1919061211b565b905081156110675760085460035473ffffffffffffffffffffffffffffffffffffffff9081169116141561101a5760095460009061101090839061181b565b945061101e915050565b8092505b600a5460035473ffffffffffffffffffffffffffffffffffffffff9081169116141561106757600d54600b546000916110629161105b91906122bb565b859061181b565b945050505b60085460035473ffffffffffffffffffffffffffffffffffffffff90811691161415611133576000611099828561181b565b915050600860010154811015611131576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f4552524f523a2053686f756c64206e6f742065786365656420616c6c6f77656460448201527f20626f756e7479000000000000000000000000000000000000000000000000006064820152608401610491565b505b821561115d5760035461115d9073ffffffffffffffffffffffffffffffffffffffff168585611841565b6040805160608101825286815273ffffffffffffffffffffffffffffffffffffffff86166020808301919091529181018590526007805460018101825560009190915281518051929360039092027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68801926111db9284920190611e87565b5060208201516001820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091179055604091820151600290910155517fa1c3b325aa2c115e4b244062eba2515bc5585ae5b41556be8fef399ae9fde11b9061126590879087908790612231565b60405180910390a15050505050565b600280546112819061233b565b80601f01602080910402602001604051908101604052809291908181526020018280546112ad9061233b565b80156112fa5780601f106112cf576101008083540402835291602001916112fa565b820191906000526020600020905b8154815290600101906020018083116112dd57829003601f168201915b505050505081565b6006547801000000000000000000000000000000000000000000000000900460ff16156113b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603760248201527f4552524f523a2043616e27742073656c6620726567697374657220616e64207060448201527f6c617920612077686974656c69737465642051756573740000000000000000006064820152608401610491565b3373ffffffffffffffffffffffffffffffffffffffff821614806113ec575060005473ffffffffffffffffffffffffffffffffffffffff1633145b611477576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f4552524f523a2053656e646572206e6f7420706c61796572206e6f722063726560448201527f61746f72000000000000000000000000000000000000000000000000000000006064820152608401610491565b60065474010000000000000000000000000000000000000000900463ffffffff1615806114c65750600654600d547401000000000000000000000000000000000000000090910463ffffffff16115b61152c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f4552524f523a204d617820706c617965727320726561636865640000000000006044820152606401610491565b6004544210611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4552524f523a20517565737420657870697265640000000000000000000000006044820152606401610491565b60006115a28261171a565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1461162d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4552524f523a20506c6179657220616c726561647920657869737473000000006044820152606401610491565b60408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b54602082015261166590333061191a565b600d80546001810182556000919091527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb50180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8416908117909155604080519182524260208301527f35ec60f951b4abc8b287ab5148caf98524052482927d42e86a720cc71b8a76a191016107fb565b600180546112819061233b565b6000805b600d548110156117ba578273ffffffffffffffffffffffffffffffffffffffff16600d8281548110611779577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614156117a8579050610cf9565b806117b28161238f565b91505061171e565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92915050565b60208201511561181757602082015182516118179173ffffffffffffffffffffffffffffffffffffffff909116908390611841565b5050565b600080838311156118315750600090508061183a565b50600190508183035b9250929050565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526119159084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261192e565b505050565b6119248383611a3d565b61191583826117e2565b6000611990826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611b8d9092919063ffffffff16565b90508051600014806119b15750808060200190518101906119b1919061200e565b611915576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610491565b6020820151156118175781516040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8381166004830152306024830152600092169063dd62ed3e9060440160206040518083038186803b158015611ab857600080fd5b505afa158015611acc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611af0919061211b565b90508260200151811015611b60576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4552524f52203a204465706f7369742062616420616c6c6f77616e63650000006044820152606401610491565b602083015183516119159173ffffffffffffffffffffffffffffffffffffffff9091169084903090611ba4565b6060611b9c8484600085611c08565b949350505050565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052611c029085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401611893565b50505050565b606082471015611c9a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610491565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051611cc391906121cd565b60006040518083038185875af1925050503d8060008114611d00576040519150601f19603f3d011682016040523d82523d6000602084013e611d05565b606091505b5091509150611d1687838387611d21565b979650505050505050565b60608315611db4578251611dad5773ffffffffffffffffffffffffffffffffffffffff85163b611dad576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610491565b5081611b9c565b611b9c8383815115611dc95781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610491919061221e565b828054828255906000526020600020908101928215611e77579160200282015b82811115611e7757825182547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909116178255602090920191600190910190611e1d565b50611e83929150611efb565b5090565b828054611e939061233b565b90600052602060002090601f016020900481019282611eb55760008555611e77565b82601f10611ece57805160ff1916838001178555611e77565b82800160010185558215611e77579182015b82811115611e77578251825591602001919060010190611ee0565b5b80821115611e835760008155600101611efc565b803573ffffffffffffffffffffffffffffffffffffffff81168114610cf957600080fd5b8035610cf98161244a565b600060208284031215611f50578081fd5b611f5982611f10565b9392505050565b60006020808385031215611f72578182fd5b823567ffffffffffffffff80821115611f89578384fd5b818501915085601f830112611f9c578384fd5b813581811115611fae57611fae61241b565b8381029150611fbe84830161226c565b8181528481019084860184860187018a1015611fd8578788fd5b8795505b8386101561200157611fed81611f10565b835260019590950194918601918601611fdc565b5098975050505050505050565b60006020828403121561201f578081fd5b8151611f598161244a565b6000806000806080858703121561203f578283fd5b843567ffffffffffffffff80821115612056578485fd5b818701915087601f830112612069578485fd5b813560208282111561207d5761207d61241b565b6120ad817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8501160161226c565b925081835289818386010111156120c2578687fd5b8181850182850137868183850101528297506120df818a01611f10565b965050505050604085013591506120f860608601611f34565b905092959194509250565b600060208284031215612114578081fd5b5035919050565b60006020828403121561212c578081fd5b5051919050565b6000815180845260208085019450808401835b8381101561217857815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101612146565b509495945050505050565b6000815180845261219b81602086016020860161230f565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600082516121df81846020870161230f565b9190910192915050565b600060208252611f596020830184612133565b60006040825261220f6040830185612133565b90508260208301529392505050565b600060208252611f596020830184612183565b6000606082526122446060830186612183565b73ffffffffffffffffffffffffffffffffffffffff9490941660208301525060400152919050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156122b3576122b361241b565b604052919050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156122f3576122f36123ec565b500290565b60008282101561230a5761230a6123ec565b500390565b60005b8381101561232a578181015183820152602001612312565b83811115611c025750506000910152565b60028104600182168061234f57607f821691505b60208210811415612389577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156123c1576123c16123ec565b5060010190565b600063ffffffff808316818114156123e2576123e26123ec565b6001019392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b80151581146109f857600080fdfea26469706673582212201d95e7743bcb101068cc9a865b5573cbcd2079b13e70e82b4992d89773670e1c64736f6c63430008020033"; + "0x60806040523480156200001157600080fd5b5060405162002acb38038062002acb833981016040819052620000349162000423565b8060c0015180156200005057506000816020015163ffffffff16115b15620000e35760405162461bcd60e51b815260206004820152605260248201527f4552524f523a2043616e27742063726561746520612077686974654c6973746560448201527f642071756573742077697468206d617820706c61796572732067726561746572606482015271207468616e20302028696e66696e6974792960701b608482015260a40160405180910390fd5b8451620000f8906001906020880190620001f1565b5083516200010e906002906020870190620001f1565b506040810151600380546001600160a01b03199081166001600160a01b03938416179091556060830151600455608083015160058054831691841691909117905560a083015160068054855160008054861691871691909117905587516008805486169187169190911790556020978801516009558651600a8054861691871691909117905595870151600b55600c805460ff191690559584015160c0909401519490911691161763ffffffff60a01b1916600160a01b63ffffffff909216919091021760ff60c01b1916600160c01b9115159190910217905550620005909050565b828054620001ff9062000524565b90600052602060002090601f0160209004810192826200022357600085556200026e565b82601f106200023e57805160ff19168380011785556200026e565b828001600101855582156200026e579182015b828111156200026e57825182559160200191906001019062000251565b506200027c92915062000280565b5090565b5b808211156200027c576000815560010162000281565b60006001600160401b03831115620002b357620002b362000561565b6020620002c9601f8501601f19168201620004f1565b9150838252848484011115620002de57600080fd5b60005b84811015620002fc57838101518382018301528101620002e1565b848111156200030e5760008286850101525b50509392505050565b8051620003248162000577565b919050565b805180151581146200032457600080fd5b6000604082840312156200034c578081fd5b620003586040620004f1565b90508151620003678162000577565b808252506020820151602082015292915050565b600060e082840312156200038d578081fd5b6200039960e0620004f1565b90508151620003a88162000577565b8152602082015163ffffffff81168114620003c257600080fd5b6020820152620003d56040830162000317565b604082015260608201516060820152620003f26080830162000317565b60808201526200040560a0830162000317565b60a08201526200041860c0830162000329565b60c082015292915050565b60008060008060006101a086880312156200043c578081fd5b85516001600160401b038082111562000453578283fd5b818801915088601f83011262000467578283fd5b620004788983516020850162000297565b965060208801519150808211156200048e578283fd5b508601601f81018813620004a0578182fd5b620004b18882516020840162000297565b945050620004c387604088016200033a565b9250620004d487608088016200033a565b9150620004e58760c088016200037b565b90509295509295909350565b604051601f8201601f191681016001600160401b03811182821017156200051c576200051c62000561565b604052919050565b6002810460018216806200053957607f821691505b602082108114156200055b57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146200058d57600080fd5b50565b61252b80620005a06000396000f3fe608060405234801561001057600080fd5b506004361061016c5760003560e01c80638b5b9ccc116100cd578063d03ffefb11610081578063e492814f11610066578063e492814f146103ab578063f294cf38146103be578063f7c618c1146103c65761016c565b8063d03ffefb14610372578063e0c23423146103965761016c565b8063a888c2cd116100b2578063a888c2cd1461031d578063b0a87ac11461033f578063b434151c1461035f5761016c565b80638b5b9ccc146102b85780638c53c9bd146102cd5761016c565b8063579ca2c911610124578063775b9c1311610109578063775b9c13146102725780637ceae3101461028557806385c99e2b146102a55761016c565b8063579ca2c9146102255780636c3a4cce1461022d5761016c565b8063310a1ee311610155578063310a1ee3146101c457806348d6cb53146101db5780634c2412a2146101e85761016c565b8063151dfb06146101715780632f17b18214610186575b600080fd5b61018461017f366004612000565b6103e6565b005b6006546101af907801000000000000000000000000000000000000000000000000900460ff1681565b60405190151581526020015b60405180910390f35b6101cd60045481565b6040519081526020016101bb565b600c546101af9060ff1681565b6006546102109074010000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff90911681526020016101bb565b610184610807565b60005461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101bb565b610184610280366004612021565b610a26565b60065461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b6101af6102b3366004612000565b610d5e565b6102c0610d94565b6040516101bb91906122aa565b600a54600b546102f19173ffffffffffffffffffffffffffffffffffffffff169082565b6040805173ffffffffffffffffffffffffffffffffffffffff90931683526020830191909152016101bb565b61033061032b3660046121c4565b610e03565b6040516101bb939291906122f2565b60055461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b61018461036d3660046120eb565b610edc565b6008546009546102f19173ffffffffffffffffffffffffffffffffffffffff169082565b61039e611335565b6040516101bb91906122df565b6101846103b9366004612000565b6113c3565b61039e6117ce565b60035461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b6006547801000000000000000000000000000000000000000000000000900460ff161561049a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f4552524f523a2063616e277420756e706c617920612077686974656c6973746560448201527f642071756573740000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff821614806104d5575060005473ffffffffffffffffffffffffffffffffffffffff1633145b610560576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f4552524f523a2053656e646572206e6f7420706c61796572206e6f722063726560448201527f61746f72000000000000000000000000000000000000000000000000000000006064820152608401610491565b600061056b826117db565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14156105f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4552524f523a20706c61796572206e6f7420696e206c697374000000000000006044820152606401610491565b600d8054610607906001906123b9565b8154811061063e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260209091200154600d805473ffffffffffffffffffffffffffffffffffffffff909216918390811061069e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d80548061071e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b600082815260209081902082017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905590910190915560408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b54918101919091526107b490836118a3565b6040805173ffffffffffffffffffffffffffffffffffffffff841681524260208201527fc4a67a0877d477de99d765a3d9f48abfbe6181dff4727d68c3cb60715555417591015b60405180910390a15050565b600454421015610873576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4552524f523a204e6f74206578706972656400000000000000000000000000006044820152606401610491565b600c5460ff166108e5576000546040805180820190915260085473ffffffffffffffffffffffffffffffffffffffff908116825260095460208301526108b992166118a3565b600c80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b15801561094f57600080fd5b505afa158015610963573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098791906121dc565b600a5460035491925073ffffffffffffffffffffffffffffffffffffffff91821691161480156109d657506006547801000000000000000000000000000000000000000000000000900460ff16155b156109f957600d54600b546109f5916109ee9161237c565b82906118dc565b9150505b600654600354610a239173ffffffffffffffffffffffffffffffffffffffff918216911683611902565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610acd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f4f6e6c792063726561746f722063616e2063616c6c20746869732066756e637460448201527f696f6e00000000000000000000000000000000000000000000000000000000006064820152608401610491565b6006547801000000000000000000000000000000000000000000000000900460ff161515600114610b80576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603d60248201527f4552524f523a2043616e27742073657420746865207768697465206c6973742060448201527f746f2061206e6f6e2d77686974656c697374656420636f6e74726163740000006064820152608401610491565b6000805b8251811015610c8a576000838281518110610bc8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151905060005b8451811015610c7557828114158015610c595750848181518110610c22577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15610c6357600193505b80610c6d81612450565b915050610bd5565b50508080610c8290612450565b915050610b84565b508015610d19576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4552524f523a204f6e65206f72206d6f726520706c617965727320697320616c60448201527f726561647920696e2077686974656c69737400000000000000000000000000006064820152608401610491565b8151610d2c90600d906020850190611ebe565b507fb1565d66d9899787abe67ac307850cf339a24f69de2bf7ffa4179e0eaeb939b082426040516107fb9291906122bd565b6000610d69826117db565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff141590505b919050565b6060600d805480602002602001604051908101604052809291908181526020018280548015610df957602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610dce575b5050505050905090565b60078181548110610e1357600080fd5b9060005260206000209060030201600091509050806000018054610e36906123fc565b80601f0160208091040260200160405190810160405280929190818152602001828054610e62906123fc565b8015610eaf5780601f10610e8457610100808354040283529160200191610eaf565b820191906000526020600020905b815481529060010190602001808311610e9257829003601f168201915b505050506001830154600290930154919273ffffffffffffffffffffffffffffffffffffffff1691905083565b60055473ffffffffffffffffffffffffffffffffffffffff163314610f5d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4552524f523a2053656e646572206e6f7420676f7665726e00000000000000006044820152606401610491565b8351610fc5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4552524f523a204e6f2065766964656e636500000000000000000000000000006044820152606401610491565b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b15801561102f57600080fd5b505afa158015611043573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106791906121dc565b905081156111285760085460035473ffffffffffffffffffffffffffffffffffffffff908116911614156110b0576009546000906110a69083906118dc565b94506110b4915050565b8092505b600a5460035473ffffffffffffffffffffffffffffffffffffffff908116911614801561110057506006547801000000000000000000000000000000000000000000000000900460ff16155b1561112857600d54600b546000916111239161111c919061237c565b85906118dc565b945050505b60085460035473ffffffffffffffffffffffffffffffffffffffff908116911614156111f457600061115a82856118dc565b9150506008600101548110156111f2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f4552524f523a2053686f756c64206e6f742065786365656420616c6c6f77656460448201527f20626f756e7479000000000000000000000000000000000000000000000000006064820152608401610491565b505b821561121e5760035461121e9073ffffffffffffffffffffffffffffffffffffffff168585611902565b6040805160608101825286815273ffffffffffffffffffffffffffffffffffffffff86166020808301919091529181018590526007805460018101825560009190915281518051929360039092027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c688019261129c9284920190611f48565b5060208201516001820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091179055604091820151600290910155517fa1c3b325aa2c115e4b244062eba2515bc5585ae5b41556be8fef399ae9fde11b90611326908790879087906122f2565b60405180910390a15050505050565b60028054611342906123fc565b80601f016020809104026020016040519081016040528092919081815260200182805461136e906123fc565b80156113bb5780601f10611390576101008083540402835291602001916113bb565b820191906000526020600020905b81548152906001019060200180831161139e57829003601f168201915b505050505081565b6006547801000000000000000000000000000000000000000000000000900460ff1615611472576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603760248201527f4552524f523a2043616e27742073656c6620726567697374657220616e64207060448201527f6c617920612077686974656c69737465642051756573740000000000000000006064820152608401610491565b3373ffffffffffffffffffffffffffffffffffffffff821614806114ad575060005473ffffffffffffffffffffffffffffffffffffffff1633145b611538576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f4552524f523a2053656e646572206e6f7420706c61796572206e6f722063726560448201527f61746f72000000000000000000000000000000000000000000000000000000006064820152608401610491565b60065474010000000000000000000000000000000000000000900463ffffffff1615806115875750600654600d547401000000000000000000000000000000000000000090910463ffffffff16115b6115ed576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f4552524f523a204d617820706c617965727320726561636865640000000000006044820152606401610491565b6004544210611658576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4552524f523a20517565737420657870697265640000000000000000000000006044820152606401610491565b6000611663826117db565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff146116ee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4552524f523a20506c6179657220616c726561647920657869737473000000006044820152606401610491565b60408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b5460208201526117269033306119db565b600d80546001810182556000919091527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb50180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8416908117909155604080519182524260208301527f35ec60f951b4abc8b287ab5148caf98524052482927d42e86a720cc71b8a76a191016107fb565b60018054611342906123fc565b6000805b600d5481101561187b578273ffffffffffffffffffffffffffffffffffffffff16600d828154811061183a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff161415611869579050610d8f565b8061187381612450565b9150506117df565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92915050565b6020820151156118d857602082015182516118d89173ffffffffffffffffffffffffffffffffffffffff909116908390611902565b5050565b600080838311156118f2575060009050806118fb565b50600190508183035b9250929050565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526119d69084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526119ef565b505050565b6119e58383611afe565b6119d683826118a3565b6000611a51826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611c4e9092919063ffffffff16565b9050805160001480611a72575080806020019051810190611a7291906120cf565b6119d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610491565b6020820151156118d85781516040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8381166004830152306024830152600092169063dd62ed3e9060440160206040518083038186803b158015611b7957600080fd5b505afa158015611b8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bb191906121dc565b90508260200151811015611c21576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4552524f52203a204465706f7369742062616420616c6c6f77616e63650000006044820152606401610491565b602083015183516119d69173ffffffffffffffffffffffffffffffffffffffff9091169084903090611c65565b6060611c5d8484600085611cc9565b949350505050565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052611cc39085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401611954565b50505050565b606082471015611d5b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610491565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051611d84919061228e565b60006040518083038185875af1925050503d8060008114611dc1576040519150601f19603f3d011682016040523d82523d6000602084013e611dc6565b606091505b5091509150611dd787838387611de2565b979650505050505050565b60608315611e75578251611e6e5773ffffffffffffffffffffffffffffffffffffffff85163b611e6e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610491565b5081611c5d565b611c5d8383815115611e8a5781518083602001fd5b806040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161049191906122df565b828054828255906000526020600020908101928215611f38579160200282015b82811115611f3857825182547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909116178255602090920191600190910190611ede565b50611f44929150611fbc565b5090565b828054611f54906123fc565b90600052602060002090601f016020900481019282611f765760008555611f38565b82601f10611f8f57805160ff1916838001178555611f38565b82800160010185558215611f38579182015b82811115611f38578251825591602001919060010190611fa1565b5b80821115611f445760008155600101611fbd565b803573ffffffffffffffffffffffffffffffffffffffff81168114610d8f57600080fd5b8035610d8f816124e7565b600060208284031215612011578081fd5b61201a82611fd1565b9392505050565b60006020808385031215612033578182fd5b823567ffffffffffffffff8082111561204a578384fd5b818501915085601f83011261205d578384fd5b81358181111561206f5761206f6124b8565b838102915061207f84830161232d565b8181528481019084860184860187018a1015612099578788fd5b8795505b838610156120c2576120ae81611fd1565b83526001959095019491860191860161209d565b5098975050505050505050565b6000602082840312156120e0578081fd5b815161201a816124e7565b60008060008060808587031215612100578283fd5b843567ffffffffffffffff80821115612117578485fd5b818701915087601f83011261212a578485fd5b813560208282111561213e5761213e6124b8565b61216e817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8501160161232d565b92508183528981838601011115612183578687fd5b8181850182850137868183850101528297506121a0818a01611fd1565b965050505050604085013591506121b960608601611ff5565b905092959194509250565b6000602082840312156121d5578081fd5b5035919050565b6000602082840312156121ed578081fd5b5051919050565b6000815180845260208085019450808401835b8381101561223957815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101612207565b509495945050505050565b6000815180845261225c8160208601602086016123d0565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600082516122a08184602087016123d0565b9190910192915050565b60006020825261201a60208301846121f4565b6000604082526122d060408301856121f4565b90508260208301529392505050565b60006020825261201a6020830184612244565b6000606082526123056060830186612244565b73ffffffffffffffffffffffffffffffffffffffff9490941660208301525060400152919050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715612374576123746124b8565b604052919050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156123b4576123b4612489565b500290565b6000828210156123cb576123cb612489565b500390565b60005b838110156123eb5781810151838201526020016123d3565b83811115611cc35750506000910152565b60028104600182168061241057607f821691505b6020821081141561244a577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561248257612482612489565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b8015158114610a2357600080fdfea26469706673582212204eb3f233eed5fefb3d1f4c5541d3001cc0d8a4109bd90cca624a823385b379a164736f6c63430008020033"; diff --git a/packages/hardhat/typechain/factories/TokenMock__factory.ts b/packages/hardhat/typechain/factories/TokenMock__factory.ts index c156d424..9f973024 100644 --- a/packages/hardhat/typechain/factories/TokenMock__factory.ts +++ b/packages/hardhat/typechain/factories/TokenMock__factory.ts @@ -353,4 +353,4 @@ const _abi = [ ]; const _bytecode = - "0x608060405260405162000ec738038062000ec78339810160408190526200002691620001b9565b8151829082906200003f90600390602085019062000060565b5080516200005590600490602084019062000060565b505050505062000273565b8280546200006e9062000220565b90600052602060002090601f016020900481019282620000925760008555620000dd565b82601f10620000ad57805160ff1916838001178555620000dd565b82800160010185558215620000dd579182015b82811115620000dd578251825591602001919060010190620000c0565b50620000eb929150620000ef565b5090565b5b80821115620000eb5760008155600101620000f0565b600082601f83011262000117578081fd5b81516001600160401b03808211156200013457620001346200025d565b604051601f8301601f19908116603f011681019082821181831017156200015f576200015f6200025d565b816040528381526020925086838588010111156200017b578485fd5b8491505b838210156200019e57858201830151818301840152908201906200017f565b83821115620001af57848385830101525b9695505050505050565b60008060408385031215620001cc578182fd5b82516001600160401b0380821115620001e3578384fd5b620001f18683870162000106565b9350602085015191508082111562000207578283fd5b50620002168582860162000106565b9150509250929050565b6002810460018216806200023557607f821691505b602082108114156200025757634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b610c4480620002836000396000f3fe608060405234801561001057600080fd5b50600436106100d45760003560e01c806340c10f1911610081578063a457c2d71161005b578063a457c2d714610191578063a9059cbb146101a4578063dd62ed3e146101b7576100d4565b806340c10f191461016157806370a082311461017657806395d89b4114610189576100d4565b806323b872dd116100b257806323b872dd1461012c578063313ce5671461013f578063395093511461014e576100d4565b806306fdde03146100d9578063095ea7b3146100f757806318160ddd1461011a575b600080fd5b6100e16101fd565b6040516100ee9190610b0c565b60405180910390f35b61010a610105366004610ae3565b61028f565b60405190151581526020016100ee565b6002545b6040519081526020016100ee565b61010a61013a366004610aa8565b6102a7565b604051601281526020016100ee565b61010a61015c366004610ae3565b6102cb565b61017461016f366004610ae3565b610317565b005b61011e610184366004610a55565b610325565b6100e1610351565b61010a61019f366004610ae3565b610360565b61010a6101b2366004610ae3565b610436565b61011e6101c5366004610a76565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b60606003805461020c90610bba565b80601f016020809104026020016040519081016040528092919081815260200182805461023890610bba565b80156102855780601f1061025a57610100808354040283529160200191610285565b820191906000526020600020905b81548152906001019060200180831161026857829003601f168201915b5050505050905090565b60003361029d818585610444565b5060019392505050565b6000336102b58582856105f7565b6102c08585856106ce565b506001949350505050565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919061029d9082908690610312908790610b7d565b610444565b610321828261093d565b5050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152602081905260409020545b919050565b60606004805461020c90610bba565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919083811015610429576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6102c08286868403610444565b60003361029d8185856106ce565b73ffffffffffffffffffffffffffffffffffffffff83166104e6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610420565b73ffffffffffffffffffffffffffffffffffffffff8216610589576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610420565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146106c857818110156106bb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610420565b6106c88484848403610444565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610771576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610420565b73ffffffffffffffffffffffffffffffffffffffff8216610814576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610420565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260208190526040902054818110156108ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610420565b73ffffffffffffffffffffffffffffffffffffffff848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a36106c8565b73ffffffffffffffffffffffffffffffffffffffff82166109ba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610420565b80600260008282546109cc9190610b7d565b909155505073ffffffffffffffffffffffffffffffffffffffff8216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610321565b803573ffffffffffffffffffffffffffffffffffffffff8116811461034c57600080fd5b600060208284031215610a66578081fd5b610a6f82610a31565b9392505050565b60008060408385031215610a88578081fd5b610a9183610a31565b9150610a9f60208401610a31565b90509250929050565b600080600060608486031215610abc578081fd5b610ac584610a31565b9250610ad360208501610a31565b9150604084013590509250925092565b60008060408385031215610af5578182fd5b610afe83610a31565b946020939093013593505050565b6000602080835283518082850152825b81811015610b3857858101830151858201604001528201610b1c565b81811115610b495783604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b60008219821115610bb5577f4e487b710000000000000000000000000000000000000000000000000000000081526011600452602481fd5b500190565b600281046001821680610bce57607f821691505b60208210811415610c08577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b5091905056fea2646970667358221220641b0bae79b071168299277ea848fb84314d7fb43ff1c355649676e049400a1b64736f6c63430008020033"; + "0x608060405260405162000ec738038062000ec78339810160408190526200002691620001b9565b8151829082906200003f90600390602085019062000060565b5080516200005590600490602084019062000060565b505050505062000273565b8280546200006e9062000220565b90600052602060002090601f016020900481019282620000925760008555620000dd565b82601f10620000ad57805160ff1916838001178555620000dd565b82800160010185558215620000dd579182015b82811115620000dd578251825591602001919060010190620000c0565b50620000eb929150620000ef565b5090565b5b80821115620000eb5760008155600101620000f0565b600082601f83011262000117578081fd5b81516001600160401b03808211156200013457620001346200025d565b604051601f8301601f19908116603f011681019082821181831017156200015f576200015f6200025d565b816040528381526020925086838588010111156200017b578485fd5b8491505b838210156200019e57858201830151818301840152908201906200017f565b83821115620001af57848385830101525b9695505050505050565b60008060408385031215620001cc578182fd5b82516001600160401b0380821115620001e3578384fd5b620001f18683870162000106565b9350602085015191508082111562000207578283fd5b50620002168582860162000106565b9150509250929050565b6002810460018216806200023557607f821691505b602082108114156200025757634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b610c4480620002836000396000f3fe608060405234801561001057600080fd5b50600436106100d45760003560e01c806340c10f1911610081578063a457c2d71161005b578063a457c2d714610191578063a9059cbb146101a4578063dd62ed3e146101b7576100d4565b806340c10f191461016157806370a082311461017657806395d89b4114610189576100d4565b806323b872dd116100b257806323b872dd1461012c578063313ce5671461013f578063395093511461014e576100d4565b806306fdde03146100d9578063095ea7b3146100f757806318160ddd1461011a575b600080fd5b6100e16101fd565b6040516100ee9190610b0c565b60405180910390f35b61010a610105366004610ae3565b61028f565b60405190151581526020016100ee565b6002545b6040519081526020016100ee565b61010a61013a366004610aa8565b6102a7565b604051601281526020016100ee565b61010a61015c366004610ae3565b6102cb565b61017461016f366004610ae3565b610317565b005b61011e610184366004610a55565b610325565b6100e1610351565b61010a61019f366004610ae3565b610360565b61010a6101b2366004610ae3565b610436565b61011e6101c5366004610a76565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b60606003805461020c90610bba565b80601f016020809104026020016040519081016040528092919081815260200182805461023890610bba565b80156102855780601f1061025a57610100808354040283529160200191610285565b820191906000526020600020905b81548152906001019060200180831161026857829003601f168201915b5050505050905090565b60003361029d818585610444565b5060019392505050565b6000336102b58582856105f7565b6102c08585856106ce565b506001949350505050565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919061029d9082908690610312908790610b7d565b610444565b610321828261093d565b5050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152602081905260409020545b919050565b60606004805461020c90610bba565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919083811015610429576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6102c08286868403610444565b60003361029d8185856106ce565b73ffffffffffffffffffffffffffffffffffffffff83166104e6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610420565b73ffffffffffffffffffffffffffffffffffffffff8216610589576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610420565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146106c857818110156106bb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610420565b6106c88484848403610444565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610771576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610420565b73ffffffffffffffffffffffffffffffffffffffff8216610814576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610420565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260208190526040902054818110156108ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610420565b73ffffffffffffffffffffffffffffffffffffffff848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a36106c8565b73ffffffffffffffffffffffffffffffffffffffff82166109ba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610420565b80600260008282546109cc9190610b7d565b909155505073ffffffffffffffffffffffffffffffffffffffff8216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610321565b803573ffffffffffffffffffffffffffffffffffffffff8116811461034c57600080fd5b600060208284031215610a66578081fd5b610a6f82610a31565b9392505050565b60008060408385031215610a88578081fd5b610a9183610a31565b9150610a9f60208401610a31565b90509250929050565b600080600060608486031215610abc578081fd5b610ac584610a31565b9250610ad360208501610a31565b9150604084013590509250925092565b60008060408385031215610af5578182fd5b610afe83610a31565b946020939093013593505050565b6000602080835283518082850152825b81811015610b3857858101830151858201604001528201610b1c565b81811115610b495783604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b60008219821115610bb5577f4e487b710000000000000000000000000000000000000000000000000000000081526011600452602481fd5b500190565b600281046001821680610bce57607f821691505b60208210811415610c08577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b5091905056fea26469706673582212205736dd923321a5d60220ed8346a2be0440f03acac5b3578fe15792cf63d5d11d64736f6c63430008020033"; diff --git a/packages/react-app/.eslintrc.json b/packages/react-app/.eslintrc.json index 156bb612..8acc9992 100644 --- a/packages/react-app/.eslintrc.json +++ b/packages/react-app/.eslintrc.json @@ -5,7 +5,11 @@ "browser": true, "node": true }, - "extends": ["plugin:react/recommended", "airbnb", "prettier"], + "extends": [ + "plugin:react/recommended", + "airbnb", + "prettier" + ], "parser": "@typescript-eslint/parser", "parserOptions": { "ecmaFeatures": { @@ -14,7 +18,11 @@ "ecmaVersion": 12, "sourceType": "module" }, - "plugins": ["react", "@typescript-eslint", "prettier"], + "plugins": [ + "react", + "@typescript-eslint", + "prettier" + ], "rules": { "prettier/prettier": [ "error", @@ -23,7 +31,14 @@ } ], "radix": 0, - "react/jsx-filename-extension": ["warn", { "extensions": [".tsx"] }], + "react/jsx-filename-extension": [ + "warn", + { + "extensions": [ + ".tsx" + ] + } + ], "import/extensions": [ "error", "ignorePackages", @@ -43,15 +58,28 @@ "jsx-props-no-spreading": "off", "react/jsx-props-no-spreading": "off", "react/state-in-constructor": "off", - "no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }], + "no-unused-vars": [ + "warn", + { + "argsIgnorePattern": "^_" + } + ], "no-debugger": "warn", - "react/no-unknown-property": ["error", { "ignore": ["css"] }], + "react/no-unknown-property": [ + "error", + { + "ignore": [ + "css" + ] + } + ], "no-shadow": "off", - "@typescript-eslint/no-shadow": "error" + "@typescript-eslint/no-shadow": "error", + "import/order": "off" }, "settings": { "import/resolver": { "typescript": {} } } -} +} \ No newline at end of file diff --git a/packages/react-app/src/components/claim.tsx b/packages/react-app/src/components/claim.tsx index 6f0aa10c..bdb02626 100644 --- a/packages/react-app/src/components/claim.tsx +++ b/packages/react-app/src/components/claim.tsx @@ -125,9 +125,12 @@ export default function Claim({ claim, isLoading, challengeDeposit, questData }: { // Second arg is the dispute resolution result const newState = + // eslint-disable-next-line no-nested-ternary transaction.args.disputeState === DisputeStatus.DisputeRuledForChallenger ? ClaimStatus.Rejected - : ClaimStatus.Executed; + : transaction.args.disputeState === DisputeStatus.DisputeRuledForSubmitter + ? ClaimStatus.Executed + : ClaimStatus.Cancelled; setStatus(newState); } break; diff --git a/packages/react-app/src/components/field-input/address-list-field-input.tsx b/packages/react-app/src/components/field-input/address-list-field-input.tsx index 1255cab2..4b9aa28c 100644 --- a/packages/react-app/src/components/field-input/address-list-field-input.tsx +++ b/packages/react-app/src/components/field-input/address-list-field-input.tsx @@ -57,13 +57,18 @@ export default function AddressListFieldInput({ ); const addPlayerToWhitelist = () => { - setValueState([...valueState, { key: Math.random().toString(), value: '' }]); - onChange(isFormik ? createEventWithValue() : valueState.map((x) => x.value)); + const newList = [...valueState, { key: Math.random().toString(), value: '' }]; + setValueState(newList); + onChange(isFormik ? createEventWithValue() : newList.map((x) => x.value)); }; const removePlayerFromWhitelist = (indexToRemove: number) => { - setValueState([...valueState.filter((_, index) => index !== indexToRemove)]); - onChange(isFormik ? createEventWithValue() : valueState.map((x) => x.value)); + const newList = [...valueState.filter((_, index) => index !== indexToRemove)]; + if (newList.length === 0) { + newList.push({ key: Math.random().toString(), value: '' }); + } + setValueState(newList); + onChange(isFormik ? createEventWithValue() : newList.map((x) => x.value)); }; const handleChange = (v: string, i: number) => { @@ -73,7 +78,7 @@ export default function AddressListFieldInput({ if (isFormik) { onChange(createEventWithValue()); } else { - onChange(valueState.map((x) => x.value)); + onChange(newList.map((x) => x.value)); } }; @@ -107,13 +112,7 @@ export default function AddressListFieldInput({ onBlur={onBlur} wide /> - {isEdit && ( -