diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 374fb5e1..03f555e7 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -22,7 +22,7 @@ jobs: - name: Case Sensitivity Checker uses: credfeto/action-case-checker@v1.1 - name: Install - run: yarn ci + run: yarn install - name: Lint run: yarn lint @@ -53,7 +53,7 @@ jobs: key: ${{ runner.os }}-contracts-v${{ secrets.CONTRACTS_CACHE_VERSION }}-${{ hashFiles('packages/*/contracts/**/*.sol') }} - name: Install dependencies - run: yarn ci + run: yarn install - name: Build contracts run: yarn compile diff --git a/honey-quest.code-workspace b/honey-quest.code-workspace index 517e11d5..a74e2c53 100644 --- a/honey-quest.code-workspace +++ b/honey-quest.code-workspace @@ -1,11 +1,29 @@ { "folders": [ - { "name": "WebApp", "path": "./packages/react-app" }, - { "name": "Hardhat", "path": "./packages/hardhat" }, - { "name": "Subgraph", "path": "./packages/subgraphs" }, - { "name": "Services", "path": "./packages/services" }, - { "name": "E2E", "path": "./packages/e2e" }, - { "name": "Root", "path": "." } + { + "name": "WebApp", + "path": "./packages/react-app" + }, + { + "name": "Hardhat", + "path": "./packages/hardhat" + }, + { + "name": "Subgraph", + "path": "./packages/subgraphs" + }, + { + "name": "Services", + "path": "./packages/services" + }, + { + "name": "E2E", + "path": "./packages/e2e" + }, + { + "name": "Root", + "path": "." + } ], "settings": { "typescript.tsdk": "WebApp/node_modules/typescript/lib", @@ -15,6 +33,9 @@ }, "[json]": { "editor.defaultFormatter": "vscode.json-language-features" + }, + "[properties]": { + "editor.defaultFormatter": "foxundermoon.shell-format" } }, "extensions": { @@ -26,4 +47,4 @@ "styled-components.vscode-styled-components" ] } -} +} \ No newline at end of file diff --git a/package.json b/package.json index 876cb06f..027d5c86 100644 --- a/package.json +++ b/package.json @@ -39,4 +39,4 @@ "ts-node": "^10.2.1", "typescript": "^4.4.2" } -} +} \ No newline at end of file diff --git a/packages/hardhat/.openzeppelin/goerli.json b/packages/hardhat/.openzeppelin/goerli.json new file mode 100644 index 00000000..2862eba4 --- /dev/null +++ b/packages/hardhat/.openzeppelin/goerli.json @@ -0,0 +1,768 @@ +{ + "manifestVersion": "3.2", + "admin": { + "address": "0xa7F867D22420faB2D684351b9C95f7128e138d52", + "txHash": "0x8be132f70dd70e5c0968f5a6b417f87bc75c3c0754ba876faab1b18f64d25456" + }, + "proxies": [ + { + "address": "0x6bc0CD1e98B66b5644f0720f7dF7786746628C5d", + "txHash": "0x41ea17ea8558f65e3628d0f46dac6bb0a4018588e9a942fca53dcdfedc42c7a9", + "kind": "transparent" + }, + { + "address": "0xBd66CcFceAE3836885F74295C922Da2d8cdD7940", + "txHash": "0x0686abbde2960577f4df420458f582e26cefbbaf60f1225522736cf7ad9566f9", + "kind": "transparent" + }, + { + "address": "0x3E4E6Ea969722382f76858D2eF0cf89E45a848e1", + "txHash": "0x36291cd05033fcbeab07ec5e3abbfa84036bd2a1eeace0980a332b989e933c4a", + "kind": "transparent" + }, + { + "address": "0xbfFEce7c884a488921F52Fb4dd0b0c61B77C9104", + "txHash": "0x79ea242422293cb66ecc3f08d3f929760ba90dbb1c272a3eacd9bb4c74a337c3", + "kind": "transparent" + }, + { + "address": "0x05301D6787430d26bb0D6430Bd98a59B955a27D0", + "txHash": "0xcea8f557f3c834b08b05f85965ad21d2fec5717be730ae5a0fddf016c0b7d5d7", + "kind": "transparent" + } + ], + "impls": { + "32a98c90f0fb31631d3da5e565a60b3bcf5d152d3dc81b21ecd5cc0c8c42df91": { + "address": "0xF2574ba0570E38edf3917eB7f7f1314d40609612", + "txHash": "0xed9e2a5d5913c781f2d16c62217339c4ffe12156c04a1676819e15e855142bab", + "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)3257_storage", + "contract": "QuestFactory", + "src": "contracts\\QuestFactory.sol:16" + }, + { + "label": "playDeposit", + "offset": 0, + "slot": "104", + "type": "t_struct(Deposit)3257_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)3257_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" + } + } + } + }, + "f79f007915555548f0a15b15684b2d233289de453b81e4943b45d8bc59f15406": { + "address": "0xf8f927FE67bD8b0a9B0673f4Ae9f04b2e51a5974", + "txHash": "0x56fafd877ad959504d65e4ad13ca314041ae0392350a8a87c7f6d65d461b0044", + "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)3246_storage", + "contract": "QuestFactory", + "src": "contracts\\QuestFactory.sol:16" + }, + { + "label": "playDeposit", + "offset": 0, + "slot": "104", + "type": "t_struct(Deposit)3246_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)3246_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" + } + } + } + }, + "5e9ff64d2f8c29ea479b86854efdb27d8660c24701351b95a6f3997727ae61d1": { + "address": "0x01cf8920D51B579b10e1d8CeaB2afc25708d8C15", + "txHash": "0x93edc2c4e9818257200d9919bca42993174c7f15c2b1419525a935f38d6e5d2c", + "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)2534_storage", + "contract": "QuestFactory", + "src": "contracts\\QuestFactory.sol:16" + }, + { + "label": "playDeposit", + "offset": 0, + "slot": "104", + "type": "t_struct(Deposit)2534_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)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" + } + } + } + }, + "de52b0ea94600e22bb1a04240f6f598b21211a05d4828563b15fc5a57f57de0a": { + "address": "0x9f2FD32105e18E9047E0C110D8De2bd8442eCe51", + "txHash": "0x7c0402440a6035002c44f30978473f022ca57da789cb208d77ab22fefc9f62ab", + "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)2534_storage", + "contract": "QuestFactory", + "src": "contracts\\QuestFactory.sol:16" + }, + { + "label": "playDeposit", + "offset": 0, + "slot": "104", + "type": "t_struct(Deposit)2534_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)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": [ + { + "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/.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 b2a7cfba..dfe25860 100644 --- a/packages/hardhat/contracts/Quest.sol +++ b/packages/hardhat/contracts/Quest.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: GPL-3.0 -pragma solidity ^0.8.1; +pragma solidity ^0.8.2; -import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; +import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "./libraries/Deposit.sol"; import "./libraries/Models.sol"; @@ -10,19 +10,19 @@ import "./libraries/IExecutable.sol"; contract Quest is IExecutable { using SafeMath for uint256; - using SafeERC20 for IERC20; + using SafeERC20Upgradeable for IERC20Upgradeable; using DepositLib for Models.Deposit; // Quest payload address public questCreator; string public questTitle; bytes public questDetailsRef; - IERC20 public rewardToken; + IERC20Upgradeable public rewardToken; uint256 public expireTime; address public aragonGovernAddress; address payable public fundsRecoveryAddress; uint32 public maxPlayers; // 0 for unlimited players - + bool public isWhiteList; Models.Claim[] public claims; Models.Deposit public createDeposit; Models.Deposit public playDeposit; @@ -33,31 +33,39 @@ contract Quest is IExecutable { event QuestClaimed(bytes evidence, address player, uint256 amount); event QuestPlayed(address player, uint256 timestamp); event QuestUnplayed(address player, uint256 timestamp); + event QuestWhiteListChanged(address[] whiteListPlayers, uint256 timestamp); + modifier OnlyCreator() { + require( + msg.sender == questCreator, + "Only creator can call this function" + ); + _; + } constructor( string memory _questTitle, bytes memory _questDetailsRef, - IERC20 _rewardToken, - uint256 _expireTime, - address _aragonGovernAddress, - address payable _fundsRecoveryAddress, Models.Deposit memory _createDeposit, Models.Deposit memory _playDeposit, - address _questCreator, - uint32 _maxPlayers + Models.QuestParam memory _questParam ) { + require( + !(_questParam.isWhiteList && _questParam.maxPlayers > 0), + "ERROR: Can't create a whiteListed quest with max players greater than 0 (infinity)" + ); questTitle = _questTitle; questDetailsRef = _questDetailsRef; - rewardToken = _rewardToken; - expireTime = _expireTime; - aragonGovernAddress = _aragonGovernAddress; - fundsRecoveryAddress = _fundsRecoveryAddress; - questCreator = _questCreator; + rewardToken = _questParam.rewardToken; + expireTime = _questParam.expireTime; + aragonGovernAddress = _questParam.aragonGovernAddress; + fundsRecoveryAddress = _questParam.fundsRecoveryAddress; + questCreator = _questParam.questCreator; createDeposit = _createDeposit; playDeposit = _playDeposit; isCreateDepositReleased = false; - maxPlayers = _maxPlayers; + maxPlayers = _questParam.maxPlayers; + isWhiteList = _questParam.isWhiteList; } /* @@ -92,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 ); @@ -135,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 ); @@ -169,6 +181,10 @@ contract Quest is IExecutable { * emit QuestPlayed with player and timestamp */ function play(address _player) external { + require( + isWhiteList == false, + "ERROR: Can't self register and play a whitelisted Quest" + ); require( msg.sender == _player || msg.sender == questCreator, "ERROR: Sender not player nor creator" @@ -187,6 +203,40 @@ contract Quest is IExecutable { emit QuestPlayed(_player, block.timestamp); } + /*** + * 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 { + require( + isWhiteList == true, + "ERROR: Can't set the white list to a non-whitelisted contract" + ); + + 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( + duplicatedPlayers == false, + "ERROR: One or more players is already in whitelist" + ); + + playerList = _players; + emit QuestWhiteListChanged(_players, block.timestamp); + } + /** * Unregister a player from the quest. (sender could be the player or quest creator) * @param _player Player address. @@ -197,6 +247,10 @@ contract Quest is IExecutable { * emit QuestUnplayed with player and timestamp */ function unplay(address _player) external { + require( + isWhiteList == false, + "ERROR: can't unplay a whitelisted quest" + ); require( msg.sender == _player || msg.sender == questCreator, "ERROR: Sender not player nor creator" diff --git a/packages/hardhat/contracts/QuestFactory.sol b/packages/hardhat/contracts/QuestFactory.sol index 8ff88372..ea95bca9 100644 --- a/packages/hardhat/contracts/QuestFactory.sol +++ b/packages/hardhat/contracts/QuestFactory.sol @@ -1,19 +1,21 @@ // SPDX-License-Identifier: GPL-3.0 -pragma solidity ^0.8.1; +pragma solidity ^0.8.2; -import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; -import "@openzeppelin/contracts/access/Ownable.sol"; +import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "./libraries/Deposit.sol"; import "./libraries/Models.sol"; import "./Quest.sol"; -contract QuestFactory is Ownable { +contract QuestFactory is OwnableUpgradeable { using DepositLib for Models.Deposit; address public aragonGovernAddress; Models.Deposit public createDeposit; Models.Deposit public playDeposit; + uint256 public constant version = 3; event QuestCreated( address questAddress, @@ -22,12 +24,12 @@ contract QuestFactory is Ownable { address rewardTokenAddress, uint256 expireTime, address fundsRecoveryAddress, - address createDepositToken, - uint256 createDepositAmount, - address playDepositToken, - uint256 playDepositAmount, + Models.Deposit createDeposit, + Models.Deposit playDeposit, address creator, - uint32 maxPlayers + uint32 maxPlayers, + bool isWhiteList, + uint256 version ); event CreateDepositChanged( @@ -38,20 +40,14 @@ contract QuestFactory is Ownable { event PlayDepositChanged(uint256 timestamp, address token, uint256 amount); - constructor( - address _aragonGovernAddress, - IERC20 _createDepositToken, - uint256 _createDepositAmount, - IERC20 _playDepositToken, - uint256 _playDepositAmount, - address _initialOwner - ) { + /// @custom:oz-upgrades-unsafe-allow constructor + constructor() { + _disableInitializers(); + } + + function initialize(address _aragonGovernAddress) public initializer { + __Ownable_init(); aragonGovernAddress = _aragonGovernAddress; - setCreateDeposit(_createDepositToken, _createDepositAmount); - setPlayDeposit(_playDepositToken, _playDepositAmount); - if (_initialOwner != msg.sender) { - transferOwnership(_initialOwner); - } } /* @@ -60,7 +56,10 @@ contract QuestFactory is Ownable { * @param _depositAmount The deposit amount. * emit CreateDepositChanged */ - function setCreateDeposit(IERC20 token, uint256 amount) public onlyOwner { + function setCreateDeposit( + IERC20Upgradeable token, + uint256 amount + ) public onlyOwner { createDeposit = Models.Deposit(token, amount); emit CreateDepositChanged(block.timestamp, address(token), amount); } @@ -71,7 +70,10 @@ contract QuestFactory is Ownable { * @param _depositAmount The deposit amount. * emit PlayDepositChanged */ - function setPlayDeposit(IERC20 token, uint256 amount) public onlyOwner { + function setPlayDeposit( + IERC20Upgradeable token, + uint256 amount + ) public onlyOwner { playDeposit = Models.Deposit(token, amount); emit PlayDepositChanged(block.timestamp, address(token), amount); } @@ -91,22 +93,26 @@ contract QuestFactory is Ownable { function createQuest( string memory _questTitle, bytes memory _questDetailsRef, - IERC20 _rewardToken, + IERC20Upgradeable _rewardToken, uint256 _expireTime, address payable _fundsRecoveryAddress, - uint32 _maxPlayers + uint32 _maxPlayers, + bool _isWhiteList ) external returns (address) { Quest quest = new Quest( _questTitle, _questDetailsRef, - _rewardToken, - _expireTime, - aragonGovernAddress, - _fundsRecoveryAddress, Models.Deposit(createDeposit.token, createDeposit.amount), Models.Deposit(playDeposit.token, playDeposit.amount), - msg.sender, - _maxPlayers + Models.QuestParam( + msg.sender, + _maxPlayers, + _rewardToken, + _expireTime, + aragonGovernAddress, + _fundsRecoveryAddress, + _isWhiteList + ) ); // Collect deposit from quest creator and send it to quest @@ -119,12 +125,12 @@ contract QuestFactory is Ownable { address(_rewardToken), _expireTime, _fundsRecoveryAddress, - address(createDeposit.token), - createDeposit.amount, - address(playDeposit.token), - playDeposit.amount, + createDeposit, + playDeposit, msg.sender, - _maxPlayers + _maxPlayers, + _isWhiteList, + version ); return address(quest); diff --git a/packages/hardhat/contracts/libraries/Deposit.sol b/packages/hardhat/contracts/libraries/Deposit.sol index 6595ad8f..e9b90f9b 100644 --- a/packages/hardhat/contracts/libraries/Deposit.sol +++ b/packages/hardhat/contracts/libraries/Deposit.sol @@ -1,13 +1,14 @@ // SPDX-License-Identifier: GPL-3.0 +// Solidity: Package Default Dependencies Directory = "node_modules" -pragma solidity ^0.8.1; +pragma solidity ^0.8.2; -import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; +import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; import "./Models.sol"; library DepositLib { - using SafeERC20 for IERC20; + using SafeERC20Upgradeable for IERC20Upgradeable; /* * Collect deposit from signer and send it to _to address. diff --git a/packages/hardhat/contracts/libraries/IExecutable.sol b/packages/hardhat/contracts/libraries/IExecutable.sol index 2f6adef2..5ee8ed56 100644 --- a/packages/hardhat/contracts/libraries/IExecutable.sol +++ b/packages/hardhat/contracts/libraries/IExecutable.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0 -pragma solidity ^0.8.1; +pragma solidity ^0.8.2; interface IExecutable { function canExecute(address executer) external returns (bool); diff --git a/packages/hardhat/contracts/libraries/Models.sol b/packages/hardhat/contracts/libraries/Models.sol index 55abfa23..835b4eaa 100644 --- a/packages/hardhat/contracts/libraries/Models.sol +++ b/packages/hardhat/contracts/libraries/Models.sol @@ -1,10 +1,10 @@ // SPDX-License-Identifier: GPL-3.0 -pragma solidity ^0.8.1; -import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +pragma solidity ^0.8.2; +import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; library Models { struct Deposit { - IERC20 token; + IERC20Upgradeable token; uint256 amount; } struct Claim { @@ -12,4 +12,13 @@ library Models { address player; uint256 amount; } + struct QuestParam { + address questCreator; + uint32 maxPlayers; + IERC20Upgradeable rewardToken; + uint256 expireTime; + address aragonGovernAddress; + address payable fundsRecoveryAddress; + bool isWhiteList; + } } 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 671e81a0..257494e6 100644 --- a/packages/hardhat/coverage.json +++ b/packages/hardhat/coverage.json @@ -1 +1 @@ -{"contracts\\libraries\\Deposit.sol":{"l":{"23":53,"24":51,"35":53,"37":53,"41":53,"46":51,"57":69,"58":69},"path":"C:\\Users\\gossm\\Documents\\Projects\\quests\\packages\\hardhat\\contracts\\libraries\\Deposit.sol","s":{"1":53,"2":51,"3":53,"4":53,"5":53,"6":51,"7":69,"8":69},"b":{"1":[53,0],"2":[51,2],"3":[69,0]},"f":{"1":53,"2":53,"3":69},"fnMap":{"1":{"name":"collectFrom","line":18,"loc":{"start":{"line":18,"column":4},"end":{"line":25,"column":4}}},"2":{"name":"collectFrom","line":32,"loc":{"start":{"line":32,"column":4},"end":{"line":52,"column":4}}},"3":{"name":"releaseTo","line":54,"loc":{"start":{"line":54,"column":4},"end":{"line":60,"column":4}}}},"statementMap":{"1":{"start":{"line":23,"column":8},"end":{"line":23,"column":38}},"2":{"start":{"line":24,"column":8},"end":{"line":24,"column":34}},"3":{"start":{"line":35,"column":8},"end":{"line":35,"column":988}},"4":{"start":{"line":37,"column":12},"end":{"line":37,"column":1069}},"5":{"start":{"line":41,"column":12},"end":{"line":41,"column":1201}},"6":{"start":{"line":46,"column":12},"end":{"line":46,"column":1340}},"7":{"start":{"line":57,"column":8},"end":{"line":57,"column":1606}},"8":{"start":{"line":58,"column":12},"end":{"line":58,"column":66}}},"branchMap":{"1":{"line":35,"type":"if","locations":[{"start":{"line":35,"column":8},"end":{"line":35,"column":8}},{"start":{"line":35,"column":8},"end":{"line":35,"column":8}}]},"2":{"line":41,"type":"if","locations":[{"start":{"line":41,"column":12},"end":{"line":41,"column":12}},{"start":{"line":41,"column":12},"end":{"line":41,"column":12}}]},"3":{"line":57,"type":"if","locations":[{"start":{"line":57,"column":8},"end":{"line":57,"column":8}},{"start":{"line":57,"column":8},"end":{"line":57,"column":8}}]}}},"contracts\\libraries\\IExecutable.sol":{"l":{},"path":"C:\\Users\\gossm\\Documents\\Projects\\quests\\packages\\hardhat\\contracts\\libraries\\IExecutable.sol","s":{},"b":{},"f":{},"fnMap":{},"statementMap":{},"branchMap":{}},"contracts\\libraries\\Models.sol":{"l":{},"path":"C:\\Users\\gossm\\Documents\\Projects\\quests\\packages\\hardhat\\contracts\\libraries\\Models.sol","s":{},"b":{},"f":{},"fnMap":{},"statementMap":{},"branchMap":{}},"contracts\\Quest.sol":{"l":{"49":94,"50":94,"51":94,"52":94,"53":94,"54":94,"55":94,"56":94,"57":94,"59":94,"60":94,"82":22,"83":21,"85":20,"87":20,"89":12,"90":6,"91":6,"93":6,"96":12,"97":6,"100":6,"104":20,"105":7,"106":7,"112":19,"113":19,"116":18,"118":18,"128":16,"131":15,"132":12,"133":12,"136":15,"139":15,"140":3,"145":15,"155":3,"172":44,"176":43,"180":42,"181":41,"182":41,"184":40,"186":39,"187":39,"200":8,"204":7,"205":7,"208":6,"210":6,"212":6,"213":6,"220":5,"226":51,"227":15,"228":8,"231":43},"path":"C:\\Users\\gossm\\Documents\\Projects\\quests\\packages\\hardhat\\contracts\\Quest.sol","s":{"1":22,"2":21,"3":20,"4":20,"5":12,"6":6,"7":12,"8":6,"9":20,"10":7,"11":7,"12":19,"13":19,"14":18,"15":18,"16":16,"17":15,"18":12,"19":15,"20":15,"21":15,"22":3,"23":44,"24":43,"25":42,"26":41,"27":41,"28":40,"29":39,"30":39,"31":8,"32":7,"33":7,"34":6,"35":6,"36":6,"37":5,"38":51,"39":15,"40":8,"41":43},"b":{"1":[21,1],"2":[20,1],"3":[12,8],"4":[6,6],"5":[6,6],"6":[7,13],"7":[6,1],"8":[19,0],"9":[15,1],"10":[12,3],"11":[3,12],"12":[43,1],"13":[22,21],"14":[42,1],"15":[39,3],"16":[41,1],"17":[40,1],"18":[7,1],"19":[3,4],"20":[6,1],"21":[8,7]},"f":{"1":94,"2":22,"3":16,"4":3,"5":44,"6":8,"7":5,"8":51},"fnMap":{"1":{"name":"constructor","line":37,"loc":{"start":{"line":37,"column":4},"end":{"line":61,"column":4}}},"2":{"name":"claim","line":76,"loc":{"start":{"line":76,"column":4},"end":{"line":119,"column":4}}},"3":{"name":"recoverFundsAndDeposit","line":127,"loc":{"start":{"line":127,"column":4},"end":{"line":146,"column":4}}},"4":{"name":"canExecute","line":152,"loc":{"start":{"line":152,"column":4},"end":{"line":156,"column":4}}},"5":{"name":"play","line":171,"loc":{"start":{"line":171,"column":4},"end":{"line":188,"column":4}}},"6":{"name":"unplay","line":199,"loc":{"start":{"line":199,"column":4},"end":{"line":214,"column":4}}},"7":{"name":"getPlayers","line":219,"loc":{"start":{"line":219,"column":4},"end":{"line":221,"column":4}}},"8":{"name":"findIndexOfPlayer","line":225,"loc":{"start":{"line":225,"column":4},"end":{"line":232,"column":4}}}},"statementMap":{"1":{"start":{"line":82,"column":8},"end":{"line":82,"column":77}},"2":{"start":{"line":83,"column":8},"end":{"line":83,"column":59}},"3":{"start":{"line":85,"column":8},"end":{"line":85,"column":62}},"4":{"start":{"line":87,"column":8},"end":{"line":87,"column":2875}},"5":{"start":{"line":89,"column":12},"end":{"line":89,"column":2985}},"6":{"start":{"line":90,"column":16},"end":{"line":90,"column":73}},"7":{"start":{"line":96,"column":12},"end":{"line":96,"column":3328}},"8":{"start":{"line":97,"column":16},"end":{"line":97,"column":3408}},"9":{"start":{"line":104,"column":8},"end":{"line":104,"column":3588}},"10":{"start":{"line":105,"column":12},"end":{"line":105,"column":56}},"11":{"start":{"line":106,"column":12},"end":{"line":106,"column":3724}},"12":{"start":{"line":112,"column":8},"end":{"line":112,"column":3875}},"13":{"start":{"line":113,"column":12},"end":{"line":113,"column":53}},"14":{"start":{"line":116,"column":8},"end":{"line":116,"column":61}},"15":{"start":{"line":118,"column":8},"end":{"line":118,"column":54}},"16":{"start":{"line":128,"column":8},"end":{"line":128,"column":67}},"17":{"start":{"line":131,"column":8},"end":{"line":131,"column":4472}},"18":{"start":{"line":132,"column":12},"end":{"line":132,"column":48}},"19":{"start":{"line":136,"column":8},"end":{"line":136,"column":62}},"20":{"start":{"line":139,"column":8},"end":{"line":139,"column":4762}},"21":{"start":{"line":145,"column":8},"end":{"line":145,"column":62}},"22":{"start":{"line":155,"column":8},"end":{"line":155,"column":48}},"23":{"start":{"line":172,"column":8},"end":{"line":172,"column":5858}},"24":{"start":{"line":176,"column":8},"end":{"line":176,"column":6006}},"25":{"start":{"line":180,"column":8},"end":{"line":180,"column":68}},"26":{"start":{"line":181,"column":8},"end":{"line":181,"column":55}},"27":{"start":{"line":182,"column":8},"end":{"line":182,"column":65}},"28":{"start":{"line":184,"column":8},"end":{"line":184,"column":57}},"29":{"start":{"line":186,"column":8},"end":{"line":186,"column":31}},"30":{"start":{"line":187,"column":8},"end":{"line":187,"column":50}},"31":{"start":{"line":200,"column":8},"end":{"line":200,"column":6868}},"32":{"start":{"line":204,"column":8},"end":{"line":204,"column":55}},"33":{"start":{"line":205,"column":8},"end":{"line":205,"column":62}},"34":{"start":{"line":210,"column":8},"end":{"line":210,"column":23}},"35":{"start":{"line":212,"column":8},"end":{"line":212,"column":37}},"36":{"start":{"line":213,"column":8},"end":{"line":213,"column":52}},"37":{"start":{"line":220,"column":8},"end":{"line":220,"column":25}},"38":{"start":{"line":226,"column":8},"end":{"line":226,"column":7803}},"39":{"start":{"line":227,"column":12},"end":{"line":227,"column":7870}},"40":{"start":{"line":228,"column":16},"end":{"line":228,"column":32}},"41":{"start":{"line":231,"column":8},"end":{"line":231,"column":17}}},"branchMap":{"1":{"line":82,"type":"if","locations":[{"start":{"line":82,"column":8},"end":{"line":82,"column":8}},{"start":{"line":82,"column":8},"end":{"line":82,"column":8}}]},"2":{"line":83,"type":"if","locations":[{"start":{"line":83,"column":8},"end":{"line":83,"column":8}},{"start":{"line":83,"column":8},"end":{"line":83,"column":8}}]},"3":{"line":87,"type":"if","locations":[{"start":{"line":87,"column":8},"end":{"line":87,"column":8}},{"start":{"line":87,"column":8},"end":{"line":87,"column":8}}]},"4":{"line":89,"type":"if","locations":[{"start":{"line":89,"column":12},"end":{"line":89,"column":12}},{"start":{"line":89,"column":12},"end":{"line":89,"column":12}}]},"5":{"line":96,"type":"if","locations":[{"start":{"line":96,"column":12},"end":{"line":96,"column":12}},{"start":{"line":96,"column":12},"end":{"line":96,"column":12}}]},"6":{"line":104,"type":"if","locations":[{"start":{"line":104,"column":8},"end":{"line":104,"column":8}},{"start":{"line":104,"column":8},"end":{"line":104,"column":8}}]},"7":{"line":106,"type":"if","locations":[{"start":{"line":106,"column":12},"end":{"line":106,"column":12}},{"start":{"line":106,"column":12},"end":{"line":106,"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":128,"type":"if","locations":[{"start":{"line":128,"column":8},"end":{"line":128,"column":8}},{"start":{"line":128,"column":8},"end":{"line":128,"column":8}}]},"10":{"line":131,"type":"if","locations":[{"start":{"line":131,"column":8},"end":{"line":131,"column":8}},{"start":{"line":131,"column":8},"end":{"line":131,"column":8}}]},"11":{"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}}]},"12":{"line":172,"type":"if","locations":[{"start":{"line":172,"column":8},"end":{"line":172,"column":8}},{"start":{"line":172,"column":8},"end":{"line":172,"column":8}}]},"13":{"line":173,"type":"cond-expr","locations":[{"start":{"line":173,"column":12},"end":{"line":173,"column":32}},{"start":{"line":173,"column":37},"end":{"line":173,"column":62}}]},"14":{"line":176,"type":"if","locations":[{"start":{"line":176,"column":8},"end":{"line":176,"column":8}},{"start":{"line":176,"column":8},"end":{"line":176,"column":8}}]},"15":{"line":177,"type":"cond-expr","locations":[{"start":{"line":177,"column":12},"end":{"line":177,"column":26}},{"start":{"line":177,"column":31},"end":{"line":177,"column":60}}]},"16":{"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}}]},"17":{"line":182,"type":"if","locations":[{"start":{"line":182,"column":8},"end":{"line":182,"column":8}},{"start":{"line":182,"column":8},"end":{"line":182,"column":8}}]},"18":{"line":200,"type":"if","locations":[{"start":{"line":200,"column":8},"end":{"line":200,"column":8}},{"start":{"line":200,"column":8},"end":{"line":200,"column":8}}]},"19":{"line":201,"type":"cond-expr","locations":[{"start":{"line":201,"column":12},"end":{"line":201,"column":32}},{"start":{"line":201,"column":37},"end":{"line":201,"column":62}}]},"20":{"line":205,"type":"if","locations":[{"start":{"line":205,"column":8},"end":{"line":205,"column":8}},{"start":{"line":205,"column":8},"end":{"line":205,"column":8}}]},"21":{"line":227,"type":"if","locations":[{"start":{"line":227,"column":12},"end":{"line":227,"column":12}},{"start":{"line":227,"column":12},"end":{"line":227,"column":12}}]}}},"contracts\\QuestFactory.sol":{"l":{"49":42,"50":42,"51":42,"52":42,"53":3,"64":48,"65":48,"75":48,"76":48,"99":13,"113":13,"115":12,"130":12,"141":3},"path":"C:\\Users\\gossm\\Documents\\Projects\\quests\\packages\\hardhat\\contracts\\QuestFactory.sol","s":{"1":42,"2":42,"3":42,"4":3,"5":48,"6":48,"7":13,"8":13,"9":12,"10":12},"b":{"1":[3,39],"2":[48,1],"3":[48,1],"4":[3,1]},"f":{"1":42,"2":48,"3":48,"4":13,"5":3},"fnMap":{"1":{"name":"constructor","line":41,"loc":{"start":{"line":41,"column":4},"end":{"line":55,"column":4}}},"2":{"name":"setCreateDeposit","line":63,"loc":{"start":{"line":63,"column":4},"end":{"line":66,"column":4}}},"3":{"name":"setPlayDeposit","line":74,"loc":{"start":{"line":74,"column":4},"end":{"line":77,"column":4}}},"4":{"name":"createQuest","line":91,"loc":{"start":{"line":91,"column":4},"end":{"line":131,"column":4}}},"5":{"name":"setAragonGovernAddress","line":140,"loc":{"start":{"line":138,"column":4},"end":{"line":142,"column":4}}}},"statementMap":{"1":{"start":{"line":50,"column":8},"end":{"line":50,"column":66}},"2":{"start":{"line":51,"column":8},"end":{"line":51,"column":60}},"3":{"start":{"line":52,"column":8},"end":{"line":52,"column":1623}},"4":{"start":{"line":53,"column":12},"end":{"line":53,"column":43}},"5":{"start":{"line":65,"column":8},"end":{"line":65,"column":74}},"6":{"start":{"line":76,"column":8},"end":{"line":76,"column":72}},"7":{"start":{"line":99,"column":8},"end":{"line":99,"column":3297}},"8":{"start":{"line":113,"column":8},"end":{"line":113,"column":60}},"9":{"start":{"line":115,"column":8},"end":{"line":115,"column":3849}},"10":{"start":{"line":130,"column":8},"end":{"line":130,"column":29}}},"branchMap":{"1":{"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}}]},"2":{"line":63,"type":"if","locations":[{"start":{"line":63,"column":67},"end":{"line":63,"column":67}},{"start":{"line":63,"column":67},"end":{"line":63,"column":67}}]},"3":{"line":74,"type":"if","locations":[{"start":{"line":74,"column":65},"end":{"line":74,"column":65}},{"start":{"line":74,"column":65},"end":{"line":74,"column":65}}]},"4":{"line":140,"type":"if","locations":[{"start":{"line":140,"column":15},"end":{"line":140,"column":15}},{"start":{"line":140,"column":15},"end":{"line":140,"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 45e8ac10..c42f8b40 100644 --- a/packages/hardhat/default-config.json +++ b/packages/hardhat/default-config.json @@ -1,68 +1,88 @@ { - "GovernQueueFactory": { - "xdai": "0xA6591419f78C044979bf63Aa81edD5e100C0E957", - "goerli": "0xEA6015008c7926E84C76b70344EbD31a48A6fd2c" - }, - "GovernFactory": { - "xdai": "0x8De393cd9F84D7989A1164191a1f6CDd5D2a7F9B", - "goerli": "0xd0A50194CeFf1A33E2a831F80EBfa2b11aC44B78" - }, - "CreateQuestDeposit": { - "xdai": { - "token": "0x71850b7E9Ee3f13Ab46d67167341E4bDc905Eef9", - "amount": 2 + "GovernQueueFactory": { + "xdai": "0xA6591419f78C044979bf63Aa81edD5e100C0E957", + "goerli": "0xEA6015008c7926E84C76b70344EbD31a48A6fd2c" }, - "goerli": { - "token": "0x2d467a24095B262787f58ce97d9B130ce7232B57", - "amount": 0.01 - } - }, - "PlayQuestDeposit": { - "xdai": { - "token": "0x71850b7E9Ee3f13Ab46d67167341E4bDc905Eef9", - "amount": 0.5 + "GovernFactory": { + "xdai": "0x8De393cd9F84D7989A1164191a1f6CDd5D2a7F9B", + "goerli": "0xd0A50194CeFf1A33E2a831F80EBfa2b11aC44B78" }, - "goerli": { - "token": "0x2d467a24095B262787f58ce97d9B130ce7232B57", - "amount": 0.01 - } - }, - "ScheduleDeposit": { - "xdai": { - "token": "0x71850b7E9Ee3f13Ab46d67167341E4bDc905Eef9", - "amount": 0.5 + "CreateQuestDeposit": { + "xdai": { + "token": "0x71850b7E9Ee3f13Ab46d67167341E4bDc905Eef9", + "amount": 2 + }, + "goerli": { + "token": "0x2d467a24095B262787f58ce97d9B130ce7232B57", + "amount": 0.01 + }, + "localhost": { + "token": "0x0000000000000000000000000000000000000000", + "amount": 0 + } }, - "goerli": { - "token": "0x2d467a24095B262787f58ce97d9B130ce7232B57", - "amount": 0.01 - } - }, - "ChallengeDeposit": { - "xdai": { - "token": "0x71850b7E9Ee3f13Ab46d67167341E4bDc905Eef9", - "amount": 0.3 + "PlayQuestDeposit": { + "xdai": { + "token": "0x71850b7E9Ee3f13Ab46d67167341E4bDc905Eef9", + "amount": 0.5 + }, + "goerli": { + "token": "0x2d467a24095B262787f58ce97d9B130ce7232B57", + "amount": 0.01 + }, + "localhost": { + "token": "0x0000000000000000000000000000000000000000", + "amount": 0 + } }, - "goerli": { - "token": "0x2d467a24095B262787f58ce97d9B130ce7232B57", - "amount": 0.01 - } - }, - "ChallengeFee": { - "goerli": { - "token": "0x2d467a24095B262787f58ce97d9B130ce7232B57", - "amount": 0.05 + "ScheduleDeposit": { + "xdai": { + "token": "0x71850b7E9Ee3f13Ab46d67167341E4bDc905Eef9", + "amount": 0.5 + }, + "goerli": { + "token": "0x2d467a24095B262787f58ce97d9B130ce7232B57", + "amount": 0.01 + }, + "localhost": { + "token": "0x0000000000000000000000000000000000000000", + "amount": 0 + } + }, + "ChallengeDeposit": { + "xdai": { + "token": "0x71850b7E9Ee3f13Ab46d67167341E4bDc905Eef9", + "amount": 0.3 + }, + "goerli": { + "token": "0x2d467a24095B262787f58ce97d9B130ce7232B57", + "amount": 0.01 + }, + "localhost": { + "token": "0x0000000000000000000000000000000000000000", + "amount": 0 + } + }, + "ChallengeFee": { + "goerli": { + "token": "0x2d467a24095B262787f58ce97d9B130ce7232B57", + "amount": 0.2 + }, + "localhost": { + "token": "0x0000000000000000000000000000000000000000", + "amount": 0 + } + }, + "RootOwner": { + "xdai": "0x7375Ed576952BD6CeD060EeE2Db763130eA13bA0", + "goerli": "0x7375Ed576952BD6CeD060EeE2Db763130eA13bA0" + }, + "ClaimDelay": { + "xdai": 604800, + "goerli": 300 + }, + "CelesteResolver": { + "xdai": "0x44E4fCFed14E1285c9e0F6eae77D5fDd0F196f85", + "goerli": "0xb802fBfb9e880fa0C57443F5ff12239101Eb90f3" } - }, - "RootOwner": { - "xdai": "0x7375Ed576952BD6CeD060EeE2Db763130eA13bA0", - "goerli": "0x7375Ed576952BD6CeD060EeE2Db763130eA13bA0" - }, - "ClaimDelay": { - "xdai": 604800, - "goerli": 300 - }, - "CelesteResolver": { - "xdai": "0x44E4fCFed14E1285c9e0F6eae77D5fDd0F196f85", - "goerli": "0xCDD144eac3dD79667a1cAADFDc4Edaa75D0Eb81f" - } -} +} \ No newline at end of file diff --git a/packages/hardhat/deploy/deploy-quest.ts b/packages/hardhat/deploy/deploy-quest.ts index 36c5df85..86399636 100644 --- a/packages/hardhat/deploy/deploy-quest.ts +++ b/packages/hardhat/deploy/deploy-quest.ts @@ -1,6 +1,28 @@ 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, @@ -10,50 +32,16 @@ export default async ({ }: HardhatRuntimeEnvironment) => { const { deploy } = deployments; const { deployer } = await getNamedAccounts(); - const constructorArguments = [ - "ASDF", - "0x00", - "0xdf456B614fE9FF1C7c0B380330Da29C96d40FB02", - 1700122574, - "0x6e7c3BC98bee14302AA2A98B4c5C86b13eB4b6Cd", - "0xdf456B614fE9FF1C7c0B380330Da29C96d40FB02", - { - token: "0x6e7c3BC98bee14302AA2A98B4c5C86b13eB4b6Cd", - amount: "100000000000000000", - }, - { - token: "0x6e7c3BC98bee14302AA2A98B4c5C86b13eB4b6Cd", - amount: "100000000000000000", - }, - "0xdf456B614fE9FF1C7c0B380330Da29C96d40FB02", - 0, - ]; + // Get another deployed contract address + const { address: tokenAddress } = await deployments.get("DeedNFT"); const deployResult = await deploy("Quest", { from: deployer, - args: constructorArguments, + args: questConstructorArguments, log: true, - // gasLimit: 4000000, + // 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 aba632a1..ebcf97d4 100644 --- a/packages/hardhat/deploy/deploy-quest_factory.ts +++ b/packages/hardhat/deploy/deploy-quest_factory.ts @@ -2,29 +2,20 @@ 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 default async ( - { - getNamedAccounts, - deployments, - ethers, - network, - run, - }: HardhatRuntimeEnvironment, - args?: { - governAddress: string; - createDepositToken: string; - createDepositAmount: number; - playDepositToken: string; - playDepositAmount: number; - } -) => { - const { deploy } = deployments; - const { deployer, govern, owner } = await getNamedAccounts(); - const createDeposit = args +export const buildQuestFactoryConstructorArguments = async ({ + getNamedAccounts, + args, + network, + ethers, +}) => { + const { govern, owner } = await getNamedAccounts(); + const createDeposit = args.createDepositToken ? { token: args.createDepositToken, amount: args.createDepositAmount } : defaultConfig.CreateQuestDeposit[network.name]; - const playDeposit = args + console.log(network.name); + const playDeposit = args.playDepositToken ? { token: args.playDepositToken, amount: args.playDepositAmount } : defaultConfig.PlayQuestDeposit[network.name]; const constructorArguments = [ @@ -36,37 +27,50 @@ export default async ( owner, ]; console.log({ constructorArguments }); - const deployResult = await deploy("QuestFactory", { - from: deployer, - args: constructorArguments, - log: true, - // gasLimit: 4000000, - }); - await ethers.getContract("QuestFactory", deployResult.address); + return constructorArguments; +}; - 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); +export default async ( + { + getNamedAccounts, + ethers, + network, + run, + upgrades, + }: HardhatRuntimeEnvironment, + args?: { + governAddress: string; } +) => { + const constructorArguments = await buildQuestFactoryConstructorArguments({ + getNamedAccounts, + args, + network, + ethers, + }); + const abi = + require(`../artifacts/contracts/QuestFactory.sol/QuestFactory.json`).abi; + var contractFactory = await ethers.getContractFactory("QuestFactory"); + var deployResult = await upgrades.deployProxy( + contractFactory, + constructorArguments, + { initializer: "initialize" } + ); + deployResult.deployed(); + await ethers.getContractAt("QuestFactory", deployResult.address); - exportContractResult(network, "Quest", { + exportContractResult(network, "QuestFactory", { address: deployResult.address, - abi: deployResult.abi, + 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 30de06f0..d795d1a6 100644 --- a/packages/hardhat/deployments/goerli/Quest.json +++ b/packages/hardhat/deployments/goerli/Quest.json @@ -1,289 +1 @@ -{ - "address": "0xa6FEAF5CA07b6F367CF39a840F5A7E41d0AE613D", - "abi": [ - { - "inputs": [ - { "internalType": "string", "name": "_questTitle", "type": "string" }, - { - "internalType": "bytes", - "name": "_questDetailsRef", - "type": "bytes" - }, - { - "internalType": "contract IERC20", - "name": "_rewardToken", - "type": "address" - }, - { "internalType": "uint256", "name": "_expireTime", "type": "uint256" }, - { - "internalType": "address", - "name": "_aragonGovernAddress", - "type": "address" - }, - { - "internalType": "address payable", - "name": "_fundsRecoveryAddress", - "type": "address" - }, - { - "components": [ - { - "internalType": "contract IERC20", - "name": "token", - "type": "address" - }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "internalType": "struct Models.Deposit", - "name": "_createDeposit", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "contract IERC20", - "name": "token", - "type": "address" - }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "internalType": "struct Models.Deposit", - "name": "_playDeposit", - "type": "tuple" - }, - { - "internalType": "address", - "name": "_questCreator", - "type": "address" - }, - { "internalType": "uint32", "name": "_maxPlayers", "type": "uint32" } - ], - "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" - }, - { - "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 IERC20", - "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": "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 IERC20", - "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 IERC20", "name": "", "type": "address" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_player", "type": "address" } - ], - "name": "unplay", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ] -} +{"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 df6e9158..27fecbce 100644 --- a/packages/hardhat/deployments/goerli/QuestFactory.json +++ b/packages/hardhat/deployments/goerli/QuestFactory.json @@ -1,547 +1 @@ -{ - "address": "0xa6FEAF5CA07b6F367CF39a840F5A7E41d0AE613D", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_aragonGovernAddress", - "type": "address" - }, - { - "internalType": "contract IERC20", - "name": "_createDepositToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_createDepositAmount", - "type": "uint256" - }, - { - "internalType": "contract IERC20", - "name": "_playDepositToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_playDepositAmount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_initialOwner", - "type": "address" - } - ], - "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": 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" - }, - { - "indexed": false, - "internalType": "address", - "name": "createDepositToken", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "createDepositAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "playDepositToken", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "playDepositAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "creator", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint32", - "name": "maxPlayers", - "type": "uint32" - } - ], - "name": "QuestCreated", - "type": "event" - }, - { - "inputs": [], - "name": "aragonGovernAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "createDeposit", - "outputs": [ - { - "internalType": "contract IERC20", - "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 IERC20", - "name": "_rewardToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_expireTime", - "type": "uint256" - }, - { - "internalType": "address payable", - "name": "_fundsRecoveryAddress", - "type": "address" - }, - { - "internalType": "uint32", - "name": "_maxPlayers", - "type": "uint32" - } - ], - "name": "createQuest", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "playDeposit", - "outputs": [ - { - "internalType": "contract IERC20", - "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 IERC20", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "setCreateDeposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IERC20", - "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" - } - ], - "transactionHash": "0x3e4eda7a1773acb31bbe7957514b24c11d8998b8b5f3c99d81450b4377b48578", - "receipt": { - "to": null, - "from": "0x91B0d67D3F47A30FBEeB159E67209Ad6cb2cE22E", - "contractAddress": "0xa6FEAF5CA07b6F367CF39a840F5A7E41d0AE613D", - "transactionIndex": 43, - "gasUsed": "3156538", - "logsBloom": "0x00000000000000000000000000000100000040000000000000800000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000040000080000000001000000000000000000000020000000000000020000000000000000000804000400000004000400080000000200400000000000000000000000000000000000000000008000000000000000000002000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x0155891ee13717b5afcb2d3719d28b5af24f24ef675d454d18f451ca7c8ca397", - "transactionHash": "0x3e4eda7a1773acb31bbe7957514b24c11d8998b8b5f3c99d81450b4377b48578", - "logs": [ - { - "transactionIndex": 43, - "blockNumber": 8240344, - "transactionHash": "0x3e4eda7a1773acb31bbe7957514b24c11d8998b8b5f3c99d81450b4377b48578", - "address": "0xa6FEAF5CA07b6F367CF39a840F5A7E41d0AE613D", - "topics": [ - "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", - "0x0000000000000000000000000000000000000000000000000000000000000000", - "0x00000000000000000000000091b0d67d3f47a30fbeeb159e67209ad6cb2ce22e" - ], - "data": "0x", - "logIndex": 98, - "blockHash": "0x0155891ee13717b5afcb2d3719d28b5af24f24ef675d454d18f451ca7c8ca397" - }, - { - "transactionIndex": 43, - "blockNumber": 8240344, - "transactionHash": "0x3e4eda7a1773acb31bbe7957514b24c11d8998b8b5f3c99d81450b4377b48578", - "address": "0xa6FEAF5CA07b6F367CF39a840F5A7E41d0AE613D", - "topics": [ - "0x35c5e8a6f8bed2c61a2eb1996d117b1b96192314c0d4ca7cd96360f250920079" - ], - "data": "0x0000000000000000000000000000000000000000000000000000000063b1ec880000000000000000000000002d467a24095b262787f58ce97d9b130ce7232b57000000000000000000000000000000000000000000000000002386f26fc10000", - "logIndex": 99, - "blockHash": "0x0155891ee13717b5afcb2d3719d28b5af24f24ef675d454d18f451ca7c8ca397" - }, - { - "transactionIndex": 43, - "blockNumber": 8240344, - "transactionHash": "0x3e4eda7a1773acb31bbe7957514b24c11d8998b8b5f3c99d81450b4377b48578", - "address": "0xa6FEAF5CA07b6F367CF39a840F5A7E41d0AE613D", - "topics": [ - "0x013c800b1a136f9798a25e471501a7b824156d1e9cba8439821c5a41adf2fb89" - ], - "data": "0x0000000000000000000000000000000000000000000000000000000063b1ec880000000000000000000000002d467a24095b262787f58ce97d9b130ce7232b57000000000000000000000000000000000000000000000000002386f26fc10000", - "logIndex": 100, - "blockHash": "0x0155891ee13717b5afcb2d3719d28b5af24f24ef675d454d18f451ca7c8ca397" - }, - { - "transactionIndex": 43, - "blockNumber": 8240344, - "transactionHash": "0x3e4eda7a1773acb31bbe7957514b24c11d8998b8b5f3c99d81450b4377b48578", - "address": "0xa6FEAF5CA07b6F367CF39a840F5A7E41d0AE613D", - "topics": [ - "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", - "0x00000000000000000000000091b0d67d3f47a30fbeeb159e67209ad6cb2ce22e", - "0x0000000000000000000000007375ed576952bd6ced060eee2db763130ea13ba0" - ], - "data": "0x", - "logIndex": 101, - "blockHash": "0x0155891ee13717b5afcb2d3719d28b5af24f24ef675d454d18f451ca7c8ca397" - } - ], - "blockNumber": 8240344, - "cumulativeGasUsed": "8100835", - "status": 1, - "byzantium": true - }, - "args": [ - "0x7281807631714071425C2efE38917C9e1A7D1aA4", - "0x2d467a24095B262787f58ce97d9B130ce7232B57", - "10000000000000000", - "0x2d467a24095B262787f58ce97d9B130ce7232B57", - "10000000000000000", - "0x7375Ed576952BD6CeD060EeE2Db763130eA13bA0" - ], - "solcInputHash": "95827ae7dd12c21f6fa5e995742d6074", - "metadata": "{\"compiler\":{\"version\":\"0.8.1+commit.df193b15\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_aragonGovernAddress\",\"type\":\"address\"},{\"internalType\":\"contract IERC20\",\"name\":\"_createDepositToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_createDepositAmount\",\"type\":\"uint256\"},{\"internalType\":\"contract IERC20\",\"name\":\"_playDepositToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_playDepositAmount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_initialOwner\",\"type\":\"address\"}],\"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\":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\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"createDepositToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"createDepositAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"playDepositToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"playDepositAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"creator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"maxPlayers\",\"type\":\"uint32\"}],\"name\":\"QuestCreated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"aragonGovernAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"createDeposit\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"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 IERC20\",\"name\":\"_rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_expireTime\",\"type\":\"uint256\"},{\"internalType\":\"address payable\",\"name\":\"_fundsRecoveryAddress\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"_maxPlayers\",\"type\":\"uint32\"}],\"name\":\"createQuest\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"playDeposit\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"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 IERC20\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"setCreateDeposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"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\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"setAragonGovernAddress(address)\":{\"details\":\"Be able to change it after deploy so we can deploy a new GovernQueue but keep the same QuestFactory\",\"params\":{\"_aragonGovernAddress\":\"The aragonGovernAddress.\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/QuestFactory.sol\":\"QuestFactory\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":20000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev 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 anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n function safePermit(\\n IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x032807210d1d7d218963d7355d62e021a84bf1b3339f4f50be2f63b53cccaf29\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @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}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SafeMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.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(\\n uint256 a,\\n uint256 b,\\n string memory errorMessage\\n ) 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(\\n uint256 a,\\n uint256 b,\\n string memory errorMessage\\n ) 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(\\n uint256 a,\\n uint256 b,\\n string memory errorMessage\\n ) internal pure returns (uint256) {\\n unchecked {\\n require(b > 0, errorMessage);\\n return a % b;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0f633a0223d9a1dcccfcf38a64c9de0874dfcbfac0c6941ccf074d63a2ce0e1e\",\"license\":\"MIT\"},\"contracts/Quest.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.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 SafeERC20 for IERC20;\\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 IERC20 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\\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\\r\\n constructor(\\r\\n string memory _questTitle,\\r\\n bytes memory _questDetailsRef,\\r\\n IERC20 _rewardToken,\\r\\n uint256 _expireTime,\\r\\n address _aragonGovernAddress,\\r\\n address payable _fundsRecoveryAddress,\\r\\n Models.Deposit memory _createDeposit,\\r\\n Models.Deposit memory _playDeposit,\\r\\n address _questCreator,\\r\\n uint32 _maxPlayers\\r\\n ) {\\r\\n questTitle = _questTitle;\\r\\n questDetailsRef = _questDetailsRef;\\r\\n rewardToken = _rewardToken;\\r\\n expireTime = _expireTime;\\r\\n aragonGovernAddress = _aragonGovernAddress;\\r\\n fundsRecoveryAddress = _fundsRecoveryAddress;\\r\\n questCreator = _questCreator;\\r\\n createDeposit = _createDeposit;\\r\\n playDeposit = _playDeposit;\\r\\n\\r\\n isCreateDepositReleased = false;\\r\\n maxPlayers = _maxPlayers;\\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 // Claim all but let play deposits of each player if they are same token\\r\\n if (address(rewardToken) == address(playDeposit.token)) {\\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 // Claim all but let the create deposit if they are same token\\r\\n if (address(rewardToken) == address(playDeposit.token)) {\\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 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 * 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 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\",\"keccak256\":\"0x456dfbc5d6bc59f674c30fcb9d71184d28cbd70da826d60934d5d20dba5a4500\",\"license\":\"GPL-3.0\"},\"contracts/QuestFactory.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\r\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\r\\nimport \\\"./libraries/Deposit.sol\\\";\\r\\nimport \\\"./libraries/Models.sol\\\";\\r\\nimport \\\"./Quest.sol\\\";\\r\\n\\r\\ncontract QuestFactory is Ownable {\\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\\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 address createDepositToken,\\r\\n uint256 createDepositAmount,\\r\\n address playDepositToken,\\r\\n uint256 playDepositAmount,\\r\\n address creator,\\r\\n uint32 maxPlayers\\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 constructor(\\r\\n address _aragonGovernAddress,\\r\\n IERC20 _createDepositToken,\\r\\n uint256 _createDepositAmount,\\r\\n IERC20 _playDepositToken,\\r\\n uint256 _playDepositAmount,\\r\\n address _initialOwner\\r\\n ) {\\r\\n aragonGovernAddress = _aragonGovernAddress;\\r\\n setCreateDeposit(_createDepositToken, _createDepositAmount);\\r\\n setPlayDeposit(_playDepositToken, _playDepositAmount);\\r\\n if (_initialOwner != msg.sender) {\\r\\n transferOwnership(_initialOwner);\\r\\n }\\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(IERC20 token, uint256 amount) 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(IERC20 token, uint256 amount) 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 IERC20 _rewardToken,\\r\\n uint256 _expireTime,\\r\\n address payable _fundsRecoveryAddress,\\r\\n uint32 _maxPlayers\\r\\n ) external returns (address) {\\r\\n Quest quest = new Quest(\\r\\n _questTitle,\\r\\n _questDetailsRef,\\r\\n _rewardToken,\\r\\n _expireTime,\\r\\n aragonGovernAddress,\\r\\n _fundsRecoveryAddress,\\r\\n Models.Deposit(createDeposit.token, createDeposit.amount),\\r\\n Models.Deposit(playDeposit.token, playDeposit.amount),\\r\\n msg.sender,\\r\\n _maxPlayers\\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 address(createDeposit.token),\\r\\n createDeposit.amount,\\r\\n address(playDeposit.token),\\r\\n playDeposit.amount,\\r\\n msg.sender,\\r\\n _maxPlayers\\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\",\"keccak256\":\"0x8a5c374e65ebdff41dabbe7deee05ad4b7df3db6a6ab7720c60c25e253ee0d71\",\"license\":\"GPL-3.0\"},\"contracts/libraries/Deposit.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\r\\nimport \\\"./Models.sol\\\";\\r\\n\\r\\nlibrary DepositLib {\\r\\n using SafeERC20 for IERC20;\\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\",\"keccak256\":\"0x00419d7de8fe1cf0e8c06555f8c2929dede75db585aa6c9e8c7a2ff8c91f5051\",\"license\":\"GPL-3.0\"},\"contracts/libraries/IExecutable.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\ninterface IExecutable {\\r\\n function canExecute(address executer) external returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0x1d0c1ecd494b35f6e3c1d7e092ac6b78425f02ad95ee0dbb4ba7215120072cea\",\"license\":\"GPL-3.0\"},\"contracts/libraries/Models.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\r\\npragma solidity ^0.8.1;\\r\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\n\\r\\nlibrary Models {\\r\\n struct Deposit {\\r\\n IERC20 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}\\r\\n\",\"keccak256\":\"0xe986229d7b557584748437b549743509e0fe5e41fc02b2d468dbae860612be26\",\"license\":\"GPL-3.0\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506040516200396b3803806200396b83398101604081905262000034916200028c565b6200004862000042620000a3565b620000a7565b600180546001600160a01b0319166001600160a01b0388161790556200006f8585620000f7565b6200007b838362000177565b6001600160a01b038116331462000097576200009781620001eb565b505050505050620003b7565b3390565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6200010162000235565b6040805180820182526001600160a01b0384168082526020909101839052600280546001600160a01b03191690911790556003829055517f35c5e8a6f8bed2c61a2eb1996d117b1b96192314c0d4ca7cd96360f250920079906200016b9042908590859062000382565b60405180910390a15050565b6200018162000235565b6040805180820182526001600160a01b0384168082526020909101839052600480546001600160a01b03191690911790556005829055517f013c800b1a136f9798a25e471501a7b824156d1e9cba8439821c5a41adf2fb89906200016b9042908590859062000382565b620001f562000235565b6001600160a01b038116620002275760405162461bcd60e51b81526004016200021e9062000307565b60405180910390fd5b6200023281620000a7565b50565b6200023f620000a3565b6001600160a01b0316620002526200027d565b6001600160a01b0316146200027b5760405162461bcd60e51b81526004016200021e906200034d565b565b6000546001600160a01b031690565b60008060008060008060c08789031215620002a5578182fd5b8651620002b281620003a1565b6020880151909650620002c581620003a1565b604088015160608901519196509450620002df81620003a1565b608088015160a08901519194509250620002f981620003a1565b809150509295509295509295565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b9283526001600160a01b03919091166020830152604082015260600190565b6001600160a01b03811681146200023257600080fd5b6135a480620003c76000396000f3fe60806040523480156200001157600080fd5b5060043610620000cf5760003560e01c8063b0a87ac11162000081578063e87fae211162000063578063e87fae21146200015e578063edeecdd31462000175578063f2fde38b146200018c57620000cf565b8063b0a87ac1146200014a578063d03ffefb146200015457620000cf565b80638c43b41111620000b75780638c43b41114620000f75780638c53c9bd146200010e5780638da5cb5b146200013157620000cf565b8062732e3014620000d4578063715018a614620000ed575b600080fd5b620000eb620000e536600462000c39565b620001a3565b005b620000eb620001f4565b620000eb6200010836600462000c7a565b6200020c565b62000118620002b1565b6040516200012892919062000f50565b60405180910390f35b6200013b620002d3565b60405162000128919062000e2d565b6200013b620002ef565b620001186200030b565b6200013b6200016f36600462000ca8565b6200032d565b620000eb6200018636600462000c7a565b620004be565b620000eb6200019d36600462000c39565b62000557565b620001ad620005c8565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b620001fe620005c8565b6200020a600062000642565b565b62000216620005c8565b60408051808201825273ffffffffffffffffffffffffffffffffffffffff84168082526020909101839052600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001690911790556005829055517f013c800b1a136f9798a25e471501a7b824156d1e9cba8439821c5a41adf2fb8990620002a590429085908590620011ec565b60405180910390a15050565b60045460055473ffffffffffffffffffffffffffffffffffffffff9091169082565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b60025460035473ffffffffffffffffffffffffffffffffffffffff9091169082565b60015460408051808201825260025473ffffffffffffffffffffffffffffffffffffffff9081168252600354602080840191909152835180850185526004548316815260055491810191909152925160009485948c948c948c948c9491909116928b929133908c90620003a09062000b6e565b620003b59a9998979695949392919062000f8b565b604051809103906000f080158015620003d2573d6000803e3d6000fd5b506040805180820190915260025473ffffffffffffffffffffffffffffffffffffffff168152600354602082015290915062000410903383620006b7565b7f6b2fd076e791d7e0318fa62bf6e275ebe9ff601badea3d9bfdc43c02317d1119818989898989600260000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260010154600460000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600460010154338e604051620004ab9c9b9a9998979695949392919062000ea6565b60405180910390a1979650505050505050565b620004c8620005c8565b60408051808201825273ffffffffffffffffffffffffffffffffffffffff84168082526020909101839052600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001690911790556003829055517f35c5e8a6f8bed2c61a2eb1996d117b1b96192314c0d4ca7cd96360f25092007990620002a590429085908590620011ec565b62000561620005c8565b73ffffffffffffffffffffffffffffffffffffffff8116620005ba576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b19062001032565b60405180910390fd5b620005c58162000642565b50565b620005d2620006d4565b73ffffffffffffffffffffffffffffffffffffffff16620005f2620002d3565b73ffffffffffffffffffffffffffffffffffffffff16146200020a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b190620010ec565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b620006c38383620006d8565b620006cf838262000807565b505050565b3390565b602082015115620008035781516040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff169063dd62ed3e906200073d908590309060040162000e4e565b60206040518083038186803b1580156200075657600080fd5b505afa1580156200076b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000791919062000d7b565b90508260200151811015620007d4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b19062001121565b60208301518351620006cf9173ffffffffffffffffffffffffffffffffffffffff90911690849030906200083f565b5050565b602082015115620008035760208201518251620008039173ffffffffffffffffffffffffffffffffffffffff909116908390620008ec565b620008e6846323b872dd60e01b858585604051602401620008639392919062000e75565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526200090e565b50505050565b620006cf8363a9059cbb60e01b84846040516024016200086392919062000f50565b600062000972826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16620009cc9092919063ffffffff16565b805190915015620006cf578080602001905181019062000993919062000c58565b620006cf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b1906200118f565b6060620009dd8484600085620009e7565b90505b9392505050565b60608247101562000a26576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b1906200108f565b62000a318562000af6565b62000a6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b19062001158565b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405162000a95919062000e0f565b60006040518083038185875af1925050503d806000811462000ad4576040519150601f19603f3d011682016040523d82523d6000602084013e62000ad9565b606091505b509150915062000aeb82828662000b16565b979650505050505050565b73ffffffffffffffffffffffffffffffffffffffff81163b15155b919050565b6060831562000b27575081620009e0565b82511562000b385782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b1919062000f76565b6122d5806200129a83390190565b600067ffffffffffffffff8084111562000b9a5762000b9a62001247565b604051601f85017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190828211818310171562000be35762000be362001247565b8160405280935085815286868601111562000bfd57600080fd5b858560208301376000602087830101525050509392505050565b803562000b118162001276565b803563ffffffff8116811462000b1157600080fd5b60006020828403121562000c4b578081fd5b8135620009e08162001276565b60006020828403121562000c6a578081fd5b81518015158114620009e0578182fd5b6000806040838503121562000c8d578081fd5b823562000c9a8162001276565b946020939093013593505050565b60008060008060008060c0878903121562000cc1578182fd5b863567ffffffffffffffff8082111562000cd9578384fd5b818901915089601f83011262000ced578384fd5b62000cfe8a83356020850162000b7c565b9750602089013591508082111562000d14578384fd5b508701601f8101891362000d26578283fd5b62000d378982356020840162000b7c565b95505062000d486040880162000c17565b93506060870135925062000d5f6080880162000c17565b915062000d6f60a0880162000c24565b90509295509295509295565b60006020828403121562000d8d578081fd5b5051919050565b6000815180845262000dae81602086016020860162001218565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b805173ffffffffffffffffffffffffffffffffffffffff168252602090810151910152565b63ffffffff169052565b6000825162000e2381846020870162001218565b9190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b600073ffffffffffffffffffffffffffffffffffffffff808f168352610180602084015262000eda61018084018f62000d94565b838103604085015262000eee818f62000d94565b925050808c1660608401528a6080840152808a1660a084015280891660c08401528760e0840152808716610100840152856101208401528085166101408401525062000f3f61016083018462000e05565b9d9c50505050505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b600060208252620009e0602083018462000d94565b600061018080835262000fa18184018e62000d94565b9050828103602084015262000fb7818d62000d94565b91505073ffffffffffffffffffffffffffffffffffffffff808b166040840152896060840152808916608084015280881660a084015262000ffc60c084018862000de0565b6200100c61010084018762000de0565b8085166101408401525063ffffffff83166101608301529b9a5050505050505050505050565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201527f6464726573730000000000000000000000000000000000000000000000000000606082015260800190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60408201527f722063616c6c0000000000000000000000000000000000000000000000000000606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601d908201527f4552524f52203a204465706f7369742062616420616c6c6f77616e6365000000604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60408201527f6f74207375636365656400000000000000000000000000000000000000000000606082015260800190565b92835273ffffffffffffffffffffffffffffffffffffffff919091166020830152604082015260600190565b60005b83811015620012355781810151838201526020016200121b565b83811115620008e65750506000910152565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff81168114620005c557600080fdfe60806040523480156200001157600080fd5b50604051620022d5380380620022d58339810160408190526200003491620002b7565b8951620000499060019060208d019062000118565b5088516200005f9060029060208c019062000118565b50600380546001600160a01b03199081166001600160a01b039a8b16179091556004979097556005805488169689169690961790955560068054600080548916938a16939093179092558351600880548916918a169190911790556020938401516009558251600a80548916918a169190911790559190920151600b55600c805460ff19169055931693169290921763ffffffff60a01b1916600160a01b63ffffffff90931692909202919091179055506200044e9050565b8280546200012690620003e2565b90600052602060002090601f0160209004810192826200014a576000855562000195565b82601f106200016557805160ff191683800117855562000195565b8280016001018555821562000195579182015b828111156200019557825182559160200191906001019062000178565b50620001a3929150620001a7565b5090565b5b80821115620001a35760008155600101620001a8565b8051620001cb8162000435565b919050565b600082601f830112620001e1578081fd5b81516001600160401b03811115620001fd57620001fd6200041f565b602062000213601f8301601f19168201620003af565b828152858284870101111562000227578384fd5b835b838110156200024657858101830151828201840152820162000229565b838111156200025757848385840101525b5095945050505050565b60006040828403121562000273578081fd5b6200027f6040620003af565b905081516200028e8162000435565b808252506020820151602082015292915050565b805163ffffffff81168114620001cb57600080fd5b6000806000806000806000806000806101808b8d031215620002d7578586fd5b8a516001600160401b0380821115620002ee578788fd5b620002fc8e838f01620001d0565b9b5060208d015191508082111562000312578788fd5b50620003218d828e01620001d0565b9950506200033260408c01620001be565b975060608b015196506200034960808c01620001be565b95506200035960a08c01620001be565b94506200036a8c60c08d0162000261565b93506200037c8c6101008d0162000261565b92506200038d6101408c01620001be565b91506200039e6101608c01620002a2565b90509295989b9194979a5092959850565b604051601f8201601f191681016001600160401b0381118282101715620003da57620003da6200041f565b604052919050565b600281046001821680620003f757607f821691505b602082108114156200041957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146200044b57600080fd5b50565b611e77806200045e6000396000f3fe608060405234801561001057600080fd5b50600436106101365760003560e01c80638c53c9bd116100b2578063d03ffefb11610081578063e492814f11610066578063e492814f14610255578063f294cf3814610268578063f7c618c11461027057610136565b8063d03ffefb14610238578063e0c234231461024057610136565b80638c53c9bd146101e5578063a888c2cd146101fb578063b0a87ac11461021d578063b434151c1461022557610136565b8063579ca2c9116101095780637ceae310116100ee5780637ceae310146101b557806385c99e2b146101bd5780638b5b9ccc146101d057610136565b8063579ca2c9146101985780636c3a4cce146101a057610136565b8063151dfb061461013b578063310a1ee31461015057806348d6cb531461016e5780634c2412a214610183575b600080fd5b61014e610149366004611638565b610278565b005b610158610553565b6040516101659190611cae565b60405180910390f35b610176610559565b60405161016591906118f2565b61018b610562565b6040516101659190611cb7565b61014e610586565b6101a861074f565b60405161016591906117f9565b6101a861076b565b6101766101cb366004611638565b610787565b6101d86107bd565b6040516101659190611898565b6101ed61082c565b604051610165929190611872565b61020e610209366004611763565b61084e565b60405161016593929190611910565b6101a8610927565b61014e61023336600461166e565b610943565b6101ed610cc0565b610248610ce2565b60405161016591906118fd565b61014e610263366004611638565b610d70565b610248610fe1565b6101a8610fee565b3373ffffffffffffffffffffffffffffffffffffffff821614806102b3575060005473ffffffffffffffffffffffffffffffffffffffff1633145b6102f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611c51565b60405180910390fd5b60006102fd8261100a565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1415610359576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e9906119df565b600d805461036990600190611d05565b815481106103a0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260209091200154600d805473ffffffffffffffffffffffffffffffffffffffff9092169183908110610400577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d805480610480577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b600082815260209081902082017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905590910190915560408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b549181019190915261051690836110d2565b7fc4a67a0877d477de99d765a3d9f48abfbe6181dff4727d68c3cb6071555541758242604051610547929190611872565b60405180910390a15050565b60045481565b600c5460ff1681565b60065474010000000000000000000000000000000000000000900463ffffffff1681565b6004544210156105c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611a73565b600c5460ff16610634576000546040805180820190915260085473ffffffffffffffffffffffffffffffffffffffff9081168252600954602083015261060892166110d2565b600c80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319061068b9030906004016117f9565b60206040518083038186803b1580156106a357600080fd5b505afa1580156106b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106db919061177b565b600a5460035491925073ffffffffffffffffffffffffffffffffffffffff9182169116141561072257600d54600b5461071e9161071791611cc8565b829061110b565b9150505b60065460035461074c9173ffffffffffffffffffffffffffffffffffffffff918216911683611131565b50565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60006107928261100a565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff141590505b919050565b6060600d80548060200260200160405190810160405280929190818152602001828054801561082257602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff1681526001909101906020018083116107f7575b5050505050905090565b600a54600b5473ffffffffffffffffffffffffffffffffffffffff9091169082565b6007818154811061085e57600080fd5b906000526020600020906003020160009150905080600001805461088190611d48565b80601f01602080910402602001604051908101604052809291908181526020018280546108ad90611d48565b80156108fa5780601f106108cf576101008083540402835291602001916108fa565b820191906000526020600020905b8154815290600101906020018083116108dd57829003601f168201915b505050506001830154600290930154919273ffffffffffffffffffffffffffffffffffffffff1691905083565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60055473ffffffffffffffffffffffffffffffffffffffff163314610994576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611ae1565b83516109cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611b86565b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff16906370a0823190610a239030906004016117f9565b60206040518083038186803b158015610a3b57600080fd5b505afa158015610a4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a73919061177b565b90508115610b095760085460035473ffffffffffffffffffffffffffffffffffffffff90811691161415610abc57600954600090610ab290839061110b565b9450610ac0915050565b8092505b600a5460035473ffffffffffffffffffffffffffffffffffffffff90811691161415610b0957600d54600b54600091610b0491610afd9190611cc8565b859061110b565b945050505b60085460035473ffffffffffffffffffffffffffffffffffffffff90811691161415610b7f576000610b3b828561110b565b915050600860010154811015610b7d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611982565b505b8215610ba957600354610ba99073ffffffffffffffffffffffffffffffffffffffff168585611131565b6040805160608101825286815273ffffffffffffffffffffffffffffffffffffffff86166020808301919091529181018590526007805460018101825560009190915281518051929360039092027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880192610c279284920190611570565b5060208201516001820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091179055604091820151600290910155517fa1c3b325aa2c115e4b244062eba2515bc5585ae5b41556be8fef399ae9fde11b90610cb190879087908790611910565b60405180910390a15050505050565b60085460095473ffffffffffffffffffffffffffffffffffffffff9091169082565b60028054610cef90611d48565b80601f0160208091040260200160405190810160405280929190818152602001828054610d1b90611d48565b8015610d685780601f10610d3d57610100808354040283529160200191610d68565b820191906000526020600020905b815481529060010190602001808311610d4b57829003601f168201915b505050505081565b3373ffffffffffffffffffffffffffffffffffffffff82161480610dab575060005473ffffffffffffffffffffffffffffffffffffffff1633145b610de1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611c51565b60065474010000000000000000000000000000000000000000900463ffffffff161580610e305750600654600d547401000000000000000000000000000000000000000090910463ffffffff16115b610e66576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611aaa565b6004544210610ea1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e99061194b565b6000610eac8261100a565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610f07576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611bbd565b60408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b546020820152610f3f9033306111d7565b600d80546001810182556000919091527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb50180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790556040517f35ec60f951b4abc8b287ab5148caf98524052482927d42e86a720cc71b8a76a1906105479084904290611872565b60018054610cef90611d48565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b6000805b600d548110156110aa578273ffffffffffffffffffffffffffffffffffffffff16600d8281548110611069577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614156110985790506107b8565b806110a281611d9c565b91505061100e565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92915050565b60208201511561110757602082015182516111079173ffffffffffffffffffffffffffffffffffffffff909116908390611131565b5050565b600080838311156111215750600090508061112a565b50600190508183035b9250929050565b6111d28363a9059cbb60e01b8484604051602401611150929190611872565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526111eb565b505050565b6111e183836112a1565b6111d283826110d2565b600061124d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166113c09092919063ffffffff16565b8051909150156111d2578080602001905181019061126b9190611652565b6111d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611bf4565b6020820151156111075781516040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff169063dd62ed3e90611303908590309060040161181a565b60206040518083038186803b15801561131b57600080fd5b505afa15801561132f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611353919061177b565b90508260200151811015611393576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611b18565b602083015183516111d29173ffffffffffffffffffffffffffffffffffffffff90911690849030906113d9565b60606113cf8484600085611400565b90505b9392505050565b6113fa846323b872dd60e01b85858560405160240161115093929190611841565b50505050565b60608247101561143c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611a16565b61144585611501565b61147b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611b4f565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516114a491906117dd565b60006040518083038185875af1925050503d80600081146114e1576040519150601f19603f3d011682016040523d82523d6000602084013e6114e6565b606091505b50915091506114f682828661151d565b979650505050505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b6060831561152c5750816113d2565b82511561153c5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e991906118fd565b82805461157c90611d48565b90600052602060002090601f01602090048101928261159e57600085556115e4565b82601f106115b757805160ff19168380011785556115e4565b828001600101855582156115e4579182015b828111156115e45782518255916020019190600101906115c9565b506115f09291506115f4565b5090565b5b808211156115f057600081556001016115f5565b803573ffffffffffffffffffffffffffffffffffffffff811681146107b857600080fd5b80356107b881611e33565b600060208284031215611649578081fd5b6113d282611609565b600060208284031215611663578081fd5b81516113d281611e33565b60008060008060808587031215611683578283fd5b843567ffffffffffffffff8082111561169a578485fd5b818701915087601f8301126116ad578485fd5b8135818111156116bf576116bf611e04565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561170557611705611e04565b816040528281528a602084870101111561171d578788fd5b826020860160208301378760208483010152809850505050505061174360208601611609565b9250604085013591506117586060860161162d565b905092959194509250565b600060208284031215611774578081fd5b5035919050565b60006020828403121561178c578081fd5b5051919050565b600081518084526117ab816020860160208601611d1c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600082516117ef818460208701611d1c565b9190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b818110156118e657835173ffffffffffffffffffffffffffffffffffffffff16835292840192918401916001016118b4565b50909695505050505050565b901515815260200190565b6000602082526113d26020830184611793565b6000606082526119236060830186611793565b73ffffffffffffffffffffffffffffffffffffffff9490941660208301525060400152919050565b60208082526014908201527f4552524f523a2051756573742065787069726564000000000000000000000000604082015260600190565b60208082526027908201527f4552524f523a2053686f756c64206e6f742065786365656420616c6c6f77656460408201527f20626f756e747900000000000000000000000000000000000000000000000000606082015260800190565b60208082526019908201527f4552524f523a20706c61796572206e6f7420696e206c69737400000000000000604082015260600190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60408201527f722063616c6c0000000000000000000000000000000000000000000000000000606082015260800190565b60208082526012908201527f4552524f523a204e6f7420657870697265640000000000000000000000000000604082015260600190565b6020808252601a908201527f4552524f523a204d617820706c61796572732072656163686564000000000000604082015260600190565b60208082526018908201527f4552524f523a2053656e646572206e6f7420676f7665726e0000000000000000604082015260600190565b6020808252601d908201527f4552524f52203a204465706f7369742062616420616c6c6f77616e6365000000604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b60208082526012908201527f4552524f523a204e6f2065766964656e63650000000000000000000000000000604082015260600190565b6020808252601c908201527f4552524f523a20506c6179657220616c72656164792065786973747300000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60408201527f6f74207375636365656400000000000000000000000000000000000000000000606082015260800190565b60208082526024908201527f4552524f523a2053656e646572206e6f7420706c61796572206e6f722063726560408201527f61746f7200000000000000000000000000000000000000000000000000000000606082015260800190565b90815260200190565b63ffffffff91909116815260200190565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611d0057611d00611dd5565b500290565b600082821015611d1757611d17611dd5565b500390565b60005b83811015611d37578181015183820152602001611d1f565b838111156113fa5750506000910152565b600281046001821680611d5c57607f821691505b60208210811415611d96577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611dce57611dce611dd5565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b801515811461074c57600080fdfea2646970667358221220001ecc7e3a56a6e8ceba0a2f6f0020ef13bacde460faf1b1cca5699bfd12ab1764736f6c63430008010033a264697066735822122006ddcb5ccdb8532fd391ece411b1311d2d44d237eb8d1044c11f2c762c9eb08564736f6c63430008010033", - "deployedBytecode": "0x60806040523480156200001157600080fd5b5060043610620000cf5760003560e01c8063b0a87ac11162000081578063e87fae211162000063578063e87fae21146200015e578063edeecdd31462000175578063f2fde38b146200018c57620000cf565b8063b0a87ac1146200014a578063d03ffefb146200015457620000cf565b80638c43b41111620000b75780638c43b41114620000f75780638c53c9bd146200010e5780638da5cb5b146200013157620000cf565b8062732e3014620000d4578063715018a614620000ed575b600080fd5b620000eb620000e536600462000c39565b620001a3565b005b620000eb620001f4565b620000eb6200010836600462000c7a565b6200020c565b62000118620002b1565b6040516200012892919062000f50565b60405180910390f35b6200013b620002d3565b60405162000128919062000e2d565b6200013b620002ef565b620001186200030b565b6200013b6200016f36600462000ca8565b6200032d565b620000eb6200018636600462000c7a565b620004be565b620000eb6200019d36600462000c39565b62000557565b620001ad620005c8565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b620001fe620005c8565b6200020a600062000642565b565b62000216620005c8565b60408051808201825273ffffffffffffffffffffffffffffffffffffffff84168082526020909101839052600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001690911790556005829055517f013c800b1a136f9798a25e471501a7b824156d1e9cba8439821c5a41adf2fb8990620002a590429085908590620011ec565b60405180910390a15050565b60045460055473ffffffffffffffffffffffffffffffffffffffff9091169082565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b60025460035473ffffffffffffffffffffffffffffffffffffffff9091169082565b60015460408051808201825260025473ffffffffffffffffffffffffffffffffffffffff9081168252600354602080840191909152835180850185526004548316815260055491810191909152925160009485948c948c948c948c9491909116928b929133908c90620003a09062000b6e565b620003b59a9998979695949392919062000f8b565b604051809103906000f080158015620003d2573d6000803e3d6000fd5b506040805180820190915260025473ffffffffffffffffffffffffffffffffffffffff168152600354602082015290915062000410903383620006b7565b7f6b2fd076e791d7e0318fa62bf6e275ebe9ff601badea3d9bfdc43c02317d1119818989898989600260000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260010154600460000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600460010154338e604051620004ab9c9b9a9998979695949392919062000ea6565b60405180910390a1979650505050505050565b620004c8620005c8565b60408051808201825273ffffffffffffffffffffffffffffffffffffffff84168082526020909101839052600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001690911790556003829055517f35c5e8a6f8bed2c61a2eb1996d117b1b96192314c0d4ca7cd96360f25092007990620002a590429085908590620011ec565b62000561620005c8565b73ffffffffffffffffffffffffffffffffffffffff8116620005ba576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b19062001032565b60405180910390fd5b620005c58162000642565b50565b620005d2620006d4565b73ffffffffffffffffffffffffffffffffffffffff16620005f2620002d3565b73ffffffffffffffffffffffffffffffffffffffff16146200020a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b190620010ec565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b620006c38383620006d8565b620006cf838262000807565b505050565b3390565b602082015115620008035781516040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff169063dd62ed3e906200073d908590309060040162000e4e565b60206040518083038186803b1580156200075657600080fd5b505afa1580156200076b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000791919062000d7b565b90508260200151811015620007d4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b19062001121565b60208301518351620006cf9173ffffffffffffffffffffffffffffffffffffffff90911690849030906200083f565b5050565b602082015115620008035760208201518251620008039173ffffffffffffffffffffffffffffffffffffffff909116908390620008ec565b620008e6846323b872dd60e01b858585604051602401620008639392919062000e75565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526200090e565b50505050565b620006cf8363a9059cbb60e01b84846040516024016200086392919062000f50565b600062000972826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16620009cc9092919063ffffffff16565b805190915015620006cf578080602001905181019062000993919062000c58565b620006cf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b1906200118f565b6060620009dd8484600085620009e7565b90505b9392505050565b60608247101562000a26576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b1906200108f565b62000a318562000af6565b62000a6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b19062001158565b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405162000a95919062000e0f565b60006040518083038185875af1925050503d806000811462000ad4576040519150601f19603f3d011682016040523d82523d6000602084013e62000ad9565b606091505b509150915062000aeb82828662000b16565b979650505050505050565b73ffffffffffffffffffffffffffffffffffffffff81163b15155b919050565b6060831562000b27575081620009e0565b82511562000b385782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b1919062000f76565b6122d5806200129a83390190565b600067ffffffffffffffff8084111562000b9a5762000b9a62001247565b604051601f85017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190828211818310171562000be35762000be362001247565b8160405280935085815286868601111562000bfd57600080fd5b858560208301376000602087830101525050509392505050565b803562000b118162001276565b803563ffffffff8116811462000b1157600080fd5b60006020828403121562000c4b578081fd5b8135620009e08162001276565b60006020828403121562000c6a578081fd5b81518015158114620009e0578182fd5b6000806040838503121562000c8d578081fd5b823562000c9a8162001276565b946020939093013593505050565b60008060008060008060c0878903121562000cc1578182fd5b863567ffffffffffffffff8082111562000cd9578384fd5b818901915089601f83011262000ced578384fd5b62000cfe8a83356020850162000b7c565b9750602089013591508082111562000d14578384fd5b508701601f8101891362000d26578283fd5b62000d378982356020840162000b7c565b95505062000d486040880162000c17565b93506060870135925062000d5f6080880162000c17565b915062000d6f60a0880162000c24565b90509295509295509295565b60006020828403121562000d8d578081fd5b5051919050565b6000815180845262000dae81602086016020860162001218565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b805173ffffffffffffffffffffffffffffffffffffffff168252602090810151910152565b63ffffffff169052565b6000825162000e2381846020870162001218565b9190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b600073ffffffffffffffffffffffffffffffffffffffff808f168352610180602084015262000eda61018084018f62000d94565b838103604085015262000eee818f62000d94565b925050808c1660608401528a6080840152808a1660a084015280891660c08401528760e0840152808716610100840152856101208401528085166101408401525062000f3f61016083018462000e05565b9d9c50505050505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b600060208252620009e0602083018462000d94565b600061018080835262000fa18184018e62000d94565b9050828103602084015262000fb7818d62000d94565b91505073ffffffffffffffffffffffffffffffffffffffff808b166040840152896060840152808916608084015280881660a084015262000ffc60c084018862000de0565b6200100c61010084018762000de0565b8085166101408401525063ffffffff83166101608301529b9a5050505050505050505050565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201527f6464726573730000000000000000000000000000000000000000000000000000606082015260800190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60408201527f722063616c6c0000000000000000000000000000000000000000000000000000606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601d908201527f4552524f52203a204465706f7369742062616420616c6c6f77616e6365000000604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60408201527f6f74207375636365656400000000000000000000000000000000000000000000606082015260800190565b92835273ffffffffffffffffffffffffffffffffffffffff919091166020830152604082015260600190565b60005b83811015620012355781810151838201526020016200121b565b83811115620008e65750506000910152565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff81168114620005c557600080fdfe60806040523480156200001157600080fd5b50604051620022d5380380620022d58339810160408190526200003491620002b7565b8951620000499060019060208d019062000118565b5088516200005f9060029060208c019062000118565b50600380546001600160a01b03199081166001600160a01b039a8b16179091556004979097556005805488169689169690961790955560068054600080548916938a16939093179092558351600880548916918a169190911790556020938401516009558251600a80548916918a169190911790559190920151600b55600c805460ff19169055931693169290921763ffffffff60a01b1916600160a01b63ffffffff90931692909202919091179055506200044e9050565b8280546200012690620003e2565b90600052602060002090601f0160209004810192826200014a576000855562000195565b82601f106200016557805160ff191683800117855562000195565b8280016001018555821562000195579182015b828111156200019557825182559160200191906001019062000178565b50620001a3929150620001a7565b5090565b5b80821115620001a35760008155600101620001a8565b8051620001cb8162000435565b919050565b600082601f830112620001e1578081fd5b81516001600160401b03811115620001fd57620001fd6200041f565b602062000213601f8301601f19168201620003af565b828152858284870101111562000227578384fd5b835b838110156200024657858101830151828201840152820162000229565b838111156200025757848385840101525b5095945050505050565b60006040828403121562000273578081fd5b6200027f6040620003af565b905081516200028e8162000435565b808252506020820151602082015292915050565b805163ffffffff81168114620001cb57600080fd5b6000806000806000806000806000806101808b8d031215620002d7578586fd5b8a516001600160401b0380821115620002ee578788fd5b620002fc8e838f01620001d0565b9b5060208d015191508082111562000312578788fd5b50620003218d828e01620001d0565b9950506200033260408c01620001be565b975060608b015196506200034960808c01620001be565b95506200035960a08c01620001be565b94506200036a8c60c08d0162000261565b93506200037c8c6101008d0162000261565b92506200038d6101408c01620001be565b91506200039e6101608c01620002a2565b90509295989b9194979a5092959850565b604051601f8201601f191681016001600160401b0381118282101715620003da57620003da6200041f565b604052919050565b600281046001821680620003f757607f821691505b602082108114156200041957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146200044b57600080fd5b50565b611e77806200045e6000396000f3fe608060405234801561001057600080fd5b50600436106101365760003560e01c80638c53c9bd116100b2578063d03ffefb11610081578063e492814f11610066578063e492814f14610255578063f294cf3814610268578063f7c618c11461027057610136565b8063d03ffefb14610238578063e0c234231461024057610136565b80638c53c9bd146101e5578063a888c2cd146101fb578063b0a87ac11461021d578063b434151c1461022557610136565b8063579ca2c9116101095780637ceae310116100ee5780637ceae310146101b557806385c99e2b146101bd5780638b5b9ccc146101d057610136565b8063579ca2c9146101985780636c3a4cce146101a057610136565b8063151dfb061461013b578063310a1ee31461015057806348d6cb531461016e5780634c2412a214610183575b600080fd5b61014e610149366004611638565b610278565b005b610158610553565b6040516101659190611cae565b60405180910390f35b610176610559565b60405161016591906118f2565b61018b610562565b6040516101659190611cb7565b61014e610586565b6101a861074f565b60405161016591906117f9565b6101a861076b565b6101766101cb366004611638565b610787565b6101d86107bd565b6040516101659190611898565b6101ed61082c565b604051610165929190611872565b61020e610209366004611763565b61084e565b60405161016593929190611910565b6101a8610927565b61014e61023336600461166e565b610943565b6101ed610cc0565b610248610ce2565b60405161016591906118fd565b61014e610263366004611638565b610d70565b610248610fe1565b6101a8610fee565b3373ffffffffffffffffffffffffffffffffffffffff821614806102b3575060005473ffffffffffffffffffffffffffffffffffffffff1633145b6102f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611c51565b60405180910390fd5b60006102fd8261100a565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1415610359576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e9906119df565b600d805461036990600190611d05565b815481106103a0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260209091200154600d805473ffffffffffffffffffffffffffffffffffffffff9092169183908110610400577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d805480610480577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b600082815260209081902082017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905590910190915560408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b549181019190915261051690836110d2565b7fc4a67a0877d477de99d765a3d9f48abfbe6181dff4727d68c3cb6071555541758242604051610547929190611872565b60405180910390a15050565b60045481565b600c5460ff1681565b60065474010000000000000000000000000000000000000000900463ffffffff1681565b6004544210156105c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611a73565b600c5460ff16610634576000546040805180820190915260085473ffffffffffffffffffffffffffffffffffffffff9081168252600954602083015261060892166110d2565b600c80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319061068b9030906004016117f9565b60206040518083038186803b1580156106a357600080fd5b505afa1580156106b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106db919061177b565b600a5460035491925073ffffffffffffffffffffffffffffffffffffffff9182169116141561072257600d54600b5461071e9161071791611cc8565b829061110b565b9150505b60065460035461074c9173ffffffffffffffffffffffffffffffffffffffff918216911683611131565b50565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60006107928261100a565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff141590505b919050565b6060600d80548060200260200160405190810160405280929190818152602001828054801561082257602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff1681526001909101906020018083116107f7575b5050505050905090565b600a54600b5473ffffffffffffffffffffffffffffffffffffffff9091169082565b6007818154811061085e57600080fd5b906000526020600020906003020160009150905080600001805461088190611d48565b80601f01602080910402602001604051908101604052809291908181526020018280546108ad90611d48565b80156108fa5780601f106108cf576101008083540402835291602001916108fa565b820191906000526020600020905b8154815290600101906020018083116108dd57829003601f168201915b505050506001830154600290930154919273ffffffffffffffffffffffffffffffffffffffff1691905083565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60055473ffffffffffffffffffffffffffffffffffffffff163314610994576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611ae1565b83516109cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611b86565b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff16906370a0823190610a239030906004016117f9565b60206040518083038186803b158015610a3b57600080fd5b505afa158015610a4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a73919061177b565b90508115610b095760085460035473ffffffffffffffffffffffffffffffffffffffff90811691161415610abc57600954600090610ab290839061110b565b9450610ac0915050565b8092505b600a5460035473ffffffffffffffffffffffffffffffffffffffff90811691161415610b0957600d54600b54600091610b0491610afd9190611cc8565b859061110b565b945050505b60085460035473ffffffffffffffffffffffffffffffffffffffff90811691161415610b7f576000610b3b828561110b565b915050600860010154811015610b7d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611982565b505b8215610ba957600354610ba99073ffffffffffffffffffffffffffffffffffffffff168585611131565b6040805160608101825286815273ffffffffffffffffffffffffffffffffffffffff86166020808301919091529181018590526007805460018101825560009190915281518051929360039092027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880192610c279284920190611570565b5060208201516001820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091179055604091820151600290910155517fa1c3b325aa2c115e4b244062eba2515bc5585ae5b41556be8fef399ae9fde11b90610cb190879087908790611910565b60405180910390a15050505050565b60085460095473ffffffffffffffffffffffffffffffffffffffff9091169082565b60028054610cef90611d48565b80601f0160208091040260200160405190810160405280929190818152602001828054610d1b90611d48565b8015610d685780601f10610d3d57610100808354040283529160200191610d68565b820191906000526020600020905b815481529060010190602001808311610d4b57829003601f168201915b505050505081565b3373ffffffffffffffffffffffffffffffffffffffff82161480610dab575060005473ffffffffffffffffffffffffffffffffffffffff1633145b610de1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611c51565b60065474010000000000000000000000000000000000000000900463ffffffff161580610e305750600654600d547401000000000000000000000000000000000000000090910463ffffffff16115b610e66576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611aaa565b6004544210610ea1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e99061194b565b6000610eac8261100a565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610f07576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611bbd565b60408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b546020820152610f3f9033306111d7565b600d80546001810182556000919091527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb50180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790556040517f35ec60f951b4abc8b287ab5148caf98524052482927d42e86a720cc71b8a76a1906105479084904290611872565b60018054610cef90611d48565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b6000805b600d548110156110aa578273ffffffffffffffffffffffffffffffffffffffff16600d8281548110611069577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614156110985790506107b8565b806110a281611d9c565b91505061100e565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92915050565b60208201511561110757602082015182516111079173ffffffffffffffffffffffffffffffffffffffff909116908390611131565b5050565b600080838311156111215750600090508061112a565b50600190508183035b9250929050565b6111d28363a9059cbb60e01b8484604051602401611150929190611872565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526111eb565b505050565b6111e183836112a1565b6111d283826110d2565b600061124d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166113c09092919063ffffffff16565b8051909150156111d2578080602001905181019061126b9190611652565b6111d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611bf4565b6020820151156111075781516040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff169063dd62ed3e90611303908590309060040161181a565b60206040518083038186803b15801561131b57600080fd5b505afa15801561132f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611353919061177b565b90508260200151811015611393576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611b18565b602083015183516111d29173ffffffffffffffffffffffffffffffffffffffff90911690849030906113d9565b60606113cf8484600085611400565b90505b9392505050565b6113fa846323b872dd60e01b85858560405160240161115093929190611841565b50505050565b60608247101561143c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611a16565b61144585611501565b61147b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611b4f565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516114a491906117dd565b60006040518083038185875af1925050503d80600081146114e1576040519150601f19603f3d011682016040523d82523d6000602084013e6114e6565b606091505b50915091506114f682828661151d565b979650505050505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b6060831561152c5750816113d2565b82511561153c5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e991906118fd565b82805461157c90611d48565b90600052602060002090601f01602090048101928261159e57600085556115e4565b82601f106115b757805160ff19168380011785556115e4565b828001600101855582156115e4579182015b828111156115e45782518255916020019190600101906115c9565b506115f09291506115f4565b5090565b5b808211156115f057600081556001016115f5565b803573ffffffffffffffffffffffffffffffffffffffff811681146107b857600080fd5b80356107b881611e33565b600060208284031215611649578081fd5b6113d282611609565b600060208284031215611663578081fd5b81516113d281611e33565b60008060008060808587031215611683578283fd5b843567ffffffffffffffff8082111561169a578485fd5b818701915087601f8301126116ad578485fd5b8135818111156116bf576116bf611e04565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561170557611705611e04565b816040528281528a602084870101111561171d578788fd5b826020860160208301378760208483010152809850505050505061174360208601611609565b9250604085013591506117586060860161162d565b905092959194509250565b600060208284031215611774578081fd5b5035919050565b60006020828403121561178c578081fd5b5051919050565b600081518084526117ab816020860160208601611d1c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600082516117ef818460208701611d1c565b9190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b818110156118e657835173ffffffffffffffffffffffffffffffffffffffff16835292840192918401916001016118b4565b50909695505050505050565b901515815260200190565b6000602082526113d26020830184611793565b6000606082526119236060830186611793565b73ffffffffffffffffffffffffffffffffffffffff9490941660208301525060400152919050565b60208082526014908201527f4552524f523a2051756573742065787069726564000000000000000000000000604082015260600190565b60208082526027908201527f4552524f523a2053686f756c64206e6f742065786365656420616c6c6f77656460408201527f20626f756e747900000000000000000000000000000000000000000000000000606082015260800190565b60208082526019908201527f4552524f523a20706c61796572206e6f7420696e206c69737400000000000000604082015260600190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60408201527f722063616c6c0000000000000000000000000000000000000000000000000000606082015260800190565b60208082526012908201527f4552524f523a204e6f7420657870697265640000000000000000000000000000604082015260600190565b6020808252601a908201527f4552524f523a204d617820706c61796572732072656163686564000000000000604082015260600190565b60208082526018908201527f4552524f523a2053656e646572206e6f7420676f7665726e0000000000000000604082015260600190565b6020808252601d908201527f4552524f52203a204465706f7369742062616420616c6c6f77616e6365000000604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b60208082526012908201527f4552524f523a204e6f2065766964656e63650000000000000000000000000000604082015260600190565b6020808252601c908201527f4552524f523a20506c6179657220616c72656164792065786973747300000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60408201527f6f74207375636365656400000000000000000000000000000000000000000000606082015260800190565b60208082526024908201527f4552524f523a2053656e646572206e6f7420706c61796572206e6f722063726560408201527f61746f7200000000000000000000000000000000000000000000000000000000606082015260800190565b90815260200190565b63ffffffff91909116815260200190565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611d0057611d00611dd5565b500290565b600082821015611d1757611d17611dd5565b500390565b60005b83811015611d37578181015183820152602001611d1f565b838111156113fa5750506000910152565b600281046001821680611d5c57607f821691505b60208210811415611d96577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611dce57611dce611dd5565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b801515811461074c57600080fdfea2646970667358221220001ecc7e3a56a6e8ceba0a2f6f0020ef13bacde460faf1b1cca5699bfd12ab1764736f6c63430008010033a264697066735822122006ddcb5ccdb8532fd391ece411b1311d2d44d237eb8d1044c11f2c762c9eb08564736f6c63430008010033", - "devdoc": { - "kind": "dev", - "methods": { - "owner()": { - "details": "Returns the address of the current owner." - }, - "renounceOwnership()": { - "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." - }, - "setAragonGovernAddress(address)": { - "details": "Be able to change it after deploy so we can deploy a new GovernQueue but keep the same QuestFactory", - "params": { - "_aragonGovernAddress": "The aragonGovernAddress." - } - }, - "transferOwnership(address)": { - "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." - } - }, - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": {}, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 7, - "contract": "contracts/QuestFactory.sol:QuestFactory", - "label": "_owner", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 2333, - "contract": "contracts/QuestFactory.sol:QuestFactory", - "label": "aragonGovernAddress", - "offset": 0, - "slot": "1", - "type": "t_address" - }, - { - "astId": 2336, - "contract": "contracts/QuestFactory.sol:QuestFactory", - "label": "createDeposit", - "offset": 0, - "slot": "2", - "type": "t_struct(Deposit)2717_storage" - }, - { - "astId": 2339, - "contract": "contracts/QuestFactory.sol:QuestFactory", - "label": "playDeposit", - "offset": 0, - "slot": "4", - "type": "t_struct(Deposit)2717_storage" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_contract(IERC20)776": { - "encoding": "inplace", - "label": "contract IERC20", - "numberOfBytes": "20" - }, - "t_struct(Deposit)2717_storage": { - "encoding": "inplace", - "label": "struct Models.Deposit", - "members": [ - { - "astId": 2714, - "contract": "contracts/QuestFactory.sol:QuestFactory", - "label": "token", - "offset": 0, - "slot": "0", - "type": "t_contract(IERC20)776" - }, - { - "astId": 2716, - "contract": "contracts/QuestFactory.sol:QuestFactory", - "label": "amount", - "offset": 0, - "slot": "1", - "type": "t_uint256" - } - ], - "numberOfBytes": "64" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - } - } - } -} \ 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/0dc94a0b7ca05e4bd82bd71a09c8bbf3.json b/packages/hardhat/deployments/goerli/solcInputs/0dc94a0b7ca05e4bd82bd71a09c8bbf3.json new file mode 100644 index 00000000..044e2ecf --- /dev/null +++ b/packages/hardhat/deployments/goerli/solcInputs/0dc94a0b7ca05e4bd82bd71a09c8bbf3.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 // Claim all but let play deposits of each player if they are same token\r\n if (address(rewardToken) == address(playDeposit.token)) {\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 // Claim all but let the create deposit if they are same token\r\n if (address(rewardToken) == address(playDeposit.token)) {\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 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 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(\r\n address _aragonGovernAddress,\r\n IERC20Upgradeable _createDepositToken,\r\n uint256 _createDepositAmount,\r\n IERC20Upgradeable _playDepositToken,\r\n uint256 _playDepositAmount,\r\n address _initialOwner\r\n ) public initializer {\r\n __Ownable_init();\r\n aragonGovernAddress = _aragonGovernAddress;\r\n setCreateDeposit(_createDepositToken, _createDepositAmount);\r\n setPlayDeposit(_playDepositToken, _playDepositAmount);\r\n if (_initialOwner != msg.sender) {\r\n transferOwnership(_initialOwner);\r\n }\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/1dc3699f6562c8886e6e512d73662af0.json b/packages/hardhat/deployments/goerli/solcInputs/1dc3699f6562c8886e6e512d73662af0.json new file mode 100644 index 00000000..d6e0d6cc --- /dev/null +++ b/packages/hardhat/deployments/goerli/solcInputs/1dc3699f6562c8886e6e512d73662af0.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 WhiteListChanged(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 // Claim all but let play deposits of each player if they are same token\r\n if (address(rewardToken) == address(playDeposit.token)) {\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 // Claim all but let the create deposit if they are same token\r\n if (address(rewardToken) == address(playDeposit.token)) {\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 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 playerList = _players;\r\n emit WhiteListChanged(_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 address createDepositToken,\r\n uint256 createDepositAmount,\r\n address playDepositToken,\r\n uint256 playDepositAmount,\r\n address creator,\r\n uint32 maxPlayers,\r\n bool isWhiteList\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(\r\n address _aragonGovernAddress,\r\n IERC20Upgradeable _createDepositToken,\r\n uint256 _createDepositAmount,\r\n IERC20Upgradeable _playDepositToken,\r\n uint256 _playDepositAmount,\r\n address _initialOwner\r\n ) public initializer {\r\n __Ownable_init();\r\n aragonGovernAddress = _aragonGovernAddress;\r\n setCreateDeposit(_createDepositToken, _createDepositAmount);\r\n setPlayDeposit(_playDepositToken, _playDepositAmount);\r\n if (_initialOwner != msg.sender) {\r\n transferOwnership(_initialOwner);\r\n }\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 address(createDeposit.token),\r\n createDeposit.amount,\r\n address(playDeposit.token),\r\n playDeposit.amount,\r\n msg.sender,\r\n _maxPlayers,\r\n _isWhiteList\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/47f6185dc196e2ecbc4b6b98f3c85d8d.json b/packages/hardhat/deployments/goerli/solcInputs/47f6185dc196e2ecbc4b6b98f3c85d8d.json new file mode 100644 index 00000000..687e3e08 --- /dev/null +++ b/packages/hardhat/deployments/goerli/solcInputs/47f6185dc196e2ecbc4b6b98f3c85d8d.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 // Claim all but let play deposits of each player if they are same token\r\n if (address(rewardToken) == address(playDeposit.token)) {\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 // Claim all but let the create deposit if they are same token\r\n if (address(rewardToken) == address(playDeposit.token)) {\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 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 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(\r\n address _aragonGovernAddress,\r\n IERC20Upgradeable _createDepositToken,\r\n uint256 _createDepositAmount,\r\n IERC20Upgradeable _playDepositToken,\r\n uint256 _playDepositAmount,\r\n address _initialOwner\r\n ) public initializer {\r\n __Ownable_init();\r\n aragonGovernAddress = _aragonGovernAddress;\r\n setCreateDeposit(_createDepositToken, _createDepositAmount);\r\n setPlayDeposit(_playDepositToken, _playDepositAmount);\r\n if (_initialOwner != msg.sender) {\r\n transferOwnership(_initialOwner);\r\n }\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/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/553ddf21e8dca1c13693c37d1e3133ad.json b/packages/hardhat/deployments/goerli/solcInputs/553ddf21e8dca1c13693c37d1e3133ad.json new file mode 100644 index 00000000..96a40701 --- /dev/null +++ b/packages/hardhat/deployments/goerli/solcInputs/553ddf21e8dca1c13693c37d1e3133ad.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 WhiteListChanged(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 // Claim all but let play deposits of each player if they are same token\r\n if (address(rewardToken) == address(playDeposit.token)) {\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 // Claim all but let the create deposit if they are same token\r\n if (address(rewardToken) == address(playDeposit.token)) {\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 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 playerList = _players;\r\n emit WhiteListChanged(_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 address createDepositToken,\r\n uint256 createDepositAmount,\r\n address playDepositToken,\r\n uint256 playDepositAmount,\r\n address creator,\r\n uint32 maxPlayers,\r\n bool isWhiteList\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(\r\n address _aragonGovernAddress,\r\n IERC20Upgradeable _createDepositToken,\r\n uint256 _createDepositAmount,\r\n IERC20Upgradeable _playDepositToken,\r\n uint256 _playDepositAmount,\r\n address _initialOwner\r\n ) public initializer {\r\n __Ownable_init();\r\n aragonGovernAddress = _aragonGovernAddress;\r\n setCreateDeposit(_createDepositToken, _createDepositAmount);\r\n setPlayDeposit(_playDepositToken, _playDepositAmount);\r\n if (_initialOwner != msg.sender) {\r\n transferOwnership(_initialOwner);\r\n }\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 address(createDeposit.token),\r\n createDeposit.amount,\r\n address(playDeposit.token),\r\n playDeposit.amount,\r\n msg.sender,\r\n _maxPlayers,\r\n _isWhiteList\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/614435b62300c978a18042f5a9842c49.json b/packages/hardhat/deployments/goerli/solcInputs/614435b62300c978a18042f5a9842c49.json new file mode 100644 index 00000000..ae8f443f --- /dev/null +++ b/packages/hardhat/deployments/goerli/solcInputs/614435b62300c978a18042f5a9842c49.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 WhiteListChanged(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 // Claim all but let play deposits of each player if they are same token\r\n if (address(rewardToken) == address(playDeposit.token)) {\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 // Claim all but let the create deposit if they are same token\r\n if (address(rewardToken) == address(playDeposit.token)) {\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 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 playerList = _players;\r\n emit WhiteListChanged(_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 address createDepositToken,\r\n uint256 createDepositAmount,\r\n address playDepositToken,\r\n uint256 playDepositAmount,\r\n address creator,\r\n uint32 maxPlayers,\r\n bool isWhiteList\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(\r\n address _aragonGovernAddress,\r\n IERC20Upgradeable _createDepositToken,\r\n uint256 _createDepositAmount,\r\n IERC20Upgradeable _playDepositToken,\r\n uint256 _playDepositAmount,\r\n address _initialOwner\r\n ) public initializer {\r\n __Ownable_init();\r\n aragonGovernAddress = _aragonGovernAddress;\r\n setCreateDeposit(_createDepositToken, _createDepositAmount);\r\n setPlayDeposit(_playDepositToken, _playDepositAmount);\r\n if (_initialOwner != msg.sender) {\r\n transferOwnership(_initialOwner);\r\n }\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 address(createDeposit.token),\r\n createDeposit.amount,\r\n address(playDeposit.token),\r\n playDeposit.amount,\r\n msg.sender,\r\n _maxPlayers,\r\n _isWhiteList\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/635017942873bb45f82d219ade56500d.json b/packages/hardhat/deployments/goerli/solcInputs/635017942873bb45f82d219ade56500d.json new file mode 100644 index 00000000..198bf31c --- /dev/null +++ b/packages/hardhat/deployments/goerli/solcInputs/635017942873bb45f82d219ade56500d.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 WhiteListChanged(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 // Claim all but let play deposits of each player if they are same token\r\n if (address(rewardToken) == address(playDeposit.token)) {\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 // Claim all but let the create deposit if they are same token\r\n if (address(rewardToken) == address(playDeposit.token)) {\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 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 playerList = _players;\r\n emit WhiteListChanged(_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(\r\n address _aragonGovernAddress,\r\n IERC20Upgradeable _createDepositToken,\r\n uint256 _createDepositAmount,\r\n IERC20Upgradeable _playDepositToken,\r\n uint256 _playDepositAmount,\r\n address _initialOwner\r\n ) public initializer {\r\n __Ownable_init();\r\n aragonGovernAddress = _aragonGovernAddress;\r\n setCreateDeposit(_createDepositToken, _createDepositAmount);\r\n setPlayDeposit(_playDepositToken, _playDepositAmount);\r\n if (_initialOwner != msg.sender) {\r\n transferOwnership(_initialOwner);\r\n }\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/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/deployments/goerli/solcInputs/a33307a6c4e89062a46e94b88af6078f.json b/packages/hardhat/deployments/goerli/solcInputs/a33307a6c4e89062a46e94b88af6078f.json new file mode 100644 index 00000000..eb438054 --- /dev/null +++ b/packages/hardhat/deployments/goerli/solcInputs/a33307a6c4e89062a46e94b88af6078f.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 // Claim all but let play deposits of each player if they are same token\r\n if (address(rewardToken) == address(playDeposit.token)) {\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 // Claim all but let the create deposit if they are same token\r\n if (address(rewardToken) == address(playDeposit.token)) {\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 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(\r\n address _aragonGovernAddress,\r\n IERC20Upgradeable _createDepositToken,\r\n uint256 _createDepositAmount,\r\n IERC20Upgradeable _playDepositToken,\r\n uint256 _playDepositAmount,\r\n address _initialOwner\r\n ) public initializer {\r\n __Ownable_init();\r\n aragonGovernAddress = _aragonGovernAddress;\r\n setCreateDeposit(_createDepositToken, _createDepositAmount);\r\n setPlayDeposit(_playDepositToken, _playDepositAmount);\r\n if (_initialOwner != msg.sender) {\r\n transferOwnership(_initialOwner);\r\n }\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/xdai/Govern.json b/packages/hardhat/deployments/xdai/Govern.json index 8d826fe0..6401be8b 100644 --- a/packages/hardhat/deployments/xdai/Govern.json +++ b/packages/hardhat/deployments/xdai/Govern.json @@ -1,5 +1,5 @@ { - "address": "0x9CA2A0fB572D63dc5ED203ae271898db52e69dA4", + "address": "0x549748A54ce150D75f73504Dd720C3adF04c9173", "abi": [ { "type": "constructor", diff --git a/packages/hardhat/deployments/xdai/GovernQueue.json b/packages/hardhat/deployments/xdai/GovernQueue.json index bb58a03a..b4b367e6 100644 --- a/packages/hardhat/deployments/xdai/GovernQueue.json +++ b/packages/hardhat/deployments/xdai/GovernQueue.json @@ -1,688 +1,1700 @@ { - "address": "0x6D8189C979bBB6768395A78E2AB8A15133459600", - "abi": [ - { - "type": "constructor", - "inputs": [ - { "type": "address", "name": "_aclRoot", "internalType": "address" }, - { - "type": "tuple", - "name": "_initialConfig", - "internalType": "struct ERC3000Data.Config", - "components": [ - { "type": "uint256" }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { "type": "address" }, - { "type": "bytes" }, - { "type": "uint256" } - ] - } - ] - }, - { - "type": "function", - "stateMutability": "view", - "outputs": [{ "type": "bytes4", "name": "", "internalType": "bytes4" }], - "name": "ROOT_ROLE", - "inputs": [] - }, - { - "type": "function", - "stateMutability": "nonpayable", - "outputs": [], - "name": "bulk", - "inputs": [ - { - "type": "tuple[]", - "name": "items", - "internalType": "struct ACLData.BulkItem[]", - "components": [ - { "type": "uint8" }, - { "type": "bytes4" }, - { "type": "address" } - ] - } - ] - }, - { - "type": "function", - "stateMutability": "nonpayable", - "outputs": [ - { "type": "uint256", "name": "disputeId", "internalType": "uint256" } - ], - "name": "challenge", - "inputs": [ - { - "type": "tuple", - "name": "_container", - "internalType": "struct ERC3000Data.Container", - "components": [ - { - "type": "tuple", - "components": [ - { "type": "uint256" }, - { "type": "uint256" }, - { "type": "address" }, - { "type": "address" }, - { - "type": "tuple[]", - "components": [ - { "type": "address" }, - { "type": "uint256" }, - { "type": "bytes" } - ] - }, - { "type": "bytes32" }, - { "type": "bytes" }, - { "type": "address" } - ] - }, - { - "type": "tuple", - "components": [ - { "type": "uint256" }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { "type": "address" }, - { "type": "bytes" }, - { "type": "uint256" } - ] - } - ] - }, - { "type": "bytes", "name": "_reason", "internalType": "bytes" } - ] - }, - { - "type": "function", - "stateMutability": "view", - "outputs": [{ "type": "address", "name": "", "internalType": "address" }], - "name": "challengerCache", - "inputs": [{ "type": "bytes32", "name": "", "internalType": "bytes32" }] - }, - { - "type": "function", - "stateMutability": "view", - "outputs": [{ "type": "bytes32", "name": "", "internalType": "bytes32" }], - "name": "configHash", - "inputs": [] - }, - { - "type": "function", - "stateMutability": "nonpayable", - "outputs": [{ "type": "bytes32", "name": "", "internalType": "bytes32" }], - "name": "configure", - "inputs": [ - { - "type": "tuple", - "name": "_config", - "internalType": "struct ERC3000Data.Config", - "components": [ - { "type": "uint256" }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { "type": "address" }, - { "type": "bytes" }, - { "type": "uint256" } - ] - } - ] - }, - { - "type": "function", - "stateMutability": "view", - "outputs": [{ "type": "uint256", "name": "", "internalType": "uint256" }], - "name": "disputeItemCache", - "inputs": [ - { "type": "bytes32", "name": "", "internalType": "bytes32" }, - { - "type": "address", - "name": "", - "internalType": "contract IArbitrator" - } - ] - }, - { - "type": "function", - "stateMutability": "nonpayable", - "outputs": [ - { "type": "bytes32", "name": "failureMap", "internalType": "bytes32" }, - { "type": "bytes[]", "name": "", "internalType": "bytes[]" } - ], - "name": "execute", - "inputs": [ - { - "type": "tuple", - "name": "_container", - "internalType": "struct ERC3000Data.Container", - "components": [ - { - "type": "tuple", - "components": [ - { "type": "uint256" }, - { "type": "uint256" }, - { "type": "address" }, - { "type": "address" }, - { - "type": "tuple[]", - "components": [ - { "type": "address" }, - { "type": "uint256" }, - { "type": "bytes" } - ] - }, - { "type": "bytes32" }, - { "type": "bytes" }, - { "type": "address" } - ] - }, - { - "type": "tuple", - "components": [ - { "type": "uint256" }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { "type": "address" }, - { "type": "bytes" }, - { "type": "uint256" } - ] - } - ] - } - ] - }, - { - "type": "function", - "stateMutability": "nonpayable", - "outputs": [], - "name": "freeze", - "inputs": [ - { "type": "bytes4", "name": "_role", "internalType": "bytes4" } - ] - }, - { - "type": "function", - "stateMutability": "nonpayable", - "outputs": [], - "name": "grant", - "inputs": [ - { "type": "bytes4", "name": "_role", "internalType": "bytes4" }, - { "type": "address", "name": "_who", "internalType": "address" } - ] - }, - { - "type": "function", - "stateMutability": "nonpayable", - "outputs": [], - "name": "grantWithOracle", - "inputs": [ - { "type": "bytes4", "name": "_role", "internalType": "bytes4" }, - { "type": "address", "name": "_who", "internalType": "address" }, - { - "type": "address", - "name": "_oracle", - "internalType": "contract IACLOracle" - } - ] - }, - { - "type": "function", - "stateMutability": "view", - "outputs": [{ "type": "uint256", "name": "", "internalType": "uint256" }], - "name": "initBlocks", - "inputs": [{ "type": "string", "name": "", "internalType": "string" }] - }, - { - "type": "function", - "stateMutability": "nonpayable", - "outputs": [], - "name": "initialize", - "inputs": [ - { "type": "address", "name": "_aclRoot", "internalType": "address" }, - { - "type": "tuple", - "name": "_initialConfig", - "internalType": "struct ERC3000Data.Config", - "components": [ - { "type": "uint256" }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { "type": "address" }, - { "type": "bytes" }, - { "type": "uint256" } - ] - } - ] - }, - { - "type": "function", - "stateMutability": "view", - "outputs": [{ "type": "bool", "name": "", "internalType": "bool" }], - "name": "isFrozen", - "inputs": [ - { "type": "bytes4", "name": "_role", "internalType": "bytes4" } - ] - }, - { - "type": "function", - "stateMutability": "view", - "outputs": [{ "type": "uint256", "name": "", "internalType": "uint256" }], - "name": "nonce", - "inputs": [] - }, - { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "uint8", - "name": "state", - "internalType": "enum GovernQueueStateLib.State" - } - ], - "name": "queue", - "inputs": [{ "type": "bytes32", "name": "", "internalType": "bytes32" }] - }, - { - "type": "function", - "stateMutability": "nonpayable", - "outputs": [ - { "type": "bytes32", "name": "failureMap", "internalType": "bytes32" }, - { "type": "bytes[]", "name": "", "internalType": "bytes[]" } - ], - "name": "resolve", - "inputs": [ - { - "type": "tuple", - "name": "_container", - "internalType": "struct ERC3000Data.Container", - "components": [ - { - "type": "tuple", - "components": [ - { "type": "uint256" }, - { "type": "uint256" }, - { "type": "address" }, - { "type": "address" }, - { - "type": "tuple[]", - "components": [ - { "type": "address" }, - { "type": "uint256" }, - { "type": "bytes" } - ] - }, - { "type": "bytes32" }, - { "type": "bytes" }, - { "type": "address" } - ] - }, - { - "type": "tuple", - "components": [ - { "type": "uint256" }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { "type": "address" }, - { "type": "bytes" }, - { "type": "uint256" } - ] - } - ] - }, - { "type": "uint256", "name": "_disputeId", "internalType": "uint256" } - ] - }, - { - "type": "function", - "stateMutability": "nonpayable", - "outputs": [], - "name": "revoke", - "inputs": [ - { "type": "bytes4", "name": "_role", "internalType": "bytes4" }, - { "type": "address", "name": "_who", "internalType": "address" } - ] - }, - { - "type": "function", - "stateMutability": "view", - "outputs": [{ "type": "address", "name": "", "internalType": "address" }], - "name": "roles", - "inputs": [ - { "type": "bytes4", "name": "", "internalType": "bytes4" }, - { "type": "address", "name": "", "internalType": "address" } - ] - }, - { - "type": "function", - "stateMutability": "nonpayable", - "outputs": [ - { - "type": "bytes32", - "name": "containerHash", - "internalType": "bytes32" - } - ], - "name": "schedule", - "inputs": [ - { - "type": "tuple", - "name": "_container", - "internalType": "struct ERC3000Data.Container", - "components": [ - { - "type": "tuple", - "components": [ - { "type": "uint256" }, - { "type": "uint256" }, - { "type": "address" }, - { "type": "address" }, - { - "type": "tuple[]", - "components": [ - { "type": "address" }, - { "type": "uint256" }, - { "type": "bytes" } - ] - }, - { "type": "bytes32" }, - { "type": "bytes" }, - { "type": "address" } - ] - }, - { - "type": "tuple", - "components": [ - { "type": "uint256" }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { "type": "address" }, - { "type": "bytes" }, - { "type": "uint256" } - ] - } - ] - } - ] - }, - { - "type": "function", - "stateMutability": "view", - "outputs": [{ "type": "bool", "name": "", "internalType": "bool" }], - "name": "supportsInterface", - "inputs": [ - { "type": "bytes4", "name": "_interfaceId", "internalType": "bytes4" } - ] - }, - { - "type": "function", - "stateMutability": "nonpayable", - "outputs": [], - "name": "veto", - "inputs": [ - { - "type": "tuple", - "name": "_container", - "internalType": "struct ERC3000Data.Container", - "components": [ - { - "type": "tuple", - "components": [ - { "type": "uint256" }, - { "type": "uint256" }, - { "type": "address" }, - { "type": "address" }, - { - "type": "tuple[]", - "components": [ - { "type": "address" }, - { "type": "uint256" }, - { "type": "bytes" } - ] - }, - { "type": "bytes32" }, - { "type": "bytes" }, - { "type": "address" } - ] - }, - { - "type": "tuple", - "components": [ - { "type": "uint256" }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { "type": "address" }, - { "type": "bytes" }, - { "type": "uint256" } - ] - } - ] - }, - { "type": "bytes", "name": "_reason", "internalType": "bytes" } - ] - }, - { - "type": "event", - "name": "Challenged", - "inputs": [ - { "type": "bytes32", "name": "containerHash", "indexed": true }, - { "type": "address", "name": "actor", "indexed": true }, - { "type": "bytes", "name": "reason", "indexed": false }, - { "type": "uint256", "name": "resolverId", "indexed": false }, - { - "type": "tuple", - "name": "collateral", - "indexed": false, - "components": [{ "type": "address" }, { "type": "uint256" }] - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "Configured", - "inputs": [ - { "type": "bytes32", "name": "configHash", "indexed": true }, - { "type": "address", "name": "actor", "indexed": true }, - { - "type": "tuple", - "name": "config", - "indexed": false, - "components": [ - { "type": "uint256" }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { "type": "address" }, - { "type": "bytes" }, - { "type": "uint256" } - ] - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "Executed", - "inputs": [ - { "type": "bytes32", "name": "containerHash", "indexed": true }, - { "type": "address", "name": "actor", "indexed": true } - ], - "anonymous": false - }, - { - "type": "event", - "name": "Frozen", - "inputs": [ - { "type": "bytes4", "name": "role", "indexed": true }, - { "type": "address", "name": "actor", "indexed": true } - ], - "anonymous": false - }, - { - "type": "event", - "name": "Granted", - "inputs": [ - { "type": "bytes4", "name": "role", "indexed": true }, - { "type": "address", "name": "actor", "indexed": true }, - { "type": "address", "name": "who", "indexed": true }, - { "type": "address", "name": "oracle", "indexed": false } - ], - "anonymous": false - }, - { - "type": "event", - "name": "Initialized", - "inputs": [{ "type": "string", "name": "key", "indexed": true }], - "anonymous": false - }, - { - "type": "event", - "name": "ReceivedCallback", - "inputs": [ - { "type": "bytes4", "name": "sig", "indexed": true }, - { "type": "bytes", "name": "data", "indexed": false } - ], - "anonymous": false - }, - { - "type": "event", - "name": "RegisteredCallback", - "inputs": [ - { "type": "bytes4", "name": "sig", "indexed": false }, - { "type": "bytes4", "name": "magicNumber", "indexed": false } - ], - "anonymous": false - }, - { - "type": "event", - "name": "RegisteredStandard", - "inputs": [{ "type": "bytes4", "name": "interfaceId", "indexed": false }], - "anonymous": false - }, - { - "type": "event", - "name": "Resolved", - "inputs": [ - { "type": "bytes32", "name": "containerHash", "indexed": true }, - { "type": "address", "name": "actor", "indexed": true }, - { "type": "bool", "name": "approved", "indexed": false } - ], - "anonymous": false - }, - { - "type": "event", - "name": "Revoked", - "inputs": [ - { "type": "bytes4", "name": "role", "indexed": true }, - { "type": "address", "name": "actor", "indexed": true }, - { "type": "address", "name": "who", "indexed": true } - ], - "anonymous": false - }, - { - "type": "event", - "name": "Ruled", - "inputs": [ - { "type": "address", "name": "arbitrator", "indexed": true }, - { "type": "uint256", "name": "disputeId", "indexed": true }, - { "type": "uint256", "name": "ruling", "indexed": false } - ], - "anonymous": false - }, - { - "type": "event", - "name": "Scheduled", - "inputs": [ - { "type": "bytes32", "name": "containerHash", "indexed": true }, - { - "type": "tuple", - "name": "payload", - "indexed": false, - "components": [ - { "type": "uint256" }, - { "type": "uint256" }, - { "type": "address" }, - { "type": "address" }, - { - "type": "tuple[]", - "components": [ - { "type": "address" }, - { "type": "uint256" }, - { "type": "bytes" } - ] - }, - { "type": "bytes32" }, - { "type": "bytes" }, - { "type": "address" } - ] + "address": "0x8A33E3015F1a9aBdFd6822E218Eb725021D73EaC", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_aclRoot", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "executionDelay", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Collateral", + "name": "scheduleDeposit", + "type": "tuple" + }, + { + "components": [ + { + "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": "uint256", + "name": "maxCalldataSize", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Config", + "name": "_initialConfig", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "containerHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "actor", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "reason", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "resolverId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct ERC3000Data.Collateral", + "name": "collateral", + "type": "tuple" + } + ], + "name": "Challenged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "configHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "actor", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "executionDelay", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Collateral", + "name": "scheduleDeposit", + "type": "tuple" + }, + { + "components": [ + { + "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": "uint256", + "name": "maxCalldataSize", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct ERC3000Data.Config", + "name": "config", + "type": "tuple" + } + ], + "name": "Configured", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "containerHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "actor", + "type": "address" + } + ], + "name": "Executed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes4", + "name": "role", + "type": "bytes4" + }, + { + "indexed": true, + "internalType": "address", + "name": "actor", + "type": "address" + } + ], + "name": "Frozen", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes4", + "name": "role", + "type": "bytes4" + }, + { + "indexed": true, + "internalType": "address", + "name": "actor", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "who", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract IACLOracle", + "name": "oracle", + "type": "address" + } + ], + "name": "Granted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "string", + "name": "key", + "type": "string" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes4", + "name": "sig", + "type": "bytes4" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "ReceivedCallback", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes4", + "name": "sig", + "type": "bytes4" + }, + { + "indexed": false, + "internalType": "bytes4", + "name": "magicNumber", + "type": "bytes4" + } + ], + "name": "RegisteredCallback", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "RegisteredStandard", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "containerHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "actor", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "Resolved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes4", + "name": "role", + "type": "bytes4" + }, + { + "indexed": true, + "internalType": "address", + "name": "actor", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "who", + "type": "address" + } + ], + "name": "Revoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract IArbitrator", + "name": "arbitrator", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "disputeId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "ruling", + "type": "uint256" + } + ], + "name": "Ruled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "containerHash", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "executionTime", + "type": "uint256" + }, + { + "internalType": "address", + "name": "submitter", + "type": "address" + }, + { + "internalType": "contract IERC3000Executor", + "name": "executor", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct ERC3000Data.Action[]", + "name": "actions", + "type": "tuple[]" + }, + { + "internalType": "bytes32", + "name": "allowFailuresMap", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + }, + { + "internalType": "address", + "name": "challenger", + "type": "address" + } + ], + "indexed": false, + "internalType": "struct ERC3000Data.Payload", + "name": "payload", + "type": "tuple" + } + ], + "name": "Scheduled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "containerHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "actor", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "reason", + "type": "bytes" + } + ], + "name": "Vetoed", + "type": "event" + }, + { + "inputs": [], + "name": "ROOT_ROLE", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "enum ACLData.BulkOp", + "name": "op", + "type": "uint8" + }, + { + "internalType": "bytes4", + "name": "role", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "who", + "type": "address" + } + ], + "internalType": "struct ACLData.BulkItem[]", + "name": "items", + "type": "tuple[]" + } + ], + "name": "bulk", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "executionTime", + "type": "uint256" + }, + { + "internalType": "address", + "name": "submitter", + "type": "address" + }, + { + "internalType": "contract IERC3000Executor", + "name": "executor", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct ERC3000Data.Action[]", + "name": "actions", + "type": "tuple[]" + }, + { + "internalType": "bytes32", + "name": "allowFailuresMap", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + }, + { + "internalType": "address", + "name": "challenger", + "type": "address" + } + ], + "internalType": "struct ERC3000Data.Payload", + "name": "payload", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "executionDelay", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Collateral", + "name": "scheduleDeposit", + "type": "tuple" + }, + { + "components": [ + { + "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": "uint256", + "name": "maxCalldataSize", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Config", + "name": "config", + "type": "tuple" + } + ], + "internalType": "struct ERC3000Data.Container", + "name": "_container", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "_reason", + "type": "bytes" + } + ], + "name": "challenge", + "outputs": [ + { + "internalType": "uint256", + "name": "disputeId", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "challengerCache", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "configHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "executionDelay", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Collateral", + "name": "scheduleDeposit", + "type": "tuple" + }, + { + "components": [ + { + "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": "uint256", + "name": "maxCalldataSize", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Config", + "name": "_config", + "type": "tuple" + } + ], + "name": "configure", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + }, + { + "internalType": "contract IArbitrator", + "name": "", + "type": "address" + } + ], + "name": "disputeItemCache", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "executionTime", + "type": "uint256" + }, + { + "internalType": "address", + "name": "submitter", + "type": "address" + }, + { + "internalType": "contract IERC3000Executor", + "name": "executor", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct ERC3000Data.Action[]", + "name": "actions", + "type": "tuple[]" + }, + { + "internalType": "bytes32", + "name": "allowFailuresMap", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + }, + { + "internalType": "address", + "name": "challenger", + "type": "address" + } + ], + "internalType": "struct ERC3000Data.Payload", + "name": "payload", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "executionDelay", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Collateral", + "name": "scheduleDeposit", + "type": "tuple" + }, + { + "components": [ + { + "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": "uint256", + "name": "maxCalldataSize", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Config", + "name": "config", + "type": "tuple" + } + ], + "internalType": "struct ERC3000Data.Container", + "name": "_container", + "type": "tuple" + } + ], + "name": "execute", + "outputs": [ + { + "internalType": "bytes32", + "name": "failureMap", + "type": "bytes32" + }, + { + "internalType": "bytes[]", + "name": "", + "type": "bytes[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_role", + "type": "bytes4" + } + ], + "name": "freeze", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_role", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "_who", + "type": "address" + } + ], + "name": "grant", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_role", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "_who", + "type": "address" + }, + { + "internalType": "contract IACLOracle", + "name": "_oracle", + "type": "address" + } + ], + "name": "grantWithOracle", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "name": "initBlocks", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_aclRoot", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "executionDelay", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Collateral", + "name": "scheduleDeposit", + "type": "tuple" + }, + { + "components": [ + { + "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": "uint256", + "name": "maxCalldataSize", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Config", + "name": "_initialConfig", + "type": "tuple" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_role", + "type": "bytes4" + } + ], + "name": "isFrozen", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nonce", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "queue", + "outputs": [ + { + "internalType": "enum GovernQueueStateLib.State", + "name": "state", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "executionTime", + "type": "uint256" + }, + { + "internalType": "address", + "name": "submitter", + "type": "address" + }, + { + "internalType": "contract IERC3000Executor", + "name": "executor", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct ERC3000Data.Action[]", + "name": "actions", + "type": "tuple[]" + }, + { + "internalType": "bytes32", + "name": "allowFailuresMap", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + }, + { + "internalType": "address", + "name": "challenger", + "type": "address" + } + ], + "internalType": "struct ERC3000Data.Payload", + "name": "payload", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "executionDelay", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Collateral", + "name": "scheduleDeposit", + "type": "tuple" + }, + { + "components": [ + { + "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": "uint256", + "name": "maxCalldataSize", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Config", + "name": "config", + "type": "tuple" + } + ], + "internalType": "struct ERC3000Data.Container", + "name": "_container", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "_disputeId", + "type": "uint256" + } + ], + "name": "resolve", + "outputs": [ + { + "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" + } + ], + "name": "revoke", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "roles", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "executionTime", + "type": "uint256" + }, + { + "internalType": "address", + "name": "submitter", + "type": "address" + }, + { + "internalType": "contract IERC3000Executor", + "name": "executor", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct ERC3000Data.Action[]", + "name": "actions", + "type": "tuple[]" + }, + { + "internalType": "bytes32", + "name": "allowFailuresMap", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + }, + { + "internalType": "address", + "name": "challenger", + "type": "address" + } + ], + "internalType": "struct ERC3000Data.Payload", + "name": "payload", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "executionDelay", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Collateral", + "name": "scheduleDeposit", + "type": "tuple" + }, + { + "components": [ + { + "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": "uint256", + "name": "maxCalldataSize", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Config", + "name": "config", + "type": "tuple" + } + ], + "internalType": "struct ERC3000Data.Container", + "name": "_container", + "type": "tuple" + } + ], + "name": "schedule", + "outputs": [ + { + "internalType": "bytes32", + "name": "containerHash", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "executionTime", + "type": "uint256" + }, + { + "internalType": "address", + "name": "submitter", + "type": "address" + }, + { + "internalType": "contract IERC3000Executor", + "name": "executor", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct ERC3000Data.Action[]", + "name": "actions", + "type": "tuple[]" + }, + { + "internalType": "bytes32", + "name": "allowFailuresMap", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + }, + { + "internalType": "address", + "name": "challenger", + "type": "address" + } + ], + "internalType": "struct ERC3000Data.Payload", + "name": "payload", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "executionDelay", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Collateral", + "name": "scheduleDeposit", + "type": "tuple" + }, + { + "components": [ + { + "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": "uint256", + "name": "maxCalldataSize", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Config", + "name": "config", + "type": "tuple" + } + ], + "internalType": "struct ERC3000Data.Container", + "name": "_container", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "_reason", + "type": "bytes" + } + ], + "name": "veto", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" } - ], - "anonymous": false - }, - { - "type": "event", - "name": "Vetoed", - "inputs": [ - { "type": "bytes32", "name": "containerHash", "indexed": true }, - { "type": "address", "name": "actor", "indexed": true }, - { "type": "bytes", "name": "reason", "indexed": false } - ], - "anonymous": false - } - ] -} + ] +} \ No newline at end of file diff --git a/packages/hardhat/hardhat.config.ts b/packages/hardhat/hardhat.config.ts index d762425b..630c01a3 100644 --- a/packages/hardhat/hardhat.config.ts +++ b/packages/hardhat/hardhat.config.ts @@ -1,21 +1,18 @@ import { config as dotenvConfig } from "dotenv"; -import "solidity-coverage"; import "hardhat-deploy"; -import { utils } from "ethers"; import fs from "fs"; import chalk from "chalk"; -import "@nomiclabs/hardhat-waffle"; -import "@eth-optimism/hardhat-ovm"; -import "@nomiclabs/hardhat-web3"; import "@tenderly/hardhat-tenderly"; import "@nomiclabs/hardhat-etherscan"; +import "@openzeppelin/hardhat-upgrades"; +import "@nomiclabs/hardhat-ethers"; import "hardhat-typechain"; +import "typechain"; +import "solidity-coverage"; import { task, HardhatUserConfig, types } from "hardhat/config"; import { HttpNetworkUserConfig } from "hardhat/types"; import { resolve } from "path"; -import { HardhatNetworkAccountsUserConfig } from "../../node_modules/hardhat/src/types/config"; -import deployQuestFactory from "./deploy/deploy-quest_factory"; -import deployQuest from "./deploy/deploy-quest"; +import deployQuest, { questConstructorArguments } from "./deploy/deploy-quest"; import deployGovernQueue, { generateQueueConfig, } from "./scripts/deploy-govern_queue"; @@ -27,35 +24,24 @@ import exportContractResult from "./scripts/export-contract-result"; 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( - __dirname, - fs - .readdirSync("../../") - .filter( - (allFilesPaths: string) => allFilesPaths.match(/\.env$/) !== null - )[0] + __dirname + "/../../", + fs.readdirSync("../../").filter((allFilesPaths: string) => { + let result = allFilesPaths.match(/\.env$/) !== null; + return result; + })[0] ), }); -const { isAddress, getAddress, formatUnits, parseUnits } = utils; - -/* - 📡 This is where you configure your deploy configuration for 🏗 scaffold-eth - - check out `packages/scripts/deploy.js` to customize your deployment - - out of the box it will auto deploy anything in the `contracts` folder and named *.sol - plus it will use *.args for constructor args -*/ - // // Select the network you want to deploy to here: // const defaultNetwork = "localhost"; const mainnetGwei = 21; - function mnemonic() { try { if (!process.env.MNEMONIC || !process.env.PRIVATE_KEY) @@ -72,7 +58,7 @@ function mnemonic() { return "test test test test test test test test test test test junk"; } -function getAccounts(): HardhatNetworkAccountsUserConfig { +function getAccounts() { if (process.env.PRIVATE_KEY) { return [process.env.PRIVATE_KEY as any]; } @@ -124,6 +110,7 @@ const hardhatConfig: HardhatUserConfig = { chainId: 5, url: "https://eth-goerli.g.alchemy.com/v2/E6EdrejZ7PPswowaPl3AfLkdFGEXm1PJ", accounts: getAccounts(), + gasPrice: 20000000000, // 20 Gwei }, xdai: { chainId: 100, @@ -163,7 +150,6 @@ const hardhatConfig: HardhatUserConfig = { url: "https://kovan.optimism.io", gasPrice: 0, accounts: getAccounts(), - ovm: true, companionNetworks: { l1: "kovan", }, @@ -172,7 +158,6 @@ const hardhatConfig: HardhatUserConfig = { url: "http://localhost:8545", gasPrice: 0, accounts: getAccounts(), - ovm: true, companionNetworks: { l1: "localOptimismL1", }, @@ -222,7 +207,7 @@ const hardhatConfig: HardhatUserConfig = { version: "0.5.8", }, { - version: "0.8.1", + version: "0.8.2", settings: { optimizer: { enabled: true, @@ -232,11 +217,11 @@ const hardhatConfig: HardhatUserConfig = { }, ], }, - ovm: { - solcVersion: "0.7.6", - }, etherscan: { - apiKey: process.env.ETHERSCAN_API_KEY, + // @ts-ignore + apiKey: { + goerli: process.env.ETHERSCAN_API_KEY, + }, }, namedAccounts: { deployer: { @@ -255,6 +240,10 @@ const hardhatConfig: HardhatUserConfig = { goerli: defaultConfig.RootOwner.goerli, }, // Goerli Gnosis Safe address }, + typechain: { + outDir: "typechain", + target: "ethers-v5", + }, }; const DEBUG = false; @@ -303,7 +292,8 @@ task("fundedwallet", "Create a wallet (pk) link and fund it with deployer?") // IF NOT SEND USING LOCAL HARDHAT NODE: if (localDeployerMnemonic) { let deployerWallet = ethers.Wallet.fromMnemonic(localDeployerMnemonic); - deployerWallet = deployerWallet.connect(ethers.provider); + const signers = await ethers.getSigners(); + deployerWallet = deployerWallet.connect(signers[0].provider); console.log( "💵 Sending " + amount + @@ -485,8 +475,8 @@ task( ); async function addr(ethers, addr) { - if (isAddress(addr)) { - return getAddress(addr); + if (ethers.isAddress(addr)) { + return ethers.getAddress(addr); } const accounts = await ethers.provider.listAccounts(); if (accounts[addr] !== undefined) { @@ -496,7 +486,7 @@ async function addr(ethers, addr) { } task("accounts", "Prints the list of accounts", async (_, { ethers }) => { - const accounts = await ethers.provider.listAccounts(); + const accounts = await ethers.getSigners(); accounts.forEach((account) => console.log(account)); }); @@ -511,7 +501,7 @@ task("balance", "Prints an account's balance") const balance = await ethers.provider.getBalance( await addr(ethers, taskArgs.account) ); - console.log(formatUnits(balance, "ether"), "ETH"); + console.log(ethers.utils.formatUnits(balance, "ether"), "ETH"); }); function send(signer, txparams) { @@ -542,19 +532,19 @@ task("send", "Send ETH") to = await addr(ethers, taskArgs.to); debug(`Normalized to address: ${to}`); } - + var signerAddress = await fromSigner.getAddress(); const txRequest = { - from: await fromSigner.getAddress(), + from: signerAddress, to, - value: parseUnits( + value: ethers.utils.parseUnits( taskArgs.amount ? taskArgs.amount : "0", "ether" - ).toHexString(), - nonce: await fromSigner.getTransactionCount(), - gasPrice: parseUnits( + ), + nonce: await ethers.provider.getTransactionCount(signerAddress), + gasPrice: ethers.utils.parseUnits( taskArgs.gasPrice ? taskArgs.gasPrice : "1.001", "gwei" - ).toHexString(), + ), gasLimit: taskArgs.gasLimit ? taskArgs.gasLimit : 24000, chainId: network.config.chainId, data: undefined, @@ -815,38 +805,32 @@ task("newQuestFactory:gnosis") "Address of the govern", governGnosis.address ) - .addOptionalParam( - "initialOwner", - "Initial owner of the QuestFactory (will be able to change deposits)" - ) - .addOptionalParam( - "createDepositToken", - "Address of the create quest deposit (default is HNY)", - defaultConfig.CreateQuestDeposit.xdai.token - ) - .addOptionalParam( - "createDepositAmount", - "Amount of the quest create deposit token", - defaultConfig.CreateQuestDeposit.xdai.amount, - types.float - ) - .addOptionalParam( - "playDepositToken", - "Address of the play quest deposit (default is HNY)", - defaultConfig.PlayQuestDeposit.xdai.token - ) - .addOptionalParam( - "playDepositAmount", - "Amount of the quest play deposit token", - defaultConfig.PlayQuestDeposit.xdai.amount, - types.float - ) .setAction(async (args, hre) => { - const deployResult = await deployQuestFactory(hre, args); + console.log("Starting by deploying the Quest template..."); + const questDeployResult = await hre.run("newQuest"); + + console.log("Deploying proxy upgrade for QuestFactory..."); + const questFactoryDeployResult = await upgradeQuestFactory(hre, args); + console.log( - "Deployed quest factory (" + hre.network.name + "):", - deployResult.address + "Deployed proxy upgrade for QuestFactory (" + hre.network.name + "):", + questFactoryDeployResult.address ); + + Promise.all([ + verifyContractWithRetry( + "Quest", + hre.run, + questDeployResult.address, + questDeployResult.args + ), + verifyContractWithRetry( + "QuestFactory", + hre.run, + questFactoryDeployResult.address, + questFactoryDeployResult.args + ), + ]); }); task("newQuestFactory:goerli") @@ -856,41 +840,32 @@ task("newQuestFactory:goerli") "Address of the govern", "0xe43217F71e496475660a3391FFbD1367e354e002" ) - .addOptionalParam( - "initialOwner", - "Initial owner of the QuestFactory (will be able to change deposits)", - defaultConfig.RootOwner.goerli - ) - .addOptionalParam( - "createDepositToken", - "Address of the create quest deposit", - defaultConfig.CreateQuestDeposit.goerli.token - ) - .addOptionalParam( - "createDepositAmount", - "Address of the govern", - defaultConfig.CreateQuestDeposit.goerli.amount, - types.float - ) - .addOptionalParam( - "playDepositToken", - "Address of the play quest deposit", - defaultConfig.PlayQuestDeposit.goerli.token - ) - .addOptionalParam( - "playDepositAmount", - "Address of the govern", - defaultConfig.PlayQuestDeposit.goerli.amount, - types.float - ) .setAction(async (args, hre) => { - console.log("Deploying QuestFactory..."); - const deployResult = await deployQuestFactory(hre, args); + console.log("Starting by deploying the Quest template..."); + const questDeployResult = await hre.run("newQuest", hre); + + console.log("Deploying proxy upgrade for QuestFactory..."); + const questFactoryDeployResult = await upgradeQuestFactory(hre, args); console.log( - "Deployed QuestFactory (" + hre.network.name + "):", - deployResult.address + "Deployed proxy upgrade for QuestFactory (" + hre.network.name + "):", + questFactoryDeployResult.address ); + + await Promise.all([ + verifyContractWithRetry( + "Quest", + hre.run, + questDeployResult.address, + questDeployResult.args + ), + verifyContractWithRetry( + "QuestFactory", + hre.run, + questFactoryDeployResult.address, + questFactoryDeployResult.args + ), + ]); }); task("newQuest") @@ -898,9 +873,10 @@ task("newQuest") .setAction(async (hre) => { const deployResult = await deployQuest(hre); console.log( - "Deployed quest (" + hre.network.name + "):", + "Deployed quest template (" + hre.network.name + "):", deployResult.address ); + return deployResult; }); async function deployAll( @@ -1079,7 +1055,7 @@ task("deployAll:goerli") .setAction(deployAll); task("grantGovernQueue").setAction( - async (_args, { web3, getNamedAccounts }) => { + async (_args, { ethers, getNamedAccounts }) => { const { owner } = await getNamedAccounts(); const publicQueueFonctions = [ "schedule", @@ -1098,11 +1074,12 @@ task("grantGovernQueue").setAction( console.log("GovernQueue roles:"); const publicGrant = "0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF"; let roles = []; + var governQueueAbiInterface = new ethers.utils.Interface(GovernQueueAbi); for (const obj of GovernQueueAbi) { if (obj.type !== "function" || !queueFonctions.includes(obj.name)) { continue; } - let signature = web3.eth.abi.encodeFunctionSignature(obj as any); + let signature = governQueueAbiInterface.getSighash(obj.name); roles.push({ signature, address: ownerOnlyQueueFonctions.includes(obj.name) @@ -1116,11 +1093,12 @@ task("grantGovernQueue").setAction( `[${roles.map((x) => `[0,"${x.signature}","${x.address}"]`).join(",")}]` ); console.log("Govern roles:"); + var governAbiInterface = new ethers.utils.Interface(GovernAbi); for (const obj of GovernAbi) { if (obj.type !== "function" || !aclGovernFunctions.includes(obj.name)) { continue; } - let signature = web3.eth.abi.encodeFunctionSignature(obj as any); + let signature = governAbiInterface.getSighash(obj.name); roles.push({ signature, address: owner, @@ -1184,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); +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 + ), + ]); } - try { - await run("verify:verify", { - address: questDeploy.address, - constructorArguments: questDeploy.args, - }); - } catch (error) { - console.error("Failed when verifying Quest contract", error); - } -}); +); module.exports = hardhatConfig; diff --git a/packages/hardhat/package.json b/packages/hardhat/package.json index 4dd5b590..e8761a46 100644 --- a/packages/hardhat/package.json +++ b/packages/hardhat/package.json @@ -3,54 +3,55 @@ "version": "1.0.0", "main": "index.js", "license": "MIT", - "devDependencies": { - "@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers@^0.3.0-beta.10", - "@types/chai": "^4.2.21", - "@types/mocha": "^9.0.0", - "@types/node": "^14.14.22", - "@types/ramda": "^0.27.38", - "chai": "^4.2.0", - "eslint-config-airbnb": "^18.2.0", - "eslint-config-prettier": "^6.11.0", - "eslint-plugin-babel": "^5.3.1", - "eslint-plugin-import": "^2.22.1", - "eslint-plugin-jsx-a11y": "^6.4.1", - "eslint-plugin-prettier": "^3.1.4", - "eslint-plugin-react": "^7.23.1", - "eslint-plugin-react-hooks": "^4.2.0", - "mocha": "^9.1.1", - "prettier": "^2.3.1", - "prettier-plugin-solidity": "^1.0.0-beta.14", - "ts-generator": "^0.1.1", - "ts-node": "^10.2.1", - "typescript": "^4.2.2" - }, "dependencies": { "@eth-optimism/hardhat-ovm": "0.2.2", "@ethersproject/hardware-wallets": "^5.0.14", "@ethersproject/solidity": "^5.0.9", "@nomicfoundation/hardhat-network-helpers": "^1.0.6", + "@nomiclabs/hardhat-ethers": "2.0.0", "@nomiclabs/hardhat-etherscan": "^3.1.0", "@nomiclabs/hardhat-waffle": "^2.0.0", "@nomiclabs/hardhat-web3": "^2.0.0", - "@openzeppelin/contracts": "^4.9.3", - "@tenderly/hardhat-tenderly": "1.0.10", + "@openzeppelin/contracts": "^4.9.2", + "@openzeppelin/contracts-upgradeable": "^4.9.3", + "@openzeppelin/hardhat-upgrades": "^1.0.0", + "@tenderly/hardhat-tenderly": "^1.7.7", "@typechain/ethers-v5": "^5.0.0", + "@types/chai": "^4.2.21", + "@types/mocha": "^9.0.0", + "@types/node": "^14.14.22", + "@types/ramda": "^0.27.38", + "chai": "^4.2.0", "chalk": "^4.1.0", "cross-var": "^1.1.0", "dotenv": "^10.0.0", "dotenv-cli": "^4.0.0", + "eslint-config-airbnb": "^18.2.0", + "eslint-config-prettier": "^6.11.0", + "eslint-plugin-babel": "^5.3.1", + "eslint-plugin-import": "^2.22.1", + "eslint-plugin-jsx-a11y": "^6.4.1", + "eslint-plugin-prettier": "^3.1.4", + "eslint-plugin-react": "^7.23.1", + "eslint-plugin-react-hooks": "^4.2.0", "ethereum-waffle": "^3.4.0", - "ethers": "^5.4.6", + "ethers": "^5.0.0", "ganache-cli": "^6.12.2", - "hardhat": "2.9.5", + "hardhat": "2.17.0", "hardhat-deploy": "^0.9.0", "hardhat-typechain": "^0.3.5", + "mocha": "^9.1.1", "node-watch": "^0.7.0", + "prettier": "^2.3.1", + "prettier-plugin-solidity": "^1.0.0-beta.14", "qrcode-terminal": "^0.12.0", "ramda": "^0.27.1", - "solidity-coverage": "0.8.2", - "typechain": "^4.0.0" + "solidity-coverage": "0.8.4", + "ts-generator": "^0.1.1", + "ts-node": "^10.2.1", + "typechain": "^4.0.0", + "typechain-target-ethers-v5": "^5.0.1", + "typescript": "^4.2.2" }, "scripts": { "chain": "hardhat node --hostname 0.0.0.0 --network hardhat --no-deploy --show-accounts", @@ -70,6 +71,8 @@ "queue-grant:gnosis": "hardhat grantGovernQueue --network xdai", "queue-grant:goerli": "hardhat grantGovernQueue --network goerli", "deploy-all:local": "hardhat deployAll:goerli", + "deploy-questFactory:goerli": "hardhat newQuestFactory:goerli --network goerli", + "deploy-questFactory:gnosis": "hardhat newQuestFactory:gnosis --network xdai", "console": "hardhat console", "watch": "node scripts/watch.js", "accounts": "hardhat accounts", @@ -77,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" } -} +} \ No newline at end of file diff --git a/packages/hardhat/scripts/deploy-govern_queue.ts b/packages/hardhat/scripts/deploy-govern_queue.ts index a10008bc..9d4a4bfa 100644 --- a/packages/hardhat/scripts/deploy-govern_queue.ts +++ b/packages/hardhat/scripts/deploy-govern_queue.ts @@ -1,7 +1,6 @@ import GovernQueueFactoryAbi from "../abi/contracts/Externals/GovernQueueFactory.json"; import { HardhatRuntimeEnvironment, Network } from "hardhat/types"; -import fs from "fs"; -import { BigNumber, ethers } from "ethers"; +import { ethers } from "ethers"; import exportContractResult from "./export-contract-result"; import GovernQueueAbi from "../abi/contracts/Externals/GovernQueue.json"; @@ -67,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 new file mode 100644 index 00000000..e2523421 --- /dev/null +++ b/packages/hardhat/scripts/upgrade-quest-factory.ts @@ -0,0 +1,42 @@ +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( + { + network, + ethers, + upgrades, + getNamedAccounts, + run, + }: HardhatRuntimeEnvironment, + args?: { + governAddress: string; + createDepositToken: string; + 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 { govern } = await getNamedAccounts(); + + const contractFactory = await ethers.getContractFactory("QuestFactory"); + const newContractUpgrade = await upgrades.upgradeProxy( + QuestFactoryProxy.address, + contractFactory + ); + await newContractUpgrade.deployed(); + + exportContractResult(network, "QuestFactory", { + address: QuestFactoryProxy.address, + abi: abi, + }); + + 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/subgraph.yaml b/packages/hardhat/subgraph.yaml deleted file mode 100644 index e69de29b..00000000 diff --git a/packages/hardhat/test/Quest.test.ts b/packages/hardhat/test/Quest.test.ts index fa1ff278..d01b20f0 100644 --- a/packages/hardhat/test/Quest.test.ts +++ b/packages/hardhat/test/Quest.test.ts @@ -1,4 +1,3 @@ -// @ts-ignore import { ethers, network } from "hardhat"; import { use, expect } from "chai"; import { solidity } from "ethereum-waffle"; @@ -9,8 +8,8 @@ import { fromNumber, } from "./test-helper"; import { TokenMock, TokenMock__factory } from "../typechain"; -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signers"; import { time } from "@nomicfoundation/hardhat-network-helpers"; +import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; use(solidity); @@ -190,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 () { @@ -512,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()", () => { @@ -734,6 +820,40 @@ 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( + "fakeTitle", + "0x", + rewardToken, + epochNow + 3600, // in 1 hour + govern.address, + creator.address, + fromNumber(0), + createDepositToken, + depositAmount, + playDepositToken, + depositAmount, + creator, + 0, + true + ); + const playerInitialBalance = fromNumber(1000); + await playDepositToken + .connect(player) + .mint(player.address, playerInitialBalance); + await playDepositToken + .connect(player) + .approve(quest.address, depositAmount); + // Act + const act = () => quest.connect(player).play(player.address); + + // Assert + await expect(act()).to.be.revertedWith( + "ERROR: Can't self register and play a whitelisted Quest" + ); + }); }); describe("unplay()", () => { @@ -869,6 +989,161 @@ 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( + "fakeTitle", + "0x", + rewardToken, + epochNow + 3600, // in 1 hour + govern.address, + creator.address, + fromNumber(0), + createDepositToken, + depositAmount, + playDepositToken, + depositAmount, + creator, + 0, + true + ); + const playerInitialBalance = fromNumber(1000); + await playDepositToken + .connect(player) + .mint(player.address, playerInitialBalance); + await playDepositToken + .connect(player) + .approve(quest.address, depositAmount); + + // Act + const act = () => quest.connect(player).unplay(player.address); + + // Assert + await expect(act()).to.be.revertedWith( + "ERROR: can't unplay a whitelisted quest" + ); + }); + }); + + describe("constructor()", () => { + it("SHOULD revert if max players greater than 0 and isWhiteList", async () => { + //Arrange + const maxPlayers = 3; + + //Act + const act = () => + deployQuest( + "fakeTitle", + "0x", + rewardToken, + epochNow + 3600, // in 1 hour + govern.address, + creator.address, + fromNumber(0), + createDepositToken, + depositAmount, + playDepositToken, + depositAmount, + creator, + maxPlayers, + true + ); + //Assert + await expect(act()).to.be.revertedWith( + "ERROR: Can't create a whiteListed quest with max players greater than 0 (infinity)" + ); + }); + }); + + describe("setWhiteList()", () => { + it("SHOULD set the player list to the one in the parameters", async () => { + //Arrange + const quest = await deployQuest( + "fakeTitle", + "0x", + rewardToken, + epochNow + 3600, // in 1 hour + govern.address, + creator.address, + fromNumber(0), + createDepositToken, + depositAmount, + playDepositToken, + depositAmount, + creator, + undefined, + true + ); + //Act + const act = () => + quest.connect(creator).setWhiteList([player.address, other.address]); + //Assert + await expect(act()).to.emit(quest, "QuestWhiteListChanged"); + expect(await quest.getPlayers()).to.deep.eq([ + player.address, + other.address, + ]); + expect(await quest.canExecute(player.address)).to.eq(true); + expect(await quest.canExecute(other.address)).to.eq(true); + }); + + it("SHOULD revert if duplicated address in given list", async () => { + //Arrange + const quest = await deployQuest( + "fakeTitle", + "0x", + rewardToken, + epochNow + 3600, // in 1 hour + govern.address, + creator.address, + fromNumber(0), + createDepositToken, + depositAmount, + playDepositToken, + depositAmount, + creator, + undefined, + true + ); + + //Act + 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" + ); + }); + + it("SHOULD revert if it's not a whitelisted quest", async () => { + //Arrange + const quest = await deployQuest( + "fakeTitle", + "0x", + rewardToken, + epochNow + 3600, // in 1 hour + govern.address, + creator.address, + fromNumber(0), + createDepositToken, + depositAmount, + playDepositToken, + depositAmount, + creator, + undefined, + false + ); + //Act + const act = () => + quest.connect(creator).setWhiteList([player.address, other.address]); + + //Assert + await expect(act()).to.be.revertedWith( + "ERROR: Can't set the white list to a non-whitelisted contract" + ); + }); }); describe("getPlayers()", () => { diff --git a/packages/hardhat/test/QuestFactory.test.ts b/packages/hardhat/test/QuestFactory.test.ts index b14a815d..76b02811 100644 --- a/packages/hardhat/test/QuestFactory.test.ts +++ b/packages/hardhat/test/QuestFactory.test.ts @@ -1,4 +1,4 @@ -import { ethers } from "hardhat"; +import { ethers, upgrades } from "hardhat"; import { use, expect } from "chai"; import { solidity } from "ethereum-waffle"; import { @@ -8,8 +8,8 @@ import { TokenMock, TokenMock__factory, } from "../typechain"; -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signers"; import { extractQuestAddressFromTransaction, fromNumber } from "./test-helper"; +import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; use(solidity); @@ -27,21 +27,6 @@ describe("[Contract] QuestFactory", function () { [owner, stranger] = await ethers.getSigners(); }); - it("SHOULD transfer ownership WHEN initialOwner is different than deployer", async function () { - // Arrange - // Act - questFactoryContract = await new QuestFactory__factory(owner).deploy( - owner.address, - createDepositToken.address, - depositAmount, - playDepositToken.address, - depositAmount, - stranger.address - ); - // Assert - expect(await questFactoryContract.owner()).to.equal(stranger.address); - }); - beforeEach(async function () { const tokenMockFactory = new TokenMock__factory(owner); rewardToken = await tokenMockFactory.deploy("Reward Token", "RTOKEN"); @@ -54,250 +39,280 @@ describe("[Contract] QuestFactory", function () { "PDTOKEN" ); otherToken = await tokenMockFactory.deploy("Other Token", "OTOKEN"); - questFactoryContract = await new QuestFactory__factory(owner).deploy( - owner.address, - createDepositToken.address, - depositAmount, - playDepositToken.address, - depositAmount, - owner.address - ); await createDepositToken .connect(owner) .mint(owner.address, fromNumber(1000)); }); - it("SHOULD set the owner address correctly", async function () { - expect(!!owner.address).to.eq(true); // truthy - }); - - describe("createQuest()", function () { - it("SHOULD emit QuestCreated", async function () { - // Arrange - const title = "title"; - const detailIPFS = "0x"; - const expireTime = 0; // Unix Epoch 0 - const maxPlayers = 1; - await createDepositToken - .connect(owner) - .approve(questFactoryContract.address, depositAmount); - - // Act - // Assert - expect( - await questFactoryContract.createQuest( - title, - detailIPFS, - rewardToken.address, - expireTime, - owner.address, - maxPlayers - ) - ).to.emit(questFactoryContract, "QuestCreated"); - }); - - it("SHOULD collect deposit and transfer to new quests", async () => { - // Arrange - const title = "title"; - const detailIPFS = "0x"; - const expireTime = 0; // Unix Epoch 0 - const maxPlayers = 1; - - await createDepositToken - .connect(owner) - .approve(questFactoryContract.address, depositAmount); - - // Act - const newQuestAddress = await extractQuestAddressFromTransaction( - await questFactoryContract.createQuest( - title, - detailIPFS, - rewardToken.address, - expireTime, - owner.address, - maxPlayers - ) + describe("Methods", () => { + beforeEach(async function () { + const contractFactory = await ethers.getContractFactory( + "QuestFactory", + owner ); - - // Assert - expect(await createDepositToken.balanceOf(newQuestAddress)).to.eq( + questFactoryContract = (await upgrades.deployProxy( + contractFactory, + [owner.address], + { + initializer: "initialize", + } + )) as QuestFactory; + questFactoryContract.setCreateDeposit( + createDepositToken.address, depositAmount ); + questFactoryContract.setPlayDeposit( + playDepositToken.address, + depositAmount + ); + await questFactoryContract.deployed(); }); - it("SHOULD revert WHEN creator didn't aproved enough funds", async () => { - // Arrange - const title = "title"; - const detailIPFS = "0x"; - const expireTime = 0; // Unix Epoch 0 - const maxPlayers = 1; - - await createDepositToken - .connect(owner) - .approve(questFactoryContract.address, depositAmount.div(2)); - // Act - const act = () => - questFactoryContract.createQuest( - title, - detailIPFS, - rewardToken.address, - expireTime, - owner.address, - maxPlayers - ); - - // Assert - await expect(act()).to.be.revertedWith("ERROR : Deposit bad allowance"); + it("SHOULD set the owner address correctly", async function () { + expect(!!owner.address).to.eq(true); // truthy }); - }); - describe("setCreateDeposit()", function () { - it("SHOULD emit CreateDepositChanged WHEN valid", async () => { - // Arrange - // Act - const act = () => - questFactoryContract + describe("createQuest()", function () { + it("SHOULD emit QuestCreated", async function () { + // Arrange + const title = "title"; + const detailIPFS = "0x"; + const expireTime = 0; // Unix Epoch 0 + const maxPlayers = 1; + const isWhiteList = false; + await createDepositToken .connect(owner) - .setCreateDeposit(otherToken.address, depositAmount); + .approve(questFactoryContract.address, depositAmount); - // Assert - expect(await act()).to.emit(questFactoryContract, "CreateDepositChanged"); - const [token, amount] = await questFactoryContract.createDeposit(); - expect(token).to.eq(otherToken.address); - expect(amount.eq(depositAmount)).to.eq(true); - }); + // Act + // Assert + expect( + await questFactoryContract.createQuest( + title, + detailIPFS, + rewardToken.address, + expireTime, + owner.address, + maxPlayers, + isWhiteList + ) + ).to.emit(questFactoryContract, "QuestCreated"); + }); - it("SHOULD revert WHEN not owner", async () => { - // Arrange - // Act - const act = () => - questFactoryContract - .connect(stranger) - .setCreateDeposit(otherToken.address, depositAmount); - // Assert - await expect(act()).to.be.revertedWith( - "Ownable: caller is not the owner" - ); - }); + it("SHOULD collect deposit and transfer to new quests", async () => { + // Arrange + const title = "title"; + const detailIPFS = "0x"; + const expireTime = 0; // Unix Epoch 0 + const maxPlayers = 1; + const isWhiteList = false; - it("already created quests SHOULD keep old deposit WHEN change deposit", async () => { - // Arrange - const maxPlayers = 1; - await createDepositToken - .connect(owner) - .approve(questFactoryContract.address, depositAmount); - const questAddress = await extractQuestAddressFromTransaction( - await questFactoryContract + await createDepositToken .connect(owner) - .createQuest( - "title", - "0x", + .approve(questFactoryContract.address, depositAmount); + + // Act + const newQuestAddress = await extractQuestAddressFromTransaction( + await questFactoryContract.createQuest( + title, + detailIPFS, rewardToken.address, - 0, + expireTime, owner.address, - maxPlayers + maxPlayers, + isWhiteList ) - ); - const quest = new Quest__factory(owner).attach(questAddress); - const otherDepositAmount = fromNumber(2); - // Act - await questFactoryContract - .connect(owner) - .setCreateDeposit(otherToken.address, otherDepositAmount); - // Assert - const [token, amount] = await quest.createDeposit(); - expect(token).to.eq(createDepositToken.address); - expect(amount.eq(depositAmount)).to.eq(true); - }); - }); + ); + + // Assert + expect(await createDepositToken.balanceOf(newQuestAddress)).to.eq( + depositAmount + ); + }); - describe("setPlayDeposit()", function () { - it("SHOULD emit PlayDepositChanged WHEN valid", async () => { - // Arrange - // Act - const act = () => - questFactoryContract + it("SHOULD revert WHEN creator didn't aproved enough funds", async () => { + // Arrange + const title = "title"; + const detailIPFS = "0x"; + const expireTime = 0; // Unix Epoch 0 + const maxPlayers = 1; + const isWhiteList = false; + + await createDepositToken .connect(owner) - .setPlayDeposit(otherToken.address, depositAmount); + .approve(questFactoryContract.address, depositAmount.div(2)); + // Act + const act = () => + questFactoryContract.createQuest( + title, + detailIPFS, + rewardToken.address, + expireTime, + owner.address, + maxPlayers, + isWhiteList + ); - // Assert - expect(await act()).to.emit(questFactoryContract, "PlayDepositChanged"); - const [token, amount] = await questFactoryContract.playDeposit(); - expect(token).to.eq(otherToken.address); - expect(amount.eq(depositAmount)).to.eq(true); + // Assert + await expect(act()).to.be.revertedWith("ERROR : Deposit bad allowance"); + }); }); - it("SHOULD revert WHEN not owner", async () => { - // Arrange - // Act - const act = () => - questFactoryContract - .connect(stranger) - .setPlayDeposit(otherToken.address, depositAmount); - // Assert - await expect(act()).to.be.revertedWith( - "Ownable: caller is not the owner" - ); - }); + describe("setCreateDeposit()", function () { + it("SHOULD emit CreateDepositChanged WHEN valid", async () => { + // Arrange + // Act + const act = () => + questFactoryContract + .connect(owner) + .setCreateDeposit(otherToken.address, depositAmount); + + // Assert + expect(await act()).to.emit( + questFactoryContract, + "CreateDepositChanged" + ); + const [token, amount] = await questFactoryContract.createDeposit(); + expect(token).to.eq(otherToken.address); + expect(amount.eq(depositAmount)).to.eq(true); + }); + + it("SHOULD revert WHEN not owner", async () => { + // Arrange + // Act + const act = () => + questFactoryContract + .connect(stranger) + .setCreateDeposit(otherToken.address, depositAmount); + // Assert + await expect(act()).to.be.revertedWith( + "Ownable: caller is not the owner" + ); + }); - it("already created quests SHOULD keep old deposit WHEN change deposit", async () => { - // Arrange - const maxPlayers = 1; - await createDepositToken - .connect(owner) - .approve(questFactoryContract.address, depositAmount); - const questAddress = await extractQuestAddressFromTransaction( + it("already created quests SHOULD keep old deposit WHEN change deposit", async () => { + // Arrange + const maxPlayers = 1; + const isWhiteList = false; + await createDepositToken + .connect(owner) + .approve(questFactoryContract.address, depositAmount); + const questAddress = await extractQuestAddressFromTransaction( + await questFactoryContract + .connect(owner) + .createQuest( + "title", + "0x", + rewardToken.address, + 0, + owner.address, + maxPlayers, + isWhiteList + ) + ); + const quest = new Quest__factory(owner).attach(questAddress); + const otherDepositAmount = fromNumber(2); + // Act await questFactoryContract .connect(owner) - .createQuest( - "title", - "0x", - rewardToken.address, - 0, - owner.address, - maxPlayers - ) - ); - const quest = new Quest__factory(owner).attach(questAddress); - const otherDepositAmount = fromNumber(2); - // Act - await questFactoryContract - .connect(owner) - .setPlayDeposit(otherToken.address, otherDepositAmount); - // Assert - const [token, amount] = await quest.playDeposit(); - expect(token).to.eq(playDepositToken.address); - expect(amount.eq(depositAmount)).to.eq(true); + .setCreateDeposit(otherToken.address, otherDepositAmount); + // Assert + const [token, amount] = await quest.createDeposit(); + expect(token).to.eq(createDepositToken.address); + expect(amount.eq(depositAmount)).to.eq(true); + }); }); - }); - describe("setAragonGovernAddress()", function () { - it("SHOULD set AragonGovernAddress WHEN valid", async () => { - // Arrange - const newGovernAddress = "0x0000000000000000000000000000000000000001"; - // Act - await questFactoryContract - .connect(owner) - .setAragonGovernAddress(newGovernAddress); + describe("setPlayDeposit()", function () { + it("SHOULD emit PlayDepositChanged WHEN valid", async () => { + // Arrange + // Act + const act = () => + questFactoryContract + .connect(owner) + .setPlayDeposit(otherToken.address, depositAmount); - // Assert - expect(await questFactoryContract.aragonGovernAddress()).to.eq( - newGovernAddress - ); + // Assert + expect(await act()).to.emit(questFactoryContract, "PlayDepositChanged"); + const [token, amount] = await questFactoryContract.playDeposit(); + expect(token).to.eq(otherToken.address); + expect(amount.eq(depositAmount)).to.eq(true); + }); + + it("SHOULD revert WHEN not owner", async () => { + // Arrange + // Act + const act = () => + questFactoryContract + .connect(stranger) + .setPlayDeposit(otherToken.address, depositAmount); + // Assert + await expect(act()).to.be.revertedWith( + "Ownable: caller is not the owner" + ); + }); + + it("already created quests SHOULD keep old deposit WHEN change deposit", async () => { + // Arrange + const maxPlayers = 1; + const isWhiteList = false; + await createDepositToken + .connect(owner) + .approve(questFactoryContract.address, depositAmount); + const questAddress = await extractQuestAddressFromTransaction( + await questFactoryContract + .connect(owner) + .createQuest( + "title", + "0x", + rewardToken.address, + 0, + owner.address, + maxPlayers, + isWhiteList + ) + ); + const quest = new Quest__factory(owner).attach(questAddress); + const otherDepositAmount = fromNumber(2); + // Act + await questFactoryContract + .connect(owner) + .setPlayDeposit(otherToken.address, otherDepositAmount); + // Assert + const [token, amount] = await quest.playDeposit(); + expect(token).to.eq(playDepositToken.address); + expect(amount.eq(depositAmount)).to.eq(true); + }); }); - it("SHOULD revert WHEN not owner", async () => { - // Arrange - const newGovernAddress = "0x0000000000000000000000000000000000000001"; - // Act - const act = () => - questFactoryContract - .connect(stranger) + describe("setAragonGovernAddress()", function () { + it("SHOULD set AragonGovernAddress WHEN valid", async () => { + // Arrange + const newGovernAddress = "0x0000000000000000000000000000000000000001"; + // Act + await questFactoryContract + .connect(owner) .setAragonGovernAddress(newGovernAddress); - // Assert - await expect(act()).to.be.revertedWith( - "Ownable: caller is not the owner" - ); + + // Assert + expect(await questFactoryContract.aragonGovernAddress()).to.eq( + newGovernAddress + ); + }); + + it("SHOULD revert WHEN not owner", async () => { + // Arrange + const newGovernAddress = "0x0000000000000000000000000000000000000001"; + // Act + const act = () => + questFactoryContract + .connect(stranger) + .setAragonGovernAddress(newGovernAddress); + // Assert + await expect(act()).to.be.revertedWith( + "Ownable: caller is not the owner" + ); + }); }); }); }); diff --git a/packages/hardhat/test/test-helper.ts b/packages/hardhat/test/test-helper.ts index c26b5b6a..cd8b17c0 100644 --- a/packages/hardhat/test/test-helper.ts +++ b/packages/hardhat/test/test-helper.ts @@ -1,4 +1,4 @@ -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signers"; +import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; import { BigNumber, ContractTransaction } from "ethers"; import { ethers } from "hardhat"; import { Address } from "hardhat-deploy/dist/types"; @@ -21,19 +21,25 @@ export const deployQuest = async ( playDepositToken: TokenMock, playDepositAmount: BigNumber, creator: SignerWithAddress, - maxPlayers: number = 0 + maxPlayers: number = 0, + isWhiteList: boolean = false ) => { const quest = await new Quest__factory(creator).deploy( title, detailIpfsHash, - rewardToken.address, - expireTime, - aragonGovernAddress, - fundsRecoveryAddress, + { token: createDepositToken.address, amount: createDepositAmount }, { token: playDepositToken.address, amount: playDepositAmount }, - creator.address, - maxPlayers + + { + questCreator: creator.address, + maxPlayers: maxPlayers, + rewardToken: rewardToken.address, + expireTime: expireTime, + aragonGovernAddress: aragonGovernAddress, + fundsRecoveryAddress: fundsRecoveryAddress, + isWhiteList: isWhiteList, + } ); await quest.deployed(); await rewardToken.connect(quest.signer).mint(quest.address, initialBalance); diff --git a/packages/hardhat/typechain/ContextUpgradeable.d.ts b/packages/hardhat/typechain/ContextUpgradeable.d.ts new file mode 100644 index 00000000..a27bd184 --- /dev/null +++ b/packages/hardhat/typechain/ContextUpgradeable.d.ts @@ -0,0 +1,52 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { + ethers, + EventFilter, + Signer, + BigNumber, + BigNumberish, + PopulatedTransaction, +} from "ethers"; +import { Contract, ContractTransaction } from "@ethersproject/contracts"; +import { BytesLike } from "@ethersproject/bytes"; +import { Listener, Provider } from "@ethersproject/providers"; +import { FunctionFragment, EventFragment, Result } from "@ethersproject/abi"; + +interface ContextUpgradeableInterface extends ethers.utils.Interface { + functions: {}; + + events: { + "Initialized(uint8)": EventFragment; + }; + + getEvent(nameOrSignatureOrTopic: "Initialized"): EventFragment; +} + +export class ContextUpgradeable extends Contract { + connect(signerOrProvider: Signer | Provider | string): this; + attach(addressOrName: string): this; + deployed(): Promise; + + on(event: EventFilter | string, listener: Listener): this; + once(event: EventFilter | string, listener: Listener): this; + addListener(eventName: EventFilter | string, listener: Listener): this; + removeAllListeners(eventName: EventFilter | string): this; + removeListener(eventName: any, listener: Listener): this; + + interface: ContextUpgradeableInterface; + + functions: {}; + + callStatic: {}; + + filters: { + Initialized(version: null): EventFilter; + }; + + estimateGas: {}; + + populateTransaction: {}; +} diff --git a/packages/hardhat/typechain/Deposit.d.ts b/packages/hardhat/typechain/Deposit.d.ts deleted file mode 100644 index aff74ab7..00000000 --- a/packages/hardhat/typechain/Deposit.d.ts +++ /dev/null @@ -1,198 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ - -import { - ethers, - EventFilter, - Signer, - BigNumber, - BigNumberish, - PopulatedTransaction, -} from "ethers"; -import { - Contract, - ContractTransaction, - Overrides, - CallOverrides, -} from "@ethersproject/contracts"; -import { BytesLike } from "@ethersproject/bytes"; -import { Listener, Provider } from "@ethersproject/providers"; -import { FunctionFragment, EventFragment, Result } from "@ethersproject/abi"; - -interface DepositInterface extends ethers.utils.Interface { - functions: { - "amount()": FunctionFragment; - "collectFrom(address)": FunctionFragment; - "releaseTo(address)": FunctionFragment; - "token()": FunctionFragment; - }; - - encodeFunctionData(functionFragment: "amount", values?: undefined): string; - encodeFunctionData(functionFragment: "collectFrom", values: [string]): string; - encodeFunctionData(functionFragment: "releaseTo", values: [string]): string; - encodeFunctionData(functionFragment: "token", values?: undefined): string; - - decodeFunctionResult(functionFragment: "amount", data: BytesLike): Result; - decodeFunctionResult( - functionFragment: "collectFrom", - data: BytesLike - ): Result; - decodeFunctionResult(functionFragment: "releaseTo", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "token", data: BytesLike): Result; - - events: { - "Lock(address,address,uint256)": EventFragment; - "Unlock(address,address,uint256)": EventFragment; - }; - - getEvent(nameOrSignatureOrTopic: "Lock"): EventFragment; - getEvent(nameOrSignatureOrTopic: "Unlock"): EventFragment; -} - -export class Deposit extends Contract { - connect(signerOrProvider: Signer | Provider | string): this; - attach(addressOrName: string): this; - deployed(): Promise; - - on(event: EventFilter | string, listener: Listener): this; - once(event: EventFilter | string, listener: Listener): this; - addListener(eventName: EventFilter | string, listener: Listener): this; - removeAllListeners(eventName: EventFilter | string): this; - removeListener(eventName: any, listener: Listener): this; - - interface: DepositInterface; - - functions: { - amount(overrides?: CallOverrides): Promise<[BigNumber]>; - - "amount()"(overrides?: CallOverrides): Promise<[BigNumber]>; - - collectFrom( - _from: string, - overrides?: Overrides - ): Promise; - - "collectFrom(address)"( - _from: string, - overrides?: Overrides - ): Promise; - - releaseTo(_to: string, overrides?: Overrides): Promise; - - "releaseTo(address)"( - _to: string, - overrides?: Overrides - ): Promise; - - token(overrides?: CallOverrides): Promise<[string]>; - - "token()"(overrides?: CallOverrides): Promise<[string]>; - }; - - amount(overrides?: CallOverrides): Promise; - - "amount()"(overrides?: CallOverrides): Promise; - - collectFrom( - _from: string, - overrides?: Overrides - ): Promise; - - "collectFrom(address)"( - _from: string, - overrides?: Overrides - ): Promise; - - releaseTo(_to: string, overrides?: Overrides): Promise; - - "releaseTo(address)"( - _to: string, - overrides?: Overrides - ): Promise; - - token(overrides?: CallOverrides): Promise; - - "token()"(overrides?: CallOverrides): Promise; - - callStatic: { - amount(overrides?: CallOverrides): Promise; - - "amount()"(overrides?: CallOverrides): Promise; - - collectFrom(_from: string, overrides?: CallOverrides): Promise; - - "collectFrom(address)"( - _from: string, - overrides?: CallOverrides - ): Promise; - - releaseTo(_to: string, overrides?: CallOverrides): Promise; - - "releaseTo(address)"(_to: string, overrides?: CallOverrides): Promise; - - token(overrides?: CallOverrides): Promise; - - "token()"(overrides?: CallOverrides): Promise; - }; - - filters: { - Lock(token: string | null, from: string | null, amount: null): EventFilter; - - Unlock(token: string | null, to: string | null, amount: null): EventFilter; - }; - - estimateGas: { - amount(overrides?: CallOverrides): Promise; - - "amount()"(overrides?: CallOverrides): Promise; - - collectFrom(_from: string, overrides?: Overrides): Promise; - - "collectFrom(address)"( - _from: string, - overrides?: Overrides - ): Promise; - - releaseTo(_to: string, overrides?: Overrides): Promise; - - "releaseTo(address)"( - _to: string, - overrides?: Overrides - ): Promise; - - token(overrides?: CallOverrides): Promise; - - "token()"(overrides?: CallOverrides): Promise; - }; - - populateTransaction: { - amount(overrides?: CallOverrides): Promise; - - "amount()"(overrides?: CallOverrides): Promise; - - collectFrom( - _from: string, - overrides?: Overrides - ): Promise; - - "collectFrom(address)"( - _from: string, - overrides?: Overrides - ): Promise; - - releaseTo( - _to: string, - overrides?: Overrides - ): Promise; - - "releaseTo(address)"( - _to: string, - overrides?: Overrides - ): Promise; - - token(overrides?: CallOverrides): Promise; - - "token()"(overrides?: CallOverrides): Promise; - }; -} diff --git a/packages/hardhat/typechain/DepositLib.d.ts b/packages/hardhat/typechain/DepositLib.d.ts deleted file mode 100644 index 9e8a1249..00000000 --- a/packages/hardhat/typechain/DepositLib.d.ts +++ /dev/null @@ -1,112 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ - -import { - ethers, - EventFilter, - Signer, - BigNumber, - BigNumberish, - PopulatedTransaction, -} from "ethers"; -import { - Contract, - ContractTransaction, - CallOverrides, -} from "@ethersproject/contracts"; -import { BytesLike } from "@ethersproject/bytes"; -import { Listener, Provider } from "@ethersproject/providers"; -import { FunctionFragment, EventFragment, Result } from "@ethersproject/abi"; - -interface DepositLibInterface extends ethers.utils.Interface { - functions: { - "c_0x86fb8751(bytes32)": FunctionFragment; - }; - - encodeFunctionData( - functionFragment: "c_0x86fb8751", - values: [BytesLike] - ): string; - - decodeFunctionResult( - functionFragment: "c_0x86fb8751", - data: BytesLike - ): Result; - - events: {}; -} - -export class DepositLib extends Contract { - connect(signerOrProvider: Signer | Provider | string): this; - attach(addressOrName: string): this; - deployed(): Promise; - - on(event: EventFilter | string, listener: Listener): this; - once(event: EventFilter | string, listener: Listener): this; - addListener(eventName: EventFilter | string, listener: Listener): this; - removeAllListeners(eventName: EventFilter | string): this; - removeListener(eventName: any, listener: Listener): this; - - interface: DepositLibInterface; - - functions: { - c_0x86fb8751( - c__0x86fb8751: BytesLike, - overrides?: CallOverrides - ): Promise<[void]>; - - "c_0x86fb8751(bytes32)"( - c__0x86fb8751: BytesLike, - overrides?: CallOverrides - ): Promise<[void]>; - }; - - c_0x86fb8751( - c__0x86fb8751: BytesLike, - overrides?: CallOverrides - ): Promise; - - "c_0x86fb8751(bytes32)"( - c__0x86fb8751: BytesLike, - overrides?: CallOverrides - ): Promise; - - callStatic: { - c_0x86fb8751( - c__0x86fb8751: BytesLike, - overrides?: CallOverrides - ): Promise; - - "c_0x86fb8751(bytes32)"( - c__0x86fb8751: BytesLike, - overrides?: CallOverrides - ): Promise; - }; - - filters: {}; - - estimateGas: { - c_0x86fb8751( - c__0x86fb8751: BytesLike, - overrides?: CallOverrides - ): Promise; - - "c_0x86fb8751(bytes32)"( - c__0x86fb8751: BytesLike, - overrides?: CallOverrides - ): Promise; - }; - - populateTransaction: { - c_0x86fb8751( - c__0x86fb8751: BytesLike, - overrides?: CallOverrides - ): Promise; - - "c_0x86fb8751(bytes32)"( - c__0x86fb8751: BytesLike, - overrides?: CallOverrides - ): Promise; - }; -} diff --git a/packages/hardhat/typechain/DisputeManager.d.ts b/packages/hardhat/typechain/DisputeManager.d.ts deleted file mode 100644 index 58f294ae..00000000 --- a/packages/hardhat/typechain/DisputeManager.d.ts +++ /dev/null @@ -1,254 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ - -import { - ethers, - EventFilter, - Signer, - BigNumber, - BigNumberish, - PopulatedTransaction, -} from "ethers"; -import { - Contract, - ContractTransaction, - Overrides, - CallOverrides, -} from "@ethersproject/contracts"; -import { BytesLike } from "@ethersproject/bytes"; -import { Listener, Provider } from "@ethersproject/providers"; -import { FunctionFragment, EventFragment, Result } from "@ethersproject/abi"; - -interface DisputeManagerInterface extends ethers.utils.Interface { - functions: { - "getDisputeFees()": FunctionFragment; - "computeRuling(uint256)": FunctionFragment; - "getDispute(uint256)": FunctionFragment; - }; - - encodeFunctionData( - functionFragment: "getDisputeFees", - values?: undefined - ): string; - encodeFunctionData( - functionFragment: "computeRuling", - values: [BigNumberish] - ): string; - encodeFunctionData( - functionFragment: "getDispute", - values: [BigNumberish] - ): string; - - decodeFunctionResult( - functionFragment: "getDisputeFees", - data: BytesLike - ): Result; - decodeFunctionResult( - functionFragment: "computeRuling", - data: BytesLike - ): Result; - decodeFunctionResult(functionFragment: "getDispute", data: BytesLike): Result; - - events: {}; -} - -export class DisputeManager extends Contract { - connect(signerOrProvider: Signer | Provider | string): this; - attach(addressOrName: string): this; - deployed(): Promise; - - on(event: EventFilter | string, listener: Listener): this; - once(event: EventFilter | string, listener: Listener): this; - addListener(eventName: EventFilter | string, listener: Listener): this; - removeAllListeners(eventName: EventFilter | string): this; - removeListener(eventName: any, listener: Listener): this; - - interface: DisputeManagerInterface; - - functions: { - getDisputeFees(overrides?: CallOverrides): Promise<[string, BigNumber]>; - - "getDisputeFees()"(overrides?: CallOverrides): Promise<[string, BigNumber]>; - - computeRuling( - _disputeId: BigNumberish, - overrides?: Overrides - ): Promise; - - "computeRuling(uint256)"( - _disputeId: BigNumberish, - overrides?: Overrides - ): Promise; - - getDispute( - _disputeId: BigNumberish, - overrides?: CallOverrides - ): Promise< - [string, number, number, number, BigNumber, BigNumber] & { - subject: string; - possibleRulings: number; - state: number; - finalRuling: number; - lastRoundId: BigNumber; - createTermId: BigNumber; - } - >; - - "getDispute(uint256)"( - _disputeId: BigNumberish, - overrides?: CallOverrides - ): Promise< - [string, number, number, number, BigNumber, BigNumber] & { - subject: string; - possibleRulings: number; - state: number; - finalRuling: number; - lastRoundId: BigNumber; - createTermId: BigNumber; - } - >; - }; - - getDisputeFees(overrides?: CallOverrides): Promise<[string, BigNumber]>; - - "getDisputeFees()"(overrides?: CallOverrides): Promise<[string, BigNumber]>; - - computeRuling( - _disputeId: BigNumberish, - overrides?: Overrides - ): Promise; - - "computeRuling(uint256)"( - _disputeId: BigNumberish, - overrides?: Overrides - ): Promise; - - getDispute( - _disputeId: BigNumberish, - overrides?: CallOverrides - ): Promise< - [string, number, number, number, BigNumber, BigNumber] & { - subject: string; - possibleRulings: number; - state: number; - finalRuling: number; - lastRoundId: BigNumber; - createTermId: BigNumber; - } - >; - - "getDispute(uint256)"( - _disputeId: BigNumberish, - overrides?: CallOverrides - ): Promise< - [string, number, number, number, BigNumber, BigNumber] & { - subject: string; - possibleRulings: number; - state: number; - finalRuling: number; - lastRoundId: BigNumber; - createTermId: BigNumber; - } - >; - - callStatic: { - getDisputeFees(overrides?: CallOverrides): Promise<[string, BigNumber]>; - - "getDisputeFees()"(overrides?: CallOverrides): Promise<[string, BigNumber]>; - - computeRuling( - _disputeId: BigNumberish, - overrides?: CallOverrides - ): Promise<[string, number] & { subject: string; finalRuling: number }>; - - "computeRuling(uint256)"( - _disputeId: BigNumberish, - overrides?: CallOverrides - ): Promise<[string, number] & { subject: string; finalRuling: number }>; - - getDispute( - _disputeId: BigNumberish, - overrides?: CallOverrides - ): Promise< - [string, number, number, number, BigNumber, BigNumber] & { - subject: string; - possibleRulings: number; - state: number; - finalRuling: number; - lastRoundId: BigNumber; - createTermId: BigNumber; - } - >; - - "getDispute(uint256)"( - _disputeId: BigNumberish, - overrides?: CallOverrides - ): Promise< - [string, number, number, number, BigNumber, BigNumber] & { - subject: string; - possibleRulings: number; - state: number; - finalRuling: number; - lastRoundId: BigNumber; - createTermId: BigNumber; - } - >; - }; - - filters: {}; - - estimateGas: { - getDisputeFees(overrides?: CallOverrides): Promise; - - "getDisputeFees()"(overrides?: CallOverrides): Promise; - - computeRuling( - _disputeId: BigNumberish, - overrides?: Overrides - ): Promise; - - "computeRuling(uint256)"( - _disputeId: BigNumberish, - overrides?: Overrides - ): Promise; - - getDispute( - _disputeId: BigNumberish, - overrides?: CallOverrides - ): Promise; - - "getDispute(uint256)"( - _disputeId: BigNumberish, - overrides?: CallOverrides - ): Promise; - }; - - populateTransaction: { - getDisputeFees(overrides?: CallOverrides): Promise; - - "getDisputeFees()"( - overrides?: CallOverrides - ): Promise; - - computeRuling( - _disputeId: BigNumberish, - overrides?: Overrides - ): Promise; - - "computeRuling(uint256)"( - _disputeId: BigNumberish, - overrides?: Overrides - ): Promise; - - getDispute( - _disputeId: BigNumberish, - overrides?: CallOverrides - ): Promise; - - "getDispute(uint256)"( - _disputeId: BigNumberish, - overrides?: CallOverrides - ): Promise; - }; -} diff --git a/packages/hardhat/typechain/IERC20Permit.d.ts b/packages/hardhat/typechain/IERC20PermitUpgradeable.d.ts similarity index 97% rename from packages/hardhat/typechain/IERC20Permit.d.ts rename to packages/hardhat/typechain/IERC20PermitUpgradeable.d.ts index 086fc968..f0549518 100644 --- a/packages/hardhat/typechain/IERC20Permit.d.ts +++ b/packages/hardhat/typechain/IERC20PermitUpgradeable.d.ts @@ -20,7 +20,7 @@ import { BytesLike } from "@ethersproject/bytes"; import { Listener, Provider } from "@ethersproject/providers"; import { FunctionFragment, EventFragment, Result } from "@ethersproject/abi"; -interface IERC20PermitInterface extends ethers.utils.Interface { +interface IERC20PermitUpgradeableInterface extends ethers.utils.Interface { functions: { "DOMAIN_SEPARATOR()": FunctionFragment; "nonces(address)": FunctionFragment; @@ -55,7 +55,7 @@ interface IERC20PermitInterface extends ethers.utils.Interface { events: {}; } -export class IERC20Permit extends Contract { +export class IERC20PermitUpgradeable extends Contract { connect(signerOrProvider: Signer | Provider | string): this; attach(addressOrName: string): this; deployed(): Promise; @@ -66,7 +66,7 @@ export class IERC20Permit extends Contract { removeAllListeners(eventName: EventFilter | string): this; removeListener(eventName: any, listener: Listener): this; - interface: IERC20PermitInterface; + interface: IERC20PermitUpgradeableInterface; functions: { DOMAIN_SEPARATOR(overrides?: CallOverrides): Promise<[string]>; diff --git a/packages/hardhat/typechain/IERC20Upgradeable.d.ts b/packages/hardhat/typechain/IERC20Upgradeable.d.ts new file mode 100644 index 00000000..9f8ca151 --- /dev/null +++ b/packages/hardhat/typechain/IERC20Upgradeable.d.ts @@ -0,0 +1,415 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { + ethers, + EventFilter, + Signer, + BigNumber, + BigNumberish, + PopulatedTransaction, +} from "ethers"; +import { + Contract, + ContractTransaction, + Overrides, + CallOverrides, +} from "@ethersproject/contracts"; +import { BytesLike } from "@ethersproject/bytes"; +import { Listener, Provider } from "@ethersproject/providers"; +import { FunctionFragment, EventFragment, Result } from "@ethersproject/abi"; + +interface IERC20UpgradeableInterface extends ethers.utils.Interface { + functions: { + "allowance(address,address)": FunctionFragment; + "approve(address,uint256)": FunctionFragment; + "balanceOf(address)": FunctionFragment; + "totalSupply()": FunctionFragment; + "transfer(address,uint256)": FunctionFragment; + "transferFrom(address,address,uint256)": FunctionFragment; + }; + + encodeFunctionData( + functionFragment: "allowance", + values: [string, string] + ): string; + encodeFunctionData( + functionFragment: "approve", + values: [string, BigNumberish] + ): string; + encodeFunctionData(functionFragment: "balanceOf", values: [string]): string; + encodeFunctionData( + functionFragment: "totalSupply", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "transfer", + values: [string, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "transferFrom", + values: [string, string, BigNumberish] + ): string; + + decodeFunctionResult(functionFragment: "allowance", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "approve", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "balanceOf", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "totalSupply", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "transfer", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "transferFrom", + data: BytesLike + ): Result; + + events: { + "Approval(address,address,uint256)": EventFragment; + "Transfer(address,address,uint256)": EventFragment; + }; + + getEvent(nameOrSignatureOrTopic: "Approval"): EventFragment; + getEvent(nameOrSignatureOrTopic: "Transfer"): EventFragment; +} + +export class IERC20Upgradeable extends Contract { + connect(signerOrProvider: Signer | Provider | string): this; + attach(addressOrName: string): this; + deployed(): Promise; + + on(event: EventFilter | string, listener: Listener): this; + once(event: EventFilter | string, listener: Listener): this; + addListener(eventName: EventFilter | string, listener: Listener): this; + removeAllListeners(eventName: EventFilter | string): this; + removeListener(eventName: any, listener: Listener): this; + + interface: IERC20UpgradeableInterface; + + functions: { + allowance( + owner: string, + spender: string, + overrides?: CallOverrides + ): Promise<[BigNumber]>; + + "allowance(address,address)"( + owner: string, + spender: string, + overrides?: CallOverrides + ): Promise<[BigNumber]>; + + approve( + spender: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + "approve(address,uint256)"( + spender: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + balanceOf(account: string, overrides?: CallOverrides): Promise<[BigNumber]>; + + "balanceOf(address)"( + account: string, + overrides?: CallOverrides + ): Promise<[BigNumber]>; + + totalSupply(overrides?: CallOverrides): Promise<[BigNumber]>; + + "totalSupply()"(overrides?: CallOverrides): Promise<[BigNumber]>; + + transfer( + to: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + "transfer(address,uint256)"( + to: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + transferFrom( + from: string, + to: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + "transferFrom(address,address,uint256)"( + from: string, + to: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + }; + + allowance( + owner: string, + spender: string, + overrides?: CallOverrides + ): Promise; + + "allowance(address,address)"( + owner: string, + spender: string, + overrides?: CallOverrides + ): Promise; + + approve( + spender: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + "approve(address,uint256)"( + spender: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + balanceOf(account: string, overrides?: CallOverrides): Promise; + + "balanceOf(address)"( + account: string, + overrides?: CallOverrides + ): Promise; + + totalSupply(overrides?: CallOverrides): Promise; + + "totalSupply()"(overrides?: CallOverrides): Promise; + + transfer( + to: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + "transfer(address,uint256)"( + to: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + transferFrom( + from: string, + to: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + "transferFrom(address,address,uint256)"( + from: string, + to: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + callStatic: { + allowance( + owner: string, + spender: string, + overrides?: CallOverrides + ): Promise; + + "allowance(address,address)"( + owner: string, + spender: string, + overrides?: CallOverrides + ): Promise; + + approve( + spender: string, + amount: BigNumberish, + overrides?: CallOverrides + ): Promise; + + "approve(address,uint256)"( + spender: string, + amount: BigNumberish, + overrides?: CallOverrides + ): Promise; + + balanceOf(account: string, overrides?: CallOverrides): Promise; + + "balanceOf(address)"( + account: string, + overrides?: CallOverrides + ): Promise; + + totalSupply(overrides?: CallOverrides): Promise; + + "totalSupply()"(overrides?: CallOverrides): Promise; + + transfer( + to: string, + amount: BigNumberish, + overrides?: CallOverrides + ): Promise; + + "transfer(address,uint256)"( + to: string, + amount: BigNumberish, + overrides?: CallOverrides + ): Promise; + + transferFrom( + from: string, + to: string, + amount: BigNumberish, + overrides?: CallOverrides + ): Promise; + + "transferFrom(address,address,uint256)"( + from: string, + to: string, + amount: BigNumberish, + overrides?: CallOverrides + ): Promise; + }; + + filters: { + Approval( + owner: string | null, + spender: string | null, + value: null + ): EventFilter; + + Transfer(from: string | null, to: string | null, value: null): EventFilter; + }; + + estimateGas: { + allowance( + owner: string, + spender: string, + overrides?: CallOverrides + ): Promise; + + "allowance(address,address)"( + owner: string, + spender: string, + overrides?: CallOverrides + ): Promise; + + approve( + spender: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + "approve(address,uint256)"( + spender: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + balanceOf(account: string, overrides?: CallOverrides): Promise; + + "balanceOf(address)"( + account: string, + overrides?: CallOverrides + ): Promise; + + totalSupply(overrides?: CallOverrides): Promise; + + "totalSupply()"(overrides?: CallOverrides): Promise; + + transfer( + to: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + "transfer(address,uint256)"( + to: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + transferFrom( + from: string, + to: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + "transferFrom(address,address,uint256)"( + from: string, + to: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + }; + + populateTransaction: { + allowance( + owner: string, + spender: string, + overrides?: CallOverrides + ): Promise; + + "allowance(address,address)"( + owner: string, + spender: string, + overrides?: CallOverrides + ): Promise; + + approve( + spender: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + "approve(address,uint256)"( + spender: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + balanceOf( + account: string, + overrides?: CallOverrides + ): Promise; + + "balanceOf(address)"( + account: string, + overrides?: CallOverrides + ): Promise; + + totalSupply(overrides?: CallOverrides): Promise; + + "totalSupply()"(overrides?: CallOverrides): Promise; + + transfer( + to: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + "transfer(address,uint256)"( + to: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + transferFrom( + from: string, + to: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + "transferFrom(address,address,uint256)"( + from: string, + to: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + }; +} diff --git a/packages/hardhat/typechain/Initializable.d.ts b/packages/hardhat/typechain/Initializable.d.ts new file mode 100644 index 00000000..b90cd586 --- /dev/null +++ b/packages/hardhat/typechain/Initializable.d.ts @@ -0,0 +1,52 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { + ethers, + EventFilter, + Signer, + BigNumber, + BigNumberish, + PopulatedTransaction, +} from "ethers"; +import { Contract, ContractTransaction } from "@ethersproject/contracts"; +import { BytesLike } from "@ethersproject/bytes"; +import { Listener, Provider } from "@ethersproject/providers"; +import { FunctionFragment, EventFragment, Result } from "@ethersproject/abi"; + +interface InitializableInterface extends ethers.utils.Interface { + functions: {}; + + events: { + "Initialized(uint8)": EventFragment; + }; + + getEvent(nameOrSignatureOrTopic: "Initialized"): EventFragment; +} + +export class Initializable extends Contract { + connect(signerOrProvider: Signer | Provider | string): this; + attach(addressOrName: string): this; + deployed(): Promise; + + on(event: EventFilter | string, listener: Listener): this; + once(event: EventFilter | string, listener: Listener): this; + addListener(eventName: EventFilter | string, listener: Listener): this; + removeAllListeners(eventName: EventFilter | string): this; + removeListener(eventName: any, listener: Listener): this; + + interface: InitializableInterface; + + functions: {}; + + callStatic: {}; + + filters: { + Initialized(version: null): EventFilter; + }; + + estimateGas: {}; + + populateTransaction: {}; +} diff --git a/packages/hardhat/typechain/Models.d.ts b/packages/hardhat/typechain/Models.d.ts deleted file mode 100644 index f09ad453..00000000 --- a/packages/hardhat/typechain/Models.d.ts +++ /dev/null @@ -1,112 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ - -import { - ethers, - EventFilter, - Signer, - BigNumber, - BigNumberish, - PopulatedTransaction, -} from "ethers"; -import { - Contract, - ContractTransaction, - CallOverrides, -} from "@ethersproject/contracts"; -import { BytesLike } from "@ethersproject/bytes"; -import { Listener, Provider } from "@ethersproject/providers"; -import { FunctionFragment, EventFragment, Result } from "@ethersproject/abi"; - -interface ModelsInterface extends ethers.utils.Interface { - functions: { - "c_0xa9dfceef(bytes32)": FunctionFragment; - }; - - encodeFunctionData( - functionFragment: "c_0xa9dfceef", - values: [BytesLike] - ): string; - - decodeFunctionResult( - functionFragment: "c_0xa9dfceef", - data: BytesLike - ): Result; - - events: {}; -} - -export class Models extends Contract { - connect(signerOrProvider: Signer | Provider | string): this; - attach(addressOrName: string): this; - deployed(): Promise; - - on(event: EventFilter | string, listener: Listener): this; - once(event: EventFilter | string, listener: Listener): this; - addListener(eventName: EventFilter | string, listener: Listener): this; - removeAllListeners(eventName: EventFilter | string): this; - removeListener(eventName: any, listener: Listener): this; - - interface: ModelsInterface; - - functions: { - c_0xa9dfceef( - c__0xa9dfceef: BytesLike, - overrides?: CallOverrides - ): Promise<[void]>; - - "c_0xa9dfceef(bytes32)"( - c__0xa9dfceef: BytesLike, - overrides?: CallOverrides - ): Promise<[void]>; - }; - - c_0xa9dfceef( - c__0xa9dfceef: BytesLike, - overrides?: CallOverrides - ): Promise; - - "c_0xa9dfceef(bytes32)"( - c__0xa9dfceef: BytesLike, - overrides?: CallOverrides - ): Promise; - - callStatic: { - c_0xa9dfceef( - c__0xa9dfceef: BytesLike, - overrides?: CallOverrides - ): Promise; - - "c_0xa9dfceef(bytes32)"( - c__0xa9dfceef: BytesLike, - overrides?: CallOverrides - ): Promise; - }; - - filters: {}; - - estimateGas: { - c_0xa9dfceef( - c__0xa9dfceef: BytesLike, - overrides?: CallOverrides - ): Promise; - - "c_0xa9dfceef(bytes32)"( - c__0xa9dfceef: BytesLike, - overrides?: CallOverrides - ): Promise; - }; - - populateTransaction: { - c_0xa9dfceef( - c__0xa9dfceef: BytesLike, - overrides?: CallOverrides - ): Promise; - - "c_0xa9dfceef(bytes32)"( - c__0xa9dfceef: BytesLike, - overrides?: CallOverrides - ): Promise; - }; -} diff --git a/packages/hardhat/typechain/Ownable.d.ts b/packages/hardhat/typechain/OwnableUpgradeable.d.ts similarity index 93% rename from packages/hardhat/typechain/Ownable.d.ts rename to packages/hardhat/typechain/OwnableUpgradeable.d.ts index bfbe509a..a302233d 100644 --- a/packages/hardhat/typechain/Ownable.d.ts +++ b/packages/hardhat/typechain/OwnableUpgradeable.d.ts @@ -20,7 +20,7 @@ import { BytesLike } from "@ethersproject/bytes"; import { Listener, Provider } from "@ethersproject/providers"; import { FunctionFragment, EventFragment, Result } from "@ethersproject/abi"; -interface OwnableInterface extends ethers.utils.Interface { +interface OwnableUpgradeableInterface extends ethers.utils.Interface { functions: { "owner()": FunctionFragment; "renounceOwnership()": FunctionFragment; @@ -48,13 +48,15 @@ interface OwnableInterface extends ethers.utils.Interface { ): Result; events: { + "Initialized(uint8)": EventFragment; "OwnershipTransferred(address,address)": EventFragment; }; + getEvent(nameOrSignatureOrTopic: "Initialized"): EventFragment; getEvent(nameOrSignatureOrTopic: "OwnershipTransferred"): EventFragment; } -export class Ownable extends Contract { +export class OwnableUpgradeable extends Contract { connect(signerOrProvider: Signer | Provider | string): this; attach(addressOrName: string): this; deployed(): Promise; @@ -65,7 +67,7 @@ export class Ownable extends Contract { removeAllListeners(eventName: EventFilter | string): this; removeListener(eventName: any, listener: Listener): this; - interface: OwnableInterface; + interface: OwnableUpgradeableInterface; functions: { owner(overrides?: CallOverrides): Promise<[string]>; @@ -126,6 +128,8 @@ export class Ownable extends Contract { }; filters: { + Initialized(version: null): EventFilter; + OwnershipTransferred( previousOwner: string | null, newOwner: string | null diff --git a/packages/hardhat/typechain/Quest.d.ts b/packages/hardhat/typechain/Quest.d.ts index df774282..7e0a4c44 100644 --- a/packages/hardhat/typechain/Quest.d.ts +++ b/packages/hardhat/typechain/Quest.d.ts @@ -31,6 +31,7 @@ interface QuestInterface extends ethers.utils.Interface { "fundsRecoveryAddress()": FunctionFragment; "getPlayers()": FunctionFragment; "isCreateDepositReleased()": FunctionFragment; + "isWhiteList()": FunctionFragment; "maxPlayers()": FunctionFragment; "play(address)": FunctionFragment; "playDeposit()": FunctionFragment; @@ -39,6 +40,7 @@ interface QuestInterface extends ethers.utils.Interface { "questTitle()": FunctionFragment; "recoverFundsAndDeposit()": FunctionFragment; "rewardToken()": FunctionFragment; + "setWhiteList(address[])": FunctionFragment; "unplay(address)": FunctionFragment; }; @@ -75,6 +77,10 @@ interface QuestInterface extends ethers.utils.Interface { functionFragment: "isCreateDepositReleased", values?: undefined ): string; + encodeFunctionData( + functionFragment: "isWhiteList", + values?: undefined + ): string; encodeFunctionData( functionFragment: "maxPlayers", values?: undefined @@ -104,6 +110,10 @@ interface QuestInterface extends ethers.utils.Interface { functionFragment: "rewardToken", values?: undefined ): string; + encodeFunctionData( + functionFragment: "setWhiteList", + values: [string[]] + ): string; encodeFunctionData(functionFragment: "unplay", values: [string]): string; decodeFunctionResult( @@ -127,6 +137,10 @@ interface QuestInterface extends ethers.utils.Interface { functionFragment: "isCreateDepositReleased", data: BytesLike ): Result; + decodeFunctionResult( + functionFragment: "isWhiteList", + data: BytesLike + ): Result; decodeFunctionResult(functionFragment: "maxPlayers", data: BytesLike): Result; decodeFunctionResult(functionFragment: "play", data: BytesLike): Result; decodeFunctionResult( @@ -150,17 +164,23 @@ interface QuestInterface extends ethers.utils.Interface { functionFragment: "rewardToken", data: BytesLike ): Result; + decodeFunctionResult( + functionFragment: "setWhiteList", + data: BytesLike + ): Result; decodeFunctionResult(functionFragment: "unplay", data: BytesLike): Result; events: { "QuestClaimed(bytes,address,uint256)": EventFragment; "QuestPlayed(address,uint256)": EventFragment; "QuestUnplayed(address,uint256)": EventFragment; + "QuestWhiteListChanged(address[],uint256)": EventFragment; }; getEvent(nameOrSignatureOrTopic: "QuestClaimed"): EventFragment; getEvent(nameOrSignatureOrTopic: "QuestPlayed"): EventFragment; getEvent(nameOrSignatureOrTopic: "QuestUnplayed"): EventFragment; + getEvent(nameOrSignatureOrTopic: "QuestWhiteListChanged"): EventFragment; } export class Quest extends Contract { @@ -250,6 +270,10 @@ export class Quest extends Contract { "isCreateDepositReleased()"(overrides?: CallOverrides): Promise<[boolean]>; + isWhiteList(overrides?: CallOverrides): Promise<[boolean]>; + + "isWhiteList()"(overrides?: CallOverrides): Promise<[boolean]>; + maxPlayers(overrides?: CallOverrides): Promise<[number]>; "maxPlayers()"(overrides?: CallOverrides): Promise<[number]>; @@ -291,6 +315,16 @@ export class Quest extends Contract { "rewardToken()"(overrides?: CallOverrides): Promise<[string]>; + setWhiteList( + _players: string[], + overrides?: Overrides + ): Promise; + + "setWhiteList(address[])"( + _players: string[], + overrides?: Overrides + ): Promise; + unplay( _player: string, overrides?: Overrides @@ -375,6 +409,10 @@ export class Quest extends Contract { "isCreateDepositReleased()"(overrides?: CallOverrides): Promise; + isWhiteList(overrides?: CallOverrides): Promise; + + "isWhiteList()"(overrides?: CallOverrides): Promise; + maxPlayers(overrides?: CallOverrides): Promise; "maxPlayers()"(overrides?: CallOverrides): Promise; @@ -416,6 +454,16 @@ export class Quest extends Contract { "rewardToken()"(overrides?: CallOverrides): Promise; + setWhiteList( + _players: string[], + overrides?: Overrides + ): Promise; + + "setWhiteList(address[])"( + _players: string[], + overrides?: Overrides + ): Promise; + unplay(_player: string, overrides?: Overrides): Promise; "unplay(address)"( @@ -497,6 +545,10 @@ export class Quest extends Contract { "isCreateDepositReleased()"(overrides?: CallOverrides): Promise; + isWhiteList(overrides?: CallOverrides): Promise; + + "isWhiteList()"(overrides?: CallOverrides): Promise; + maxPlayers(overrides?: CallOverrides): Promise; "maxPlayers()"(overrides?: CallOverrides): Promise; @@ -533,6 +585,13 @@ export class Quest extends Contract { "rewardToken()"(overrides?: CallOverrides): Promise; + setWhiteList(_players: string[], overrides?: CallOverrides): Promise; + + "setWhiteList(address[])"( + _players: string[], + overrides?: CallOverrides + ): Promise; + unplay(_player: string, overrides?: CallOverrides): Promise; "unplay(address)"( @@ -547,6 +606,8 @@ export class Quest extends Contract { QuestPlayed(player: null, timestamp: null): EventFilter; QuestUnplayed(player: null, timestamp: null): EventFilter; + + QuestWhiteListChanged(whiteListPlayers: null, timestamp: null): EventFilter; }; estimateGas: { @@ -604,6 +665,10 @@ export class Quest extends Contract { "isCreateDepositReleased()"(overrides?: CallOverrides): Promise; + isWhiteList(overrides?: CallOverrides): Promise; + + "isWhiteList()"(overrides?: CallOverrides): Promise; + maxPlayers(overrides?: CallOverrides): Promise; "maxPlayers()"(overrides?: CallOverrides): Promise; @@ -636,6 +701,13 @@ export class Quest extends Contract { "rewardToken()"(overrides?: CallOverrides): Promise; + setWhiteList(_players: string[], overrides?: Overrides): Promise; + + "setWhiteList(address[])"( + _players: string[], + overrides?: Overrides + ): Promise; + unplay(_player: string, overrides?: Overrides): Promise; "unplay(address)"( @@ -717,6 +789,10 @@ export class Quest extends Contract { overrides?: CallOverrides ): Promise; + isWhiteList(overrides?: CallOverrides): Promise; + + "isWhiteList()"(overrides?: CallOverrides): Promise; + maxPlayers(overrides?: CallOverrides): Promise; "maxPlayers()"(overrides?: CallOverrides): Promise; @@ -758,6 +834,16 @@ export class Quest extends Contract { "rewardToken()"(overrides?: CallOverrides): Promise; + setWhiteList( + _players: string[], + overrides?: Overrides + ): Promise; + + "setWhiteList(address[])"( + _players: string[], + overrides?: Overrides + ): Promise; + unplay( _player: string, overrides?: Overrides diff --git a/packages/hardhat/typechain/QuestFactory.d.ts b/packages/hardhat/typechain/QuestFactory.d.ts index 0427223f..9e7f7e3e 100644 --- a/packages/hardhat/typechain/QuestFactory.d.ts +++ b/packages/hardhat/typechain/QuestFactory.d.ts @@ -24,7 +24,8 @@ interface QuestFactoryInterface extends ethers.utils.Interface { functions: { "aragonGovernAddress()": FunctionFragment; "createDeposit()": FunctionFragment; - "createQuest(string,bytes,address,uint256,address,uint32)": FunctionFragment; + "createQuest(string,bytes,address,uint256,address,uint32,bool)": FunctionFragment; + "initialize(address)": FunctionFragment; "owner()": FunctionFragment; "playDeposit()": FunctionFragment; "renounceOwnership()": FunctionFragment; @@ -32,6 +33,7 @@ interface QuestFactoryInterface extends ethers.utils.Interface { "setCreateDeposit(address,uint256)": FunctionFragment; "setPlayDeposit(address,uint256)": FunctionFragment; "transferOwnership(address)": FunctionFragment; + "version()": FunctionFragment; }; encodeFunctionData( @@ -44,8 +46,17 @@ interface QuestFactoryInterface extends ethers.utils.Interface { ): string; encodeFunctionData( functionFragment: "createQuest", - values: [string, BytesLike, string, BigNumberish, string, BigNumberish] + values: [ + string, + BytesLike, + string, + BigNumberish, + string, + BigNumberish, + boolean + ] ): string; + encodeFunctionData(functionFragment: "initialize", values: [string]): string; encodeFunctionData(functionFragment: "owner", values?: undefined): string; encodeFunctionData( functionFragment: "playDeposit", @@ -71,6 +82,7 @@ interface QuestFactoryInterface extends ethers.utils.Interface { functionFragment: "transferOwnership", values: [string] ): string; + encodeFunctionData(functionFragment: "version", values?: undefined): string; decodeFunctionResult( functionFragment: "aragonGovernAddress", @@ -84,6 +96,7 @@ interface QuestFactoryInterface extends ethers.utils.Interface { functionFragment: "createQuest", data: BytesLike ): Result; + decodeFunctionResult(functionFragment: "initialize", data: BytesLike): Result; decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result; decodeFunctionResult( functionFragment: "playDeposit", @@ -109,15 +122,18 @@ interface QuestFactoryInterface extends ethers.utils.Interface { functionFragment: "transferOwnership", data: BytesLike ): Result; + decodeFunctionResult(functionFragment: "version", data: BytesLike): Result; events: { "CreateDepositChanged(uint256,address,uint256)": EventFragment; + "Initialized(uint8)": EventFragment; "OwnershipTransferred(address,address)": EventFragment; "PlayDepositChanged(uint256,address,uint256)": EventFragment; - "QuestCreated(address,string,bytes,address,uint256,address,address,uint256,address,uint256,address,uint32)": EventFragment; + "QuestCreated(address,string,bytes,address,uint256,address,tuple,tuple,address,uint32,bool,uint256)": EventFragment; }; getEvent(nameOrSignatureOrTopic: "CreateDepositChanged"): EventFragment; + getEvent(nameOrSignatureOrTopic: "Initialized"): EventFragment; getEvent(nameOrSignatureOrTopic: "OwnershipTransferred"): EventFragment; getEvent(nameOrSignatureOrTopic: "PlayDepositChanged"): EventFragment; getEvent(nameOrSignatureOrTopic: "QuestCreated"): EventFragment; @@ -156,16 +172,28 @@ export class QuestFactory extends Contract { _expireTime: BigNumberish, _fundsRecoveryAddress: string, _maxPlayers: BigNumberish, + _isWhiteList: boolean, overrides?: Overrides ): Promise; - "createQuest(string,bytes,address,uint256,address,uint32)"( + "createQuest(string,bytes,address,uint256,address,uint32,bool)"( _questTitle: string, _questDetailsRef: BytesLike, _rewardToken: string, _expireTime: BigNumberish, _fundsRecoveryAddress: string, _maxPlayers: BigNumberish, + _isWhiteList: boolean, + overrides?: Overrides + ): Promise; + + initialize( + _aragonGovernAddress: string, + overrides?: Overrides + ): Promise; + + "initialize(address)"( + _aragonGovernAddress: string, overrides?: Overrides ): Promise; @@ -228,6 +256,10 @@ export class QuestFactory extends Contract { newOwner: string, overrides?: Overrides ): Promise; + + version(overrides?: CallOverrides): Promise<[BigNumber]>; + + "version()"(overrides?: CallOverrides): Promise<[BigNumber]>; }; aragonGovernAddress(overrides?: CallOverrides): Promise; @@ -249,16 +281,28 @@ export class QuestFactory extends Contract { _expireTime: BigNumberish, _fundsRecoveryAddress: string, _maxPlayers: BigNumberish, + _isWhiteList: boolean, overrides?: Overrides ): Promise; - "createQuest(string,bytes,address,uint256,address,uint32)"( + "createQuest(string,bytes,address,uint256,address,uint32,bool)"( _questTitle: string, _questDetailsRef: BytesLike, _rewardToken: string, _expireTime: BigNumberish, _fundsRecoveryAddress: string, _maxPlayers: BigNumberish, + _isWhiteList: boolean, + overrides?: Overrides + ): Promise; + + initialize( + _aragonGovernAddress: string, + overrides?: Overrides + ): Promise; + + "initialize(address)"( + _aragonGovernAddress: string, overrides?: Overrides ): Promise; @@ -322,6 +366,10 @@ export class QuestFactory extends Contract { overrides?: Overrides ): Promise; + version(overrides?: CallOverrides): Promise; + + "version()"(overrides?: CallOverrides): Promise; + callStatic: { aragonGovernAddress(overrides?: CallOverrides): Promise; @@ -342,19 +390,31 @@ export class QuestFactory extends Contract { _expireTime: BigNumberish, _fundsRecoveryAddress: string, _maxPlayers: BigNumberish, + _isWhiteList: boolean, overrides?: CallOverrides ): Promise; - "createQuest(string,bytes,address,uint256,address,uint32)"( + "createQuest(string,bytes,address,uint256,address,uint32,bool)"( _questTitle: string, _questDetailsRef: BytesLike, _rewardToken: string, _expireTime: BigNumberish, _fundsRecoveryAddress: string, _maxPlayers: BigNumberish, + _isWhiteList: boolean, overrides?: CallOverrides ): Promise; + initialize( + _aragonGovernAddress: string, + overrides?: CallOverrides + ): Promise; + + "initialize(address)"( + _aragonGovernAddress: string, + overrides?: CallOverrides + ): Promise; + owner(overrides?: CallOverrides): Promise; "owner()"(overrides?: CallOverrides): Promise; @@ -414,6 +474,10 @@ export class QuestFactory extends Contract { newOwner: string, overrides?: CallOverrides ): Promise; + + version(overrides?: CallOverrides): Promise; + + "version()"(overrides?: CallOverrides): Promise; }; filters: { @@ -423,6 +487,8 @@ export class QuestFactory extends Contract { amount: null ): EventFilter; + Initialized(version: null): EventFilter; + OwnershipTransferred( previousOwner: string | null, newOwner: string | null @@ -437,12 +503,12 @@ export class QuestFactory extends Contract { rewardTokenAddress: null, expireTime: null, fundsRecoveryAddress: null, - createDepositToken: null, - createDepositAmount: null, - playDepositToken: null, - playDepositAmount: null, + createDeposit: null, + playDeposit: null, creator: null, - maxPlayers: null + maxPlayers: null, + isWhiteList: null, + version: null ): EventFilter; }; @@ -462,16 +528,28 @@ export class QuestFactory extends Contract { _expireTime: BigNumberish, _fundsRecoveryAddress: string, _maxPlayers: BigNumberish, + _isWhiteList: boolean, overrides?: Overrides ): Promise; - "createQuest(string,bytes,address,uint256,address,uint32)"( + "createQuest(string,bytes,address,uint256,address,uint32,bool)"( _questTitle: string, _questDetailsRef: BytesLike, _rewardToken: string, _expireTime: BigNumberish, _fundsRecoveryAddress: string, _maxPlayers: BigNumberish, + _isWhiteList: boolean, + overrides?: Overrides + ): Promise; + + initialize( + _aragonGovernAddress: string, + overrides?: Overrides + ): Promise; + + "initialize(address)"( + _aragonGovernAddress: string, overrides?: Overrides ): Promise; @@ -530,6 +608,10 @@ export class QuestFactory extends Contract { newOwner: string, overrides?: Overrides ): Promise; + + version(overrides?: CallOverrides): Promise; + + "version()"(overrides?: CallOverrides): Promise; }; populateTransaction: { @@ -552,16 +634,28 @@ export class QuestFactory extends Contract { _expireTime: BigNumberish, _fundsRecoveryAddress: string, _maxPlayers: BigNumberish, + _isWhiteList: boolean, overrides?: Overrides ): Promise; - "createQuest(string,bytes,address,uint256,address,uint32)"( + "createQuest(string,bytes,address,uint256,address,uint32,bool)"( _questTitle: string, _questDetailsRef: BytesLike, _rewardToken: string, _expireTime: BigNumberish, _fundsRecoveryAddress: string, _maxPlayers: BigNumberish, + _isWhiteList: boolean, + overrides?: Overrides + ): Promise; + + initialize( + _aragonGovernAddress: string, + overrides?: Overrides + ): Promise; + + "initialize(address)"( + _aragonGovernAddress: string, overrides?: Overrides ): Promise; @@ -620,5 +714,9 @@ export class QuestFactory extends Contract { newOwner: string, overrides?: Overrides ): Promise; + + version(overrides?: CallOverrides): Promise; + + "version()"(overrides?: CallOverrides): Promise; }; } diff --git a/packages/hardhat/typechain/factories/ContextUpgradeable__factory.ts b/packages/hardhat/typechain/factories/ContextUpgradeable__factory.ts new file mode 100644 index 00000000..8fca806c --- /dev/null +++ b/packages/hardhat/typechain/factories/ContextUpgradeable__factory.ts @@ -0,0 +1,33 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Signer } from "ethers"; +import { Provider } from "@ethersproject/providers"; + +import type { ContextUpgradeable } from "../ContextUpgradeable"; + +export class ContextUpgradeable__factory { + static connect( + address: string, + signerOrProvider: Signer | Provider + ): ContextUpgradeable { + return new Contract(address, _abi, signerOrProvider) as ContextUpgradeable; + } +} + +const _abi = [ + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint8", + name: "version", + type: "uint8", + }, + ], + name: "Initialized", + type: "event", + }, +]; diff --git a/packages/hardhat/typechain/factories/DepositLib__factory.ts b/packages/hardhat/typechain/factories/DepositLib__factory.ts deleted file mode 100644 index 8dfb05fc..00000000 --- a/packages/hardhat/typechain/factories/DepositLib__factory.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ - -import { Signer } from "ethers"; -import { Provider, TransactionRequest } from "@ethersproject/providers"; -import { Contract, ContractFactory, Overrides } from "@ethersproject/contracts"; - -import type { DepositLib } from "../DepositLib"; - -export class DepositLib__factory extends ContractFactory { - constructor(signer?: Signer) { - super(_abi, _bytecode, signer); - } - - deploy(overrides?: Overrides): Promise { - return super.deploy(overrides || {}) as Promise; - } - getDeployTransaction(overrides?: Overrides): TransactionRequest { - return super.getDeployTransaction(overrides || {}); - } - attach(address: string): DepositLib { - return super.attach(address) as DepositLib; - } - connect(signer: Signer): DepositLib__factory { - return super.connect(signer) as DepositLib__factory; - } - static connect( - address: string, - signerOrProvider: Signer | Provider - ): DepositLib { - return new Contract(address, _abi, signerOrProvider) as DepositLib; - } -} - -const _abi = [ - { - inputs: [ - { - internalType: "bytes32", - name: "c__0x86fb8751", - type: "bytes32", - }, - ], - name: "c_0x86fb8751", - outputs: [], - stateMutability: "pure", - type: "function", - }, -]; - -const _bytecode = - "0x60e0610052600b82828239805160001a607314610045577f4e487b7100000000000000000000000000000000000000000000000000000000600052600060045260246000fd5b30600052607381538281f3fe730000000000000000000000000000000000000000301460806040526004361060335760003560e01c8063176bc871146038575b600080fd5b604e6004803603810190604a91906066565b6050565b005b50565b6000813590506060816096565b92915050565b600060208284031215607757600080fd5b60006083848285016053565b91505092915050565b6000819050919050565b609d81608c565b811460a757600080fd5b5056fea2646970667358221220a32ca1d88683ae95494422ab83791ee969d3214649243cd5f3714835d30da88d64736f6c63430008010033"; diff --git a/packages/hardhat/typechain/factories/Deposit__factory.ts b/packages/hardhat/typechain/factories/Deposit__factory.ts deleted file mode 100644 index 222b2906..00000000 --- a/packages/hardhat/typechain/factories/Deposit__factory.ts +++ /dev/null @@ -1,166 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ - -import { Signer, BigNumberish } from "ethers"; -import { Provider, TransactionRequest } from "@ethersproject/providers"; -import { Contract, ContractFactory, Overrides } from "@ethersproject/contracts"; - -import type { Deposit } from "../Deposit"; - -export class Deposit__factory extends ContractFactory { - constructor(signer?: Signer) { - super(_abi, _bytecode, signer); - } - - deploy( - _token: string, - _amount: BigNumberish, - overrides?: Overrides - ): Promise { - return super.deploy(_token, _amount, overrides || {}) as Promise; - } - getDeployTransaction( - _token: string, - _amount: BigNumberish, - overrides?: Overrides - ): TransactionRequest { - return super.getDeployTransaction(_token, _amount, overrides || {}); - } - attach(address: string): Deposit { - return super.attach(address) as Deposit; - } - connect(signer: Signer): Deposit__factory { - return super.connect(signer) as Deposit__factory; - } - static connect( - address: string, - signerOrProvider: Signer | Provider - ): Deposit { - return new Contract(address, _abi, signerOrProvider) as Deposit; - } -} - -const _abi = [ - { - inputs: [ - { - internalType: "contract IERC20", - name: "_token", - type: "address", - }, - { - internalType: "uint256", - name: "_amount", - type: "uint256", - }, - ], - stateMutability: "nonpayable", - type: "constructor", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "token", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "from", - type: "address", - }, - { - indexed: false, - internalType: "uint256", - name: "amount", - type: "uint256", - }, - ], - name: "Lock", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "token", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "to", - type: "address", - }, - { - indexed: false, - internalType: "uint256", - name: "amount", - type: "uint256", - }, - ], - name: "Unlock", - type: "event", - }, - { - inputs: [], - name: "amount", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "_from", - type: "address", - }, - ], - name: "collectFrom", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "_to", - type: "address", - }, - ], - name: "releaseTo", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "token", - outputs: [ - { - internalType: "contract IERC20", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, -]; - -const _bytecode = - "0x608060405234801561001057600080fd5b5060405161081338038061081383398101604081905261002f91610058565b600080546001600160a01b0319166001600160a01b039390931692909217909155600155610090565b6000806040838503121561006a578182fd5b82516001600160a01b0381168114610080578283fd5b6020939093015192949293505050565b6107748061009f6000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80633865aba414610051578063aa8c217c14610066578063d1fb564614610084578063fc0c546a14610097575b600080fd5b61006461005f3660046104df565b6100ac565b005b61006e61013c565b60405161007b9190610709565b60405180910390f35b6100646100923660046104df565b610142565b61009f6101c4565b60405161007b91906105a6565b60015415610139576001546000546100e09173ffffffffffffffffffffffffffffffffffffffff90911690839030906101e0565b60005460015460405173ffffffffffffffffffffffffffffffffffffffff8085169316917fec36c0364d931187a76cf66d7eee08fad0ec2e8b7458a8d8b26b36769d4d13f3916101309190610709565b60405180910390a35b50565b60015481565b60015415610139576001546000546101749173ffffffffffffffffffffffffffffffffffffffff909116908390610289565b60005460015460405173ffffffffffffffffffffffffffffffffffffffff8085169316917fc1c90b8e0705b212262c0dbd7580efe1862c2f185bf96899226f7596beb2db09916101309190610709565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b610283846323b872dd60e01b8585856040516024016102019392919061054f565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526102ad565b50505050565b6102a88363a9059cbb60e01b8484604051602401610201929190610580565b505050565b600061030f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661036c9092919063ffffffff16565b8051909150156102a8578080602001905181019061032d9190610513565b6102a8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610363906106ac565b60405180910390fd5b606061037b8484600085610385565b90505b9392505050565b6060824710156103c1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161036390610618565b6103ca85610486565b610400576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161036390610675565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516104299190610533565b60006040518083038185875af1925050503d8060008114610466576040519150601f19603f3d011682016040523d82523d6000602084013e61046b565b606091505b509150915061047b82828661048c565b979650505050505050565b3b151590565b6060831561049b57508161037e565b8251156104ab5782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161036391906105c7565b6000602082840312156104f0578081fd5b813573ffffffffffffffffffffffffffffffffffffffff8116811461037e578182fd5b600060208284031215610524578081fd5b8151801515811461037e578182fd5b60008251610545818460208701610712565b9190910192915050565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b60006020825282518060208401526105e6816040850160208701610712565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60408201527f722063616c6c0000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60408201527f6f74207375636365656400000000000000000000000000000000000000000000606082015260800190565b90815260200190565b60005b8381101561072d578181015183820152602001610715565b83811115610283575050600091015256fea2646970667358221220511af073f57b2590d6b52d9bb2fc33242fe8ca7c6b43ad0954dc69ebd9845f3b64736f6c63430008010033"; diff --git a/packages/hardhat/typechain/factories/DisputeManager__factory.ts b/packages/hardhat/typechain/factories/DisputeManager__factory.ts deleted file mode 100644 index 9742f52b..00000000 --- a/packages/hardhat/typechain/factories/DisputeManager__factory.ts +++ /dev/null @@ -1,140 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ - -import { Signer } from "ethers"; -import { Provider, TransactionRequest } from "@ethersproject/providers"; -import { Contract, ContractFactory, Overrides } from "@ethersproject/contracts"; - -import type { DisputeManager } from "../DisputeManager"; - -export class DisputeManager__factory extends ContractFactory { - constructor(signer?: Signer) { - super(_abi, _bytecode, signer); - } - - deploy( - mockCelesteAddress: string, - overrides?: Overrides - ): Promise { - return super.deploy( - mockCelesteAddress, - overrides || {} - ) as Promise; - } - getDeployTransaction( - mockCelesteAddress: string, - overrides?: Overrides - ): TransactionRequest { - return super.getDeployTransaction(mockCelesteAddress, overrides || {}); - } - attach(address: string): DisputeManager { - return super.attach(address) as DisputeManager; - } - connect(signer: Signer): DisputeManager__factory { - return super.connect(signer) as DisputeManager__factory; - } - static connect( - address: string, - signerOrProvider: Signer | Provider - ): DisputeManager { - return new Contract(address, _abi, signerOrProvider) as DisputeManager; - } -} - -const _abi = [ - { - constant: true, - inputs: [], - name: "getDisputeFees", - outputs: [ - { - name: "", - type: "address", - }, - { - name: "", - type: "uint256", - }, - ], - payable: false, - stateMutability: "view", - type: "function", - }, - { - constant: false, - inputs: [ - { - name: "_disputeId", - type: "uint256", - }, - ], - name: "computeRuling", - outputs: [ - { - name: "subject", - type: "address", - }, - { - name: "finalRuling", - type: "uint8", - }, - ], - payable: false, - stateMutability: "nonpayable", - type: "function", - }, - { - constant: true, - inputs: [ - { - name: "_disputeId", - type: "uint256", - }, - ], - name: "getDispute", - outputs: [ - { - name: "subject", - type: "address", - }, - { - name: "possibleRulings", - type: "uint8", - }, - { - name: "state", - type: "uint8", - }, - { - name: "finalRuling", - type: "uint8", - }, - { - name: "lastRoundId", - type: "uint256", - }, - { - name: "createTermId", - type: "uint64", - }, - ], - payable: false, - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - name: "mockCelesteAddress", - type: "address", - }, - ], - payable: false, - stateMutability: "nonpayable", - type: "constructor", - }, -]; - -const _bytecode = - "0x608060405234801561001057600080fd5b5060405160208061051b8339810180604052602081101561003057600080fd5b8101908080519060200190929190505050806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505061048a806100916000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80637b751b9e14610046578063bd881e5314610097578063e3a96cbd1461011a575b600080fd5b61004e6101d9565b604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390f35b6100c3600480360360208110156100ad57600080fd5b81019080803590602001909291905050506102aa565b604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182600481111561010557fe5b60ff1681526020019250505060405180910390f35b6101466004803603602081101561013057600080fd5b810190808035906020019092919050505061036c565b604051808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018660ff1660ff16815260200185600481111561019457fe5b60ff1681526020018460ff1660ff1681526020018381526020018267ffffffffffffffff1667ffffffffffffffff168152602001965050505050505060405180910390f35b60008060008060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637b751b9e6040518163ffffffff1660e01b815260040160606040518083038186803b15801561024857600080fd5b505afa15801561025c573d6000803e3d6000fd5b505050506040513d606081101561027257600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050509250925092508181945094505050509091565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663564a565d846040518263ffffffff1660e01b815260040180828152602001915050604080518083038186803b15801561031e57600080fd5b505afa158015610332573d6000803e3d6000fd5b505050506040513d604081101561034857600080fd5b81019080805190602001909291908051906020019092919050505091509150915091565b6000806000806000806000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663564a565d8a6040518263ffffffff1660e01b815260040180828152602001915050604080518083038186803b1580156103e957600080fd5b505afa1580156103fd573d6000803e3d6000fd5b505050506040513d604081101561041357600080fd5b8101908080519060200190929190805190602001909291905050509150915081600082600080600084945082925081915080905097509750975097509750975050509193955091939556fea165627a7a723058201860abd576668e1f1c4de0a864e93cbc83e3b43f7403bfd4b851651284cfd0a90029"; diff --git a/packages/hardhat/typechain/factories/ERC20__factory.ts b/packages/hardhat/typechain/factories/ERC20__factory.ts index d9260d93..819e1147 100644 --- a/packages/hardhat/typechain/factories/ERC20__factory.ts +++ b/packages/hardhat/typechain/factories/ERC20__factory.ts @@ -328,4 +328,4 @@ const _abi = [ ]; const _bytecode = - "0x60806040523480156200001157600080fd5b5060405162000e3a38038062000e3a8339810160408190526200003491620001c1565b81516200004990600390602085019062000068565b5080516200005f90600490602084019062000068565b5050506200027b565b828054620000769062000228565b90600052602060002090601f0160209004810192826200009a5760008555620000e5565b82601f10620000b557805160ff1916838001178555620000e5565b82800160010185558215620000e5579182015b82811115620000e5578251825591602001919060010190620000c8565b50620000f3929150620000f7565b5090565b5b80821115620000f35760008155600101620000f8565b600082601f8301126200011f578081fd5b81516001600160401b03808211156200013c576200013c62000265565b604051601f8301601f19908116603f0116810190828211818310171562000167576200016762000265565b8160405283815260209250868385880101111562000183578485fd5b8491505b83821015620001a6578582018301518183018401529082019062000187565b83821115620001b757848385830101525b9695505050505050565b60008060408385031215620001d4578182fd5b82516001600160401b0380821115620001eb578384fd5b620001f9868387016200010e565b935060208501519150808211156200020f578283fd5b506200021e858286016200010e565b9150509250929050565b6002810460018216806200023d57607f821691505b602082108114156200025f57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b610baf806200028b6000396000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c80633950935111610081578063a457c2d71161005b578063a457c2d714610177578063a9059cbb1461018a578063dd62ed3e1461019d576100c9565b8063395093511461014957806370a082311461015c57806395d89b411461016f576100c9565b806318160ddd116100b257806318160ddd1461010c57806323b872dd14610121578063313ce56714610134576100c9565b806306fdde03146100ce578063095ea7b3146100ec575b600080fd5b6100d66101b0565b6040516100e391906107fb565b60405180910390f35b6100ff6100fa3660046107c7565b610242565b6040516100e391906107f0565b610114610264565b6040516100e39190610ad1565b6100ff61012f36600461078c565b61026a565b61013c610298565b6040516100e39190610ada565b6100ff6101573660046107c7565b61029d565b61011461016a366004610739565b6102c9565b6100d66102f5565b6100ff6101853660046107c7565b610304565b6100ff6101983660046107c7565b61036f565b6101146101ab36600461075a565b610387565b6060600380546101bf90610b25565b80601f01602080910402602001604051908101604052809291908181526020018280546101eb90610b25565b80156102385780601f1061020d57610100808354040283529160200191610238565b820191906000526020600020905b81548152906001019060200180831161021b57829003601f168201915b5050505050905090565b60008061024d6103bf565b905061025a8185856103c3565b5060019392505050565b60025490565b6000806102756103bf565b90506102828582856104d2565b61028d858585610554565b506001949350505050565b601290565b6000806102a86103bf565b905061025a8185856102ba8589610387565b6102c49190610ae8565b6103c3565b73ffffffffffffffffffffffffffffffffffffffff81166000908152602081905260409020545b919050565b6060600480546101bf90610b25565b60008061030f6103bf565b9050600061031d8286610387565b905083811015610362576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161035990610a74565b60405180910390fd5b61028d82868684036103c3565b60008061037a6103bf565b905061025a818585610554565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b3390565b73ffffffffffffffffffffffffffffffffffffffff8316610410576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161035990610a17565b73ffffffffffffffffffffffffffffffffffffffff821661045d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610359906108c9565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104c5908590610ad1565b60405180910390a3505050565b60006104de8484610387565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811461054e5781811015610541576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161035990610926565b61054e84848484036103c3565b50505050565b73ffffffffffffffffffffffffffffffffffffffff83166105a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610359906109ba565b73ffffffffffffffffffffffffffffffffffffffff82166105ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103599061086c565b6105f9838383610710565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205481811015610659576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103599061095d565b73ffffffffffffffffffffffffffffffffffffffff80851660009081526020819052604080822085850390559185168152908120805484929061069d908490610ae8565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516107019190610ad1565b60405180910390a361054e8484845b505050565b803573ffffffffffffffffffffffffffffffffffffffff811681146102f057600080fd5b60006020828403121561074a578081fd5b61075382610715565b9392505050565b6000806040838503121561076c578081fd5b61077583610715565b915061078360208401610715565b90509250929050565b6000806000606084860312156107a0578081fd5b6107a984610715565b92506107b760208501610715565b9150604084013590509250925092565b600080604083850312156107d9578182fd5b6107e283610715565b946020939093013593505050565b901515815260200190565b6000602080835283518082850152825b818110156108275785810183015185820160400152820161080b565b818111156108385783604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201527f6573730000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560408201527f7373000000000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601d908201527f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000604082015260600190565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260408201527f616c616e63650000000000000000000000000000000000000000000000000000606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460408201527f6472657373000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460408201527f7265737300000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526025908201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760408201527f207a65726f000000000000000000000000000000000000000000000000000000606082015260800190565b90815260200190565b60ff91909116815260200190565b60008219821115610b20577f4e487b710000000000000000000000000000000000000000000000000000000081526011600452602481fd5b500190565b600281046001821680610b3957607f821691505b60208210811415610b73577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b5091905056fea26469706673582212202d85590ab4ea505a824ce50557dd397092341765c6bdb86c099a9db4bbe0365b64736f6c63430008010033"; + "0x60806040523480156200001157600080fd5b5060405162000dad38038062000dad8339810160408190526200003491620001c1565b81516200004990600390602085019062000068565b5080516200005f90600490602084019062000068565b5050506200027b565b828054620000769062000228565b90600052602060002090601f0160209004810192826200009a5760008555620000e5565b82601f10620000b557805160ff1916838001178555620000e5565b82800160010185558215620000e5579182015b82811115620000e5578251825591602001919060010190620000c8565b50620000f3929150620000f7565b5090565b5b80821115620000f35760008155600101620000f8565b600082601f8301126200011f578081fd5b81516001600160401b03808211156200013c576200013c62000265565b604051601f8301601f19908116603f0116810190828211818310171562000167576200016762000265565b8160405283815260209250868385880101111562000183578485fd5b8491505b83821015620001a6578582018301518183018401529082019062000187565b83821115620001b757848385830101525b9695505050505050565b60008060408385031215620001d4578182fd5b82516001600160401b0380821115620001eb578384fd5b620001f9868387016200010e565b935060208501519150808211156200020f578283fd5b506200021e858286016200010e565b9150509250929050565b6002810460018216806200023d57607f821691505b602082108114156200025f57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b610b22806200028b6000396000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c80633950935111610081578063a457c2d71161005b578063a457c2d714610171578063a9059cbb14610184578063dd62ed3e14610197576100c9565b8063395093511461014357806370a082311461015657806395d89b4114610169576100c9565b806318160ddd116100b257806318160ddd1461010f57806323b872dd14610121578063313ce56714610134576100c9565b806306fdde03146100ce578063095ea7b3146100ec575b600080fd5b6100d66101dd565b6040516100e391906109ea565b60405180910390f35b6100ff6100fa3660046109c1565b61026f565b60405190151581526020016100e3565b6002545b6040519081526020016100e3565b6100ff61012f366004610986565b610287565b604051601281526020016100e3565b6100ff6101513660046109c1565b6102ab565b610113610164366004610933565b6102f7565b6100d6610323565b6100ff61017f3660046109c1565b610332565b6100ff6101923660046109c1565b610408565b6101136101a5366004610954565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b6060600380546101ec90610a98565b80601f016020809104026020016040519081016040528092919081815260200182805461021890610a98565b80156102655780601f1061023a57610100808354040283529160200191610265565b820191906000526020600020905b81548152906001019060200180831161024857829003601f168201915b5050505050905090565b60003361027d818585610416565b5060019392505050565b6000336102958582856105c9565b6102a08585856106a0565b506001949350505050565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919061027d90829086906102f2908790610a5b565b610416565b73ffffffffffffffffffffffffffffffffffffffff81166000908152602081905260409020545b919050565b6060600480546101ec90610a98565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168452909152812054909190838110156103fb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6102a08286868403610416565b60003361027d8185856106a0565b73ffffffffffffffffffffffffffffffffffffffff83166104b8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016103f2565b73ffffffffffffffffffffffffffffffffffffffff821661055b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f737300000000000000000000000000000000000000000000000000000000000060648201526084016103f2565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811461069a578181101561068d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016103f2565b61069a8484848403610416565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610743576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016103f2565b73ffffffffffffffffffffffffffffffffffffffff82166107e6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016103f2565b73ffffffffffffffffffffffffffffffffffffffff83166000908152602081905260409020548181101561089c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e6365000000000000000000000000000000000000000000000000000060648201526084016103f2565b73ffffffffffffffffffffffffffffffffffffffff848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a361069a565b803573ffffffffffffffffffffffffffffffffffffffff8116811461031e57600080fd5b600060208284031215610944578081fd5b61094d8261090f565b9392505050565b60008060408385031215610966578081fd5b61096f8361090f565b915061097d6020840161090f565b90509250929050565b60008060006060848603121561099a578081fd5b6109a38461090f565b92506109b16020850161090f565b9150604084013590509250925092565b600080604083850312156109d3578182fd5b6109dc8361090f565b946020939093013593505050565b6000602080835283518082850152825b81811015610a16578581018301518582016040015282016109fa565b81811115610a275783604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b60008219821115610a93577f4e487b710000000000000000000000000000000000000000000000000000000081526011600452602481fd5b500190565b600281046001821680610aac57607f821691505b60208210811415610ae6577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b5091905056fea26469706673582212203354817b5f0645fe69094d0c7a8d6759956aa555cb245b0d583dab70855162fa64736f6c63430008020033"; diff --git a/packages/hardhat/typechain/factories/IERC20Permit__factory.ts b/packages/hardhat/typechain/factories/IERC20PermitUpgradeable__factory.ts similarity index 86% rename from packages/hardhat/typechain/factories/IERC20Permit__factory.ts rename to packages/hardhat/typechain/factories/IERC20PermitUpgradeable__factory.ts index f24b21ea..e876a9b5 100644 --- a/packages/hardhat/typechain/factories/IERC20Permit__factory.ts +++ b/packages/hardhat/typechain/factories/IERC20PermitUpgradeable__factory.ts @@ -5,14 +5,18 @@ import { Contract, Signer } from "ethers"; import { Provider } from "@ethersproject/providers"; -import type { IERC20Permit } from "../IERC20Permit"; +import type { IERC20PermitUpgradeable } from "../IERC20PermitUpgradeable"; -export class IERC20Permit__factory { +export class IERC20PermitUpgradeable__factory { static connect( address: string, signerOrProvider: Signer | Provider - ): IERC20Permit { - return new Contract(address, _abi, signerOrProvider) as IERC20Permit; + ): IERC20PermitUpgradeable { + return new Contract( + address, + _abi, + signerOrProvider + ) as IERC20PermitUpgradeable; } } diff --git a/packages/hardhat/typechain/factories/IERC20Upgradeable__factory.ts b/packages/hardhat/typechain/factories/IERC20Upgradeable__factory.ts new file mode 100644 index 00000000..5a09857c --- /dev/null +++ b/packages/hardhat/typechain/factories/IERC20Upgradeable__factory.ts @@ -0,0 +1,203 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Signer } from "ethers"; +import { Provider } from "@ethersproject/providers"; + +import type { IERC20Upgradeable } from "../IERC20Upgradeable"; + +export class IERC20Upgradeable__factory { + static connect( + address: string, + signerOrProvider: Signer | Provider + ): IERC20Upgradeable { + return new Contract(address, _abi, signerOrProvider) as IERC20Upgradeable; + } +} + +const _abi = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256", + }, + ], + name: "Approval", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256", + }, + ], + name: "Transfer", + type: "event", + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address", + }, + { + internalType: "address", + name: "spender", + type: "address", + }, + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address", + }, + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, +]; diff --git a/packages/hardhat/typechain/factories/Initializable__factory.ts b/packages/hardhat/typechain/factories/Initializable__factory.ts new file mode 100644 index 00000000..4ede7881 --- /dev/null +++ b/packages/hardhat/typechain/factories/Initializable__factory.ts @@ -0,0 +1,33 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Signer } from "ethers"; +import { Provider } from "@ethersproject/providers"; + +import type { Initializable } from "../Initializable"; + +export class Initializable__factory { + static connect( + address: string, + signerOrProvider: Signer | Provider + ): Initializable { + return new Contract(address, _abi, signerOrProvider) as Initializable; + } +} + +const _abi = [ + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint8", + name: "version", + type: "uint8", + }, + ], + name: "Initialized", + type: "event", + }, +]; diff --git a/packages/hardhat/typechain/factories/Models__factory.ts b/packages/hardhat/typechain/factories/Models__factory.ts deleted file mode 100644 index ecdc4043..00000000 --- a/packages/hardhat/typechain/factories/Models__factory.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ - -import { Signer } from "ethers"; -import { Provider, TransactionRequest } from "@ethersproject/providers"; -import { Contract, ContractFactory, Overrides } from "@ethersproject/contracts"; - -import type { Models } from "../Models"; - -export class Models__factory extends ContractFactory { - constructor(signer?: Signer) { - super(_abi, _bytecode, signer); - } - - deploy(overrides?: Overrides): Promise { - return super.deploy(overrides || {}) as Promise; - } - getDeployTransaction(overrides?: Overrides): TransactionRequest { - return super.getDeployTransaction(overrides || {}); - } - attach(address: string): Models { - return super.attach(address) as Models; - } - connect(signer: Signer): Models__factory { - return super.connect(signer) as Models__factory; - } - static connect(address: string, signerOrProvider: Signer | Provider): Models { - return new Contract(address, _abi, signerOrProvider) as Models; - } -} - -const _abi = [ - { - inputs: [ - { - internalType: "bytes32", - name: "c__0xa9dfceef", - type: "bytes32", - }, - ], - name: "c_0xa9dfceef", - outputs: [], - stateMutability: "pure", - type: "function", - }, -]; - -const _bytecode = - "0x60e0610052600b82828239805160001a607314610045577f4e487b7100000000000000000000000000000000000000000000000000000000600052600060045260246000fd5b30600052607381538281f3fe730000000000000000000000000000000000000000301460806040526004361060335760003560e01c8063b8b153ba146038575b600080fd5b604e6004803603810190604a91906066565b6050565b005b50565b6000813590506060816096565b92915050565b600060208284031215607757600080fd5b60006083848285016053565b91505092915050565b6000819050919050565b609d81608c565b811460a757600080fd5b5056fea26469706673582212207c4ab43236faaa19caf7c418568056772ad922fb8ab65826357969db54c19b4364736f6c63430008010033"; diff --git a/packages/hardhat/typechain/factories/Ownable__factory.ts b/packages/hardhat/typechain/factories/OwnableUpgradeable__factory.ts similarity index 77% rename from packages/hardhat/typechain/factories/Ownable__factory.ts rename to packages/hardhat/typechain/factories/OwnableUpgradeable__factory.ts index e8c9147d..bcae2396 100644 --- a/packages/hardhat/typechain/factories/Ownable__factory.ts +++ b/packages/hardhat/typechain/factories/OwnableUpgradeable__factory.ts @@ -5,18 +5,31 @@ import { Contract, Signer } from "ethers"; import { Provider } from "@ethersproject/providers"; -import type { Ownable } from "../Ownable"; +import type { OwnableUpgradeable } from "../OwnableUpgradeable"; -export class Ownable__factory { +export class OwnableUpgradeable__factory { static connect( address: string, signerOrProvider: Signer | Provider - ): Ownable { - return new Contract(address, _abi, signerOrProvider) as Ownable; + ): OwnableUpgradeable { + return new Contract(address, _abi, signerOrProvider) as OwnableUpgradeable; } } const _abi = [ + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint8", + name: "version", + type: "uint8", + }, + ], + name: "Initialized", + type: "event", + }, { anonymous: false, inputs: [ diff --git a/packages/hardhat/typechain/factories/QuestFactory__factory.ts b/packages/hardhat/typechain/factories/QuestFactory__factory.ts index d678bb96..51bb00d1 100644 --- a/packages/hardhat/typechain/factories/QuestFactory__factory.ts +++ b/packages/hardhat/typechain/factories/QuestFactory__factory.ts @@ -2,7 +2,7 @@ /* tslint:disable */ /* eslint-disable */ -import { Signer, BigNumberish } from "ethers"; +import { Signer } from "ethers"; import { Provider, TransactionRequest } from "@ethersproject/providers"; import { Contract, ContractFactory, Overrides } from "@ethersproject/contracts"; @@ -13,43 +13,11 @@ export class QuestFactory__factory extends ContractFactory { super(_abi, _bytecode, signer); } - deploy( - _aragonGovernAddress: string, - _createDepositToken: string, - _createDepositAmount: BigNumberish, - _playDepositToken: string, - _playDepositAmount: BigNumberish, - _initialOwner: string, - overrides?: Overrides - ): Promise { - return super.deploy( - _aragonGovernAddress, - _createDepositToken, - _createDepositAmount, - _playDepositToken, - _playDepositAmount, - _initialOwner, - overrides || {} - ) as Promise; + deploy(overrides?: Overrides): Promise { + return super.deploy(overrides || {}) as Promise; } - getDeployTransaction( - _aragonGovernAddress: string, - _createDepositToken: string, - _createDepositAmount: BigNumberish, - _playDepositToken: string, - _playDepositAmount: BigNumberish, - _initialOwner: string, - overrides?: Overrides - ): TransactionRequest { - return super.getDeployTransaction( - _aragonGovernAddress, - _createDepositToken, - _createDepositAmount, - _playDepositToken, - _playDepositAmount, - _initialOwner, - overrides || {} - ); + getDeployTransaction(overrides?: Overrides): TransactionRequest { + return super.getDeployTransaction(overrides || {}); } attach(address: string): QuestFactory { return super.attach(address) as QuestFactory; @@ -67,38 +35,7 @@ export class QuestFactory__factory extends ContractFactory { const _abi = [ { - inputs: [ - { - internalType: "address", - name: "_aragonGovernAddress", - type: "address", - }, - { - internalType: "contract IERC20", - name: "_createDepositToken", - type: "address", - }, - { - internalType: "uint256", - name: "_createDepositAmount", - type: "uint256", - }, - { - internalType: "contract IERC20", - name: "_playDepositToken", - type: "address", - }, - { - internalType: "uint256", - name: "_playDepositAmount", - type: "uint256", - }, - { - internalType: "address", - name: "_initialOwner", - type: "address", - }, - ], + inputs: [], stateMutability: "nonpayable", type: "constructor", }, @@ -127,6 +64,19 @@ const _abi = [ name: "CreateDepositChanged", type: "event", }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint8", + name: "version", + type: "uint8", + }, + ], + name: "Initialized", + type: "event", + }, { anonymous: false, inputs: [ @@ -211,40 +161,64 @@ const _abi = [ type: "address", }, { + components: [ + { + internalType: "contract IERC20Upgradeable", + name: "token", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], indexed: false, - internalType: "address", - name: "createDepositToken", - type: "address", - }, - { + 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: "uint256", - name: "createDepositAmount", - type: "uint256", + internalType: "struct Models.Deposit", + name: "playDeposit", + type: "tuple", }, { indexed: false, internalType: "address", - name: "playDepositToken", + name: "creator", type: "address", }, { indexed: false, - internalType: "uint256", - name: "playDepositAmount", - type: "uint256", + internalType: "uint32", + name: "maxPlayers", + type: "uint32", }, { indexed: false, - internalType: "address", - name: "creator", - type: "address", + internalType: "bool", + name: "isWhiteList", + type: "bool", }, { indexed: false, - internalType: "uint32", - name: "maxPlayers", - type: "uint32", + internalType: "uint256", + name: "version", + type: "uint256", }, ], name: "QuestCreated", @@ -268,7 +242,7 @@ const _abi = [ name: "createDeposit", outputs: [ { - internalType: "contract IERC20", + internalType: "contract IERC20Upgradeable", name: "token", type: "address", }, @@ -294,7 +268,7 @@ const _abi = [ type: "bytes", }, { - internalType: "contract IERC20", + internalType: "contract IERC20Upgradeable", name: "_rewardToken", type: "address", }, @@ -313,6 +287,11 @@ const _abi = [ name: "_maxPlayers", type: "uint32", }, + { + internalType: "bool", + name: "_isWhiteList", + type: "bool", + }, ], name: "createQuest", outputs: [ @@ -325,6 +304,19 @@ const _abi = [ stateMutability: "nonpayable", type: "function", }, + { + inputs: [ + { + internalType: "address", + name: "_aragonGovernAddress", + type: "address", + }, + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, { inputs: [], name: "owner", @@ -343,7 +335,7 @@ const _abi = [ name: "playDeposit", outputs: [ { - internalType: "contract IERC20", + internalType: "contract IERC20Upgradeable", name: "token", type: "address", }, @@ -379,7 +371,7 @@ const _abi = [ { inputs: [ { - internalType: "contract IERC20", + internalType: "contract IERC20Upgradeable", name: "token", type: "address", }, @@ -397,7 +389,7 @@ const _abi = [ { inputs: [ { - internalType: "contract IERC20", + internalType: "contract IERC20Upgradeable", name: "token", type: "address", }, @@ -425,7 +417,20 @@ const _abi = [ stateMutability: "nonpayable", type: "function", }, + { + inputs: [], + name: "version", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, ]; const _bytecode = - "0x60806040523480156200001157600080fd5b506040516200396b3803806200396b83398101604081905262000034916200028c565b6200004862000042620000a3565b620000a7565b600180546001600160a01b0319166001600160a01b0388161790556200006f8585620000f7565b6200007b838362000177565b6001600160a01b038116331462000097576200009781620001eb565b505050505050620003b7565b3390565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6200010162000235565b6040805180820182526001600160a01b0384168082526020909101839052600280546001600160a01b03191690911790556003829055517f35c5e8a6f8bed2c61a2eb1996d117b1b96192314c0d4ca7cd96360f250920079906200016b9042908590859062000382565b60405180910390a15050565b6200018162000235565b6040805180820182526001600160a01b0384168082526020909101839052600480546001600160a01b03191690911790556005829055517f013c800b1a136f9798a25e471501a7b824156d1e9cba8439821c5a41adf2fb89906200016b9042908590859062000382565b620001f562000235565b6001600160a01b038116620002275760405162461bcd60e51b81526004016200021e9062000307565b60405180910390fd5b6200023281620000a7565b50565b6200023f620000a3565b6001600160a01b0316620002526200027d565b6001600160a01b0316146200027b5760405162461bcd60e51b81526004016200021e906200034d565b565b6000546001600160a01b031690565b60008060008060008060c08789031215620002a5578182fd5b8651620002b281620003a1565b6020880151909650620002c581620003a1565b604088015160608901519196509450620002df81620003a1565b608088015160a08901519194509250620002f981620003a1565b809150509295509295509295565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b9283526001600160a01b03919091166020830152604082015260600190565b6001600160a01b03811681146200023257600080fd5b6135a480620003c76000396000f3fe60806040523480156200001157600080fd5b5060043610620000cf5760003560e01c8063b0a87ac11162000081578063e87fae211162000063578063e87fae21146200015e578063edeecdd31462000175578063f2fde38b146200018c57620000cf565b8063b0a87ac1146200014a578063d03ffefb146200015457620000cf565b80638c43b41111620000b75780638c43b41114620000f75780638c53c9bd146200010e5780638da5cb5b146200013157620000cf565b8062732e3014620000d4578063715018a614620000ed575b600080fd5b620000eb620000e536600462000c39565b620001a3565b005b620000eb620001f4565b620000eb6200010836600462000c7a565b6200020c565b62000118620002b1565b6040516200012892919062000f50565b60405180910390f35b6200013b620002d3565b60405162000128919062000e2d565b6200013b620002ef565b620001186200030b565b6200013b6200016f36600462000ca8565b6200032d565b620000eb6200018636600462000c7a565b620004be565b620000eb6200019d36600462000c39565b62000557565b620001ad620005c8565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b620001fe620005c8565b6200020a600062000642565b565b62000216620005c8565b60408051808201825273ffffffffffffffffffffffffffffffffffffffff84168082526020909101839052600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001690911790556005829055517f013c800b1a136f9798a25e471501a7b824156d1e9cba8439821c5a41adf2fb8990620002a590429085908590620011ec565b60405180910390a15050565b60045460055473ffffffffffffffffffffffffffffffffffffffff9091169082565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b60025460035473ffffffffffffffffffffffffffffffffffffffff9091169082565b60015460408051808201825260025473ffffffffffffffffffffffffffffffffffffffff9081168252600354602080840191909152835180850185526004548316815260055491810191909152925160009485948c948c948c948c9491909116928b929133908c90620003a09062000b6e565b620003b59a9998979695949392919062000f8b565b604051809103906000f080158015620003d2573d6000803e3d6000fd5b506040805180820190915260025473ffffffffffffffffffffffffffffffffffffffff168152600354602082015290915062000410903383620006b7565b7f6b2fd076e791d7e0318fa62bf6e275ebe9ff601badea3d9bfdc43c02317d1119818989898989600260000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260010154600460000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600460010154338e604051620004ab9c9b9a9998979695949392919062000ea6565b60405180910390a1979650505050505050565b620004c8620005c8565b60408051808201825273ffffffffffffffffffffffffffffffffffffffff84168082526020909101839052600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001690911790556003829055517f35c5e8a6f8bed2c61a2eb1996d117b1b96192314c0d4ca7cd96360f25092007990620002a590429085908590620011ec565b62000561620005c8565b73ffffffffffffffffffffffffffffffffffffffff8116620005ba576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b19062001032565b60405180910390fd5b620005c58162000642565b50565b620005d2620006d4565b73ffffffffffffffffffffffffffffffffffffffff16620005f2620002d3565b73ffffffffffffffffffffffffffffffffffffffff16146200020a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b190620010ec565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b620006c38383620006d8565b620006cf838262000807565b505050565b3390565b602082015115620008035781516040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff169063dd62ed3e906200073d908590309060040162000e4e565b60206040518083038186803b1580156200075657600080fd5b505afa1580156200076b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000791919062000d7b565b90508260200151811015620007d4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b19062001121565b60208301518351620006cf9173ffffffffffffffffffffffffffffffffffffffff90911690849030906200083f565b5050565b602082015115620008035760208201518251620008039173ffffffffffffffffffffffffffffffffffffffff909116908390620008ec565b620008e6846323b872dd60e01b858585604051602401620008639392919062000e75565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526200090e565b50505050565b620006cf8363a9059cbb60e01b84846040516024016200086392919062000f50565b600062000972826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16620009cc9092919063ffffffff16565b805190915015620006cf578080602001905181019062000993919062000c58565b620006cf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b1906200118f565b6060620009dd8484600085620009e7565b90505b9392505050565b60608247101562000a26576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b1906200108f565b62000a318562000af6565b62000a6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b19062001158565b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405162000a95919062000e0f565b60006040518083038185875af1925050503d806000811462000ad4576040519150601f19603f3d011682016040523d82523d6000602084013e62000ad9565b606091505b509150915062000aeb82828662000b16565b979650505050505050565b73ffffffffffffffffffffffffffffffffffffffff81163b15155b919050565b6060831562000b27575081620009e0565b82511562000b385782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b1919062000f76565b6122d5806200129a83390190565b600067ffffffffffffffff8084111562000b9a5762000b9a62001247565b604051601f85017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190828211818310171562000be35762000be362001247565b8160405280935085815286868601111562000bfd57600080fd5b858560208301376000602087830101525050509392505050565b803562000b118162001276565b803563ffffffff8116811462000b1157600080fd5b60006020828403121562000c4b578081fd5b8135620009e08162001276565b60006020828403121562000c6a578081fd5b81518015158114620009e0578182fd5b6000806040838503121562000c8d578081fd5b823562000c9a8162001276565b946020939093013593505050565b60008060008060008060c0878903121562000cc1578182fd5b863567ffffffffffffffff8082111562000cd9578384fd5b818901915089601f83011262000ced578384fd5b62000cfe8a83356020850162000b7c565b9750602089013591508082111562000d14578384fd5b508701601f8101891362000d26578283fd5b62000d378982356020840162000b7c565b95505062000d486040880162000c17565b93506060870135925062000d5f6080880162000c17565b915062000d6f60a0880162000c24565b90509295509295509295565b60006020828403121562000d8d578081fd5b5051919050565b6000815180845262000dae81602086016020860162001218565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b805173ffffffffffffffffffffffffffffffffffffffff168252602090810151910152565b63ffffffff169052565b6000825162000e2381846020870162001218565b9190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b600073ffffffffffffffffffffffffffffffffffffffff808f168352610180602084015262000eda61018084018f62000d94565b838103604085015262000eee818f62000d94565b925050808c1660608401528a6080840152808a1660a084015280891660c08401528760e0840152808716610100840152856101208401528085166101408401525062000f3f61016083018462000e05565b9d9c50505050505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b600060208252620009e0602083018462000d94565b600061018080835262000fa18184018e62000d94565b9050828103602084015262000fb7818d62000d94565b91505073ffffffffffffffffffffffffffffffffffffffff808b166040840152896060840152808916608084015280881660a084015262000ffc60c084018862000de0565b6200100c61010084018762000de0565b8085166101408401525063ffffffff83166101608301529b9a5050505050505050505050565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201527f6464726573730000000000000000000000000000000000000000000000000000606082015260800190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60408201527f722063616c6c0000000000000000000000000000000000000000000000000000606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601d908201527f4552524f52203a204465706f7369742062616420616c6c6f77616e6365000000604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60408201527f6f74207375636365656400000000000000000000000000000000000000000000606082015260800190565b92835273ffffffffffffffffffffffffffffffffffffffff919091166020830152604082015260600190565b60005b83811015620012355781810151838201526020016200121b565b83811115620008e65750506000910152565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff81168114620005c557600080fdfe60806040523480156200001157600080fd5b50604051620022d5380380620022d58339810160408190526200003491620002b7565b8951620000499060019060208d019062000118565b5088516200005f9060029060208c019062000118565b50600380546001600160a01b03199081166001600160a01b039a8b16179091556004979097556005805488169689169690961790955560068054600080548916938a16939093179092558351600880548916918a169190911790556020938401516009558251600a80548916918a169190911790559190920151600b55600c805460ff19169055931693169290921763ffffffff60a01b1916600160a01b63ffffffff90931692909202919091179055506200044e9050565b8280546200012690620003e2565b90600052602060002090601f0160209004810192826200014a576000855562000195565b82601f106200016557805160ff191683800117855562000195565b8280016001018555821562000195579182015b828111156200019557825182559160200191906001019062000178565b50620001a3929150620001a7565b5090565b5b80821115620001a35760008155600101620001a8565b8051620001cb8162000435565b919050565b600082601f830112620001e1578081fd5b81516001600160401b03811115620001fd57620001fd6200041f565b602062000213601f8301601f19168201620003af565b828152858284870101111562000227578384fd5b835b838110156200024657858101830151828201840152820162000229565b838111156200025757848385840101525b5095945050505050565b60006040828403121562000273578081fd5b6200027f6040620003af565b905081516200028e8162000435565b808252506020820151602082015292915050565b805163ffffffff81168114620001cb57600080fd5b6000806000806000806000806000806101808b8d031215620002d7578586fd5b8a516001600160401b0380821115620002ee578788fd5b620002fc8e838f01620001d0565b9b5060208d015191508082111562000312578788fd5b50620003218d828e01620001d0565b9950506200033260408c01620001be565b975060608b015196506200034960808c01620001be565b95506200035960a08c01620001be565b94506200036a8c60c08d0162000261565b93506200037c8c6101008d0162000261565b92506200038d6101408c01620001be565b91506200039e6101608c01620002a2565b90509295989b9194979a5092959850565b604051601f8201601f191681016001600160401b0381118282101715620003da57620003da6200041f565b604052919050565b600281046001821680620003f757607f821691505b602082108114156200041957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146200044b57600080fd5b50565b611e77806200045e6000396000f3fe608060405234801561001057600080fd5b50600436106101365760003560e01c80638c53c9bd116100b2578063d03ffefb11610081578063e492814f11610066578063e492814f14610255578063f294cf3814610268578063f7c618c11461027057610136565b8063d03ffefb14610238578063e0c234231461024057610136565b80638c53c9bd146101e5578063a888c2cd146101fb578063b0a87ac11461021d578063b434151c1461022557610136565b8063579ca2c9116101095780637ceae310116100ee5780637ceae310146101b557806385c99e2b146101bd5780638b5b9ccc146101d057610136565b8063579ca2c9146101985780636c3a4cce146101a057610136565b8063151dfb061461013b578063310a1ee31461015057806348d6cb531461016e5780634c2412a214610183575b600080fd5b61014e610149366004611638565b610278565b005b610158610553565b6040516101659190611cae565b60405180910390f35b610176610559565b60405161016591906118f2565b61018b610562565b6040516101659190611cb7565b61014e610586565b6101a861074f565b60405161016591906117f9565b6101a861076b565b6101766101cb366004611638565b610787565b6101d86107bd565b6040516101659190611898565b6101ed61082c565b604051610165929190611872565b61020e610209366004611763565b61084e565b60405161016593929190611910565b6101a8610927565b61014e61023336600461166e565b610943565b6101ed610cc0565b610248610ce2565b60405161016591906118fd565b61014e610263366004611638565b610d70565b610248610fe1565b6101a8610fee565b3373ffffffffffffffffffffffffffffffffffffffff821614806102b3575060005473ffffffffffffffffffffffffffffffffffffffff1633145b6102f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611c51565b60405180910390fd5b60006102fd8261100a565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1415610359576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e9906119df565b600d805461036990600190611d05565b815481106103a0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260209091200154600d805473ffffffffffffffffffffffffffffffffffffffff9092169183908110610400577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d805480610480577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b600082815260209081902082017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905590910190915560408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b549181019190915261051690836110d2565b7fc4a67a0877d477de99d765a3d9f48abfbe6181dff4727d68c3cb6071555541758242604051610547929190611872565b60405180910390a15050565b60045481565b600c5460ff1681565b60065474010000000000000000000000000000000000000000900463ffffffff1681565b6004544210156105c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611a73565b600c5460ff16610634576000546040805180820190915260085473ffffffffffffffffffffffffffffffffffffffff9081168252600954602083015261060892166110d2565b600c80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319061068b9030906004016117f9565b60206040518083038186803b1580156106a357600080fd5b505afa1580156106b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106db919061177b565b600a5460035491925073ffffffffffffffffffffffffffffffffffffffff9182169116141561072257600d54600b5461071e9161071791611cc8565b829061110b565b9150505b60065460035461074c9173ffffffffffffffffffffffffffffffffffffffff918216911683611131565b50565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60006107928261100a565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff141590505b919050565b6060600d80548060200260200160405190810160405280929190818152602001828054801561082257602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff1681526001909101906020018083116107f7575b5050505050905090565b600a54600b5473ffffffffffffffffffffffffffffffffffffffff9091169082565b6007818154811061085e57600080fd5b906000526020600020906003020160009150905080600001805461088190611d48565b80601f01602080910402602001604051908101604052809291908181526020018280546108ad90611d48565b80156108fa5780601f106108cf576101008083540402835291602001916108fa565b820191906000526020600020905b8154815290600101906020018083116108dd57829003601f168201915b505050506001830154600290930154919273ffffffffffffffffffffffffffffffffffffffff1691905083565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60055473ffffffffffffffffffffffffffffffffffffffff163314610994576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611ae1565b83516109cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611b86565b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff16906370a0823190610a239030906004016117f9565b60206040518083038186803b158015610a3b57600080fd5b505afa158015610a4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a73919061177b565b90508115610b095760085460035473ffffffffffffffffffffffffffffffffffffffff90811691161415610abc57600954600090610ab290839061110b565b9450610ac0915050565b8092505b600a5460035473ffffffffffffffffffffffffffffffffffffffff90811691161415610b0957600d54600b54600091610b0491610afd9190611cc8565b859061110b565b945050505b60085460035473ffffffffffffffffffffffffffffffffffffffff90811691161415610b7f576000610b3b828561110b565b915050600860010154811015610b7d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611982565b505b8215610ba957600354610ba99073ffffffffffffffffffffffffffffffffffffffff168585611131565b6040805160608101825286815273ffffffffffffffffffffffffffffffffffffffff86166020808301919091529181018590526007805460018101825560009190915281518051929360039092027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880192610c279284920190611570565b5060208201516001820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091179055604091820151600290910155517fa1c3b325aa2c115e4b244062eba2515bc5585ae5b41556be8fef399ae9fde11b90610cb190879087908790611910565b60405180910390a15050505050565b60085460095473ffffffffffffffffffffffffffffffffffffffff9091169082565b60028054610cef90611d48565b80601f0160208091040260200160405190810160405280929190818152602001828054610d1b90611d48565b8015610d685780601f10610d3d57610100808354040283529160200191610d68565b820191906000526020600020905b815481529060010190602001808311610d4b57829003601f168201915b505050505081565b3373ffffffffffffffffffffffffffffffffffffffff82161480610dab575060005473ffffffffffffffffffffffffffffffffffffffff1633145b610de1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611c51565b60065474010000000000000000000000000000000000000000900463ffffffff161580610e305750600654600d547401000000000000000000000000000000000000000090910463ffffffff16115b610e66576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611aaa565b6004544210610ea1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e99061194b565b6000610eac8261100a565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610f07576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611bbd565b60408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b546020820152610f3f9033306111d7565b600d80546001810182556000919091527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb50180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790556040517f35ec60f951b4abc8b287ab5148caf98524052482927d42e86a720cc71b8a76a1906105479084904290611872565b60018054610cef90611d48565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b6000805b600d548110156110aa578273ffffffffffffffffffffffffffffffffffffffff16600d8281548110611069577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614156110985790506107b8565b806110a281611d9c565b91505061100e565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92915050565b60208201511561110757602082015182516111079173ffffffffffffffffffffffffffffffffffffffff909116908390611131565b5050565b600080838311156111215750600090508061112a565b50600190508183035b9250929050565b6111d28363a9059cbb60e01b8484604051602401611150929190611872565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526111eb565b505050565b6111e183836112a1565b6111d283826110d2565b600061124d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166113c09092919063ffffffff16565b8051909150156111d2578080602001905181019061126b9190611652565b6111d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611bf4565b6020820151156111075781516040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff169063dd62ed3e90611303908590309060040161181a565b60206040518083038186803b15801561131b57600080fd5b505afa15801561132f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611353919061177b565b90508260200151811015611393576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611b18565b602083015183516111d29173ffffffffffffffffffffffffffffffffffffffff90911690849030906113d9565b60606113cf8484600085611400565b90505b9392505050565b6113fa846323b872dd60e01b85858560405160240161115093929190611841565b50505050565b60608247101561143c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611a16565b61144585611501565b61147b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611b4f565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516114a491906117dd565b60006040518083038185875af1925050503d80600081146114e1576040519150601f19603f3d011682016040523d82523d6000602084013e6114e6565b606091505b50915091506114f682828661151d565b979650505050505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b6060831561152c5750816113d2565b82511561153c5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e991906118fd565b82805461157c90611d48565b90600052602060002090601f01602090048101928261159e57600085556115e4565b82601f106115b757805160ff19168380011785556115e4565b828001600101855582156115e4579182015b828111156115e45782518255916020019190600101906115c9565b506115f09291506115f4565b5090565b5b808211156115f057600081556001016115f5565b803573ffffffffffffffffffffffffffffffffffffffff811681146107b857600080fd5b80356107b881611e33565b600060208284031215611649578081fd5b6113d282611609565b600060208284031215611663578081fd5b81516113d281611e33565b60008060008060808587031215611683578283fd5b843567ffffffffffffffff8082111561169a578485fd5b818701915087601f8301126116ad578485fd5b8135818111156116bf576116bf611e04565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561170557611705611e04565b816040528281528a602084870101111561171d578788fd5b826020860160208301378760208483010152809850505050505061174360208601611609565b9250604085013591506117586060860161162d565b905092959194509250565b600060208284031215611774578081fd5b5035919050565b60006020828403121561178c578081fd5b5051919050565b600081518084526117ab816020860160208601611d1c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600082516117ef818460208701611d1c565b9190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b818110156118e657835173ffffffffffffffffffffffffffffffffffffffff16835292840192918401916001016118b4565b50909695505050505050565b901515815260200190565b6000602082526113d26020830184611793565b6000606082526119236060830186611793565b73ffffffffffffffffffffffffffffffffffffffff9490941660208301525060400152919050565b60208082526014908201527f4552524f523a2051756573742065787069726564000000000000000000000000604082015260600190565b60208082526027908201527f4552524f523a2053686f756c64206e6f742065786365656420616c6c6f77656460408201527f20626f756e747900000000000000000000000000000000000000000000000000606082015260800190565b60208082526019908201527f4552524f523a20706c61796572206e6f7420696e206c69737400000000000000604082015260600190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60408201527f722063616c6c0000000000000000000000000000000000000000000000000000606082015260800190565b60208082526012908201527f4552524f523a204e6f7420657870697265640000000000000000000000000000604082015260600190565b6020808252601a908201527f4552524f523a204d617820706c61796572732072656163686564000000000000604082015260600190565b60208082526018908201527f4552524f523a2053656e646572206e6f7420676f7665726e0000000000000000604082015260600190565b6020808252601d908201527f4552524f52203a204465706f7369742062616420616c6c6f77616e6365000000604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b60208082526012908201527f4552524f523a204e6f2065766964656e63650000000000000000000000000000604082015260600190565b6020808252601c908201527f4552524f523a20506c6179657220616c72656164792065786973747300000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60408201527f6f74207375636365656400000000000000000000000000000000000000000000606082015260800190565b60208082526024908201527f4552524f523a2053656e646572206e6f7420706c61796572206e6f722063726560408201527f61746f7200000000000000000000000000000000000000000000000000000000606082015260800190565b90815260200190565b63ffffffff91909116815260200190565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611d0057611d00611dd5565b500290565b600082821015611d1757611d17611dd5565b500390565b60005b83811015611d37578181015183820152602001611d1f565b838111156113fa5750506000910152565b600281046001821680611d5c57607f821691505b60208210811415611d96577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611dce57611dce611dd5565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b801515811461074c57600080fdfea2646970667358221220001ecc7e3a56a6e8ceba0a2f6f0020ef13bacde460faf1b1cca5699bfd12ab1764736f6c63430008010033a264697066735822122006ddcb5ccdb8532fd391ece411b1311d2d44d237eb8d1044c11f2c762c9eb08564736f6c63430008010033"; + "0x608060405234801561001057600080fd5b5061001961001e565b6100dd565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff908116146100db576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b614113806100ec6000396000f3fe60806040523480156200001157600080fd5b5060043610620000e75760003560e01c8063b0a87ac1116200008d578063d03ffefb1162000063578063d03ffefb1462000223578063edeecdd31462000248578063f2fde38b146200025f57620000e7565b8063b0a87ac114620001d4578063b628a33f14620001f5578063c4d66de8146200020c57620000e7565b80638c43b41111620000c35780638c43b411146200012b5780638c53c9bd14620001425780638da5cb5b146200019457620000e7565b8062732e3014620000ec57806354fd4d501462000105578063715018a61462000121575b600080fd5b62000103620000fd366004620011a4565b62000276565b005b6200010e600381565b6040519081526020015b60405180910390f35b62000103620002c7565b620001036200013c366004620011e2565b620002df565b606854606954620001679173ffffffffffffffffffffffffffffffffffffffff169082565b6040805173ffffffffffffffffffffffffffffffffffffffff909316835260208301919091520162000118565b60335473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200162000118565b606554620001ae9073ffffffffffffffffffffffffffffffffffffffff1681565b620001ae6200020636600462001210565b62000384565b620001036200021d366004620011a4565b620004ef565b606654606754620001679173ffffffffffffffffffffffffffffffffffffffff169082565b6200010362000259366004620011e2565b620006d5565b6200010362000270366004620011a4565b62000773565b6200028062000830565b606580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b620002d162000830565b620002dd6000620008b3565b565b620002e962000830565b60408051808201825273ffffffffffffffffffffffffffffffffffffffff84168082526020918201849052606880547fffffffffffffffffffffffff0000000000000000000000000000000000000000168217905560698490558251428152918201529081018290527f013c800b1a136f9798a25e471501a7b824156d1e9cba8439821c5a41adf2fb89906060015b60405180910390a15050565b60408051808201825260665473ffffffffffffffffffffffffffffffffffffffff9081168252606754602080840191909152835180850185526068548316815260695481830152845160e08101865233815263ffffffff88169281019290925289831682860152606082018990526065548316608083015291871660a082015284151560c0820152925160009384938c938c93919290916200042690620010a3565b6200043695949392919062001468565b604051809103906000f08015801562000453573d6000803e3d6000fd5b506040805180820190915260665473ffffffffffffffffffffffffffffffffffffffff1681526067546020820152909150620004919033836200092a565b7f2d0b32d809449b38bb442a046b092f68efaf9d4bef7678947afd25048117f187818a8a8a8a8a60666068338d8d6003604051620004db9c9b9a9998979695949392919062001366565b60405180910390a198975050505050505050565b600054610100900460ff1615808015620005105750600054600160ff909116105b80620005355750620005223062000947565b15801562000535575060005460ff166001145b620005c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156200062657600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b6200063062000967565b606580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790558015620006d157600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200162000378565b5050565b620006df62000830565b60408051808201825273ffffffffffffffffffffffffffffffffffffffff84168082526020918201849052606680547fffffffffffffffffffffffff0000000000000000000000000000000000000000168217905560678490558251428152918201529081018290527f35c5e8a6f8bed2c61a2eb1996d117b1b96192314c0d4ca7cd96360f2509200799060600162000378565b6200077d62000830565b73ffffffffffffffffffffffffffffffffffffffff811662000822576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401620005be565b6200082d81620008b3565b50565b60335473ffffffffffffffffffffffffffffffffffffffff163314620002dd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401620005be565b6033805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b62000936838362000a0a565b62000942838262000b63565b505050565b73ffffffffffffffffffffffffffffffffffffffff81163b15155b919050565b600054610100900460ff1662000a00576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401620005be565b620002dd62000b9b565b602082015115620006d15781516040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8381166004830152306024830152600092169063dd62ed3e9060440160206040518083038186803b15801562000a8757600080fd5b505afa15801562000a9c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000ac29190620012e3565b9050826020015181101562000b34576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4552524f52203a204465706f7369742062616420616c6c6f77616e63650000006044820152606401620005be565b60208301518351620009429173ffffffffffffffffffffffffffffffffffffffff909116908490309062000c3f565b602082015115620006d15760208201518251620006d19173ffffffffffffffffffffffffffffffffffffffff90911690839062000d23565b600054610100900460ff1662000c34576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401620005be565b620002dd33620008b3565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905262000d1d9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915262000d7b565b50505050565b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052620009429084907fa9059cbb000000000000000000000000000000000000000000000000000000009060640162000c9a565b600062000ddf826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1662000e919092919063ffffffff16565b905080516000148062000e0357508080602001905181019062000e039190620011c3565b62000942576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401620005be565b606062000ea2848460008562000eaa565b949350505050565b60608247101562000f3e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401620005be565b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405162000f69919062001348565b60006040518083038185875af1925050503d806000811462000fa8576040519150601f19603f3d011682016040523d82523d6000602084013e62000fad565b606091505b509150915062000fc08783838762000fcb565b979650505050505050565b60608315620010565782516200104e5762000fe68562000947565b6200104e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401620005be565b508162000ea2565b62000ea283838151156200106d5781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005be919062001453565b612acb806200161383390190565b600067ffffffffffffffff80841115620010cf57620010cf620015b1565b604051601f85017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908282118183101715620011185762001118620015b1565b816040528093508581528686860111156200113257600080fd5b858560208301376000602087830101525050509392505050565b80356200096281620015e0565b8035620009628162001603565b600082601f83011262001177578081fd5b6200118883833560208501620010b1565b9392505050565b803563ffffffff811681146200096257600080fd5b600060208284031215620011b6578081fd5b81356200118881620015e0565b600060208284031215620011d5578081fd5b8151620011888162001603565b60008060408385031215620011f5578081fd5b82356200120281620015e0565b946020939093013593505050565b600080600080600080600060e0888a0312156200122b578283fd5b873567ffffffffffffffff8082111562001243578485fd5b818a0191508a601f83011262001257578485fd5b620012688b833560208501620010b1565b985060208a01359150808211156200127e578485fd5b506200128d8a828b0162001166565b9650506200129e604089016200114c565b945060608801359350620012b5608089016200114c565b9250620012c560a089016200118f565b9150620012d560c0890162001159565b905092959891949750929550565b600060208284031215620012f5578081fd5b5051919050565b600081518084526200131681602086016020860162001582565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600082516200135c81846020870162001582565b9190910192915050565b600073ffffffffffffffffffffffffffffffffffffffff808f1683526101c060208401526200139a6101c084018f620012fc565b8381036040850152620013ae818f620012fc565b925050808c1660608401528a6080840152808a1660a0840152620013f660c084018a805473ffffffffffffffffffffffffffffffffffffffff16825260010154602090910152565b875473ffffffffffffffffffffffffffffffffffffffff166101008401526001909701546101208301529590941661014085015263ffffffff9290921661016084015215156101808301526101a090910152979650505050505050565b600060208252620011886020830184620012fc565b60006101a08083526200147e81840189620012fc565b90508281036020840152620014948188620012fc565b865173ffffffffffffffffffffffffffffffffffffffff166040850152602087015160608501529150620014c59050565b835173ffffffffffffffffffffffffffffffffffffffff166080830152602084015160a0830152825173ffffffffffffffffffffffffffffffffffffffff90811660c0840152602084015163ffffffff1660e084015260408401518116610100840152606084015161012084015260808401511661014083015260a08301516200156861016084018273ffffffffffffffffffffffffffffffffffffffff169052565b5060c0830151801515610180840152509695505050505050565b60005b838110156200159f57818101518382015260200162001585565b8381111562000d1d5750506000910152565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff811681146200082d57600080fd5b80151581146200082d57600080fdfe60806040523480156200001157600080fd5b5060405162002acb38038062002acb833981016040819052620000349162000423565b8060c0015180156200005057506000816020015163ffffffff16115b15620000e35760405162461bcd60e51b815260206004820152605260248201527f4552524f523a2043616e27742063726561746520612077686974654c6973746560448201527f642071756573742077697468206d617820706c61796572732067726561746572606482015271207468616e20302028696e66696e6974792960701b608482015260a40160405180910390fd5b8451620000f8906001906020880190620001f1565b5083516200010e906002906020870190620001f1565b506040810151600380546001600160a01b03199081166001600160a01b03938416179091556060830151600455608083015160058054831691841691909117905560a083015160068054855160008054861691871691909117905587516008805486169187169190911790556020978801516009558651600a8054861691871691909117905595870151600b55600c805460ff191690559584015160c0909401519490911691161763ffffffff60a01b1916600160a01b63ffffffff909216919091021760ff60c01b1916600160c01b9115159190910217905550620005909050565b828054620001ff9062000524565b90600052602060002090601f0160209004810192826200022357600085556200026e565b82601f106200023e57805160ff19168380011785556200026e565b828001600101855582156200026e579182015b828111156200026e57825182559160200191906001019062000251565b506200027c92915062000280565b5090565b5b808211156200027c576000815560010162000281565b60006001600160401b03831115620002b357620002b362000561565b6020620002c9601f8501601f19168201620004f1565b9150838252848484011115620002de57600080fd5b60005b84811015620002fc57838101518382018301528101620002e1565b848111156200030e5760008286850101525b50509392505050565b8051620003248162000577565b919050565b805180151581146200032457600080fd5b6000604082840312156200034c578081fd5b620003586040620004f1565b90508151620003678162000577565b808252506020820151602082015292915050565b600060e082840312156200038d578081fd5b6200039960e0620004f1565b90508151620003a88162000577565b8152602082015163ffffffff81168114620003c257600080fd5b6020820152620003d56040830162000317565b604082015260608201516060820152620003f26080830162000317565b60808201526200040560a0830162000317565b60a08201526200041860c0830162000329565b60c082015292915050565b60008060008060006101a086880312156200043c578081fd5b85516001600160401b038082111562000453578283fd5b818801915088601f83011262000467578283fd5b620004788983516020850162000297565b965060208801519150808211156200048e578283fd5b508601601f81018813620004a0578182fd5b620004b18882516020840162000297565b945050620004c387604088016200033a565b9250620004d487608088016200033a565b9150620004e58760c088016200037b565b90509295509295909350565b604051601f8201601f191681016001600160401b03811182821017156200051c576200051c62000561565b604052919050565b6002810460018216806200053957607f821691505b602082108114156200055b57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146200058d57600080fd5b50565b61252b80620005a06000396000f3fe608060405234801561001057600080fd5b506004361061016c5760003560e01c80638b5b9ccc116100cd578063d03ffefb11610081578063e492814f11610066578063e492814f146103ab578063f294cf38146103be578063f7c618c1146103c65761016c565b8063d03ffefb14610372578063e0c23423146103965761016c565b8063a888c2cd116100b2578063a888c2cd1461031d578063b0a87ac11461033f578063b434151c1461035f5761016c565b80638b5b9ccc146102b85780638c53c9bd146102cd5761016c565b8063579ca2c911610124578063775b9c1311610109578063775b9c13146102725780637ceae3101461028557806385c99e2b146102a55761016c565b8063579ca2c9146102255780636c3a4cce1461022d5761016c565b8063310a1ee311610155578063310a1ee3146101c457806348d6cb53146101db5780634c2412a2146101e85761016c565b8063151dfb06146101715780632f17b18214610186575b600080fd5b61018461017f366004612000565b6103e6565b005b6006546101af907801000000000000000000000000000000000000000000000000900460ff1681565b60405190151581526020015b60405180910390f35b6101cd60045481565b6040519081526020016101bb565b600c546101af9060ff1681565b6006546102109074010000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff90911681526020016101bb565b610184610807565b60005461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101bb565b610184610280366004612021565b610a26565b60065461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b6101af6102b3366004612000565b610d5e565b6102c0610d94565b6040516101bb91906122aa565b600a54600b546102f19173ffffffffffffffffffffffffffffffffffffffff169082565b6040805173ffffffffffffffffffffffffffffffffffffffff90931683526020830191909152016101bb565b61033061032b3660046121c4565b610e03565b6040516101bb939291906122f2565b60055461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b61018461036d3660046120eb565b610edc565b6008546009546102f19173ffffffffffffffffffffffffffffffffffffffff169082565b61039e611335565b6040516101bb91906122df565b6101846103b9366004612000565b6113c3565b61039e6117ce565b60035461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b6006547801000000000000000000000000000000000000000000000000900460ff161561049a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f4552524f523a2063616e277420756e706c617920612077686974656c6973746560448201527f642071756573740000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff821614806104d5575060005473ffffffffffffffffffffffffffffffffffffffff1633145b610560576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f4552524f523a2053656e646572206e6f7420706c61796572206e6f722063726560448201527f61746f72000000000000000000000000000000000000000000000000000000006064820152608401610491565b600061056b826117db565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14156105f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4552524f523a20706c61796572206e6f7420696e206c697374000000000000006044820152606401610491565b600d8054610607906001906123b9565b8154811061063e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260209091200154600d805473ffffffffffffffffffffffffffffffffffffffff909216918390811061069e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d80548061071e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b600082815260209081902082017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905590910190915560408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b54918101919091526107b490836118a3565b6040805173ffffffffffffffffffffffffffffffffffffffff841681524260208201527fc4a67a0877d477de99d765a3d9f48abfbe6181dff4727d68c3cb60715555417591015b60405180910390a15050565b600454421015610873576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4552524f523a204e6f74206578706972656400000000000000000000000000006044820152606401610491565b600c5460ff166108e5576000546040805180820190915260085473ffffffffffffffffffffffffffffffffffffffff908116825260095460208301526108b992166118a3565b600c80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b15801561094f57600080fd5b505afa158015610963573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098791906121dc565b600a5460035491925073ffffffffffffffffffffffffffffffffffffffff91821691161480156109d657506006547801000000000000000000000000000000000000000000000000900460ff16155b156109f957600d54600b546109f5916109ee9161237c565b82906118dc565b9150505b600654600354610a239173ffffffffffffffffffffffffffffffffffffffff918216911683611902565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610acd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f4f6e6c792063726561746f722063616e2063616c6c20746869732066756e637460448201527f696f6e00000000000000000000000000000000000000000000000000000000006064820152608401610491565b6006547801000000000000000000000000000000000000000000000000900460ff161515600114610b80576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603d60248201527f4552524f523a2043616e27742073657420746865207768697465206c6973742060448201527f746f2061206e6f6e2d77686974656c697374656420636f6e74726163740000006064820152608401610491565b6000805b8251811015610c8a576000838281518110610bc8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151905060005b8451811015610c7557828114158015610c595750848181518110610c22577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15610c6357600193505b80610c6d81612450565b915050610bd5565b50508080610c8290612450565b915050610b84565b508015610d19576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4552524f523a204f6e65206f72206d6f726520706c617965727320697320616c60448201527f726561647920696e2077686974656c69737400000000000000000000000000006064820152608401610491565b8151610d2c90600d906020850190611ebe565b507fb1565d66d9899787abe67ac307850cf339a24f69de2bf7ffa4179e0eaeb939b082426040516107fb9291906122bd565b6000610d69826117db565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff141590505b919050565b6060600d805480602002602001604051908101604052809291908181526020018280548015610df957602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610dce575b5050505050905090565b60078181548110610e1357600080fd5b9060005260206000209060030201600091509050806000018054610e36906123fc565b80601f0160208091040260200160405190810160405280929190818152602001828054610e62906123fc565b8015610eaf5780601f10610e8457610100808354040283529160200191610eaf565b820191906000526020600020905b815481529060010190602001808311610e9257829003601f168201915b505050506001830154600290930154919273ffffffffffffffffffffffffffffffffffffffff1691905083565b60055473ffffffffffffffffffffffffffffffffffffffff163314610f5d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4552524f523a2053656e646572206e6f7420676f7665726e00000000000000006044820152606401610491565b8351610fc5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4552524f523a204e6f2065766964656e636500000000000000000000000000006044820152606401610491565b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b15801561102f57600080fd5b505afa158015611043573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106791906121dc565b905081156111285760085460035473ffffffffffffffffffffffffffffffffffffffff908116911614156110b0576009546000906110a69083906118dc565b94506110b4915050565b8092505b600a5460035473ffffffffffffffffffffffffffffffffffffffff908116911614801561110057506006547801000000000000000000000000000000000000000000000000900460ff16155b1561112857600d54600b546000916111239161111c919061237c565b85906118dc565b945050505b60085460035473ffffffffffffffffffffffffffffffffffffffff908116911614156111f457600061115a82856118dc565b9150506008600101548110156111f2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f4552524f523a2053686f756c64206e6f742065786365656420616c6c6f77656460448201527f20626f756e7479000000000000000000000000000000000000000000000000006064820152608401610491565b505b821561121e5760035461121e9073ffffffffffffffffffffffffffffffffffffffff168585611902565b6040805160608101825286815273ffffffffffffffffffffffffffffffffffffffff86166020808301919091529181018590526007805460018101825560009190915281518051929360039092027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c688019261129c9284920190611f48565b5060208201516001820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091179055604091820151600290910155517fa1c3b325aa2c115e4b244062eba2515bc5585ae5b41556be8fef399ae9fde11b90611326908790879087906122f2565b60405180910390a15050505050565b60028054611342906123fc565b80601f016020809104026020016040519081016040528092919081815260200182805461136e906123fc565b80156113bb5780601f10611390576101008083540402835291602001916113bb565b820191906000526020600020905b81548152906001019060200180831161139e57829003601f168201915b505050505081565b6006547801000000000000000000000000000000000000000000000000900460ff1615611472576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603760248201527f4552524f523a2043616e27742073656c6620726567697374657220616e64207060448201527f6c617920612077686974656c69737465642051756573740000000000000000006064820152608401610491565b3373ffffffffffffffffffffffffffffffffffffffff821614806114ad575060005473ffffffffffffffffffffffffffffffffffffffff1633145b611538576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f4552524f523a2053656e646572206e6f7420706c61796572206e6f722063726560448201527f61746f72000000000000000000000000000000000000000000000000000000006064820152608401610491565b60065474010000000000000000000000000000000000000000900463ffffffff1615806115875750600654600d547401000000000000000000000000000000000000000090910463ffffffff16115b6115ed576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f4552524f523a204d617820706c617965727320726561636865640000000000006044820152606401610491565b6004544210611658576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4552524f523a20517565737420657870697265640000000000000000000000006044820152606401610491565b6000611663826117db565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff146116ee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4552524f523a20506c6179657220616c726561647920657869737473000000006044820152606401610491565b60408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b5460208201526117269033306119db565b600d80546001810182556000919091527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb50180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8416908117909155604080519182524260208301527f35ec60f951b4abc8b287ab5148caf98524052482927d42e86a720cc71b8a76a191016107fb565b60018054611342906123fc565b6000805b600d5481101561187b578273ffffffffffffffffffffffffffffffffffffffff16600d828154811061183a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff161415611869579050610d8f565b8061187381612450565b9150506117df565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92915050565b6020820151156118d857602082015182516118d89173ffffffffffffffffffffffffffffffffffffffff909116908390611902565b5050565b600080838311156118f2575060009050806118fb565b50600190508183035b9250929050565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526119d69084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526119ef565b505050565b6119e58383611afe565b6119d683826118a3565b6000611a51826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611c4e9092919063ffffffff16565b9050805160001480611a72575080806020019051810190611a7291906120cf565b6119d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610491565b6020820151156118d85781516040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8381166004830152306024830152600092169063dd62ed3e9060440160206040518083038186803b158015611b7957600080fd5b505afa158015611b8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bb191906121dc565b90508260200151811015611c21576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4552524f52203a204465706f7369742062616420616c6c6f77616e63650000006044820152606401610491565b602083015183516119d69173ffffffffffffffffffffffffffffffffffffffff9091169084903090611c65565b6060611c5d8484600085611cc9565b949350505050565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052611cc39085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401611954565b50505050565b606082471015611d5b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610491565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051611d84919061228e565b60006040518083038185875af1925050503d8060008114611dc1576040519150601f19603f3d011682016040523d82523d6000602084013e611dc6565b606091505b5091509150611dd787838387611de2565b979650505050505050565b60608315611e75578251611e6e5773ffffffffffffffffffffffffffffffffffffffff85163b611e6e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610491565b5081611c5d565b611c5d8383815115611e8a5781518083602001fd5b806040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161049191906122df565b828054828255906000526020600020908101928215611f38579160200282015b82811115611f3857825182547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909116178255602090920191600190910190611ede565b50611f44929150611fbc565b5090565b828054611f54906123fc565b90600052602060002090601f016020900481019282611f765760008555611f38565b82601f10611f8f57805160ff1916838001178555611f38565b82800160010185558215611f38579182015b82811115611f38578251825591602001919060010190611fa1565b5b80821115611f445760008155600101611fbd565b803573ffffffffffffffffffffffffffffffffffffffff81168114610d8f57600080fd5b8035610d8f816124e7565b600060208284031215612011578081fd5b61201a82611fd1565b9392505050565b60006020808385031215612033578182fd5b823567ffffffffffffffff8082111561204a578384fd5b818501915085601f83011261205d578384fd5b81358181111561206f5761206f6124b8565b838102915061207f84830161232d565b8181528481019084860184860187018a1015612099578788fd5b8795505b838610156120c2576120ae81611fd1565b83526001959095019491860191860161209d565b5098975050505050505050565b6000602082840312156120e0578081fd5b815161201a816124e7565b60008060008060808587031215612100578283fd5b843567ffffffffffffffff80821115612117578485fd5b818701915087601f83011261212a578485fd5b813560208282111561213e5761213e6124b8565b61216e817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8501160161232d565b92508183528981838601011115612183578687fd5b8181850182850137868183850101528297506121a0818a01611fd1565b965050505050604085013591506121b960608601611ff5565b905092959194509250565b6000602082840312156121d5578081fd5b5035919050565b6000602082840312156121ed578081fd5b5051919050565b6000815180845260208085019450808401835b8381101561223957815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101612207565b509495945050505050565b6000815180845261225c8160208601602086016123d0565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600082516122a08184602087016123d0565b9190910192915050565b60006020825261201a60208301846121f4565b6000604082526122d060408301856121f4565b90508260208301529392505050565b60006020825261201a6020830184612244565b6000606082526123056060830186612244565b73ffffffffffffffffffffffffffffffffffffffff9490941660208301525060400152919050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715612374576123746124b8565b604052919050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156123b4576123b4612489565b500290565b6000828210156123cb576123cb612489565b500390565b60005b838110156123eb5781810151838201526020016123d3565b83811115611cc35750506000910152565b60028104600182168061241057607f821691505b6020821081141561244a577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561248257612482612489565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b8015158114610a2357600080fdfea26469706673582212204eb3f233eed5fefb3d1f4c5541d3001cc0d8a4109bd90cca624a823385b379a164736f6c63430008020033a264697066735822122065292a639cb7d9e637fadfaa78b9d48f3864d8799ed4214556f82c758298f47564736f6c63430008020033"; diff --git a/packages/hardhat/typechain/factories/Quest__factory.ts b/packages/hardhat/typechain/factories/Quest__factory.ts index cc62bee4..6d40a425 100644 --- a/packages/hardhat/typechain/factories/Quest__factory.ts +++ b/packages/hardhat/typechain/factories/Quest__factory.ts @@ -16,54 +16,50 @@ export class Quest__factory extends ContractFactory { deploy( _questTitle: string, _questDetailsRef: BytesLike, - _rewardToken: string, - _expireTime: BigNumberish, - _aragonGovernAddress: string, - _fundsRecoveryAddress: string, _createDeposit: { token: string; amount: BigNumberish }, _playDeposit: { token: string; amount: BigNumberish }, - _questCreator: string, - _maxPlayers: BigNumberish, + _questParam: { + questCreator: string; + maxPlayers: BigNumberish; + rewardToken: string; + expireTime: BigNumberish; + aragonGovernAddress: string; + fundsRecoveryAddress: string; + isWhiteList: boolean; + }, overrides?: Overrides ): Promise { return super.deploy( _questTitle, _questDetailsRef, - _rewardToken, - _expireTime, - _aragonGovernAddress, - _fundsRecoveryAddress, _createDeposit, _playDeposit, - _questCreator, - _maxPlayers, + _questParam, overrides || {} ) as Promise; } getDeployTransaction( _questTitle: string, _questDetailsRef: BytesLike, - _rewardToken: string, - _expireTime: BigNumberish, - _aragonGovernAddress: string, - _fundsRecoveryAddress: string, _createDeposit: { token: string; amount: BigNumberish }, _playDeposit: { token: string; amount: BigNumberish }, - _questCreator: string, - _maxPlayers: BigNumberish, + _questParam: { + questCreator: string; + maxPlayers: BigNumberish; + rewardToken: string; + expireTime: BigNumberish; + aragonGovernAddress: string; + fundsRecoveryAddress: string; + isWhiteList: boolean; + }, overrides?: Overrides ): TransactionRequest { return super.getDeployTransaction( _questTitle, _questDetailsRef, - _rewardToken, - _expireTime, - _aragonGovernAddress, - _fundsRecoveryAddress, _createDeposit, _playDeposit, - _questCreator, - _maxPlayers, + _questParam, overrides || {} ); } @@ -91,30 +87,10 @@ const _abi = [ name: "_questDetailsRef", type: "bytes", }, - { - internalType: "contract IERC20", - name: "_rewardToken", - type: "address", - }, - { - internalType: "uint256", - name: "_expireTime", - type: "uint256", - }, - { - internalType: "address", - name: "_aragonGovernAddress", - type: "address", - }, - { - internalType: "address payable", - name: "_fundsRecoveryAddress", - type: "address", - }, { components: [ { - internalType: "contract IERC20", + internalType: "contract IERC20Upgradeable", name: "token", type: "address", }, @@ -131,7 +107,7 @@ const _abi = [ { components: [ { - internalType: "contract IERC20", + internalType: "contract IERC20Upgradeable", name: "token", type: "address", }, @@ -146,14 +122,46 @@ const _abi = [ type: "tuple", }, { - internalType: "address", - name: "_questCreator", - type: "address", - }, - { - internalType: "uint32", - name: "_maxPlayers", - type: "uint32", + 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", @@ -222,6 +230,25 @@ const _abi = [ 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", @@ -316,7 +343,7 @@ const _abi = [ name: "createDeposit", outputs: [ { - internalType: "contract IERC20", + internalType: "contract IERC20Upgradeable", name: "token", type: "address", }, @@ -381,6 +408,19 @@ const _abi = [ stateMutability: "view", type: "function", }, + { + inputs: [], + name: "isWhiteList", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, { inputs: [], name: "maxPlayers", @@ -412,7 +452,7 @@ const _abi = [ name: "playDeposit", outputs: [ { - internalType: "contract IERC20", + internalType: "contract IERC20Upgradeable", name: "token", type: "address", }, @@ -476,7 +516,7 @@ const _abi = [ name: "rewardToken", outputs: [ { - internalType: "contract IERC20", + internalType: "contract IERC20Upgradeable", name: "", type: "address", }, @@ -484,6 +524,19 @@ const _abi = [ stateMutability: "view", type: "function", }, + { + inputs: [ + { + internalType: "address[]", + name: "_players", + type: "address[]", + }, + ], + name: "setWhiteList", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, { inputs: [ { @@ -500,4 +553,4 @@ const _abi = [ ]; const _bytecode = - "0x60806040523480156200001157600080fd5b50604051620022d5380380620022d58339810160408190526200003491620002b7565b8951620000499060019060208d019062000118565b5088516200005f9060029060208c019062000118565b50600380546001600160a01b03199081166001600160a01b039a8b16179091556004979097556005805488169689169690961790955560068054600080548916938a16939093179092558351600880548916918a169190911790556020938401516009558251600a80548916918a169190911790559190920151600b55600c805460ff19169055931693169290921763ffffffff60a01b1916600160a01b63ffffffff90931692909202919091179055506200044e9050565b8280546200012690620003e2565b90600052602060002090601f0160209004810192826200014a576000855562000195565b82601f106200016557805160ff191683800117855562000195565b8280016001018555821562000195579182015b828111156200019557825182559160200191906001019062000178565b50620001a3929150620001a7565b5090565b5b80821115620001a35760008155600101620001a8565b8051620001cb8162000435565b919050565b600082601f830112620001e1578081fd5b81516001600160401b03811115620001fd57620001fd6200041f565b602062000213601f8301601f19168201620003af565b828152858284870101111562000227578384fd5b835b838110156200024657858101830151828201840152820162000229565b838111156200025757848385840101525b5095945050505050565b60006040828403121562000273578081fd5b6200027f6040620003af565b905081516200028e8162000435565b808252506020820151602082015292915050565b805163ffffffff81168114620001cb57600080fd5b6000806000806000806000806000806101808b8d031215620002d7578586fd5b8a516001600160401b0380821115620002ee578788fd5b620002fc8e838f01620001d0565b9b5060208d015191508082111562000312578788fd5b50620003218d828e01620001d0565b9950506200033260408c01620001be565b975060608b015196506200034960808c01620001be565b95506200035960a08c01620001be565b94506200036a8c60c08d0162000261565b93506200037c8c6101008d0162000261565b92506200038d6101408c01620001be565b91506200039e6101608c01620002a2565b90509295989b9194979a5092959850565b604051601f8201601f191681016001600160401b0381118282101715620003da57620003da6200041f565b604052919050565b600281046001821680620003f757607f821691505b602082108114156200041957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146200044b57600080fd5b50565b611e77806200045e6000396000f3fe608060405234801561001057600080fd5b50600436106101365760003560e01c80638c53c9bd116100b2578063d03ffefb11610081578063e492814f11610066578063e492814f14610255578063f294cf3814610268578063f7c618c11461027057610136565b8063d03ffefb14610238578063e0c234231461024057610136565b80638c53c9bd146101e5578063a888c2cd146101fb578063b0a87ac11461021d578063b434151c1461022557610136565b8063579ca2c9116101095780637ceae310116100ee5780637ceae310146101b557806385c99e2b146101bd5780638b5b9ccc146101d057610136565b8063579ca2c9146101985780636c3a4cce146101a057610136565b8063151dfb061461013b578063310a1ee31461015057806348d6cb531461016e5780634c2412a214610183575b600080fd5b61014e610149366004611638565b610278565b005b610158610553565b6040516101659190611cae565b60405180910390f35b610176610559565b60405161016591906118f2565b61018b610562565b6040516101659190611cb7565b61014e610586565b6101a861074f565b60405161016591906117f9565b6101a861076b565b6101766101cb366004611638565b610787565b6101d86107bd565b6040516101659190611898565b6101ed61082c565b604051610165929190611872565b61020e610209366004611763565b61084e565b60405161016593929190611910565b6101a8610927565b61014e61023336600461166e565b610943565b6101ed610cc0565b610248610ce2565b60405161016591906118fd565b61014e610263366004611638565b610d70565b610248610fe1565b6101a8610fee565b3373ffffffffffffffffffffffffffffffffffffffff821614806102b3575060005473ffffffffffffffffffffffffffffffffffffffff1633145b6102f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611c51565b60405180910390fd5b60006102fd8261100a565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1415610359576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e9906119df565b600d805461036990600190611d05565b815481106103a0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260209091200154600d805473ffffffffffffffffffffffffffffffffffffffff9092169183908110610400577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d805480610480577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b600082815260209081902082017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905590910190915560408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b549181019190915261051690836110d2565b7fc4a67a0877d477de99d765a3d9f48abfbe6181dff4727d68c3cb6071555541758242604051610547929190611872565b60405180910390a15050565b60045481565b600c5460ff1681565b60065474010000000000000000000000000000000000000000900463ffffffff1681565b6004544210156105c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611a73565b600c5460ff16610634576000546040805180820190915260085473ffffffffffffffffffffffffffffffffffffffff9081168252600954602083015261060892166110d2565b600c80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319061068b9030906004016117f9565b60206040518083038186803b1580156106a357600080fd5b505afa1580156106b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106db919061177b565b600a5460035491925073ffffffffffffffffffffffffffffffffffffffff9182169116141561072257600d54600b5461071e9161071791611cc8565b829061110b565b9150505b60065460035461074c9173ffffffffffffffffffffffffffffffffffffffff918216911683611131565b50565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60006107928261100a565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff141590505b919050565b6060600d80548060200260200160405190810160405280929190818152602001828054801561082257602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff1681526001909101906020018083116107f7575b5050505050905090565b600a54600b5473ffffffffffffffffffffffffffffffffffffffff9091169082565b6007818154811061085e57600080fd5b906000526020600020906003020160009150905080600001805461088190611d48565b80601f01602080910402602001604051908101604052809291908181526020018280546108ad90611d48565b80156108fa5780601f106108cf576101008083540402835291602001916108fa565b820191906000526020600020905b8154815290600101906020018083116108dd57829003601f168201915b505050506001830154600290930154919273ffffffffffffffffffffffffffffffffffffffff1691905083565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60055473ffffffffffffffffffffffffffffffffffffffff163314610994576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611ae1565b83516109cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611b86565b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff16906370a0823190610a239030906004016117f9565b60206040518083038186803b158015610a3b57600080fd5b505afa158015610a4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a73919061177b565b90508115610b095760085460035473ffffffffffffffffffffffffffffffffffffffff90811691161415610abc57600954600090610ab290839061110b565b9450610ac0915050565b8092505b600a5460035473ffffffffffffffffffffffffffffffffffffffff90811691161415610b0957600d54600b54600091610b0491610afd9190611cc8565b859061110b565b945050505b60085460035473ffffffffffffffffffffffffffffffffffffffff90811691161415610b7f576000610b3b828561110b565b915050600860010154811015610b7d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611982565b505b8215610ba957600354610ba99073ffffffffffffffffffffffffffffffffffffffff168585611131565b6040805160608101825286815273ffffffffffffffffffffffffffffffffffffffff86166020808301919091529181018590526007805460018101825560009190915281518051929360039092027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880192610c279284920190611570565b5060208201516001820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091179055604091820151600290910155517fa1c3b325aa2c115e4b244062eba2515bc5585ae5b41556be8fef399ae9fde11b90610cb190879087908790611910565b60405180910390a15050505050565b60085460095473ffffffffffffffffffffffffffffffffffffffff9091169082565b60028054610cef90611d48565b80601f0160208091040260200160405190810160405280929190818152602001828054610d1b90611d48565b8015610d685780601f10610d3d57610100808354040283529160200191610d68565b820191906000526020600020905b815481529060010190602001808311610d4b57829003601f168201915b505050505081565b3373ffffffffffffffffffffffffffffffffffffffff82161480610dab575060005473ffffffffffffffffffffffffffffffffffffffff1633145b610de1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611c51565b60065474010000000000000000000000000000000000000000900463ffffffff161580610e305750600654600d547401000000000000000000000000000000000000000090910463ffffffff16115b610e66576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611aaa565b6004544210610ea1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e99061194b565b6000610eac8261100a565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610f07576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611bbd565b60408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b546020820152610f3f9033306111d7565b600d80546001810182556000919091527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb50180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790556040517f35ec60f951b4abc8b287ab5148caf98524052482927d42e86a720cc71b8a76a1906105479084904290611872565b60018054610cef90611d48565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b6000805b600d548110156110aa578273ffffffffffffffffffffffffffffffffffffffff16600d8281548110611069577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614156110985790506107b8565b806110a281611d9c565b91505061100e565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92915050565b60208201511561110757602082015182516111079173ffffffffffffffffffffffffffffffffffffffff909116908390611131565b5050565b600080838311156111215750600090508061112a565b50600190508183035b9250929050565b6111d28363a9059cbb60e01b8484604051602401611150929190611872565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526111eb565b505050565b6111e183836112a1565b6111d283826110d2565b600061124d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166113c09092919063ffffffff16565b8051909150156111d2578080602001905181019061126b9190611652565b6111d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611bf4565b6020820151156111075781516040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff169063dd62ed3e90611303908590309060040161181a565b60206040518083038186803b15801561131b57600080fd5b505afa15801561132f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611353919061177b565b90508260200151811015611393576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611b18565b602083015183516111d29173ffffffffffffffffffffffffffffffffffffffff90911690849030906113d9565b60606113cf8484600085611400565b90505b9392505050565b6113fa846323b872dd60e01b85858560405160240161115093929190611841565b50505050565b60608247101561143c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611a16565b61144585611501565b61147b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611b4f565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516114a491906117dd565b60006040518083038185875af1925050503d80600081146114e1576040519150601f19603f3d011682016040523d82523d6000602084013e6114e6565b606091505b50915091506114f682828661151d565b979650505050505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b6060831561152c5750816113d2565b82511561153c5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e991906118fd565b82805461157c90611d48565b90600052602060002090601f01602090048101928261159e57600085556115e4565b82601f106115b757805160ff19168380011785556115e4565b828001600101855582156115e4579182015b828111156115e45782518255916020019190600101906115c9565b506115f09291506115f4565b5090565b5b808211156115f057600081556001016115f5565b803573ffffffffffffffffffffffffffffffffffffffff811681146107b857600080fd5b80356107b881611e33565b600060208284031215611649578081fd5b6113d282611609565b600060208284031215611663578081fd5b81516113d281611e33565b60008060008060808587031215611683578283fd5b843567ffffffffffffffff8082111561169a578485fd5b818701915087601f8301126116ad578485fd5b8135818111156116bf576116bf611e04565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561170557611705611e04565b816040528281528a602084870101111561171d578788fd5b826020860160208301378760208483010152809850505050505061174360208601611609565b9250604085013591506117586060860161162d565b905092959194509250565b600060208284031215611774578081fd5b5035919050565b60006020828403121561178c578081fd5b5051919050565b600081518084526117ab816020860160208601611d1c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600082516117ef818460208701611d1c565b9190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b818110156118e657835173ffffffffffffffffffffffffffffffffffffffff16835292840192918401916001016118b4565b50909695505050505050565b901515815260200190565b6000602082526113d26020830184611793565b6000606082526119236060830186611793565b73ffffffffffffffffffffffffffffffffffffffff9490941660208301525060400152919050565b60208082526014908201527f4552524f523a2051756573742065787069726564000000000000000000000000604082015260600190565b60208082526027908201527f4552524f523a2053686f756c64206e6f742065786365656420616c6c6f77656460408201527f20626f756e747900000000000000000000000000000000000000000000000000606082015260800190565b60208082526019908201527f4552524f523a20706c61796572206e6f7420696e206c69737400000000000000604082015260600190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60408201527f722063616c6c0000000000000000000000000000000000000000000000000000606082015260800190565b60208082526012908201527f4552524f523a204e6f7420657870697265640000000000000000000000000000604082015260600190565b6020808252601a908201527f4552524f523a204d617820706c61796572732072656163686564000000000000604082015260600190565b60208082526018908201527f4552524f523a2053656e646572206e6f7420676f7665726e0000000000000000604082015260600190565b6020808252601d908201527f4552524f52203a204465706f7369742062616420616c6c6f77616e6365000000604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b60208082526012908201527f4552524f523a204e6f2065766964656e63650000000000000000000000000000604082015260600190565b6020808252601c908201527f4552524f523a20506c6179657220616c72656164792065786973747300000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60408201527f6f74207375636365656400000000000000000000000000000000000000000000606082015260800190565b60208082526024908201527f4552524f523a2053656e646572206e6f7420706c61796572206e6f722063726560408201527f61746f7200000000000000000000000000000000000000000000000000000000606082015260800190565b90815260200190565b63ffffffff91909116815260200190565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611d0057611d00611dd5565b500290565b600082821015611d1757611d17611dd5565b500390565b60005b83811015611d37578181015183820152602001611d1f565b838111156113fa5750506000910152565b600281046001821680611d5c57607f821691505b60208210811415611d96577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611dce57611dce611dd5565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b801515811461074c57600080fdfea2646970667358221220001ecc7e3a56a6e8ceba0a2f6f0020ef13bacde460faf1b1cca5699bfd12ab1764736f6c63430008010033"; + "0x60806040523480156200001157600080fd5b5060405162002acb38038062002acb833981016040819052620000349162000423565b8060c0015180156200005057506000816020015163ffffffff16115b15620000e35760405162461bcd60e51b815260206004820152605260248201527f4552524f523a2043616e27742063726561746520612077686974654c6973746560448201527f642071756573742077697468206d617820706c61796572732067726561746572606482015271207468616e20302028696e66696e6974792960701b608482015260a40160405180910390fd5b8451620000f8906001906020880190620001f1565b5083516200010e906002906020870190620001f1565b506040810151600380546001600160a01b03199081166001600160a01b03938416179091556060830151600455608083015160058054831691841691909117905560a083015160068054855160008054861691871691909117905587516008805486169187169190911790556020978801516009558651600a8054861691871691909117905595870151600b55600c805460ff191690559584015160c0909401519490911691161763ffffffff60a01b1916600160a01b63ffffffff909216919091021760ff60c01b1916600160c01b9115159190910217905550620005909050565b828054620001ff9062000524565b90600052602060002090601f0160209004810192826200022357600085556200026e565b82601f106200023e57805160ff19168380011785556200026e565b828001600101855582156200026e579182015b828111156200026e57825182559160200191906001019062000251565b506200027c92915062000280565b5090565b5b808211156200027c576000815560010162000281565b60006001600160401b03831115620002b357620002b362000561565b6020620002c9601f8501601f19168201620004f1565b9150838252848484011115620002de57600080fd5b60005b84811015620002fc57838101518382018301528101620002e1565b848111156200030e5760008286850101525b50509392505050565b8051620003248162000577565b919050565b805180151581146200032457600080fd5b6000604082840312156200034c578081fd5b620003586040620004f1565b90508151620003678162000577565b808252506020820151602082015292915050565b600060e082840312156200038d578081fd5b6200039960e0620004f1565b90508151620003a88162000577565b8152602082015163ffffffff81168114620003c257600080fd5b6020820152620003d56040830162000317565b604082015260608201516060820152620003f26080830162000317565b60808201526200040560a0830162000317565b60a08201526200041860c0830162000329565b60c082015292915050565b60008060008060006101a086880312156200043c578081fd5b85516001600160401b038082111562000453578283fd5b818801915088601f83011262000467578283fd5b620004788983516020850162000297565b965060208801519150808211156200048e578283fd5b508601601f81018813620004a0578182fd5b620004b18882516020840162000297565b945050620004c387604088016200033a565b9250620004d487608088016200033a565b9150620004e58760c088016200037b565b90509295509295909350565b604051601f8201601f191681016001600160401b03811182821017156200051c576200051c62000561565b604052919050565b6002810460018216806200053957607f821691505b602082108114156200055b57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146200058d57600080fd5b50565b61252b80620005a06000396000f3fe608060405234801561001057600080fd5b506004361061016c5760003560e01c80638b5b9ccc116100cd578063d03ffefb11610081578063e492814f11610066578063e492814f146103ab578063f294cf38146103be578063f7c618c1146103c65761016c565b8063d03ffefb14610372578063e0c23423146103965761016c565b8063a888c2cd116100b2578063a888c2cd1461031d578063b0a87ac11461033f578063b434151c1461035f5761016c565b80638b5b9ccc146102b85780638c53c9bd146102cd5761016c565b8063579ca2c911610124578063775b9c1311610109578063775b9c13146102725780637ceae3101461028557806385c99e2b146102a55761016c565b8063579ca2c9146102255780636c3a4cce1461022d5761016c565b8063310a1ee311610155578063310a1ee3146101c457806348d6cb53146101db5780634c2412a2146101e85761016c565b8063151dfb06146101715780632f17b18214610186575b600080fd5b61018461017f366004612000565b6103e6565b005b6006546101af907801000000000000000000000000000000000000000000000000900460ff1681565b60405190151581526020015b60405180910390f35b6101cd60045481565b6040519081526020016101bb565b600c546101af9060ff1681565b6006546102109074010000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff90911681526020016101bb565b610184610807565b60005461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101bb565b610184610280366004612021565b610a26565b60065461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b6101af6102b3366004612000565b610d5e565b6102c0610d94565b6040516101bb91906122aa565b600a54600b546102f19173ffffffffffffffffffffffffffffffffffffffff169082565b6040805173ffffffffffffffffffffffffffffffffffffffff90931683526020830191909152016101bb565b61033061032b3660046121c4565b610e03565b6040516101bb939291906122f2565b60055461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b61018461036d3660046120eb565b610edc565b6008546009546102f19173ffffffffffffffffffffffffffffffffffffffff169082565b61039e611335565b6040516101bb91906122df565b6101846103b9366004612000565b6113c3565b61039e6117ce565b60035461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b6006547801000000000000000000000000000000000000000000000000900460ff161561049a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f4552524f523a2063616e277420756e706c617920612077686974656c6973746560448201527f642071756573740000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff821614806104d5575060005473ffffffffffffffffffffffffffffffffffffffff1633145b610560576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f4552524f523a2053656e646572206e6f7420706c61796572206e6f722063726560448201527f61746f72000000000000000000000000000000000000000000000000000000006064820152608401610491565b600061056b826117db565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14156105f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4552524f523a20706c61796572206e6f7420696e206c697374000000000000006044820152606401610491565b600d8054610607906001906123b9565b8154811061063e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260209091200154600d805473ffffffffffffffffffffffffffffffffffffffff909216918390811061069e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d80548061071e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b600082815260209081902082017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905590910190915560408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b54918101919091526107b490836118a3565b6040805173ffffffffffffffffffffffffffffffffffffffff841681524260208201527fc4a67a0877d477de99d765a3d9f48abfbe6181dff4727d68c3cb60715555417591015b60405180910390a15050565b600454421015610873576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4552524f523a204e6f74206578706972656400000000000000000000000000006044820152606401610491565b600c5460ff166108e5576000546040805180820190915260085473ffffffffffffffffffffffffffffffffffffffff908116825260095460208301526108b992166118a3565b600c80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b15801561094f57600080fd5b505afa158015610963573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098791906121dc565b600a5460035491925073ffffffffffffffffffffffffffffffffffffffff91821691161480156109d657506006547801000000000000000000000000000000000000000000000000900460ff16155b156109f957600d54600b546109f5916109ee9161237c565b82906118dc565b9150505b600654600354610a239173ffffffffffffffffffffffffffffffffffffffff918216911683611902565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610acd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f4f6e6c792063726561746f722063616e2063616c6c20746869732066756e637460448201527f696f6e00000000000000000000000000000000000000000000000000000000006064820152608401610491565b6006547801000000000000000000000000000000000000000000000000900460ff161515600114610b80576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603d60248201527f4552524f523a2043616e27742073657420746865207768697465206c6973742060448201527f746f2061206e6f6e2d77686974656c697374656420636f6e74726163740000006064820152608401610491565b6000805b8251811015610c8a576000838281518110610bc8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151905060005b8451811015610c7557828114158015610c595750848181518110610c22577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15610c6357600193505b80610c6d81612450565b915050610bd5565b50508080610c8290612450565b915050610b84565b508015610d19576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4552524f523a204f6e65206f72206d6f726520706c617965727320697320616c60448201527f726561647920696e2077686974656c69737400000000000000000000000000006064820152608401610491565b8151610d2c90600d906020850190611ebe565b507fb1565d66d9899787abe67ac307850cf339a24f69de2bf7ffa4179e0eaeb939b082426040516107fb9291906122bd565b6000610d69826117db565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff141590505b919050565b6060600d805480602002602001604051908101604052809291908181526020018280548015610df957602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610dce575b5050505050905090565b60078181548110610e1357600080fd5b9060005260206000209060030201600091509050806000018054610e36906123fc565b80601f0160208091040260200160405190810160405280929190818152602001828054610e62906123fc565b8015610eaf5780601f10610e8457610100808354040283529160200191610eaf565b820191906000526020600020905b815481529060010190602001808311610e9257829003601f168201915b505050506001830154600290930154919273ffffffffffffffffffffffffffffffffffffffff1691905083565b60055473ffffffffffffffffffffffffffffffffffffffff163314610f5d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4552524f523a2053656e646572206e6f7420676f7665726e00000000000000006044820152606401610491565b8351610fc5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4552524f523a204e6f2065766964656e636500000000000000000000000000006044820152606401610491565b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b15801561102f57600080fd5b505afa158015611043573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106791906121dc565b905081156111285760085460035473ffffffffffffffffffffffffffffffffffffffff908116911614156110b0576009546000906110a69083906118dc565b94506110b4915050565b8092505b600a5460035473ffffffffffffffffffffffffffffffffffffffff908116911614801561110057506006547801000000000000000000000000000000000000000000000000900460ff16155b1561112857600d54600b546000916111239161111c919061237c565b85906118dc565b945050505b60085460035473ffffffffffffffffffffffffffffffffffffffff908116911614156111f457600061115a82856118dc565b9150506008600101548110156111f2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f4552524f523a2053686f756c64206e6f742065786365656420616c6c6f77656460448201527f20626f756e7479000000000000000000000000000000000000000000000000006064820152608401610491565b505b821561121e5760035461121e9073ffffffffffffffffffffffffffffffffffffffff168585611902565b6040805160608101825286815273ffffffffffffffffffffffffffffffffffffffff86166020808301919091529181018590526007805460018101825560009190915281518051929360039092027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c688019261129c9284920190611f48565b5060208201516001820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091179055604091820151600290910155517fa1c3b325aa2c115e4b244062eba2515bc5585ae5b41556be8fef399ae9fde11b90611326908790879087906122f2565b60405180910390a15050505050565b60028054611342906123fc565b80601f016020809104026020016040519081016040528092919081815260200182805461136e906123fc565b80156113bb5780601f10611390576101008083540402835291602001916113bb565b820191906000526020600020905b81548152906001019060200180831161139e57829003601f168201915b505050505081565b6006547801000000000000000000000000000000000000000000000000900460ff1615611472576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603760248201527f4552524f523a2043616e27742073656c6620726567697374657220616e64207060448201527f6c617920612077686974656c69737465642051756573740000000000000000006064820152608401610491565b3373ffffffffffffffffffffffffffffffffffffffff821614806114ad575060005473ffffffffffffffffffffffffffffffffffffffff1633145b611538576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f4552524f523a2053656e646572206e6f7420706c61796572206e6f722063726560448201527f61746f72000000000000000000000000000000000000000000000000000000006064820152608401610491565b60065474010000000000000000000000000000000000000000900463ffffffff1615806115875750600654600d547401000000000000000000000000000000000000000090910463ffffffff16115b6115ed576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f4552524f523a204d617820706c617965727320726561636865640000000000006044820152606401610491565b6004544210611658576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4552524f523a20517565737420657870697265640000000000000000000000006044820152606401610491565b6000611663826117db565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff146116ee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4552524f523a20506c6179657220616c726561647920657869737473000000006044820152606401610491565b60408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b5460208201526117269033306119db565b600d80546001810182556000919091527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb50180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8416908117909155604080519182524260208301527f35ec60f951b4abc8b287ab5148caf98524052482927d42e86a720cc71b8a76a191016107fb565b60018054611342906123fc565b6000805b600d5481101561187b578273ffffffffffffffffffffffffffffffffffffffff16600d828154811061183a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff161415611869579050610d8f565b8061187381612450565b9150506117df565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92915050565b6020820151156118d857602082015182516118d89173ffffffffffffffffffffffffffffffffffffffff909116908390611902565b5050565b600080838311156118f2575060009050806118fb565b50600190508183035b9250929050565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526119d69084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526119ef565b505050565b6119e58383611afe565b6119d683826118a3565b6000611a51826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611c4e9092919063ffffffff16565b9050805160001480611a72575080806020019051810190611a7291906120cf565b6119d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610491565b6020820151156118d85781516040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8381166004830152306024830152600092169063dd62ed3e9060440160206040518083038186803b158015611b7957600080fd5b505afa158015611b8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bb191906121dc565b90508260200151811015611c21576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4552524f52203a204465706f7369742062616420616c6c6f77616e63650000006044820152606401610491565b602083015183516119d69173ffffffffffffffffffffffffffffffffffffffff9091169084903090611c65565b6060611c5d8484600085611cc9565b949350505050565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052611cc39085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401611954565b50505050565b606082471015611d5b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610491565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051611d84919061228e565b60006040518083038185875af1925050503d8060008114611dc1576040519150601f19603f3d011682016040523d82523d6000602084013e611dc6565b606091505b5091509150611dd787838387611de2565b979650505050505050565b60608315611e75578251611e6e5773ffffffffffffffffffffffffffffffffffffffff85163b611e6e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610491565b5081611c5d565b611c5d8383815115611e8a5781518083602001fd5b806040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161049191906122df565b828054828255906000526020600020908101928215611f38579160200282015b82811115611f3857825182547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909116178255602090920191600190910190611ede565b50611f44929150611fbc565b5090565b828054611f54906123fc565b90600052602060002090601f016020900481019282611f765760008555611f38565b82601f10611f8f57805160ff1916838001178555611f38565b82800160010185558215611f38579182015b82811115611f38578251825591602001919060010190611fa1565b5b80821115611f445760008155600101611fbd565b803573ffffffffffffffffffffffffffffffffffffffff81168114610d8f57600080fd5b8035610d8f816124e7565b600060208284031215612011578081fd5b61201a82611fd1565b9392505050565b60006020808385031215612033578182fd5b823567ffffffffffffffff8082111561204a578384fd5b818501915085601f83011261205d578384fd5b81358181111561206f5761206f6124b8565b838102915061207f84830161232d565b8181528481019084860184860187018a1015612099578788fd5b8795505b838610156120c2576120ae81611fd1565b83526001959095019491860191860161209d565b5098975050505050505050565b6000602082840312156120e0578081fd5b815161201a816124e7565b60008060008060808587031215612100578283fd5b843567ffffffffffffffff80821115612117578485fd5b818701915087601f83011261212a578485fd5b813560208282111561213e5761213e6124b8565b61216e817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8501160161232d565b92508183528981838601011115612183578687fd5b8181850182850137868183850101528297506121a0818a01611fd1565b965050505050604085013591506121b960608601611ff5565b905092959194509250565b6000602082840312156121d5578081fd5b5035919050565b6000602082840312156121ed578081fd5b5051919050565b6000815180845260208085019450808401835b8381101561223957815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101612207565b509495945050505050565b6000815180845261225c8160208601602086016123d0565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600082516122a08184602087016123d0565b9190910192915050565b60006020825261201a60208301846121f4565b6000604082526122d060408301856121f4565b90508260208301529392505050565b60006020825261201a6020830184612244565b6000606082526123056060830186612244565b73ffffffffffffffffffffffffffffffffffffffff9490941660208301525060400152919050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715612374576123746124b8565b604052919050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156123b4576123b4612489565b500290565b6000828210156123cb576123cb612489565b500390565b60005b838110156123eb5781810151838201526020016123d3565b83811115611cc35750506000910152565b60028104600182168061241057607f821691505b6020821081141561244a577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561248257612482612489565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b8015158114610a2357600080fdfea26469706673582212204eb3f233eed5fefb3d1f4c5541d3001cc0d8a4109bd90cca624a823385b379a164736f6c63430008020033"; diff --git a/packages/hardhat/typechain/factories/TokenMock__factory.ts b/packages/hardhat/typechain/factories/TokenMock__factory.ts index a55b1b89..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 = - "0x608060405260405162000fa038038062000fa08339810160408190526200002691620001b9565b8151829082906200003f90600390602085019062000060565b5080516200005590600490602084019062000060565b505050505062000273565b8280546200006e9062000220565b90600052602060002090601f016020900481019282620000925760008555620000dd565b82601f10620000ad57805160ff1916838001178555620000dd565b82800160010185558215620000dd579182015b82811115620000dd578251825591602001919060010190620000c0565b50620000eb929150620000ef565b5090565b5b80821115620000eb5760008155600101620000f0565b600082601f83011262000117578081fd5b81516001600160401b03808211156200013457620001346200025d565b604051601f8301601f19908116603f011681019082821181831017156200015f576200015f6200025d565b816040528381526020925086838588010111156200017b578485fd5b8491505b838210156200019e57858201830151818301840152908201906200017f565b83821115620001af57848385830101525b9695505050505050565b60008060408385031215620001cc578182fd5b82516001600160401b0380821115620001e3578384fd5b620001f18683870162000106565b9350602085015191508082111562000207578283fd5b50620002168582860162000106565b9150509250929050565b6002810460018216806200023557607f821691505b602082108114156200025757634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b610d1d80620002836000396000f3fe608060405234801561001057600080fd5b50600436106100d45760003560e01c806340c10f1911610081578063a457c2d71161005b578063a457c2d714610197578063a9059cbb146101aa578063dd62ed3e146101bd576100d4565b806340c10f191461016757806370a082311461017c57806395d89b411461018f576100d4565b806323b872dd116100b257806323b872dd1461012c578063313ce5671461013f5780633950935114610154576100d4565b806306fdde03146100d9578063095ea7b3146100f757806318160ddd14610117575b600080fd5b6100e16101d0565b6040516100ee9190610932565b60405180910390f35b61010a6101053660046108fe565b610262565b6040516100ee9190610927565b61011f610284565b6040516100ee9190610c3f565b61010a61013a3660046108c3565b61028a565b6101476102b8565b6040516100ee9190610c48565b61010a6101623660046108fe565b6102bd565b61017a6101753660046108fe565b6102e9565b005b61011f61018a366004610870565b6102f7565b6100e1610323565b61010a6101a53660046108fe565b610332565b61010a6101b83660046108fe565b61039d565b61011f6101cb366004610891565b6103b5565b6060600380546101df90610c93565b80601f016020809104026020016040519081016040528092919081815260200182805461020b90610c93565b80156102585780601f1061022d57610100808354040283529160200191610258565b820191906000526020600020905b81548152906001019060200180831161023b57829003601f168201915b5050505050905090565b60008061026d6103ed565b905061027a8185856103f1565b5060019392505050565b60025490565b6000806102956103ed565b90506102a2858285610500565b6102ad858585610582565b506001949350505050565b601290565b6000806102c86103ed565b905061027a8185856102da85896103b5565b6102e49190610c56565b6103f1565b6102f38282610742565b5050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152602081905260409020545b919050565b6060600480546101df90610c93565b60008061033d6103ed565b9050600061034b82866103b5565b905083811015610390576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161038790610bab565b60405180910390fd5b6102ad82868684036103f1565b6000806103a86103ed565b905061027a818585610582565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b3390565b73ffffffffffffffffffffffffffffffffffffffff831661043e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161038790610b4e565b73ffffffffffffffffffffffffffffffffffffffff821661048b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161038790610a00565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104f3908590610c3f565b60405180910390a3505050565b600061050c84846103b5565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811461057c578181101561056f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161038790610a5d565b61057c84848484036103f1565b50505050565b73ffffffffffffffffffffffffffffffffffffffff83166105cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161038790610af1565b73ffffffffffffffffffffffffffffffffffffffff821661061c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610387906109a3565b610627838383610847565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205481811015610687576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161038790610a94565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152602081905260408082208585039055918516815290812080548492906106cb908490610c56565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161072f9190610c3f565b60405180910390a361057c848484610847565b73ffffffffffffffffffffffffffffffffffffffff821661078f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161038790610c08565b61079b60008383610847565b80600260008282546107ad9190610c56565b909155505073ffffffffffffffffffffffffffffffffffffffff8216600090815260208190526040812080548392906107e7908490610c56565b909155505060405173ffffffffffffffffffffffffffffffffffffffff8316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610837908590610c3f565b60405180910390a36102f3600083835b505050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461031e57600080fd5b600060208284031215610881578081fd5b61088a8261084c565b9392505050565b600080604083850312156108a3578081fd5b6108ac8361084c565b91506108ba6020840161084c565b90509250929050565b6000806000606084860312156108d7578081fd5b6108e08461084c565b92506108ee6020850161084c565b9150604084013590509250925092565b60008060408385031215610910578182fd5b6109198361084c565b946020939093013593505050565b901515815260200190565b6000602080835283518082850152825b8181101561095e57858101830151858201604001528201610942565b8181111561096f5783604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201527f6573730000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560408201527f7373000000000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601d908201527f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000604082015260600190565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260408201527f616c616e63650000000000000000000000000000000000000000000000000000606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460408201527f6472657373000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460408201527f7265737300000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526025908201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760408201527f207a65726f000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601f908201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604082015260600190565b90815260200190565b60ff91909116815260200190565b60008219821115610c8e577f4e487b710000000000000000000000000000000000000000000000000000000081526011600452602481fd5b500190565b600281046001821680610ca757607f821691505b60208210811415610ce1577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b5091905056fea2646970667358221220a4b54a7a2f37c82415ec22d08b2dc27e1757a12d2bc3dd51bf2ca56dc3ca377a64736f6c63430008010033"; + "0x608060405260405162000ec738038062000ec78339810160408190526200002691620001b9565b8151829082906200003f90600390602085019062000060565b5080516200005590600490602084019062000060565b505050505062000273565b8280546200006e9062000220565b90600052602060002090601f016020900481019282620000925760008555620000dd565b82601f10620000ad57805160ff1916838001178555620000dd565b82800160010185558215620000dd579182015b82811115620000dd578251825591602001919060010190620000c0565b50620000eb929150620000ef565b5090565b5b80821115620000eb5760008155600101620000f0565b600082601f83011262000117578081fd5b81516001600160401b03808211156200013457620001346200025d565b604051601f8301601f19908116603f011681019082821181831017156200015f576200015f6200025d565b816040528381526020925086838588010111156200017b578485fd5b8491505b838210156200019e57858201830151818301840152908201906200017f565b83821115620001af57848385830101525b9695505050505050565b60008060408385031215620001cc578182fd5b82516001600160401b0380821115620001e3578384fd5b620001f18683870162000106565b9350602085015191508082111562000207578283fd5b50620002168582860162000106565b9150509250929050565b6002810460018216806200023557607f821691505b602082108114156200025757634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b610c4480620002836000396000f3fe608060405234801561001057600080fd5b50600436106100d45760003560e01c806340c10f1911610081578063a457c2d71161005b578063a457c2d714610191578063a9059cbb146101a4578063dd62ed3e146101b7576100d4565b806340c10f191461016157806370a082311461017657806395d89b4114610189576100d4565b806323b872dd116100b257806323b872dd1461012c578063313ce5671461013f578063395093511461014e576100d4565b806306fdde03146100d9578063095ea7b3146100f757806318160ddd1461011a575b600080fd5b6100e16101fd565b6040516100ee9190610b0c565b60405180910390f35b61010a610105366004610ae3565b61028f565b60405190151581526020016100ee565b6002545b6040519081526020016100ee565b61010a61013a366004610aa8565b6102a7565b604051601281526020016100ee565b61010a61015c366004610ae3565b6102cb565b61017461016f366004610ae3565b610317565b005b61011e610184366004610a55565b610325565b6100e1610351565b61010a61019f366004610ae3565b610360565b61010a6101b2366004610ae3565b610436565b61011e6101c5366004610a76565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b60606003805461020c90610bba565b80601f016020809104026020016040519081016040528092919081815260200182805461023890610bba565b80156102855780601f1061025a57610100808354040283529160200191610285565b820191906000526020600020905b81548152906001019060200180831161026857829003601f168201915b5050505050905090565b60003361029d818585610444565b5060019392505050565b6000336102b58582856105f7565b6102c08585856106ce565b506001949350505050565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919061029d9082908690610312908790610b7d565b610444565b610321828261093d565b5050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152602081905260409020545b919050565b60606004805461020c90610bba565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919083811015610429576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6102c08286868403610444565b60003361029d8185856106ce565b73ffffffffffffffffffffffffffffffffffffffff83166104e6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610420565b73ffffffffffffffffffffffffffffffffffffffff8216610589576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610420565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146106c857818110156106bb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610420565b6106c88484848403610444565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610771576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610420565b73ffffffffffffffffffffffffffffffffffffffff8216610814576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610420565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260208190526040902054818110156108ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610420565b73ffffffffffffffffffffffffffffffffffffffff848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a36106c8565b73ffffffffffffffffffffffffffffffffffffffff82166109ba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610420565b80600260008282546109cc9190610b7d565b909155505073ffffffffffffffffffffffffffffffffffffffff8216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610321565b803573ffffffffffffffffffffffffffffffffffffffff8116811461034c57600080fd5b600060208284031215610a66578081fd5b610a6f82610a31565b9392505050565b60008060408385031215610a88578081fd5b610a9183610a31565b9150610a9f60208401610a31565b90509250929050565b600080600060608486031215610abc578081fd5b610ac584610a31565b9250610ad360208501610a31565b9150604084013590509250925092565b60008060408385031215610af5578182fd5b610afe83610a31565b946020939093013593505050565b6000602080835283518082850152825b81811015610b3857858101830151858201604001528201610b1c565b81811115610b495783604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b60008219821115610bb5577f4e487b710000000000000000000000000000000000000000000000000000000081526011600452602481fd5b500190565b600281046001821680610bce57607f821691505b60208210811415610c08577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b5091905056fea26469706673582212205736dd923321a5d60220ed8346a2be0440f03acac5b3578fe15792cf63d5d11d64736f6c63430008020033"; diff --git a/packages/hardhat/typechain/index.ts b/packages/hardhat/typechain/index.ts index 6aaf1180..f9c9980e 100644 --- a/packages/hardhat/typechain/index.ts +++ b/packages/hardhat/typechain/index.ts @@ -1,9 +1,12 @@ /* Autogenerated file. Do not edit manually. */ /* tslint:disable */ /* eslint-disable */ -export type { Ownable } from "./Ownable"; +export type { OwnableUpgradeable } from "./OwnableUpgradeable"; +export type { Initializable } from "./Initializable"; +export type { IERC20PermitUpgradeable } from "./IERC20PermitUpgradeable"; +export type { IERC20Upgradeable } from "./IERC20Upgradeable"; +export type { ContextUpgradeable } from "./ContextUpgradeable"; export type { ERC20 } from "./ERC20"; -export type { IERC20Permit } from "./IERC20Permit"; export type { IERC20Metadata } from "./IERC20Metadata"; export type { IERC20 } from "./IERC20"; export type { IExecutable } from "./IExecutable"; @@ -14,9 +17,12 @@ export type { TokenMock } from "./TokenMock"; export type { Quest } from "./Quest"; export type { QuestFactory } from "./QuestFactory"; -export { Ownable__factory } from "./factories/Ownable__factory"; +export { OwnableUpgradeable__factory } from "./factories/OwnableUpgradeable__factory"; +export { Initializable__factory } from "./factories/Initializable__factory"; +export { IERC20PermitUpgradeable__factory } from "./factories/IERC20PermitUpgradeable__factory"; +export { IERC20Upgradeable__factory } from "./factories/IERC20Upgradeable__factory"; +export { ContextUpgradeable__factory } from "./factories/ContextUpgradeable__factory"; export { ERC20__factory } from "./factories/ERC20__factory"; -export { IERC20Permit__factory } from "./factories/IERC20Permit__factory"; export { IERC20Metadata__factory } from "./factories/IERC20Metadata__factory"; export { IERC20__factory } from "./factories/IERC20__factory"; export { IExecutable__factory } from "./factories/IExecutable__factory"; diff --git a/packages/react-app/config/webpack.config.ts b/packages/react-app/config/webpack.config.ts index 7b3fd7ce..78223ae9 100644 --- a/packages/react-app/config/webpack.config.ts +++ b/packages/react-app/config/webpack.config.ts @@ -187,6 +187,7 @@ module.exports = function (webpackEnv) { // this defaults to 'window', but by setting it to 'this' then // module chunks which are built will work in web workers as well. globalObject: 'this', + hashFunction: 'xxhash64', }, optimization: { minimize: isEnvProduction, diff --git a/packages/react-app/package.json b/packages/react-app/package.json index 720d2190..59b6c78c 100644 --- a/packages/react-app/package.json +++ b/packages/react-app/package.json @@ -4,21 +4,10 @@ "version": "0.1.1-alpha", "license": "MIT", "homepage": ".", - "browserslist": { - "production": [ - ">0.2%", - "not dead", - "not op_mini all" - ], - "development": [ - "last 1 chrome version", - "last 1 firefox version", - "last 1 safari version" - ] - }, "dependencies": { "@1hive/1hive-ui": "^1.0.2", "@1hive/use-wallet": "npm:@1hive/use-wallet@1.1.2", + "@babel/runtime": "7.18.0", "@babel/types": "^7.15.6", "@fortawesome/fontawesome-svg-core": "^6.1.1", "@fortawesome/free-brands-svg-icons": "^6.1.1", @@ -61,11 +50,11 @@ "node-sass": "^7.0.0", "prop-types": "^15.7.2", "react": "^17.0.2", - "react-dom": "^17.0.2", "react-app-rewire-hot-loader": "^2.0.1", "react-app-rewired": "^2.1.8", "react-dev-utils": "^11.0.4", "react-device-detect": "^1.17.0", + "react-dom": "^17.0.2", "react-focus-within": "^2.0.2", "react-hot-loader": "^4.13.0", "react-icons": "^4.2.0", @@ -87,6 +76,7 @@ "devDependencies": { "@babel/core": "^7.11.1", "@babel/plugin-proposal-class-properties": "^7.7.4", + "@babel/plugin-proposal-private-property-in-object": "^7.21.11", "@babel/plugin-transform-react-jsx-source": "^7.12.13", "@babel/preset-env": "^7.7.4", "@babel/preset-react": "^7.7.4", @@ -129,7 +119,7 @@ "start:local": "cross-env REACT_APP_DEFAULT_CHAIN_ID=1337 yarn start", "start:goerli": "cross-env REACT_APP_DEFAULT_CHAIN_ID=5 REACT_APP_STAGING=true yarn start", "start:gnosis": "cross-env REACT_APP_DEFAULT_CHAIN_ID=100 REACT_APP_STAGING=true yarn start", - "build": "npm run sync-assets && react-app-rewired build", + "build": "cross-env npm run sync-assets && react-app-rewired build", "build:gnosis": "cross-env REACT_APP_DEFAULT_CHAIN_ID=100 && yarn build", "lint": "eslint src --no-error-on-unmatched-pattern --ext js,jsx,ts,tsx", "lint-fix": "eslint --fix src --no-error-on-unmatched-pattern", @@ -163,5 +153,17 @@ }, "preset": "ts-jest", "testEnvironment": "node" + }, + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] } } \ No newline at end of file diff --git a/packages/react-app/src/app.tsx b/packages/react-app/src/app.tsx index 3a4528a5..36ac7e0e 100644 --- a/packages/react-app/src/app.tsx +++ b/packages/react-app/src/app.tsx @@ -40,24 +40,24 @@ function App() { return ( - - - -
- - + + +
+ + + - - -
-
-
- + +
+
+
+
+
); diff --git a/packages/react-app/src/assets/ChallengeScreenshot.png b/packages/react-app/src/assets/ChallengeScreenshot.png new file mode 100644 index 00000000..7ab3f82f Binary files /dev/null and b/packages/react-app/src/assets/ChallengeScreenshot.png differ diff --git a/packages/react-app/src/assets/ClaimScreenshot.png b/packages/react-app/src/assets/ClaimScreenshot.png new file mode 100644 index 00000000..35a48aa1 Binary files /dev/null and b/packages/react-app/src/assets/ClaimScreenshot.png differ diff --git a/packages/react-app/src/assets/CreateQuestScreenshot.png b/packages/react-app/src/assets/CreateQuestScreenshot.png new file mode 100644 index 00000000..53385761 Binary files /dev/null and b/packages/react-app/src/assets/CreateQuestScreenshot.png differ diff --git a/packages/react-app/src/assets/ListScreenshot.png b/packages/react-app/src/assets/ListScreenshot.png new file mode 100644 index 00000000..618d7d40 Binary files /dev/null and b/packages/react-app/src/assets/ListScreenshot.png differ diff --git a/packages/react-app/src/assets/PlayScreenshot.png b/packages/react-app/src/assets/PlayScreenshot.png new file mode 100644 index 00000000..78039b33 Binary files /dev/null and b/packages/react-app/src/assets/PlayScreenshot.png differ diff --git a/packages/react-app/src/assets/RecoverFundsScreenshot.png b/packages/react-app/src/assets/RecoverFundsScreenshot.png new file mode 100644 index 00000000..e7cbdce9 Binary files /dev/null and b/packages/react-app/src/assets/RecoverFundsScreenshot.png differ diff --git a/packages/react-app/src/assets/ResolveScreenshot.png b/packages/react-app/src/assets/ResolveScreenshot.png new file mode 100644 index 00000000..20c6c2f3 Binary files /dev/null and b/packages/react-app/src/assets/ResolveScreenshot.png differ diff --git a/packages/react-app/src/assets/background-logo.png b/packages/react-app/src/assets/background-logo.png new file mode 100644 index 00000000..3a95ac9e Binary files /dev/null and b/packages/react-app/src/assets/background-logo.png differ diff --git a/packages/react-app/src/assets/background-logo.tsx b/packages/react-app/src/assets/background-logo.tsx new file mode 100644 index 00000000..5f505591 --- /dev/null +++ b/packages/react-app/src/assets/background-logo.tsx @@ -0,0 +1,174 @@ +import { GUpx } from 'src/utils/style.util'; +import styled from 'styled-components'; + +// #region StyledComponents +const WrapperStyled = styled.div` + height: 100%; + margin-left: ${GUpx(4)}; +`; +// #endregion + +export default function BackgroundLogo() { + return ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ); +} diff --git a/packages/react-app/src/assets/piggy.png b/packages/react-app/src/assets/piggy.png new file mode 100644 index 00000000..15e63439 Binary files /dev/null and b/packages/react-app/src/assets/piggy.png differ diff --git a/packages/react-app/src/assets/piggy.tsx b/packages/react-app/src/assets/piggy.tsx index 77f1090b..5d00c1a4 100644 --- a/packages/react-app/src/assets/piggy.tsx +++ b/packages/react-app/src/assets/piggy.tsx @@ -12,9 +12,10 @@ export default function Piggy() { return ( diff --git a/packages/react-app/src/components/account/account-module.tsx b/packages/react-app/src/components/account/account-module.tsx index aec37f45..c566c6d4 100644 --- a/packages/react-app/src/components/account/account-module.tsx +++ b/packages/react-app/src/components/account/account-module.tsx @@ -158,7 +158,7 @@ function AccountModule({ compact = false }: Props) { } label={`Switch wallet to ${name}`} - onClick={() => wallet.changeNetwork()} + onClick={() => wallet.changeNetwork(undefined, false)} display={compact ? 'icon' : 'all'} mode="strong" /> diff --git a/packages/react-app/src/components/back-to-top.tsx b/packages/react-app/src/components/back-to-top.tsx index 5ae86bad..7f397131 100644 --- a/packages/react-app/src/components/back-to-top.tsx +++ b/packages/react-app/src/components/back-to-top.tsx @@ -6,7 +6,8 @@ import { useEffect, useState } from 'react'; const TopRightCornerStyled = styled.div` position: absolute; bottom: ${GUpx(2)}; - right: ${GUpx(2)}; + right: calc(50vw - 10px); + width: 40px; `; export function BackToTop() { diff --git a/packages/react-app/src/components/claim.tsx b/packages/react-app/src/components/claim.tsx index b0d3cb31..bdb02626 100644 --- a/packages/react-app/src/components/claim.tsx +++ b/packages/react-app/src/components/claim.tsx @@ -74,7 +74,7 @@ export default function Claim({ claim, isLoading, challengeDeposit, questData }: const { walletAddress, walletConnected } = useWallet(); const { transaction } = useTransactionContext(); const [status, setStatus] = useState(claim.state); - const { below } = useViewport(); + const { below, width } = useViewport(); const [waitForClose, setWaitForClose] = useState(false); const [actionButton, setActionButton] = useState(); const [challengeReason, setChallengeReason] = useState(); @@ -92,6 +92,8 @@ export default function Claim({ claim, isLoading, challengeDeposit, questData }: ); }, [claim.state, claimable]); + const isSmall = useMemo(() => below('medium'), [width]); + const timer = useMemo( () => !claimable && @@ -123,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; @@ -230,18 +235,18 @@ export default function Claim({ claim, isLoading, challengeDeposit, questData }:
{status && ( )} - + } adornmentPosition={isEdit ? 'end' : 'start'} adornmentSettings={{ padding: 0, width: 36 }} + title={value} /> ) : ( ( + value + ? value.map((x) => ({ key: Math.random().toString(), value: x })) + : [{ key: Math.random().toString(), value: '' }], + ); + + const addPlayerToWhitelist = () => { + const newList = [...valueState, { key: Math.random().toString(), value: '' }]; + setValueState(newList); + onChange(isFormik ? createEventWithValue() : newList.map((x) => x.value)); + }; + + const removePlayerFromWhitelist = (indexToRemove: number) => { + 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) => { + const newList = [...valueState]; + newList[i].value = v; + setValueState(newList); + if (isFormik) { + onChange(createEventWithValue()); + } else { + onChange(newList.map((x) => x.value)); + } + }; + + const createEventWithValue = () => { + const ev = { + target: { + value: valueState.map((x) => x.value), + id, + }, + } as BaseSyntheticEvent; + return ev; + }; + + return ( + + {valueState.map((playerAddress, i) => ( + // eslint-disable-next-line react/no-array-index-key + + handleChange(e.target.value, i)} + onBlur={onBlur} + wide + /> + {isEdit &&