From e201e4c5eaf823a7b21c38a854c64400f84559f8 Mon Sep 17 00:00:00 2001 From: Corantin Date: Tue, 22 Aug 2023 21:53:34 -0400 Subject: [PATCH] Push the bhay --- packages/hardhat/.openzeppelin/goerli.json | 122 +++ packages/hardhat/contracts/QuestFactory.sol | 14 +- .../hardhat/deploy/deploy-quest_factory.ts | 5 - .../hardhat/deployments/goerli/Quest.json | 481 +-------- .../deployments/goerli/QuestFactory.json | 427 +------- .../47f6185dc196e2ecbc4b6b98f3c85d8d.json | 87 ++ .../a33307a6c4e89062a46e94b88af6078f.json | 87 ++ packages/hardhat/hardhat.config.ts | 53 - packages/hardhat/subgraph.yaml | 0 .../factories/QuestFactory__factory.ts | 2 +- .../typechain/factories/Quest__factory.ts | 2 +- .../src/contracts/hardhat_contracts.json | 960 ++++++++++++++++++ .../react-app/src/services/quest.service.ts | 7 +- packages/react-app/src/utils/contract.util.ts | 18 +- .../quest-subgraph/config/goerli.json | 44 +- .../subgraphs/quest-subgraph/subgraph.yaml | 6 +- 16 files changed, 1303 insertions(+), 1012 deletions(-) create mode 100644 packages/hardhat/deployments/goerli/solcInputs/47f6185dc196e2ecbc4b6b98f3c85d8d.json create mode 100644 packages/hardhat/deployments/goerli/solcInputs/a33307a6c4e89062a46e94b88af6078f.json delete mode 100644 packages/hardhat/subgraph.yaml diff --git a/packages/hardhat/.openzeppelin/goerli.json b/packages/hardhat/.openzeppelin/goerli.json index f48a1a11..17cc4aa7 100644 --- a/packages/hardhat/.openzeppelin/goerli.json +++ b/packages/hardhat/.openzeppelin/goerli.json @@ -279,6 +279,128 @@ "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": [ diff --git a/packages/hardhat/contracts/QuestFactory.sol b/packages/hardhat/contracts/QuestFactory.sol index 1fbb2dfd..ea95bca9 100644 --- a/packages/hardhat/contracts/QuestFactory.sol +++ b/packages/hardhat/contracts/QuestFactory.sol @@ -45,21 +45,9 @@ contract QuestFactory is OwnableUpgradeable { _disableInitializers(); } - function initialize( - address _aragonGovernAddress, - IERC20Upgradeable _createDepositToken, - uint256 _createDepositAmount, - IERC20Upgradeable _playDepositToken, - uint256 _playDepositAmount, - address _initialOwner - ) public initializer { + function initialize(address _aragonGovernAddress) public initializer { __Ownable_init(); aragonGovernAddress = _aragonGovernAddress; - setCreateDeposit(_createDepositToken, _createDepositAmount); - setPlayDeposit(_playDepositToken, _playDepositAmount); - if (_initialOwner != msg.sender) { - transferOwnership(_initialOwner); - } } /* diff --git a/packages/hardhat/deploy/deploy-quest_factory.ts b/packages/hardhat/deploy/deploy-quest_factory.ts index 6af7095c..c399b45a 100644 --- a/packages/hardhat/deploy/deploy-quest_factory.ts +++ b/packages/hardhat/deploy/deploy-quest_factory.ts @@ -32,7 +32,6 @@ export const buildQuestFactoryConstructorArguments = async ({ export default async ( { getNamedAccounts, - deployments, ethers, network, run, @@ -40,10 +39,6 @@ export default async ( }: HardhatRuntimeEnvironment, args?: { governAddress: string; - createDepositToken: string; - createDepositAmount: number; - playDepositToken: string; - playDepositAmount: number; } ) => { const constructorArguments = await buildQuestFactoryConstructorArguments({ diff --git a/packages/hardhat/deployments/goerli/Quest.json b/packages/hardhat/deployments/goerli/Quest.json index 1b345d51..cc0377b0 100644 --- a/packages/hardhat/deployments/goerli/Quest.json +++ b/packages/hardhat/deployments/goerli/Quest.json @@ -1,480 +1 @@ -{ - "address": "0x76E25d5bEBbaA5618Ab45E61918aDC45c8725C09", - "abi": [ - { - "inputs": [ - { - "internalType": "string", - "name": "_questTitle", - "type": "string" - }, - { - "internalType": "bytes", - "name": "_questDetailsRef", - "type": "bytes" - }, - { - "components": [ - { - "internalType": "contract IERC20Upgradeable", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "internalType": "struct Models.Deposit", - "name": "_createDeposit", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "contract IERC20Upgradeable", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "internalType": "struct Models.Deposit", - "name": "_playDeposit", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "questCreator", - "type": "address" - }, - { - "internalType": "uint32", - "name": "maxPlayers", - "type": "uint32" - }, - { - "internalType": "contract IERC20Upgradeable", - "name": "rewardToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "expireTime", - "type": "uint256" - }, - { - "internalType": "address", - "name": "aragonGovernAddress", - "type": "address" - }, - { - "internalType": "address payable", - "name": "fundsRecoveryAddress", - "type": "address" - }, - { - "internalType": "bool", - "name": "isWhiteList", - "type": "bool" - } - ], - "internalType": "struct Models.QuestParam", - "name": "_questParam", - "type": "tuple" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes", - "name": "evidence", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "address", - "name": "player", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "QuestClaimed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "player", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - } - ], - "name": "QuestPlayed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "player", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - } - ], - "name": "QuestUnplayed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address[]", - "name": "whiteListPlayers", - "type": "address[]" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - } - ], - "name": "QuestWhiteListChanged", - "type": "event" - }, - { - "inputs": [], - "name": "aragonGovernAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "executer", - "type": "address" - } - ], - "name": "canExecute", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "_evidence", - "type": "bytes" - }, - { - "internalType": "address", - "name": "_player", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "_claimAll", - "type": "bool" - } - ], - "name": "claim", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "claims", - "outputs": [ - { - "internalType": "bytes", - "name": "evidence", - "type": "bytes" - }, - { - "internalType": "address", - "name": "player", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "createDeposit", - "outputs": [ - { - "internalType": "contract IERC20Upgradeable", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "expireTime", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "fundsRecoveryAddress", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPlayers", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "isCreateDepositReleased", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "isWhiteList", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxPlayers", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_player", - "type": "address" - } - ], - "name": "play", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "playDeposit", - "outputs": [ - { - "internalType": "contract IERC20Upgradeable", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "questCreator", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "questDetailsRef", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "questTitle", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "recoverFundsAndDeposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "rewardToken", - "outputs": [ - { - "internalType": "contract IERC20Upgradeable", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "_players", - "type": "address[]" - } - ], - "name": "setWhiteList", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_player", - "type": "address" - } - ], - "name": "unplay", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ] -} \ No newline at end of file +{"address":"0xD0699B582ec12E37602EcC16Fb4d9F2DeEE0DD2F","abi":[{"inputs":[{"internalType":"string","name":"_questTitle","type":"string"},{"internalType":"bytes","name":"_questDetailsRef","type":"bytes"},{"components":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct Models.Deposit","name":"_createDeposit","type":"tuple"},{"components":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct Models.Deposit","name":"_playDeposit","type":"tuple"},{"components":[{"internalType":"address","name":"questCreator","type":"address"},{"internalType":"uint32","name":"maxPlayers","type":"uint32"},{"internalType":"contract IERC20Upgradeable","name":"rewardToken","type":"address"},{"internalType":"uint256","name":"expireTime","type":"uint256"},{"internalType":"address","name":"aragonGovernAddress","type":"address"},{"internalType":"address payable","name":"fundsRecoveryAddress","type":"address"},{"internalType":"bool","name":"isWhiteList","type":"bool"}],"internalType":"struct Models.QuestParam","name":"_questParam","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"evidence","type":"bytes"},{"indexed":false,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"QuestClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"QuestPlayed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"QuestUnplayed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"whiteListPlayers","type":"address[]"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"QuestWhiteListChanged","type":"event"},{"inputs":[],"name":"aragonGovernAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"executer","type":"address"}],"name":"canExecute","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_evidence","type":"bytes"},{"internalType":"address","name":"_player","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bool","name":"_claimAll","type":"bool"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"claims","outputs":[{"internalType":"bytes","name":"evidence","type":"bytes"},{"internalType":"address","name":"player","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"createDeposit","outputs":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"expireTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fundsRecoveryAddress","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPlayers","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isCreateDepositReleased","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isWhiteList","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPlayers","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_player","type":"address"}],"name":"play","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"playDeposit","outputs":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"questCreator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"questDetailsRef","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"questTitle","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"recoverFundsAndDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract IERC20Upgradeable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_players","type":"address[]"}],"name":"setWhiteList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_player","type":"address"}],"name":"unplay","outputs":[],"stateMutability":"nonpayable","type":"function"}]} \ No newline at end of file diff --git a/packages/hardhat/deployments/goerli/QuestFactory.json b/packages/hardhat/deployments/goerli/QuestFactory.json index 48114063..88fc4001 100644 --- a/packages/hardhat/deployments/goerli/QuestFactory.json +++ b/packages/hardhat/deployments/goerli/QuestFactory.json @@ -1,426 +1 @@ -{ - "address": "0x05301D6787430d26bb0D6430Bd98a59B955a27D0", - "abi": [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "CreateDepositChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "PlayDepositChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "questAddress", - "type": "address" - }, - { - "indexed": false, - "internalType": "string", - "name": "questTitle", - "type": "string" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "questDetailsRef", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "address", - "name": "rewardTokenAddress", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "expireTime", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "fundsRecoveryAddress", - "type": "address" - }, - { - "components": [ - { - "internalType": "contract IERC20Upgradeable", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "indexed": false, - "internalType": "struct Models.Deposit", - "name": "createDeposit", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "contract IERC20Upgradeable", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "indexed": false, - "internalType": "struct Models.Deposit", - "name": "playDeposit", - "type": "tuple" - }, - { - "indexed": false, - "internalType": "address", - "name": "creator", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint32", - "name": "maxPlayers", - "type": "uint32" - }, - { - "indexed": false, - "internalType": "bool", - "name": "isWhiteList", - "type": "bool" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "version", - "type": "uint256" - } - ], - "name": "QuestCreated", - "type": "event" - }, - { - "inputs": [], - "name": "aragonGovernAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "createDeposit", - "outputs": [ - { - "internalType": "contract IERC20Upgradeable", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "_questTitle", - "type": "string" - }, - { - "internalType": "bytes", - "name": "_questDetailsRef", - "type": "bytes" - }, - { - "internalType": "contract IERC20Upgradeable", - "name": "_rewardToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_expireTime", - "type": "uint256" - }, - { - "internalType": "address payable", - "name": "_fundsRecoveryAddress", - "type": "address" - }, - { - "internalType": "uint32", - "name": "_maxPlayers", - "type": "uint32" - }, - { - "internalType": "bool", - "name": "_isWhiteList", - "type": "bool" - } - ], - "name": "createQuest", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_aragonGovernAddress", - "type": "address" - }, - { - "internalType": "contract IERC20Upgradeable", - "name": "_createDepositToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_createDepositAmount", - "type": "uint256" - }, - { - "internalType": "contract IERC20Upgradeable", - "name": "_playDepositToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_playDepositAmount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_initialOwner", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "playDeposit", - "outputs": [ - { - "internalType": "contract IERC20Upgradeable", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_aragonGovernAddress", - "type": "address" - } - ], - "name": "setAragonGovernAddress", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IERC20Upgradeable", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "setCreateDeposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IERC20Upgradeable", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "setPlayDeposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "version", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - ] -} \ No newline at end of file +{"address":"0x05301D6787430d26bb0D6430Bd98a59B955a27D0","abi":[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"CreateDepositChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PlayDepositChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"questAddress","type":"address"},{"indexed":false,"internalType":"string","name":"questTitle","type":"string"},{"indexed":false,"internalType":"bytes","name":"questDetailsRef","type":"bytes"},{"indexed":false,"internalType":"address","name":"rewardTokenAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"expireTime","type":"uint256"},{"indexed":false,"internalType":"address","name":"fundsRecoveryAddress","type":"address"},{"components":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"indexed":false,"internalType":"struct Models.Deposit","name":"createDeposit","type":"tuple"},{"components":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"indexed":false,"internalType":"struct Models.Deposit","name":"playDeposit","type":"tuple"},{"indexed":false,"internalType":"address","name":"creator","type":"address"},{"indexed":false,"internalType":"uint32","name":"maxPlayers","type":"uint32"},{"indexed":false,"internalType":"bool","name":"isWhiteList","type":"bool"},{"indexed":false,"internalType":"uint256","name":"version","type":"uint256"}],"name":"QuestCreated","type":"event"},{"inputs":[],"name":"aragonGovernAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"createDeposit","outputs":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_questTitle","type":"string"},{"internalType":"bytes","name":"_questDetailsRef","type":"bytes"},{"internalType":"contract IERC20Upgradeable","name":"_rewardToken","type":"address"},{"internalType":"uint256","name":"_expireTime","type":"uint256"},{"internalType":"address payable","name":"_fundsRecoveryAddress","type":"address"},{"internalType":"uint32","name":"_maxPlayers","type":"uint32"},{"internalType":"bool","name":"_isWhiteList","type":"bool"}],"name":"createQuest","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_aragonGovernAddress","type":"address"},{"internalType":"contract IERC20Upgradeable","name":"_createDepositToken","type":"address"},{"internalType":"uint256","name":"_createDepositAmount","type":"uint256"},{"internalType":"contract IERC20Upgradeable","name":"_playDepositToken","type":"address"},{"internalType":"uint256","name":"_playDepositAmount","type":"uint256"},{"internalType":"address","name":"_initialOwner","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"playDeposit","outputs":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_aragonGovernAddress","type":"address"}],"name":"setAragonGovernAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"setCreateDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"setPlayDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]} \ No newline at end of file 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/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/hardhat.config.ts b/packages/hardhat/hardhat.config.ts index 9e9c0327..455f644e 100644 --- a/packages/hardhat/hardhat.config.ts +++ b/packages/hardhat/hardhat.config.ts @@ -804,32 +804,6 @@ 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) => { console.log("Starting by deploying the Quest template..."); await hre.run("newQuest"); @@ -850,33 +824,6 @@ 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("Starting by deploying the Quest template..."); await hre.run("newQuest", hre); diff --git a/packages/hardhat/subgraph.yaml b/packages/hardhat/subgraph.yaml deleted file mode 100644 index e69de29b..00000000 diff --git a/packages/hardhat/typechain/factories/QuestFactory__factory.ts b/packages/hardhat/typechain/factories/QuestFactory__factory.ts index 046087fd..fcfba94e 100644 --- a/packages/hardhat/typechain/factories/QuestFactory__factory.ts +++ b/packages/hardhat/typechain/factories/QuestFactory__factory.ts @@ -458,4 +458,4 @@ const _abi = [ ]; const _bytecode = - "0x608060405234801561001057600080fd5b5061001961001e565b6100dd565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff908116146100db576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b613ff4806100ec6000396000f3fe60806040523480156200001157600080fd5b5060043610620000e75760003560e01c806392cf0dc7116200008d578063d03ffefb1162000063578063d03ffefb1462000223578063edeecdd31462000248578063f2fde38b146200025f57620000e7565b806392cf0dc714620001d4578063b0a87ac114620001eb578063b628a33f146200020c57620000e7565b80638c43b41111620000c35780638c43b411146200012b5780638c53c9bd14620001425780638da5cb5b146200019457620000e7565b8062732e3014620000ec57806354fd4d501462000105578063715018a61462000121575b600080fd5b62000103620000fd366004620011f1565b62000276565b005b6200010e600381565b6040519081526020015b60405180910390f35b62000103620002c7565b620001036200013c366004620012a7565b620002df565b606854606954620001679173ffffffffffffffffffffffffffffffffffffffff169082565b6040805173ffffffffffffffffffffffffffffffffffffffff909316835260208301919091520162000118565b60335473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200162000118565b62000103620001e536600462001210565b62000384565b606554620001ae9073ffffffffffffffffffffffffffffffffffffffff1681565b620001ae6200021d366004620012d5565b620005b3565b606654606754620001679173ffffffffffffffffffffffffffffffffffffffff169082565b6200010362000259366004620012a7565b6200071e565b6200010362000270366004620011f1565b620007bc565b6200028062000879565b606580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b620002d162000879565b620002dd6000620008fc565b565b620002e962000879565b60408051808201825273ffffffffffffffffffffffffffffffffffffffff84168082526020918201849052606880547fffffffffffffffffffffffff0000000000000000000000000000000000000000168217905560698490558251428152918201529081018290527f013c800b1a136f9798a25e471501a7b824156d1e9cba8439821c5a41adf2fb89906060015b60405180910390a15050565b600054610100900460ff1615808015620003a55750600054600160ff909116105b80620003ca5750620003b73062000973565b158015620003ca575060005460ff166001145b6200045c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558015620004bb57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b620004c562000993565b606580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff89161790556200051186866200071e565b6200051d8484620002df565b73ffffffffffffffffffffffffffffffffffffffff8216331462000546576200054682620007bc565b8015620005aa57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050565b60408051808201825260665473ffffffffffffffffffffffffffffffffffffffff9081168252606754602080840191909152835180850185526068548316815260695481830152845160e08101865233815263ffffffff88169281019290925289831682860152606082018990526065548316608083015291871660a082015284151560c0820152925160009384938c938c93919290916200065590620010f0565b620006659594939291906200152d565b604051809103906000f08015801562000682573d6000803e3d6000fd5b506040805180820190915260665473ffffffffffffffffffffffffffffffffffffffff1681526067546020820152909150620006c090338362000a36565b7f2d0b32d809449b38bb442a046b092f68efaf9d4bef7678947afd25048117f187818a8a8a8a8a60666068338d8d60036040516200070a9c9b9a999897969594939291906200142b565b60405180910390a198975050505050505050565b6200072862000879565b60408051808201825273ffffffffffffffffffffffffffffffffffffffff84168082526020918201849052606680547fffffffffffffffffffffffff0000000000000000000000000000000000000000168217905560678490558251428152918201529081018290527f35c5e8a6f8bed2c61a2eb1996d117b1b96192314c0d4ca7cd96360f2509200799060600162000378565b620007c662000879565b73ffffffffffffffffffffffffffffffffffffffff81166200086b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840162000453565b6200087681620008fc565b50565b60335473ffffffffffffffffffffffffffffffffffffffff163314620002dd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000453565b6033805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b73ffffffffffffffffffffffffffffffffffffffff81163b15155b919050565b600054610100900460ff1662000a2c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840162000453565b620002dd62000a53565b62000a42838362000af7565b62000a4e838262000c54565b505050565b600054610100900460ff1662000aec576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840162000453565b620002dd33620008fc565b60208201511562000c505781516040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8381166004830152306024830152600092169063dd62ed3e9060440160206040518083038186803b15801562000b7457600080fd5b505afa15801562000b89573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000baf9190620013a8565b9050826020015181101562000c21576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4552524f52203a204465706f7369742062616420616c6c6f77616e6365000000604482015260640162000453565b6020830151835162000a4e9173ffffffffffffffffffffffffffffffffffffffff909116908490309062000c8c565b5050565b60208201511562000c50576020820151825162000c509173ffffffffffffffffffffffffffffffffffffffff90911690839062000d70565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905262000d6a9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915262000dc8565b50505050565b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905262000a4e9084907fa9059cbb000000000000000000000000000000000000000000000000000000009060640162000ce7565b600062000e2c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1662000ede9092919063ffffffff16565b905080516000148062000e5057508080602001905181019062000e50919062001288565b62000a4e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840162000453565b606062000eef848460008562000ef7565b949350505050565b60608247101562000f8b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840162000453565b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405162000fb691906200140d565b60006040518083038185875af1925050503d806000811462000ff5576040519150601f19603f3d011682016040523d82523d6000602084013e62000ffa565b606091505b50915091506200100d8783838762001018565b979650505050505050565b60608315620010a35782516200109b57620010338562000973565b6200109b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640162000453565b508162000eef565b62000eef8383815115620010ba5781518083602001fd5b806040517f08c379a000000000000000000000000000000000000000000000000000000000815260040162000453919062001518565b6128e780620016d883390190565b600067ffffffffffffffff808411156200111c576200111c62001676565b604051601f85017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190828211818310171562001165576200116562001676565b816040528093508581528686860111156200117f57600080fd5b858560208301376000602087830101525050509392505050565b80356200098e81620016a5565b80356200098e81620016c8565b600082601f830112620011c4578081fd5b620011d583833560208501620010fe565b9392505050565b803563ffffffff811681146200098e57600080fd5b60006020828403121562001203578081fd5b8135620011d581620016a5565b60008060008060008060c0878903121562001229578182fd5b86356200123681620016a5565b955060208701356200124881620016a5565b94506040870135935060608701356200126181620016a5565b92506080870135915060a08701356200127a81620016a5565b809150509295509295509295565b6000602082840312156200129a578081fd5b8151620011d581620016c8565b60008060408385031215620012ba578182fd5b8235620012c781620016a5565b946020939093013593505050565b600080600080600080600060e0888a031215620012f0578081fd5b873567ffffffffffffffff8082111562001308578283fd5b818a0191508a601f8301126200131c578283fd5b6200132d8b833560208501620010fe565b985060208a013591508082111562001343578283fd5b50620013528a828b01620011b3565b965050620013636040890162001199565b9450606088013593506200137a6080890162001199565b92506200138a60a08901620011dc565b91506200139a60c08901620011a6565b905092959891949750929550565b600060208284031215620013ba578081fd5b5051919050565b60008151808452620013db81602086016020860162001647565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600082516200142181846020870162001647565b9190910192915050565b600073ffffffffffffffffffffffffffffffffffffffff808f1683526101c060208401526200145f6101c084018f620013c1565b838103604085015262001473818f620013c1565b925050808c1660608401528a6080840152808a1660a0840152620014bb60c084018a805473ffffffffffffffffffffffffffffffffffffffff16825260010154602090910152565b875473ffffffffffffffffffffffffffffffffffffffff166101008401526001909701546101208301529590941661014085015263ffffffff9290921661016084015215156101808301526101a090910152979650505050505050565b600060208252620011d56020830184620013c1565b60006101a08083526200154381840189620013c1565b90508281036020840152620015598188620013c1565b865173ffffffffffffffffffffffffffffffffffffffff1660408501526020870151606085015291506200158a9050565b835173ffffffffffffffffffffffffffffffffffffffff166080830152602084015160a0830152825173ffffffffffffffffffffffffffffffffffffffff90811660c0840152602084015163ffffffff1660e084015260408401518116610100840152606084015161012084015260808401511661014083015260a08301516200162d61016084018273ffffffffffffffffffffffffffffffffffffffff169052565b5060c0830151801515610180840152509695505050505050565b60005b83811015620016645781810151838201526020016200164a565b8381111562000d6a5750506000910152565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff811681146200087657600080fd5b80151581146200087657600080fdfe60806040523480156200001157600080fd5b50604051620028e7380380620028e7833981016040819052620000349162000423565b8060c0015180156200005057506000816020015163ffffffff16115b15620000e35760405162461bcd60e51b815260206004820152605260248201527f4552524f523a2043616e27742063726561746520612077686974654c6973746560448201527f642071756573742077697468206d617820706c61796572732067726561746572606482015271207468616e20302028696e66696e6974792960701b608482015260a40160405180910390fd5b8451620000f8906001906020880190620001f1565b5083516200010e906002906020870190620001f1565b506040810151600380546001600160a01b03199081166001600160a01b03938416179091556060830151600455608083015160058054831691841691909117905560a083015160068054855160008054861691871691909117905587516008805486169187169190911790556020978801516009558651600a8054861691871691909117905595870151600b55600c805460ff191690559584015160c0909401519490911691161763ffffffff60a01b1916600160a01b63ffffffff909216919091021760ff60c01b1916600160c01b9115159190910217905550620005909050565b828054620001ff9062000524565b90600052602060002090601f0160209004810192826200022357600085556200026e565b82601f106200023e57805160ff19168380011785556200026e565b828001600101855582156200026e579182015b828111156200026e57825182559160200191906001019062000251565b506200027c92915062000280565b5090565b5b808211156200027c576000815560010162000281565b60006001600160401b03831115620002b357620002b362000561565b6020620002c9601f8501601f19168201620004f1565b9150838252848484011115620002de57600080fd5b60005b84811015620002fc57838101518382018301528101620002e1565b848111156200030e5760008286850101525b50509392505050565b8051620003248162000577565b919050565b805180151581146200032457600080fd5b6000604082840312156200034c578081fd5b620003586040620004f1565b90508151620003678162000577565b808252506020820151602082015292915050565b600060e082840312156200038d578081fd5b6200039960e0620004f1565b90508151620003a88162000577565b8152602082015163ffffffff81168114620003c257600080fd5b6020820152620003d56040830162000317565b604082015260608201516060820152620003f26080830162000317565b60808201526200040560a0830162000317565b60a08201526200041860c0830162000329565b60c082015292915050565b60008060008060006101a086880312156200043c578081fd5b85516001600160401b038082111562000453578283fd5b818801915088601f83011262000467578283fd5b620004788983516020850162000297565b965060208801519150808211156200048e578283fd5b508601601f81018813620004a0578182fd5b620004b18882516020840162000297565b945050620004c387604088016200033a565b9250620004d487608088016200033a565b9150620004e58760c088016200037b565b90509295509295909350565b604051601f8201601f191681016001600160401b03811182821017156200051c576200051c62000561565b604052919050565b6002810460018216806200053957607f821691505b602082108114156200055b57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146200058d57600080fd5b50565b61234780620005a06000396000f3fe608060405234801561001057600080fd5b506004361061016c5760003560e01c80638b5b9ccc116100cd578063d03ffefb11610081578063e492814f11610066578063e492814f146103ab578063f294cf38146103be578063f7c618c1146103c65761016c565b8063d03ffefb14610372578063e0c23423146103965761016c565b8063a888c2cd116100b2578063a888c2cd1461031d578063b0a87ac11461033f578063b434151c1461035f5761016c565b80638b5b9ccc146102b85780638c53c9bd146102cd5761016c565b8063579ca2c911610124578063775b9c1311610109578063775b9c13146102725780637ceae3101461028557806385c99e2b146102a55761016c565b8063579ca2c9146102255780636c3a4cce1461022d5761016c565b8063310a1ee311610155578063310a1ee3146101c457806348d6cb53146101db5780634c2412a2146101e85761016c565b8063151dfb06146101715780632f17b18214610186575b600080fd5b61018461017f366004611e1c565b6103e6565b005b6006546101af907801000000000000000000000000000000000000000000000000900460ff1681565b60405190151581526020015b60405180910390f35b6101cd60045481565b6040519081526020016101bb565b600c546101af9060ff1681565b6006546102109074010000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff90911681526020016101bb565b610184610807565b60005461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101bb565b610184610280366004611e3d565b6109fb565b60065461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b6101af6102b3366004611e1c565b610ba5565b6102c0610bdb565b6040516101bb91906120c6565b600a54600b546102f19173ffffffffffffffffffffffffffffffffffffffff169082565b6040805173ffffffffffffffffffffffffffffffffffffffff90931683526020830191909152016101bb565b61033061032b366004611fe0565b610c4a565b6040516101bb9392919061210e565b60055461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b61018461036d366004611f07565b610d23565b6008546009546102f19173ffffffffffffffffffffffffffffffffffffffff169082565b61039e611151565b6040516101bb91906120fb565b6101846103b9366004611e1c565b6111df565b61039e6115ea565b60035461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b6006547801000000000000000000000000000000000000000000000000900460ff161561049a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f4552524f523a2063616e277420756e706c617920612077686974656c6973746560448201527f642071756573740000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff821614806104d5575060005473ffffffffffffffffffffffffffffffffffffffff1633145b610560576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f4552524f523a2053656e646572206e6f7420706c61796572206e6f722063726560448201527f61746f72000000000000000000000000000000000000000000000000000000006064820152608401610491565b600061056b826115f7565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14156105f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4552524f523a20706c61796572206e6f7420696e206c697374000000000000006044820152606401610491565b600d8054610607906001906121d5565b8154811061063e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260209091200154600d805473ffffffffffffffffffffffffffffffffffffffff909216918390811061069e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d80548061071e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b600082815260209081902082017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905590910190915560408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b54918101919091526107b490836116bf565b6040805173ffffffffffffffffffffffffffffffffffffffff841681524260208201527fc4a67a0877d477de99d765a3d9f48abfbe6181dff4727d68c3cb60715555417591015b60405180910390a15050565b600454421015610873576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4552524f523a204e6f74206578706972656400000000000000000000000000006044820152606401610491565b600c5460ff166108e5576000546040805180820190915260085473ffffffffffffffffffffffffffffffffffffffff908116825260095460208301526108b992166116bf565b600c80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b15801561094f57600080fd5b505afa158015610963573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109879190611ff8565b600a5460035491925073ffffffffffffffffffffffffffffffffffffffff918216911614156109ce57600d54600b546109ca916109c391612198565b82906116f8565b9150505b6006546003546109f89173ffffffffffffffffffffffffffffffffffffffff91821691168361171e565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610aa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f4f6e6c792063726561746f722063616e2063616c6c20746869732066756e637460448201527f696f6e00000000000000000000000000000000000000000000000000000000006064820152608401610491565b6006547801000000000000000000000000000000000000000000000000900460ff161515600114610b55576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603d60248201527f4552524f523a2043616e27742073657420746865207768697465206c6973742060448201527f746f2061206e6f6e2d77686974656c697374656420636f6e74726163740000006064820152608401610491565b8051610b6890600d906020840190611cda565b507fb1565d66d9899787abe67ac307850cf339a24f69de2bf7ffa4179e0eaeb939b08142604051610b9a9291906120d9565b60405180910390a150565b6000610bb0826115f7565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff141590505b919050565b6060600d805480602002602001604051908101604052809291908181526020018280548015610c4057602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610c15575b5050505050905090565b60078181548110610c5a57600080fd5b9060005260206000209060030201600091509050806000018054610c7d90612218565b80601f0160208091040260200160405190810160405280929190818152602001828054610ca990612218565b8015610cf65780601f10610ccb57610100808354040283529160200191610cf6565b820191906000526020600020905b815481529060010190602001808311610cd957829003601f168201915b505050506001830154600290930154919273ffffffffffffffffffffffffffffffffffffffff1691905083565b60055473ffffffffffffffffffffffffffffffffffffffff163314610da4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4552524f523a2053656e646572206e6f7420676f7665726e00000000000000006044820152606401610491565b8351610e0c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4552524f523a204e6f2065766964656e636500000000000000000000000000006044820152606401610491565b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b158015610e7657600080fd5b505afa158015610e8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eae9190611ff8565b90508115610f445760085460035473ffffffffffffffffffffffffffffffffffffffff90811691161415610ef757600954600090610eed9083906116f8565b9450610efb915050565b8092505b600a5460035473ffffffffffffffffffffffffffffffffffffffff90811691161415610f4457600d54600b54600091610f3f91610f389190612198565b85906116f8565b945050505b60085460035473ffffffffffffffffffffffffffffffffffffffff90811691161415611010576000610f7682856116f8565b91505060086001015481101561100e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f4552524f523a2053686f756c64206e6f742065786365656420616c6c6f77656460448201527f20626f756e7479000000000000000000000000000000000000000000000000006064820152608401610491565b505b821561103a5760035461103a9073ffffffffffffffffffffffffffffffffffffffff16858561171e565b6040805160608101825286815273ffffffffffffffffffffffffffffffffffffffff86166020808301919091529181018590526007805460018101825560009190915281518051929360039092027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68801926110b89284920190611d64565b5060208201516001820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091179055604091820151600290910155517fa1c3b325aa2c115e4b244062eba2515bc5585ae5b41556be8fef399ae9fde11b906111429087908790879061210e565b60405180910390a15050505050565b6002805461115e90612218565b80601f016020809104026020016040519081016040528092919081815260200182805461118a90612218565b80156111d75780601f106111ac576101008083540402835291602001916111d7565b820191906000526020600020905b8154815290600101906020018083116111ba57829003601f168201915b505050505081565b6006547801000000000000000000000000000000000000000000000000900460ff161561128e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603760248201527f4552524f523a2043616e27742073656c6620726567697374657220616e64207060448201527f6c617920612077686974656c69737465642051756573740000000000000000006064820152608401610491565b3373ffffffffffffffffffffffffffffffffffffffff821614806112c9575060005473ffffffffffffffffffffffffffffffffffffffff1633145b611354576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f4552524f523a2053656e646572206e6f7420706c61796572206e6f722063726560448201527f61746f72000000000000000000000000000000000000000000000000000000006064820152608401610491565b60065474010000000000000000000000000000000000000000900463ffffffff1615806113a35750600654600d547401000000000000000000000000000000000000000090910463ffffffff16115b611409576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f4552524f523a204d617820706c617965727320726561636865640000000000006044820152606401610491565b6004544210611474576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4552524f523a20517565737420657870697265640000000000000000000000006044820152606401610491565b600061147f826115f7565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1461150a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4552524f523a20506c6179657220616c726561647920657869737473000000006044820152606401610491565b60408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b5460208201526115429033306117f7565b600d80546001810182556000919091527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb50180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8416908117909155604080519182524260208301527f35ec60f951b4abc8b287ab5148caf98524052482927d42e86a720cc71b8a76a191016107fb565b6001805461115e90612218565b6000805b600d54811015611697578273ffffffffffffffffffffffffffffffffffffffff16600d8281548110611656577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff161415611685579050610bd6565b8061168f8161226c565b9150506115fb565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92915050565b6020820151156116f457602082015182516116f49173ffffffffffffffffffffffffffffffffffffffff90911690839061171e565b5050565b6000808383111561170e57506000905080611717565b50600190508183035b9250929050565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526117f29084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261180b565b505050565b611801838361191a565b6117f283826116bf565b600061186d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611a6a9092919063ffffffff16565b905080516000148061188e57508080602001905181019061188e9190611eeb565b6117f2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610491565b6020820151156116f45781516040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8381166004830152306024830152600092169063dd62ed3e9060440160206040518083038186803b15801561199557600080fd5b505afa1580156119a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119cd9190611ff8565b90508260200151811015611a3d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4552524f52203a204465706f7369742062616420616c6c6f77616e63650000006044820152606401610491565b602083015183516117f29173ffffffffffffffffffffffffffffffffffffffff9091169084903090611a81565b6060611a798484600085611ae5565b949350505050565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052611adf9085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401611770565b50505050565b606082471015611b77576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610491565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051611ba091906120aa565b60006040518083038185875af1925050503d8060008114611bdd576040519150601f19603f3d011682016040523d82523d6000602084013e611be2565b606091505b5091509150611bf387838387611bfe565b979650505050505050565b60608315611c91578251611c8a5773ffffffffffffffffffffffffffffffffffffffff85163b611c8a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610491565b5081611a79565b611a798383815115611ca65781518083602001fd5b806040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161049191906120fb565b828054828255906000526020600020908101928215611d54579160200282015b82811115611d5457825182547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909116178255602090920191600190910190611cfa565b50611d60929150611dd8565b5090565b828054611d7090612218565b90600052602060002090601f016020900481019282611d925760008555611d54565b82601f10611dab57805160ff1916838001178555611d54565b82800160010185558215611d54579182015b82811115611d54578251825591602001919060010190611dbd565b5b80821115611d605760008155600101611dd9565b803573ffffffffffffffffffffffffffffffffffffffff81168114610bd657600080fd5b8035610bd681612303565b600060208284031215611e2d578081fd5b611e3682611ded565b9392505050565b60006020808385031215611e4f578182fd5b823567ffffffffffffffff80821115611e66578384fd5b818501915085601f830112611e79578384fd5b813581811115611e8b57611e8b6122d4565b8381029150611e9b848301612149565b8181528481019084860184860187018a1015611eb5578788fd5b8795505b83861015611ede57611eca81611ded565b835260019590950194918601918601611eb9565b5098975050505050505050565b600060208284031215611efc578081fd5b8151611e3681612303565b60008060008060808587031215611f1c578283fd5b843567ffffffffffffffff80821115611f33578485fd5b818701915087601f830112611f46578485fd5b8135602082821115611f5a57611f5a6122d4565b611f8a817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f85011601612149565b92508183528981838601011115611f9f578687fd5b818185018285013786818385010152829750611fbc818a01611ded565b96505050505060408501359150611fd560608601611e11565b905092959194509250565b600060208284031215611ff1578081fd5b5035919050565b600060208284031215612009578081fd5b5051919050565b6000815180845260208085019450808401835b8381101561205557815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101612023565b509495945050505050565b600081518084526120788160208601602086016121ec565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600082516120bc8184602087016121ec565b9190910192915050565b600060208252611e366020830184612010565b6000604082526120ec6040830185612010565b90508260208301529392505050565b600060208252611e366020830184612060565b6000606082526121216060830186612060565b73ffffffffffffffffffffffffffffffffffffffff9490941660208301525060400152919050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715612190576121906122d4565b604052919050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156121d0576121d06122a5565b500290565b6000828210156121e7576121e76122a5565b500390565b60005b838110156122075781810151838201526020016121ef565b83811115611adf5750506000910152565b60028104600182168061222c57607f821691505b60208210811415612266577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561229e5761229e6122a5565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b80151581146109f857600080fdfea2646970667358221220eb8e08257be96c5364599eeafeaaf47959ec14bc8e63e7aad294af72576ce19e64736f6c63430008020033a2646970667358221220cd1918941a58dc0b7c0a0e150599f6ff2a005c5bdc7edcf50ab821e5fbbf306964736f6c63430008020033"; + "0x608060405234801561001057600080fd5b5061001961001e565b6100dd565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff908116146100db576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b613ff4806100ec6000396000f3fe60806040523480156200001157600080fd5b5060043610620000e75760003560e01c806392cf0dc7116200008d578063d03ffefb1162000063578063d03ffefb1462000223578063edeecdd31462000248578063f2fde38b146200025f57620000e7565b806392cf0dc714620001d4578063b0a87ac114620001eb578063b628a33f146200020c57620000e7565b80638c43b41111620000c35780638c43b411146200012b5780638c53c9bd14620001425780638da5cb5b146200019457620000e7565b8062732e3014620000ec57806354fd4d501462000105578063715018a61462000121575b600080fd5b62000103620000fd366004620011f1565b62000276565b005b6200010e600381565b6040519081526020015b60405180910390f35b62000103620002c7565b620001036200013c366004620012a7565b620002df565b606854606954620001679173ffffffffffffffffffffffffffffffffffffffff169082565b6040805173ffffffffffffffffffffffffffffffffffffffff909316835260208301919091520162000118565b60335473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200162000118565b62000103620001e536600462001210565b62000384565b606554620001ae9073ffffffffffffffffffffffffffffffffffffffff1681565b620001ae6200021d366004620012d5565b620005b3565b606654606754620001679173ffffffffffffffffffffffffffffffffffffffff169082565b6200010362000259366004620012a7565b6200071e565b6200010362000270366004620011f1565b620007bc565b6200028062000879565b606580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b620002d162000879565b620002dd6000620008fc565b565b620002e962000879565b60408051808201825273ffffffffffffffffffffffffffffffffffffffff84168082526020918201849052606880547fffffffffffffffffffffffff0000000000000000000000000000000000000000168217905560698490558251428152918201529081018290527f013c800b1a136f9798a25e471501a7b824156d1e9cba8439821c5a41adf2fb89906060015b60405180910390a15050565b600054610100900460ff1615808015620003a55750600054600160ff909116105b80620003ca5750620003b73062000973565b158015620003ca575060005460ff166001145b6200045c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558015620004bb57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b620004c562000993565b606580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff89161790556200051186866200071e565b6200051d8484620002df565b73ffffffffffffffffffffffffffffffffffffffff8216331462000546576200054682620007bc565b8015620005aa57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050565b60408051808201825260665473ffffffffffffffffffffffffffffffffffffffff9081168252606754602080840191909152835180850185526068548316815260695481830152845160e08101865233815263ffffffff88169281019290925289831682860152606082018990526065548316608083015291871660a082015284151560c0820152925160009384938c938c93919290916200065590620010f0565b620006659594939291906200152d565b604051809103906000f08015801562000682573d6000803e3d6000fd5b506040805180820190915260665473ffffffffffffffffffffffffffffffffffffffff1681526067546020820152909150620006c090338362000a36565b7f2d0b32d809449b38bb442a046b092f68efaf9d4bef7678947afd25048117f187818a8a8a8a8a60666068338d8d60036040516200070a9c9b9a999897969594939291906200142b565b60405180910390a198975050505050505050565b6200072862000879565b60408051808201825273ffffffffffffffffffffffffffffffffffffffff84168082526020918201849052606680547fffffffffffffffffffffffff0000000000000000000000000000000000000000168217905560678490558251428152918201529081018290527f35c5e8a6f8bed2c61a2eb1996d117b1b96192314c0d4ca7cd96360f2509200799060600162000378565b620007c662000879565b73ffffffffffffffffffffffffffffffffffffffff81166200086b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840162000453565b6200087681620008fc565b50565b60335473ffffffffffffffffffffffffffffffffffffffff163314620002dd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000453565b6033805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b73ffffffffffffffffffffffffffffffffffffffff81163b15155b919050565b600054610100900460ff1662000a2c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840162000453565b620002dd62000a53565b62000a42838362000af7565b62000a4e838262000c54565b505050565b600054610100900460ff1662000aec576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840162000453565b620002dd33620008fc565b60208201511562000c505781516040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8381166004830152306024830152600092169063dd62ed3e9060440160206040518083038186803b15801562000b7457600080fd5b505afa15801562000b89573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000baf9190620013a8565b9050826020015181101562000c21576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4552524f52203a204465706f7369742062616420616c6c6f77616e6365000000604482015260640162000453565b6020830151835162000a4e9173ffffffffffffffffffffffffffffffffffffffff909116908490309062000c8c565b5050565b60208201511562000c50576020820151825162000c509173ffffffffffffffffffffffffffffffffffffffff90911690839062000d70565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905262000d6a9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915262000dc8565b50505050565b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905262000a4e9084907fa9059cbb000000000000000000000000000000000000000000000000000000009060640162000ce7565b600062000e2c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1662000ede9092919063ffffffff16565b905080516000148062000e5057508080602001905181019062000e50919062001288565b62000a4e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840162000453565b606062000eef848460008562000ef7565b949350505050565b60608247101562000f8b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840162000453565b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405162000fb691906200140d565b60006040518083038185875af1925050503d806000811462000ff5576040519150601f19603f3d011682016040523d82523d6000602084013e62000ffa565b606091505b50915091506200100d8783838762001018565b979650505050505050565b60608315620010a35782516200109b57620010338562000973565b6200109b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640162000453565b508162000eef565b62000eef8383815115620010ba5781518083602001fd5b806040517f08c379a000000000000000000000000000000000000000000000000000000000815260040162000453919062001518565b6128e780620016d883390190565b600067ffffffffffffffff808411156200111c576200111c62001676565b604051601f85017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190828211818310171562001165576200116562001676565b816040528093508581528686860111156200117f57600080fd5b858560208301376000602087830101525050509392505050565b80356200098e81620016a5565b80356200098e81620016c8565b600082601f830112620011c4578081fd5b620011d583833560208501620010fe565b9392505050565b803563ffffffff811681146200098e57600080fd5b60006020828403121562001203578081fd5b8135620011d581620016a5565b60008060008060008060c0878903121562001229578182fd5b86356200123681620016a5565b955060208701356200124881620016a5565b94506040870135935060608701356200126181620016a5565b92506080870135915060a08701356200127a81620016a5565b809150509295509295509295565b6000602082840312156200129a578081fd5b8151620011d581620016c8565b60008060408385031215620012ba578182fd5b8235620012c781620016a5565b946020939093013593505050565b600080600080600080600060e0888a031215620012f0578081fd5b873567ffffffffffffffff8082111562001308578283fd5b818a0191508a601f8301126200131c578283fd5b6200132d8b833560208501620010fe565b985060208a013591508082111562001343578283fd5b50620013528a828b01620011b3565b965050620013636040890162001199565b9450606088013593506200137a6080890162001199565b92506200138a60a08901620011dc565b91506200139a60c08901620011a6565b905092959891949750929550565b600060208284031215620013ba578081fd5b5051919050565b60008151808452620013db81602086016020860162001647565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600082516200142181846020870162001647565b9190910192915050565b600073ffffffffffffffffffffffffffffffffffffffff808f1683526101c060208401526200145f6101c084018f620013c1565b838103604085015262001473818f620013c1565b925050808c1660608401528a6080840152808a1660a0840152620014bb60c084018a805473ffffffffffffffffffffffffffffffffffffffff16825260010154602090910152565b875473ffffffffffffffffffffffffffffffffffffffff166101008401526001909701546101208301529590941661014085015263ffffffff9290921661016084015215156101808301526101a090910152979650505050505050565b600060208252620011d56020830184620013c1565b60006101a08083526200154381840189620013c1565b90508281036020840152620015598188620013c1565b865173ffffffffffffffffffffffffffffffffffffffff1660408501526020870151606085015291506200158a9050565b835173ffffffffffffffffffffffffffffffffffffffff166080830152602084015160a0830152825173ffffffffffffffffffffffffffffffffffffffff90811660c0840152602084015163ffffffff1660e084015260408401518116610100840152606084015161012084015260808401511661014083015260a08301516200162d61016084018273ffffffffffffffffffffffffffffffffffffffff169052565b5060c0830151801515610180840152509695505050505050565b60005b83811015620016645781810151838201526020016200164a565b8381111562000d6a5750506000910152565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff811681146200087657600080fd5b80151581146200087657600080fdfe60806040523480156200001157600080fd5b50604051620028e7380380620028e7833981016040819052620000349162000423565b8060c0015180156200005057506000816020015163ffffffff16115b15620000e35760405162461bcd60e51b815260206004820152605260248201527f4552524f523a2043616e27742063726561746520612077686974654c6973746560448201527f642071756573742077697468206d617820706c61796572732067726561746572606482015271207468616e20302028696e66696e6974792960701b608482015260a40160405180910390fd5b8451620000f8906001906020880190620001f1565b5083516200010e906002906020870190620001f1565b506040810151600380546001600160a01b03199081166001600160a01b03938416179091556060830151600455608083015160058054831691841691909117905560a083015160068054855160008054861691871691909117905587516008805486169187169190911790556020978801516009558651600a8054861691871691909117905595870151600b55600c805460ff191690559584015160c0909401519490911691161763ffffffff60a01b1916600160a01b63ffffffff909216919091021760ff60c01b1916600160c01b9115159190910217905550620005909050565b828054620001ff9062000524565b90600052602060002090601f0160209004810192826200022357600085556200026e565b82601f106200023e57805160ff19168380011785556200026e565b828001600101855582156200026e579182015b828111156200026e57825182559160200191906001019062000251565b506200027c92915062000280565b5090565b5b808211156200027c576000815560010162000281565b60006001600160401b03831115620002b357620002b362000561565b6020620002c9601f8501601f19168201620004f1565b9150838252848484011115620002de57600080fd5b60005b84811015620002fc57838101518382018301528101620002e1565b848111156200030e5760008286850101525b50509392505050565b8051620003248162000577565b919050565b805180151581146200032457600080fd5b6000604082840312156200034c578081fd5b620003586040620004f1565b90508151620003678162000577565b808252506020820151602082015292915050565b600060e082840312156200038d578081fd5b6200039960e0620004f1565b90508151620003a88162000577565b8152602082015163ffffffff81168114620003c257600080fd5b6020820152620003d56040830162000317565b604082015260608201516060820152620003f26080830162000317565b60808201526200040560a0830162000317565b60a08201526200041860c0830162000329565b60c082015292915050565b60008060008060006101a086880312156200043c578081fd5b85516001600160401b038082111562000453578283fd5b818801915088601f83011262000467578283fd5b620004788983516020850162000297565b965060208801519150808211156200048e578283fd5b508601601f81018813620004a0578182fd5b620004b18882516020840162000297565b945050620004c387604088016200033a565b9250620004d487608088016200033a565b9150620004e58760c088016200037b565b90509295509295909350565b604051601f8201601f191681016001600160401b03811182821017156200051c576200051c62000561565b604052919050565b6002810460018216806200053957607f821691505b602082108114156200055b57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146200058d57600080fd5b50565b61234780620005a06000396000f3fe608060405234801561001057600080fd5b506004361061016c5760003560e01c80638b5b9ccc116100cd578063d03ffefb11610081578063e492814f11610066578063e492814f146103ab578063f294cf38146103be578063f7c618c1146103c65761016c565b8063d03ffefb14610372578063e0c23423146103965761016c565b8063a888c2cd116100b2578063a888c2cd1461031d578063b0a87ac11461033f578063b434151c1461035f5761016c565b80638b5b9ccc146102b85780638c53c9bd146102cd5761016c565b8063579ca2c911610124578063775b9c1311610109578063775b9c13146102725780637ceae3101461028557806385c99e2b146102a55761016c565b8063579ca2c9146102255780636c3a4cce1461022d5761016c565b8063310a1ee311610155578063310a1ee3146101c457806348d6cb53146101db5780634c2412a2146101e85761016c565b8063151dfb06146101715780632f17b18214610186575b600080fd5b61018461017f366004611e1c565b6103e6565b005b6006546101af907801000000000000000000000000000000000000000000000000900460ff1681565b60405190151581526020015b60405180910390f35b6101cd60045481565b6040519081526020016101bb565b600c546101af9060ff1681565b6006546102109074010000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff90911681526020016101bb565b610184610807565b60005461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101bb565b610184610280366004611e3d565b6109fb565b60065461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b6101af6102b3366004611e1c565b610ba5565b6102c0610bdb565b6040516101bb91906120c6565b600a54600b546102f19173ffffffffffffffffffffffffffffffffffffffff169082565b6040805173ffffffffffffffffffffffffffffffffffffffff90931683526020830191909152016101bb565b61033061032b366004611fe0565b610c4a565b6040516101bb9392919061210e565b60055461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b61018461036d366004611f07565b610d23565b6008546009546102f19173ffffffffffffffffffffffffffffffffffffffff169082565b61039e611151565b6040516101bb91906120fb565b6101846103b9366004611e1c565b6111df565b61039e6115ea565b60035461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b6006547801000000000000000000000000000000000000000000000000900460ff161561049a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f4552524f523a2063616e277420756e706c617920612077686974656c6973746560448201527f642071756573740000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff821614806104d5575060005473ffffffffffffffffffffffffffffffffffffffff1633145b610560576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f4552524f523a2053656e646572206e6f7420706c61796572206e6f722063726560448201527f61746f72000000000000000000000000000000000000000000000000000000006064820152608401610491565b600061056b826115f7565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14156105f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4552524f523a20706c61796572206e6f7420696e206c697374000000000000006044820152606401610491565b600d8054610607906001906121d5565b8154811061063e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260209091200154600d805473ffffffffffffffffffffffffffffffffffffffff909216918390811061069e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d80548061071e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b600082815260209081902082017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905590910190915560408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b54918101919091526107b490836116bf565b6040805173ffffffffffffffffffffffffffffffffffffffff841681524260208201527fc4a67a0877d477de99d765a3d9f48abfbe6181dff4727d68c3cb60715555417591015b60405180910390a15050565b600454421015610873576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4552524f523a204e6f74206578706972656400000000000000000000000000006044820152606401610491565b600c5460ff166108e5576000546040805180820190915260085473ffffffffffffffffffffffffffffffffffffffff908116825260095460208301526108b992166116bf565b600c80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b15801561094f57600080fd5b505afa158015610963573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109879190611ff8565b600a5460035491925073ffffffffffffffffffffffffffffffffffffffff918216911614156109ce57600d54600b546109ca916109c391612198565b82906116f8565b9150505b6006546003546109f89173ffffffffffffffffffffffffffffffffffffffff91821691168361171e565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610aa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f4f6e6c792063726561746f722063616e2063616c6c20746869732066756e637460448201527f696f6e00000000000000000000000000000000000000000000000000000000006064820152608401610491565b6006547801000000000000000000000000000000000000000000000000900460ff161515600114610b55576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603d60248201527f4552524f523a2043616e27742073657420746865207768697465206c6973742060448201527f746f2061206e6f6e2d77686974656c697374656420636f6e74726163740000006064820152608401610491565b8051610b6890600d906020840190611cda565b507fb1565d66d9899787abe67ac307850cf339a24f69de2bf7ffa4179e0eaeb939b08142604051610b9a9291906120d9565b60405180910390a150565b6000610bb0826115f7565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff141590505b919050565b6060600d805480602002602001604051908101604052809291908181526020018280548015610c4057602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610c15575b5050505050905090565b60078181548110610c5a57600080fd5b9060005260206000209060030201600091509050806000018054610c7d90612218565b80601f0160208091040260200160405190810160405280929190818152602001828054610ca990612218565b8015610cf65780601f10610ccb57610100808354040283529160200191610cf6565b820191906000526020600020905b815481529060010190602001808311610cd957829003601f168201915b505050506001830154600290930154919273ffffffffffffffffffffffffffffffffffffffff1691905083565b60055473ffffffffffffffffffffffffffffffffffffffff163314610da4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4552524f523a2053656e646572206e6f7420676f7665726e00000000000000006044820152606401610491565b8351610e0c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4552524f523a204e6f2065766964656e636500000000000000000000000000006044820152606401610491565b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b158015610e7657600080fd5b505afa158015610e8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eae9190611ff8565b90508115610f445760085460035473ffffffffffffffffffffffffffffffffffffffff90811691161415610ef757600954600090610eed9083906116f8565b9450610efb915050565b8092505b600a5460035473ffffffffffffffffffffffffffffffffffffffff90811691161415610f4457600d54600b54600091610f3f91610f389190612198565b85906116f8565b945050505b60085460035473ffffffffffffffffffffffffffffffffffffffff90811691161415611010576000610f7682856116f8565b91505060086001015481101561100e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f4552524f523a2053686f756c64206e6f742065786365656420616c6c6f77656460448201527f20626f756e7479000000000000000000000000000000000000000000000000006064820152608401610491565b505b821561103a5760035461103a9073ffffffffffffffffffffffffffffffffffffffff16858561171e565b6040805160608101825286815273ffffffffffffffffffffffffffffffffffffffff86166020808301919091529181018590526007805460018101825560009190915281518051929360039092027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68801926110b89284920190611d64565b5060208201516001820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091179055604091820151600290910155517fa1c3b325aa2c115e4b244062eba2515bc5585ae5b41556be8fef399ae9fde11b906111429087908790879061210e565b60405180910390a15050505050565b6002805461115e90612218565b80601f016020809104026020016040519081016040528092919081815260200182805461118a90612218565b80156111d75780601f106111ac576101008083540402835291602001916111d7565b820191906000526020600020905b8154815290600101906020018083116111ba57829003601f168201915b505050505081565b6006547801000000000000000000000000000000000000000000000000900460ff161561128e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603760248201527f4552524f523a2043616e27742073656c6620726567697374657220616e64207060448201527f6c617920612077686974656c69737465642051756573740000000000000000006064820152608401610491565b3373ffffffffffffffffffffffffffffffffffffffff821614806112c9575060005473ffffffffffffffffffffffffffffffffffffffff1633145b611354576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f4552524f523a2053656e646572206e6f7420706c61796572206e6f722063726560448201527f61746f72000000000000000000000000000000000000000000000000000000006064820152608401610491565b60065474010000000000000000000000000000000000000000900463ffffffff1615806113a35750600654600d547401000000000000000000000000000000000000000090910463ffffffff16115b611409576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f4552524f523a204d617820706c617965727320726561636865640000000000006044820152606401610491565b6004544210611474576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4552524f523a20517565737420657870697265640000000000000000000000006044820152606401610491565b600061147f826115f7565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1461150a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4552524f523a20506c6179657220616c726561647920657869737473000000006044820152606401610491565b60408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b5460208201526115429033306117f7565b600d80546001810182556000919091527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb50180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8416908117909155604080519182524260208301527f35ec60f951b4abc8b287ab5148caf98524052482927d42e86a720cc71b8a76a191016107fb565b6001805461115e90612218565b6000805b600d54811015611697578273ffffffffffffffffffffffffffffffffffffffff16600d8281548110611656577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff161415611685579050610bd6565b8061168f8161226c565b9150506115fb565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92915050565b6020820151156116f457602082015182516116f49173ffffffffffffffffffffffffffffffffffffffff90911690839061171e565b5050565b6000808383111561170e57506000905080611717565b50600190508183035b9250929050565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526117f29084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261180b565b505050565b611801838361191a565b6117f283826116bf565b600061186d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611a6a9092919063ffffffff16565b905080516000148061188e57508080602001905181019061188e9190611eeb565b6117f2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610491565b6020820151156116f45781516040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8381166004830152306024830152600092169063dd62ed3e9060440160206040518083038186803b15801561199557600080fd5b505afa1580156119a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119cd9190611ff8565b90508260200151811015611a3d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4552524f52203a204465706f7369742062616420616c6c6f77616e63650000006044820152606401610491565b602083015183516117f29173ffffffffffffffffffffffffffffffffffffffff9091169084903090611a81565b6060611a798484600085611ae5565b949350505050565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052611adf9085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401611770565b50505050565b606082471015611b77576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610491565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051611ba091906120aa565b60006040518083038185875af1925050503d8060008114611bdd576040519150601f19603f3d011682016040523d82523d6000602084013e611be2565b606091505b5091509150611bf387838387611bfe565b979650505050505050565b60608315611c91578251611c8a5773ffffffffffffffffffffffffffffffffffffffff85163b611c8a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610491565b5081611a79565b611a798383815115611ca65781518083602001fd5b806040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161049191906120fb565b828054828255906000526020600020908101928215611d54579160200282015b82811115611d5457825182547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909116178255602090920191600190910190611cfa565b50611d60929150611dd8565b5090565b828054611d7090612218565b90600052602060002090601f016020900481019282611d925760008555611d54565b82601f10611dab57805160ff1916838001178555611d54565b82800160010185558215611d54579182015b82811115611d54578251825591602001919060010190611dbd565b5b80821115611d605760008155600101611dd9565b803573ffffffffffffffffffffffffffffffffffffffff81168114610bd657600080fd5b8035610bd681612303565b600060208284031215611e2d578081fd5b611e3682611ded565b9392505050565b60006020808385031215611e4f578182fd5b823567ffffffffffffffff80821115611e66578384fd5b818501915085601f830112611e79578384fd5b813581811115611e8b57611e8b6122d4565b8381029150611e9b848301612149565b8181528481019084860184860187018a1015611eb5578788fd5b8795505b83861015611ede57611eca81611ded565b835260019590950194918601918601611eb9565b5098975050505050505050565b600060208284031215611efc578081fd5b8151611e3681612303565b60008060008060808587031215611f1c578283fd5b843567ffffffffffffffff80821115611f33578485fd5b818701915087601f830112611f46578485fd5b8135602082821115611f5a57611f5a6122d4565b611f8a817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f85011601612149565b92508183528981838601011115611f9f578687fd5b818185018285013786818385010152829750611fbc818a01611ded565b96505050505060408501359150611fd560608601611e11565b905092959194509250565b600060208284031215611ff1578081fd5b5035919050565b600060208284031215612009578081fd5b5051919050565b6000815180845260208085019450808401835b8381101561205557815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101612023565b509495945050505050565b600081518084526120788160208601602086016121ec565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600082516120bc8184602087016121ec565b9190910192915050565b600060208252611e366020830184612010565b6000604082526120ec6040830185612010565b90508260208301529392505050565b600060208252611e366020830184612060565b6000606082526121216060830186612060565b73ffffffffffffffffffffffffffffffffffffffff9490941660208301525060400152919050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715612190576121906122d4565b604052919050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156121d0576121d06122a5565b500290565b6000828210156121e7576121e76122a5565b500390565b60005b838110156122075781810151838201526020016121ef565b83811115611adf5750506000910152565b60028104600182168061222c57607f821691505b60208210811415612266577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561229e5761229e6122a5565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b80151581146109f857600080fdfea26469706673582212207a89747e6d25956d64f95972c1f129d7a1914bad877e8c0f7fc4d79f78aecaf664736f6c63430008020033a2646970667358221220fe247d7c0d7778ae4cb1b1abc8ab64694e0955322a87875538851643050ec8ae64736f6c63430008020033"; diff --git a/packages/hardhat/typechain/factories/Quest__factory.ts b/packages/hardhat/typechain/factories/Quest__factory.ts index e5bb6dc4..93e0e2a3 100644 --- a/packages/hardhat/typechain/factories/Quest__factory.ts +++ b/packages/hardhat/typechain/factories/Quest__factory.ts @@ -553,4 +553,4 @@ const _abi = [ ]; const _bytecode = - "0x60806040523480156200001157600080fd5b50604051620028e7380380620028e7833981016040819052620000349162000423565b8060c0015180156200005057506000816020015163ffffffff16115b15620000e35760405162461bcd60e51b815260206004820152605260248201527f4552524f523a2043616e27742063726561746520612077686974654c6973746560448201527f642071756573742077697468206d617820706c61796572732067726561746572606482015271207468616e20302028696e66696e6974792960701b608482015260a40160405180910390fd5b8451620000f8906001906020880190620001f1565b5083516200010e906002906020870190620001f1565b506040810151600380546001600160a01b03199081166001600160a01b03938416179091556060830151600455608083015160058054831691841691909117905560a083015160068054855160008054861691871691909117905587516008805486169187169190911790556020978801516009558651600a8054861691871691909117905595870151600b55600c805460ff191690559584015160c0909401519490911691161763ffffffff60a01b1916600160a01b63ffffffff909216919091021760ff60c01b1916600160c01b9115159190910217905550620005909050565b828054620001ff9062000524565b90600052602060002090601f0160209004810192826200022357600085556200026e565b82601f106200023e57805160ff19168380011785556200026e565b828001600101855582156200026e579182015b828111156200026e57825182559160200191906001019062000251565b506200027c92915062000280565b5090565b5b808211156200027c576000815560010162000281565b60006001600160401b03831115620002b357620002b362000561565b6020620002c9601f8501601f19168201620004f1565b9150838252848484011115620002de57600080fd5b60005b84811015620002fc57838101518382018301528101620002e1565b848111156200030e5760008286850101525b50509392505050565b8051620003248162000577565b919050565b805180151581146200032457600080fd5b6000604082840312156200034c578081fd5b620003586040620004f1565b90508151620003678162000577565b808252506020820151602082015292915050565b600060e082840312156200038d578081fd5b6200039960e0620004f1565b90508151620003a88162000577565b8152602082015163ffffffff81168114620003c257600080fd5b6020820152620003d56040830162000317565b604082015260608201516060820152620003f26080830162000317565b60808201526200040560a0830162000317565b60a08201526200041860c0830162000329565b60c082015292915050565b60008060008060006101a086880312156200043c578081fd5b85516001600160401b038082111562000453578283fd5b818801915088601f83011262000467578283fd5b620004788983516020850162000297565b965060208801519150808211156200048e578283fd5b508601601f81018813620004a0578182fd5b620004b18882516020840162000297565b945050620004c387604088016200033a565b9250620004d487608088016200033a565b9150620004e58760c088016200037b565b90509295509295909350565b604051601f8201601f191681016001600160401b03811182821017156200051c576200051c62000561565b604052919050565b6002810460018216806200053957607f821691505b602082108114156200055b57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146200058d57600080fd5b50565b61234780620005a06000396000f3fe608060405234801561001057600080fd5b506004361061016c5760003560e01c80638b5b9ccc116100cd578063d03ffefb11610081578063e492814f11610066578063e492814f146103ab578063f294cf38146103be578063f7c618c1146103c65761016c565b8063d03ffefb14610372578063e0c23423146103965761016c565b8063a888c2cd116100b2578063a888c2cd1461031d578063b0a87ac11461033f578063b434151c1461035f5761016c565b80638b5b9ccc146102b85780638c53c9bd146102cd5761016c565b8063579ca2c911610124578063775b9c1311610109578063775b9c13146102725780637ceae3101461028557806385c99e2b146102a55761016c565b8063579ca2c9146102255780636c3a4cce1461022d5761016c565b8063310a1ee311610155578063310a1ee3146101c457806348d6cb53146101db5780634c2412a2146101e85761016c565b8063151dfb06146101715780632f17b18214610186575b600080fd5b61018461017f366004611e1c565b6103e6565b005b6006546101af907801000000000000000000000000000000000000000000000000900460ff1681565b60405190151581526020015b60405180910390f35b6101cd60045481565b6040519081526020016101bb565b600c546101af9060ff1681565b6006546102109074010000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff90911681526020016101bb565b610184610807565b60005461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101bb565b610184610280366004611e3d565b6109fb565b60065461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b6101af6102b3366004611e1c565b610ba5565b6102c0610bdb565b6040516101bb91906120c6565b600a54600b546102f19173ffffffffffffffffffffffffffffffffffffffff169082565b6040805173ffffffffffffffffffffffffffffffffffffffff90931683526020830191909152016101bb565b61033061032b366004611fe0565b610c4a565b6040516101bb9392919061210e565b60055461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b61018461036d366004611f07565b610d23565b6008546009546102f19173ffffffffffffffffffffffffffffffffffffffff169082565b61039e611151565b6040516101bb91906120fb565b6101846103b9366004611e1c565b6111df565b61039e6115ea565b60035461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b6006547801000000000000000000000000000000000000000000000000900460ff161561049a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f4552524f523a2063616e277420756e706c617920612077686974656c6973746560448201527f642071756573740000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff821614806104d5575060005473ffffffffffffffffffffffffffffffffffffffff1633145b610560576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f4552524f523a2053656e646572206e6f7420706c61796572206e6f722063726560448201527f61746f72000000000000000000000000000000000000000000000000000000006064820152608401610491565b600061056b826115f7565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14156105f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4552524f523a20706c61796572206e6f7420696e206c697374000000000000006044820152606401610491565b600d8054610607906001906121d5565b8154811061063e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260209091200154600d805473ffffffffffffffffffffffffffffffffffffffff909216918390811061069e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d80548061071e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b600082815260209081902082017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905590910190915560408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b54918101919091526107b490836116bf565b6040805173ffffffffffffffffffffffffffffffffffffffff841681524260208201527fc4a67a0877d477de99d765a3d9f48abfbe6181dff4727d68c3cb60715555417591015b60405180910390a15050565b600454421015610873576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4552524f523a204e6f74206578706972656400000000000000000000000000006044820152606401610491565b600c5460ff166108e5576000546040805180820190915260085473ffffffffffffffffffffffffffffffffffffffff908116825260095460208301526108b992166116bf565b600c80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b15801561094f57600080fd5b505afa158015610963573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109879190611ff8565b600a5460035491925073ffffffffffffffffffffffffffffffffffffffff918216911614156109ce57600d54600b546109ca916109c391612198565b82906116f8565b9150505b6006546003546109f89173ffffffffffffffffffffffffffffffffffffffff91821691168361171e565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610aa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f4f6e6c792063726561746f722063616e2063616c6c20746869732066756e637460448201527f696f6e00000000000000000000000000000000000000000000000000000000006064820152608401610491565b6006547801000000000000000000000000000000000000000000000000900460ff161515600114610b55576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603d60248201527f4552524f523a2043616e27742073657420746865207768697465206c6973742060448201527f746f2061206e6f6e2d77686974656c697374656420636f6e74726163740000006064820152608401610491565b8051610b6890600d906020840190611cda565b507fb1565d66d9899787abe67ac307850cf339a24f69de2bf7ffa4179e0eaeb939b08142604051610b9a9291906120d9565b60405180910390a150565b6000610bb0826115f7565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff141590505b919050565b6060600d805480602002602001604051908101604052809291908181526020018280548015610c4057602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610c15575b5050505050905090565b60078181548110610c5a57600080fd5b9060005260206000209060030201600091509050806000018054610c7d90612218565b80601f0160208091040260200160405190810160405280929190818152602001828054610ca990612218565b8015610cf65780601f10610ccb57610100808354040283529160200191610cf6565b820191906000526020600020905b815481529060010190602001808311610cd957829003601f168201915b505050506001830154600290930154919273ffffffffffffffffffffffffffffffffffffffff1691905083565b60055473ffffffffffffffffffffffffffffffffffffffff163314610da4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4552524f523a2053656e646572206e6f7420676f7665726e00000000000000006044820152606401610491565b8351610e0c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4552524f523a204e6f2065766964656e636500000000000000000000000000006044820152606401610491565b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b158015610e7657600080fd5b505afa158015610e8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eae9190611ff8565b90508115610f445760085460035473ffffffffffffffffffffffffffffffffffffffff90811691161415610ef757600954600090610eed9083906116f8565b9450610efb915050565b8092505b600a5460035473ffffffffffffffffffffffffffffffffffffffff90811691161415610f4457600d54600b54600091610f3f91610f389190612198565b85906116f8565b945050505b60085460035473ffffffffffffffffffffffffffffffffffffffff90811691161415611010576000610f7682856116f8565b91505060086001015481101561100e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f4552524f523a2053686f756c64206e6f742065786365656420616c6c6f77656460448201527f20626f756e7479000000000000000000000000000000000000000000000000006064820152608401610491565b505b821561103a5760035461103a9073ffffffffffffffffffffffffffffffffffffffff16858561171e565b6040805160608101825286815273ffffffffffffffffffffffffffffffffffffffff86166020808301919091529181018590526007805460018101825560009190915281518051929360039092027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68801926110b89284920190611d64565b5060208201516001820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091179055604091820151600290910155517fa1c3b325aa2c115e4b244062eba2515bc5585ae5b41556be8fef399ae9fde11b906111429087908790879061210e565b60405180910390a15050505050565b6002805461115e90612218565b80601f016020809104026020016040519081016040528092919081815260200182805461118a90612218565b80156111d75780601f106111ac576101008083540402835291602001916111d7565b820191906000526020600020905b8154815290600101906020018083116111ba57829003601f168201915b505050505081565b6006547801000000000000000000000000000000000000000000000000900460ff161561128e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603760248201527f4552524f523a2043616e27742073656c6620726567697374657220616e64207060448201527f6c617920612077686974656c69737465642051756573740000000000000000006064820152608401610491565b3373ffffffffffffffffffffffffffffffffffffffff821614806112c9575060005473ffffffffffffffffffffffffffffffffffffffff1633145b611354576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f4552524f523a2053656e646572206e6f7420706c61796572206e6f722063726560448201527f61746f72000000000000000000000000000000000000000000000000000000006064820152608401610491565b60065474010000000000000000000000000000000000000000900463ffffffff1615806113a35750600654600d547401000000000000000000000000000000000000000090910463ffffffff16115b611409576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f4552524f523a204d617820706c617965727320726561636865640000000000006044820152606401610491565b6004544210611474576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4552524f523a20517565737420657870697265640000000000000000000000006044820152606401610491565b600061147f826115f7565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1461150a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4552524f523a20506c6179657220616c726561647920657869737473000000006044820152606401610491565b60408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b5460208201526115429033306117f7565b600d80546001810182556000919091527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb50180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8416908117909155604080519182524260208301527f35ec60f951b4abc8b287ab5148caf98524052482927d42e86a720cc71b8a76a191016107fb565b6001805461115e90612218565b6000805b600d54811015611697578273ffffffffffffffffffffffffffffffffffffffff16600d8281548110611656577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff161415611685579050610bd6565b8061168f8161226c565b9150506115fb565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92915050565b6020820151156116f457602082015182516116f49173ffffffffffffffffffffffffffffffffffffffff90911690839061171e565b5050565b6000808383111561170e57506000905080611717565b50600190508183035b9250929050565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526117f29084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261180b565b505050565b611801838361191a565b6117f283826116bf565b600061186d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611a6a9092919063ffffffff16565b905080516000148061188e57508080602001905181019061188e9190611eeb565b6117f2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610491565b6020820151156116f45781516040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8381166004830152306024830152600092169063dd62ed3e9060440160206040518083038186803b15801561199557600080fd5b505afa1580156119a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119cd9190611ff8565b90508260200151811015611a3d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4552524f52203a204465706f7369742062616420616c6c6f77616e63650000006044820152606401610491565b602083015183516117f29173ffffffffffffffffffffffffffffffffffffffff9091169084903090611a81565b6060611a798484600085611ae5565b949350505050565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052611adf9085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401611770565b50505050565b606082471015611b77576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610491565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051611ba091906120aa565b60006040518083038185875af1925050503d8060008114611bdd576040519150601f19603f3d011682016040523d82523d6000602084013e611be2565b606091505b5091509150611bf387838387611bfe565b979650505050505050565b60608315611c91578251611c8a5773ffffffffffffffffffffffffffffffffffffffff85163b611c8a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610491565b5081611a79565b611a798383815115611ca65781518083602001fd5b806040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161049191906120fb565b828054828255906000526020600020908101928215611d54579160200282015b82811115611d5457825182547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909116178255602090920191600190910190611cfa565b50611d60929150611dd8565b5090565b828054611d7090612218565b90600052602060002090601f016020900481019282611d925760008555611d54565b82601f10611dab57805160ff1916838001178555611d54565b82800160010185558215611d54579182015b82811115611d54578251825591602001919060010190611dbd565b5b80821115611d605760008155600101611dd9565b803573ffffffffffffffffffffffffffffffffffffffff81168114610bd657600080fd5b8035610bd681612303565b600060208284031215611e2d578081fd5b611e3682611ded565b9392505050565b60006020808385031215611e4f578182fd5b823567ffffffffffffffff80821115611e66578384fd5b818501915085601f830112611e79578384fd5b813581811115611e8b57611e8b6122d4565b8381029150611e9b848301612149565b8181528481019084860184860187018a1015611eb5578788fd5b8795505b83861015611ede57611eca81611ded565b835260019590950194918601918601611eb9565b5098975050505050505050565b600060208284031215611efc578081fd5b8151611e3681612303565b60008060008060808587031215611f1c578283fd5b843567ffffffffffffffff80821115611f33578485fd5b818701915087601f830112611f46578485fd5b8135602082821115611f5a57611f5a6122d4565b611f8a817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f85011601612149565b92508183528981838601011115611f9f578687fd5b818185018285013786818385010152829750611fbc818a01611ded565b96505050505060408501359150611fd560608601611e11565b905092959194509250565b600060208284031215611ff1578081fd5b5035919050565b600060208284031215612009578081fd5b5051919050565b6000815180845260208085019450808401835b8381101561205557815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101612023565b509495945050505050565b600081518084526120788160208601602086016121ec565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600082516120bc8184602087016121ec565b9190910192915050565b600060208252611e366020830184612010565b6000604082526120ec6040830185612010565b90508260208301529392505050565b600060208252611e366020830184612060565b6000606082526121216060830186612060565b73ffffffffffffffffffffffffffffffffffffffff9490941660208301525060400152919050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715612190576121906122d4565b604052919050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156121d0576121d06122a5565b500290565b6000828210156121e7576121e76122a5565b500390565b60005b838110156122075781810151838201526020016121ef565b83811115611adf5750506000910152565b60028104600182168061222c57607f821691505b60208210811415612266577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561229e5761229e6122a5565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b80151581146109f857600080fdfea2646970667358221220eb8e08257be96c5364599eeafeaaf47959ec14bc8e63e7aad294af72576ce19e64736f6c63430008020033"; + "0x60806040523480156200001157600080fd5b50604051620028e7380380620028e7833981016040819052620000349162000423565b8060c0015180156200005057506000816020015163ffffffff16115b15620000e35760405162461bcd60e51b815260206004820152605260248201527f4552524f523a2043616e27742063726561746520612077686974654c6973746560448201527f642071756573742077697468206d617820706c61796572732067726561746572606482015271207468616e20302028696e66696e6974792960701b608482015260a40160405180910390fd5b8451620000f8906001906020880190620001f1565b5083516200010e906002906020870190620001f1565b506040810151600380546001600160a01b03199081166001600160a01b03938416179091556060830151600455608083015160058054831691841691909117905560a083015160068054855160008054861691871691909117905587516008805486169187169190911790556020978801516009558651600a8054861691871691909117905595870151600b55600c805460ff191690559584015160c0909401519490911691161763ffffffff60a01b1916600160a01b63ffffffff909216919091021760ff60c01b1916600160c01b9115159190910217905550620005909050565b828054620001ff9062000524565b90600052602060002090601f0160209004810192826200022357600085556200026e565b82601f106200023e57805160ff19168380011785556200026e565b828001600101855582156200026e579182015b828111156200026e57825182559160200191906001019062000251565b506200027c92915062000280565b5090565b5b808211156200027c576000815560010162000281565b60006001600160401b03831115620002b357620002b362000561565b6020620002c9601f8501601f19168201620004f1565b9150838252848484011115620002de57600080fd5b60005b84811015620002fc57838101518382018301528101620002e1565b848111156200030e5760008286850101525b50509392505050565b8051620003248162000577565b919050565b805180151581146200032457600080fd5b6000604082840312156200034c578081fd5b620003586040620004f1565b90508151620003678162000577565b808252506020820151602082015292915050565b600060e082840312156200038d578081fd5b6200039960e0620004f1565b90508151620003a88162000577565b8152602082015163ffffffff81168114620003c257600080fd5b6020820152620003d56040830162000317565b604082015260608201516060820152620003f26080830162000317565b60808201526200040560a0830162000317565b60a08201526200041860c0830162000329565b60c082015292915050565b60008060008060006101a086880312156200043c578081fd5b85516001600160401b038082111562000453578283fd5b818801915088601f83011262000467578283fd5b620004788983516020850162000297565b965060208801519150808211156200048e578283fd5b508601601f81018813620004a0578182fd5b620004b18882516020840162000297565b945050620004c387604088016200033a565b9250620004d487608088016200033a565b9150620004e58760c088016200037b565b90509295509295909350565b604051601f8201601f191681016001600160401b03811182821017156200051c576200051c62000561565b604052919050565b6002810460018216806200053957607f821691505b602082108114156200055b57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146200058d57600080fd5b50565b61234780620005a06000396000f3fe608060405234801561001057600080fd5b506004361061016c5760003560e01c80638b5b9ccc116100cd578063d03ffefb11610081578063e492814f11610066578063e492814f146103ab578063f294cf38146103be578063f7c618c1146103c65761016c565b8063d03ffefb14610372578063e0c23423146103965761016c565b8063a888c2cd116100b2578063a888c2cd1461031d578063b0a87ac11461033f578063b434151c1461035f5761016c565b80638b5b9ccc146102b85780638c53c9bd146102cd5761016c565b8063579ca2c911610124578063775b9c1311610109578063775b9c13146102725780637ceae3101461028557806385c99e2b146102a55761016c565b8063579ca2c9146102255780636c3a4cce1461022d5761016c565b8063310a1ee311610155578063310a1ee3146101c457806348d6cb53146101db5780634c2412a2146101e85761016c565b8063151dfb06146101715780632f17b18214610186575b600080fd5b61018461017f366004611e1c565b6103e6565b005b6006546101af907801000000000000000000000000000000000000000000000000900460ff1681565b60405190151581526020015b60405180910390f35b6101cd60045481565b6040519081526020016101bb565b600c546101af9060ff1681565b6006546102109074010000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff90911681526020016101bb565b610184610807565b60005461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101bb565b610184610280366004611e3d565b6109fb565b60065461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b6101af6102b3366004611e1c565b610ba5565b6102c0610bdb565b6040516101bb91906120c6565b600a54600b546102f19173ffffffffffffffffffffffffffffffffffffffff169082565b6040805173ffffffffffffffffffffffffffffffffffffffff90931683526020830191909152016101bb565b61033061032b366004611fe0565b610c4a565b6040516101bb9392919061210e565b60055461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b61018461036d366004611f07565b610d23565b6008546009546102f19173ffffffffffffffffffffffffffffffffffffffff169082565b61039e611151565b6040516101bb91906120fb565b6101846103b9366004611e1c565b6111df565b61039e6115ea565b60035461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b6006547801000000000000000000000000000000000000000000000000900460ff161561049a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f4552524f523a2063616e277420756e706c617920612077686974656c6973746560448201527f642071756573740000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff821614806104d5575060005473ffffffffffffffffffffffffffffffffffffffff1633145b610560576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f4552524f523a2053656e646572206e6f7420706c61796572206e6f722063726560448201527f61746f72000000000000000000000000000000000000000000000000000000006064820152608401610491565b600061056b826115f7565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14156105f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4552524f523a20706c61796572206e6f7420696e206c697374000000000000006044820152606401610491565b600d8054610607906001906121d5565b8154811061063e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260209091200154600d805473ffffffffffffffffffffffffffffffffffffffff909216918390811061069e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d80548061071e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b600082815260209081902082017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905590910190915560408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b54918101919091526107b490836116bf565b6040805173ffffffffffffffffffffffffffffffffffffffff841681524260208201527fc4a67a0877d477de99d765a3d9f48abfbe6181dff4727d68c3cb60715555417591015b60405180910390a15050565b600454421015610873576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4552524f523a204e6f74206578706972656400000000000000000000000000006044820152606401610491565b600c5460ff166108e5576000546040805180820190915260085473ffffffffffffffffffffffffffffffffffffffff908116825260095460208301526108b992166116bf565b600c80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b15801561094f57600080fd5b505afa158015610963573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109879190611ff8565b600a5460035491925073ffffffffffffffffffffffffffffffffffffffff918216911614156109ce57600d54600b546109ca916109c391612198565b82906116f8565b9150505b6006546003546109f89173ffffffffffffffffffffffffffffffffffffffff91821691168361171e565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610aa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f4f6e6c792063726561746f722063616e2063616c6c20746869732066756e637460448201527f696f6e00000000000000000000000000000000000000000000000000000000006064820152608401610491565b6006547801000000000000000000000000000000000000000000000000900460ff161515600114610b55576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603d60248201527f4552524f523a2043616e27742073657420746865207768697465206c6973742060448201527f746f2061206e6f6e2d77686974656c697374656420636f6e74726163740000006064820152608401610491565b8051610b6890600d906020840190611cda565b507fb1565d66d9899787abe67ac307850cf339a24f69de2bf7ffa4179e0eaeb939b08142604051610b9a9291906120d9565b60405180910390a150565b6000610bb0826115f7565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff141590505b919050565b6060600d805480602002602001604051908101604052809291908181526020018280548015610c4057602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610c15575b5050505050905090565b60078181548110610c5a57600080fd5b9060005260206000209060030201600091509050806000018054610c7d90612218565b80601f0160208091040260200160405190810160405280929190818152602001828054610ca990612218565b8015610cf65780601f10610ccb57610100808354040283529160200191610cf6565b820191906000526020600020905b815481529060010190602001808311610cd957829003601f168201915b505050506001830154600290930154919273ffffffffffffffffffffffffffffffffffffffff1691905083565b60055473ffffffffffffffffffffffffffffffffffffffff163314610da4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4552524f523a2053656e646572206e6f7420676f7665726e00000000000000006044820152606401610491565b8351610e0c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4552524f523a204e6f2065766964656e636500000000000000000000000000006044820152606401610491565b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b158015610e7657600080fd5b505afa158015610e8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eae9190611ff8565b90508115610f445760085460035473ffffffffffffffffffffffffffffffffffffffff90811691161415610ef757600954600090610eed9083906116f8565b9450610efb915050565b8092505b600a5460035473ffffffffffffffffffffffffffffffffffffffff90811691161415610f4457600d54600b54600091610f3f91610f389190612198565b85906116f8565b945050505b60085460035473ffffffffffffffffffffffffffffffffffffffff90811691161415611010576000610f7682856116f8565b91505060086001015481101561100e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f4552524f523a2053686f756c64206e6f742065786365656420616c6c6f77656460448201527f20626f756e7479000000000000000000000000000000000000000000000000006064820152608401610491565b505b821561103a5760035461103a9073ffffffffffffffffffffffffffffffffffffffff16858561171e565b6040805160608101825286815273ffffffffffffffffffffffffffffffffffffffff86166020808301919091529181018590526007805460018101825560009190915281518051929360039092027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68801926110b89284920190611d64565b5060208201516001820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091179055604091820151600290910155517fa1c3b325aa2c115e4b244062eba2515bc5585ae5b41556be8fef399ae9fde11b906111429087908790879061210e565b60405180910390a15050505050565b6002805461115e90612218565b80601f016020809104026020016040519081016040528092919081815260200182805461118a90612218565b80156111d75780601f106111ac576101008083540402835291602001916111d7565b820191906000526020600020905b8154815290600101906020018083116111ba57829003601f168201915b505050505081565b6006547801000000000000000000000000000000000000000000000000900460ff161561128e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603760248201527f4552524f523a2043616e27742073656c6620726567697374657220616e64207060448201527f6c617920612077686974656c69737465642051756573740000000000000000006064820152608401610491565b3373ffffffffffffffffffffffffffffffffffffffff821614806112c9575060005473ffffffffffffffffffffffffffffffffffffffff1633145b611354576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f4552524f523a2053656e646572206e6f7420706c61796572206e6f722063726560448201527f61746f72000000000000000000000000000000000000000000000000000000006064820152608401610491565b60065474010000000000000000000000000000000000000000900463ffffffff1615806113a35750600654600d547401000000000000000000000000000000000000000090910463ffffffff16115b611409576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f4552524f523a204d617820706c617965727320726561636865640000000000006044820152606401610491565b6004544210611474576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4552524f523a20517565737420657870697265640000000000000000000000006044820152606401610491565b600061147f826115f7565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1461150a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4552524f523a20506c6179657220616c726561647920657869737473000000006044820152606401610491565b60408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b5460208201526115429033306117f7565b600d80546001810182556000919091527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb50180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8416908117909155604080519182524260208301527f35ec60f951b4abc8b287ab5148caf98524052482927d42e86a720cc71b8a76a191016107fb565b6001805461115e90612218565b6000805b600d54811015611697578273ffffffffffffffffffffffffffffffffffffffff16600d8281548110611656577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff161415611685579050610bd6565b8061168f8161226c565b9150506115fb565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92915050565b6020820151156116f457602082015182516116f49173ffffffffffffffffffffffffffffffffffffffff90911690839061171e565b5050565b6000808383111561170e57506000905080611717565b50600190508183035b9250929050565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526117f29084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261180b565b505050565b611801838361191a565b6117f283826116bf565b600061186d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611a6a9092919063ffffffff16565b905080516000148061188e57508080602001905181019061188e9190611eeb565b6117f2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610491565b6020820151156116f45781516040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8381166004830152306024830152600092169063dd62ed3e9060440160206040518083038186803b15801561199557600080fd5b505afa1580156119a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119cd9190611ff8565b90508260200151811015611a3d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4552524f52203a204465706f7369742062616420616c6c6f77616e63650000006044820152606401610491565b602083015183516117f29173ffffffffffffffffffffffffffffffffffffffff9091169084903090611a81565b6060611a798484600085611ae5565b949350505050565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052611adf9085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401611770565b50505050565b606082471015611b77576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610491565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051611ba091906120aa565b60006040518083038185875af1925050503d8060008114611bdd576040519150601f19603f3d011682016040523d82523d6000602084013e611be2565b606091505b5091509150611bf387838387611bfe565b979650505050505050565b60608315611c91578251611c8a5773ffffffffffffffffffffffffffffffffffffffff85163b611c8a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610491565b5081611a79565b611a798383815115611ca65781518083602001fd5b806040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161049191906120fb565b828054828255906000526020600020908101928215611d54579160200282015b82811115611d5457825182547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909116178255602090920191600190910190611cfa565b50611d60929150611dd8565b5090565b828054611d7090612218565b90600052602060002090601f016020900481019282611d925760008555611d54565b82601f10611dab57805160ff1916838001178555611d54565b82800160010185558215611d54579182015b82811115611d54578251825591602001919060010190611dbd565b5b80821115611d605760008155600101611dd9565b803573ffffffffffffffffffffffffffffffffffffffff81168114610bd657600080fd5b8035610bd681612303565b600060208284031215611e2d578081fd5b611e3682611ded565b9392505050565b60006020808385031215611e4f578182fd5b823567ffffffffffffffff80821115611e66578384fd5b818501915085601f830112611e79578384fd5b813581811115611e8b57611e8b6122d4565b8381029150611e9b848301612149565b8181528481019084860184860187018a1015611eb5578788fd5b8795505b83861015611ede57611eca81611ded565b835260019590950194918601918601611eb9565b5098975050505050505050565b600060208284031215611efc578081fd5b8151611e3681612303565b60008060008060808587031215611f1c578283fd5b843567ffffffffffffffff80821115611f33578485fd5b818701915087601f830112611f46578485fd5b8135602082821115611f5a57611f5a6122d4565b611f8a817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f85011601612149565b92508183528981838601011115611f9f578687fd5b818185018285013786818385010152829750611fbc818a01611ded565b96505050505060408501359150611fd560608601611e11565b905092959194509250565b600060208284031215611ff1578081fd5b5035919050565b600060208284031215612009578081fd5b5051919050565b6000815180845260208085019450808401835b8381101561205557815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101612023565b509495945050505050565b600081518084526120788160208601602086016121ec565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600082516120bc8184602087016121ec565b9190910192915050565b600060208252611e366020830184612010565b6000604082526120ec6040830185612010565b90508260208301529392505050565b600060208252611e366020830184612060565b6000606082526121216060830186612060565b73ffffffffffffffffffffffffffffffffffffffff9490941660208301525060400152919050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715612190576121906122d4565b604052919050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156121d0576121d06122a5565b500290565b6000828210156121e7576121e76122a5565b500390565b60005b838110156122075781810151838201526020016121ef565b83811115611adf5750506000910152565b60028104600182168061222c57607f821691505b60208210811415612266577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561229e5761229e6122a5565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b80151581146109f857600080fdfea26469706673582212207a89747e6d25956d64f95972c1f129d7a1914bad877e8c0f7fc4d79f78aecaf664736f6c63430008020033"; diff --git a/packages/react-app/src/contracts/hardhat_contracts.json b/packages/react-app/src/contracts/hardhat_contracts.json index cd54c7f1..66183dee 100644 --- a/packages/react-app/src/contracts/hardhat_contracts.json +++ b/packages/react-app/src/contracts/hardhat_contracts.json @@ -11090,6 +11090,966 @@ "type": "function" } ] + }, + { + "address": "0x7008b825b9b54bF088a9608759B500C786483B13", + "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" + } + ] + }, + { + "address": "0xD0699B582ec12E37602EcC16Fb4d9F2DeEE0DD2F", + "abi": [ + { + "inputs": [ + { + "internalType": "string", + "name": "_questTitle", + "type": "string" + }, + { + "internalType": "bytes", + "name": "_questDetailsRef", + "type": "bytes" + }, + { + "components": [ + { + "internalType": "contract IERC20Upgradeable", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct Models.Deposit", + "name": "_createDeposit", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "contract IERC20Upgradeable", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct Models.Deposit", + "name": "_playDeposit", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "questCreator", + "type": "address" + }, + { + "internalType": "uint32", + "name": "maxPlayers", + "type": "uint32" + }, + { + "internalType": "contract IERC20Upgradeable", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "expireTime", + "type": "uint256" + }, + { + "internalType": "address", + "name": "aragonGovernAddress", + "type": "address" + }, + { + "internalType": "address payable", + "name": "fundsRecoveryAddress", + "type": "address" + }, + { + "internalType": "bool", + "name": "isWhiteList", + "type": "bool" + } + ], + "internalType": "struct Models.QuestParam", + "name": "_questParam", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes", + "name": "evidence", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "address", + "name": "player", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "QuestClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "player", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "QuestPlayed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "player", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "QuestUnplayed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address[]", + "name": "whiteListPlayers", + "type": "address[]" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "QuestWhiteListChanged", + "type": "event" + }, + { + "inputs": [], + "name": "aragonGovernAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "executer", + "type": "address" + } + ], + "name": "canExecute", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "_evidence", + "type": "bytes" + }, + { + "internalType": "address", + "name": "_player", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_claimAll", + "type": "bool" + } + ], + "name": "claim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "claims", + "outputs": [ + { + "internalType": "bytes", + "name": "evidence", + "type": "bytes" + }, + { + "internalType": "address", + "name": "player", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "createDeposit", + "outputs": [ + { + "internalType": "contract IERC20Upgradeable", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "expireTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "fundsRecoveryAddress", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPlayers", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "isCreateDepositReleased", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "isWhiteList", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxPlayers", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_player", + "type": "address" + } + ], + "name": "play", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "playDeposit", + "outputs": [ + { + "internalType": "contract IERC20Upgradeable", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "questCreator", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "questDetailsRef", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "questTitle", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "recoverFundsAndDeposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "rewardToken", + "outputs": [ + { + "internalType": "contract IERC20Upgradeable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_players", + "type": "address[]" + } + ], + "name": "setWhiteList", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_player", + "type": "address" + } + ], + "name": "unplay", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] } ], "QuestFactory": { diff --git a/packages/react-app/src/services/quest.service.ts b/packages/react-app/src/services/quest.service.ts index 923b250a..7f7f3b7c 100644 --- a/packages/react-app/src/services/quest.service.ts +++ b/packages/react-app/src/services/quest.service.ts @@ -620,7 +620,12 @@ export async function setWhitelist( questAddress: string, onTx?: onTxCallback, ) { - const tx = await getQuestContract({ address: questAddress }, walletAddress).setWhiteList(players); + const tx = await getQuestContract({ address: questAddress }, walletAddress).setWhiteList( + players, + { + // gasLimit: 10000000, + }, + ); return handleTransaction(tx, onTx); } diff --git a/packages/react-app/src/utils/contract.util.ts b/packages/react-app/src/utils/contract.util.ts index be029386..219c9b51 100644 --- a/packages/react-app/src/utils/contract.util.ts +++ b/packages/react-app/src/utils/contract.util.ts @@ -51,17 +51,21 @@ function getContract( } const network = getNetwork(); if (!contracts) contracts = getContractsJson(network); - let askedContract = contracts[contractName]; - if (Array.isArray(askedContract) && askedContract.length) { + let askedContract; + const contractImplementations = contracts[contractName]; + if (Array.isArray(contractImplementations) && contractImplementations.length) { if (abiIndex) { - askedContract = askedContract[abiIndex ?? askedContract.length - 1]; + askedContract = contractImplementations[abiIndex]; } else if (contractAddressOverride) { - askedContract = askedContract.find( - (c) => c.address.toLowerCase() === contractAddressOverride.toLowerCase(), + askedContract = contractImplementations.find( + (c) => c.address?.toLowerCase() === contractAddressOverride.toLowerCase(), ); - } else { - askedContract = askedContract[askedContract.length - 1]; // Use the last one } + if (!askedContract) { + askedContract = contractImplementations[contractImplementations.length - 1]; // Use the last one + } + } else { + askedContract = contractImplementations; } const contractAddress: string = contractAddressOverride ?? askedContract.address; diff --git a/packages/subgraphs/quest-subgraph/config/goerli.json b/packages/subgraphs/quest-subgraph/config/goerli.json index 1e7f85ae..e200fb92 100644 --- a/packages/subgraphs/quest-subgraph/config/goerli.json +++ b/packages/subgraphs/quest-subgraph/config/goerli.json @@ -1,23 +1,23 @@ { - "network": "goerli", - "dataSources": [ - { - "name": "QuestFactory", - "startBlock": 7543619, - "address": "0x4DfE6C03132BD14D95b87803e232AcA352a715b4", - "customTemplate": "questFactory" - }, - { - "name": "QuestFactoryV2", - "startBlock": 8240344, - "address": "0xa6FEAF5CA07b6F367CF39a840F5A7E41d0AE613D", - "customTemplate": "questFactory.2" - }, - { - "name": "QuestFactoryProxy", - "startBlock": 9439525, - "address": "0xbfFEce7c884a488921F52Fb4dd0b0c61B77C9104", - "customTemplate": "questFactory.proxy" - } - ] -} + "network": "goerli", + "dataSources": [ + { + "name": "QuestFactory", + "startBlock": 7543619, + "address": "0x4DfE6C03132BD14D95b87803e232AcA352a715b4", + "customTemplate": "questFactory" + }, + { + "name": "QuestFactoryV2", + "startBlock": 8240344, + "address": "0xa6FEAF5CA07b6F367CF39a840F5A7E41d0AE613D", + "customTemplate": "questFactory.2" + }, + { + "name": "QuestFactoryProxy", + "startBlock": 9564173, + "address": "0x05301D6787430d26bb0D6430Bd98a59B955a27D0", + "customTemplate": "questFactory.proxy" + } + ] +} \ No newline at end of file diff --git a/packages/subgraphs/quest-subgraph/subgraph.yaml b/packages/subgraphs/quest-subgraph/subgraph.yaml index 985c7c7c..e39e9f30 100644 --- a/packages/subgraphs/quest-subgraph/subgraph.yaml +++ b/packages/subgraphs/quest-subgraph/subgraph.yaml @@ -100,9 +100,9 @@ dataSources: name: QuestFactoryProxy network: goerli source: - address: "0xbfFEce7c884a488921F52Fb4dd0b0c61B77C9104" + address: "0x05301D6787430d26bb0D6430Bd98a59B955a27D0" abi: QuestFactory - startBlock: 9439525 + startBlock: 9564173 mapping: kind: ethereum/events apiVersion: 0.0.6 @@ -125,7 +125,7 @@ dataSources: network: goerli source: abi: Quest - startBlock: 9439525 + startBlock: 9564173 mapping: kind: ethereum/events apiVersion: 0.0.6